Hi,

This patch does three things, and I'll be happy if even one makes it in to
Browse.

   - It causes ctrl-l (lowercase L) to put focus on the address bar like in
   all other browsers that do not make me angry.
   - It causes ctrl-d to do what ctrl-l used to do, namely do a
   screenshot-bookmark.  This is the standard bookmark key.   Pressing ctrl-d
   more times will show/hide the bookmark toolbar, so if you accidentally show
   it you can get rid of the large and obnoxious thing.  Ctrl-b will also
   show/hide it, cause why not?
   - It causes ctrl-i to show the URI of the page instead of the title,
   temporarily.  Good for checking that one isn't being fished.

Oh, I wrote the patch on-XO, but couldn't figure out how to get it into
gmail.  This was a further annoyance I hope to one day address.

The lonely bit at the top about _tray.show() _tray.hide() was my best guess
at getting the tray into a sane state; its properties show it as visible
when empty, but it is not in fact visible.  I'm not sure this is the best
way to handle it.

I welcome questions and comments.
Best regards,
Cortland Setlow
-- 
The world is quiet here.
Only in ./Activities/Web.activity/: Web-86.xo
diff -ru ./Web.activity/webactivity.py ./Activities/Web.activity/webactivity.py
--- ./Web.activity/webactivity.py	2008-01-21 15:46:46.000000000 +0000
+++ ./Activities/Web.activity/webactivity.py	2008-05-16 02:20:10.000000000 +0000
@@ -108,6 +108,7 @@
         self._tray = HTray()
         self.set_tray(self._tray, gtk.POS_BOTTOM)
         self._tray.show()
+        self._tray.hide()
         
         self.viewtoolbar = ViewToolbar(self)
         toolbox.add_toolbar(_('View'), self.viewtoolbar)
@@ -332,9 +333,31 @@
             
     def _key_press_cb(self, widget, event):
         if event.state & gtk.gdk.CONTROL_MASK:
-            if gtk.gdk.keyval_name(event.keyval) == "l":
+            if gtk.gdk.keyval_name(event.keyval) == "d":
                 _logger.debug('keyboard: Add link: %s.' % self.current)                
+                #It's nice if repeating the same keystroke
+                #undoes the annoying tray expand.
+                wasVisible = self._tray.props.visible
                 self._add_link()                
+                if wasVisible:
+                    self._tray.hide()
+                else:
+                    self._tray.show()        
+                return True
+            elif gtk.gdk.keyval_name(event.keyval) == "i":
+                _logger.debug('keyboard: reveal URI.')
+                self.toolbar._entry.emit('focus-in-event', None)
+                return True
+            elif gtk.gdk.keyval_name(event.keyval) == "l":
+                _logger.debug('keyboard: focus on address input.')
+                self.toolbar._entry.grab_focus()
+                return True
+            elif gtk.gdk.keyval_name(event.keyval) == "b":
+                _logger.debug('keyboard: hide/show bookmark tray.')
+                if self._tray.props.visible is True:
+                    self._tray.hide()
+                else:
+                    self._tray.show()        
                 return True
             elif gtk.gdk.keyval_name(event.keyval) == "u":
                 _logger.debug('keyboard: Show source of the current page')
_______________________________________________
Sugar mailing list
Sugar@lists.laptop.org
http://lists.laptop.org/listinfo/sugar

Reply via email to