Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/webtoolbar.py
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2012-09-28 13:18:48 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2012-09-28 14:15:01 (GMT)
commitaf31a44d9b5247d56a7a468102369d3314e1a2a3 (patch)
tree0ca5f53ab843c807d0890454ed094c129a0c30d7 /webtoolbar.py
parent49495aa4584035a97754c75b124a3c326d9f8db9 (diff)
Button to clear the url entry SL #3499
Added an 'X' to clear the url entry easily. This button is shown when the url entry has focus and the user is not reading a .pdf webpage. When the focus is left the icon changes again to the correct one (reload, stop loading or none) Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Acked-by: Manuel QuiƱones <manuq@laptop.org>
Diffstat (limited to 'webtoolbar.py')
-rw-r--r--webtoolbar.py31
1 files changed, 28 insertions, 3 deletions
diff --git a/webtoolbar.py b/webtoolbar.py
index 442c78a..6350dfb 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -237,6 +237,8 @@ class PrimaryToolbar(ToolbarBase):
'browse-dialog-cancel')
self.entry.connect('icon-press', self._stop_and_reload_cb)
self.entry.connect('activate', self._entry_activate_cb)
+ self.entry.connect('focus-in-event', self.__focus_in_event_cb)
+ self.entry.connect('focus-out-event', self.__focus_out_event_cb)
entry_item = Gtk.ToolItem()
entry_item.set_expand(True)
@@ -345,6 +347,21 @@ class PrimaryToolbar(ToolbarBase):
else:
self.entry.props.address = uri
+ def __focus_in_event_cb(self, entry, event):
+ if not self._tabbed_view.is_current_page_pdf():
+ self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY,
+ 'dialog-cancel')
+
+ def __focus_out_event_cb(self, entry, event):
+ if self._loading:
+ self._show_stop_icon()
+ else:
+ if not self._tabbed_view.is_current_page_pdf():
+ self._show_reload_icon()
+
+ def _show_no_icon(self):
+ self.entry.remove_icon(iconentry.ICON_ENTRY_SECONDARY)
+
def _show_stop_icon(self):
self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY,
'browse-dialog-cancel')
@@ -389,10 +406,15 @@ class PrimaryToolbar(ToolbarBase):
filepicker.cleanup_temp_files()
def _stop_and_reload_cb(self, entry, icon_pos, button):
- if self._loading:
- self._browser.stop_loading()
+ if entry.has_focus() and \
+ not self._tabbed_view.is_current_page_pdf():
+ entry.set_text('')
else:
self._browser.reload()
+ if self._loading:
+ self._browser.stop_loading()
+ else:
+ self._browser.reload()
def _set_loading(self, loading):
self._loading = loading
@@ -400,7 +422,10 @@ class PrimaryToolbar(ToolbarBase):
if self._loading:
self._show_stop_icon()
else:
- self._show_reload_icon()
+ if not self._tabbed_view.is_current_page_pdf():
+ self._show_reload_icon()
+ else:
+ self._show_no_icon()
def _reload_session_history(self):
back_forward_list = self._browser.get_back_forward_list()