[Pkg-sugar-commit] [sugar-browse-activity] 13/19: Do not show clear url icon when there is not text SL #3968

Jonas Smedegaard dr at jones.dk
Mon Apr 20 09:47:35 UTC 2015


This is an automated email from the git hooks/post-receive script.

js pushed a commit to tag v149.1
in repository sugar-browse-activity.

commit 53c2e7e7283852f7c72d8d4d5db001c7e14f26e9
Author: Manuel Kaufmann <humitos at gmail.com>
Date:   Mon Jan 21 10:04:53 2013 -0300

    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 at gmail.com>
    Signed-off-by: Manuel Quiñones <manuq at laptop.org>
    
    Conflicts resolved: webtoolbar.py
---
 webtoolbar.py | 21 +++++++++++++++++++--
 1 file changed, 19 insertions(+), 2 deletions(-)

diff --git a/webtoolbar.py b/webtoolbar.py
index dc0b3de..21811cc 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,
-                                          'dialog-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,
                                       'browse-view-refresh')
 
+    def _show_clear_icon(self):
+        self.entry.set_icon_from_name(iconentry.ICON_ENTRY_SECONDARY,
+                                      'dialog-cancel')
+
     def _update_navigation_buttons(self):
         can_go_back = self._browser.can_go_back()
         self._back.props.sensitive = can_go_back

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-sugar/sugar-browse-activity.git



More information about the pkg-sugar-commit mailing list