This patch replaces the text in the location bar with the URI instead
of the page title on rollover, making editing/selecting the URL much
more natural, since you can place the cursor accurately when focusing
the entry.

- Eben
From 19213e27001482bf1f5c61e1afc2aaaa0a279323 Mon Sep 17 00:00:00 2001
From: Eben Eliason <[EMAIL PROTECTED](none)>
Date: Sat, 14 Jun 2008 18:26:32 -0400
Subject: [PATCH] Reveal URI on rollover of the location bar.

---
 webtoolbar.py |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/webtoolbar.py b/webtoolbar.py
index f3f8ccb..cb40ddf 100755
--- a/webtoolbar.py
+++ b/webtoolbar.py
@@ -52,6 +52,8 @@ class WebEntry(AddressEntry):
         self.connect('focus-in-event', self.__focus_in_event_cb)
         self.connect('populate-popup', self.__populate_popup_cb)
         self.connect('key-press-event', self.__key_press_event_cb)
+        self.connect('enter-notify-event', self.__enter_notify_event_cb)
+        self.connect('leave-notify-event', self.__leave_notify_event_cb)
         self._focus_out_hid = self.connect(
                     'focus-out-event', self.__focus_out_event_cb)
         self._change_hid = self.connect('changed', self.__changed_cb)
@@ -144,6 +146,14 @@ class WebEntry(AddressEntry):
         self._set_text(self._title)
         self._search_popdown()
 
+    def __enter_notify_event_cb(self, entry, event):
+        if not entry.props.has_focus:
+            self._set_text(self._address)
+
+    def __leave_notify_event_cb(self, entry, event):
+        if not entry.props.has_focus:
+            self._set_text(self._title)
+
     def __view_button_press_event_cb(self, view, event):
         model = view.get_model()
 
-- 
1.5.4.3

_______________________________________________
Sugar mailing list
[email protected]
http://lists.laptop.org/listinfo/sugar

Reply via email to