From ec88446758f58e3d4af4a6b4777321180b831ea7 Mon Sep 17 00:00:00 2001 From: Lucian Branescu Mihaila Date: Sun, 25 Jul 2010 19:38:26 +0000 Subject: Anish Mangal's patch to add explicit tab support. Because it crashes on some versions of cairo, it will disable itself if it detects such a version. --- (limited to 'webtoolbar.py') diff --git a/webtoolbar.py b/webtoolbar.py index e7c20be..69a3c8e 100644 --- a/webtoolbar.py +++ b/webtoolbar.py @@ -35,10 +35,8 @@ from sugar.activity import activity import filepicker import places - _MAX_HISTORY_ENTRIES = 15 - class WebEntry(AddressEntry): _COL_ADDRESS = 0 _COL_TITLE = 1 @@ -218,17 +216,19 @@ class WebEntry(AddressEntry): else: self._search_popup() - class PrimaryToolbar(ToolbarBox): __gtype_name__ = 'PrimaryToolbar' __gsignals__ = { 'add-link': (gobject.SIGNAL_RUN_FIRST, gobject.TYPE_NONE, + ([])), + 'add-tab': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, ([])) } - def __init__(self, tabbed_view, act): + def __init__(self, tabbed_view, act, disable_multiple_tabs): ToolbarBox.__init__(self) self._activity = act @@ -270,6 +270,14 @@ class PrimaryToolbar(ToolbarBox): self.toolbar.insert(self._forward, -1) self._forward.show() + if not disable_multiple_tabs: + self._add_tab = ToolButton('tab-add') + self._add_tab.set_tooltip(_('Add a tab')) + self._add_tab.props.sensitive = True + self._add_tab.connect('clicked', self._add_tab_cb) + self.toolbar.insert(self._add_tab, -1) + self._add_tab.show() + self._link_add = ToolButton('emblem-favorite') self._link_add.set_tooltip(_('Bookmark')) self._link_add.connect('clicked', self._link_add_clicked_cb) @@ -388,6 +396,9 @@ class PrimaryToolbar(ToolbarBox): browser.load_uri(entry.props.text) browser.grab_focus() + def _add_tab_cb(self, button): + self.emit('add-tab') + def _go_back_cb(self, button): browser = self._tabbed_view.props.current_browser browser.web_navigation.goBack() -- cgit v0.9.1