Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Kaufmann <humitos@gmail.com>2013-01-21 13:04:53 (GMT)
committer Manuel QuiƱones <manuq@laptop.org>2013-01-23 15:22:44 (GMT)
commit58f06e2752e3a661a4beb611c0b6494429ab1017 (patch)
tree89b55bff791f129e5bd480d7222f4e627f4ea61e
parenta1575b120dd14f32e0d74ff7d411d8e5351c83df (diff)
Do not show clear url icon when there is not text SL #3968
Use 'changed' signal to know if the url entry is empty. Check if the entry has_focus() to know if the entry was changed by the user or not. We only want to show the clear icon if the user has changed the url entry. Signed-off-by: Manuel Kaufmann <humitos@gmail.com> Signed-off-by: Manuel QuiƱones <manuq@laptop.org>
-rw-r--r--webtoolbar.py21
1 files changed, 19 insertions, 2 deletions
diff --git a/webtoolbar.py b/webtoolbar.py
index 7433bea..63f22aa 100644
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -284,6 +284,7 @@ class PrimaryToolbar(ToolbarBase):
self.entry.connect('focus-in-event', self.__focus_in_event_cb)
self.entry.connect('focus-out-event', self.__focus_out_event_cb)
self.entry.connect('key-press-event', self.__key_press_event_cb)
+ self.entry.connect('changed', self.__changed_cb)
entry_item = Gtk.ToolItem()
entry_item.set_expand(True)
@@ -419,10 +420,22 @@ class PrimaryToolbar(ToolbarBase):
else:
self.entry.props.address = uri
+ def __changed_cb(self, iconentry):
+ # The WebEntry can be changed when we click on a link, then we
+ # have to show the clear icon only if is the user who has
+ # changed the entry
+ if self.entry.has_focus():
+ if not self.entry.props.text:
+ self._show_no_icon()
+ else:
+ self._show_clear_icon()
+
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,
- 'entry-cancel')
+ if not self.entry.props.text:
+ self._show_no_icon()
+ else:
+ self._show_clear_icon()
def __focus_out_event_cb(self, entry, event):
if self._loading:
@@ -442,6 +455,10 @@ class PrimaryToolbar(ToolbarBase):
self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY,
'entry-refresh')
+ def _show_clear_icon(self):
+ self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY,
+ 'entry-cancel')
+
def _update_navigation_buttons(self):
can_go_back = self._browser.can_go_back()
self._back.props.sensitive = can_go_back