[sugar] [PATCH] Browse - Add-address-entry-focus
Tomeu Vizoso
tomeu at tomeuvizoso.net
Fri Jun 13 07:47:07 EDT 2008
r+
On Fri, Jun 13, 2008 at 1:18 PM, Simon Schampijer <simon at schampijer.de> wrote:
> Hi,
>
> this patch adds the shortcut ctr+l (a la firefox) to focus the adress/uri
> entry. Furthermore it changes the shortcut for adding a bookmark to be
> ctrl+d (standard a la firefox) - was ctrl+l before.
>
> Thanks,
> Simon
>
> diff --git a/webactivity.py b/webactivity.py
> index f0d5021..7a0d5df 100755
> --- a/webactivity.py
> +++ b/webactivity.py
> @@ -108,17 +108,17 @@ class WebActivity(activity.Activity):
> toolbox.add_toolbar(_('Edit'), self._edit_toolbar)
> self._edit_toolbar.show()
>
> - self.toolbar = WebToolbar(self._browser)
> - toolbox.add_toolbar(_('Browse'), self.toolbar)
> - self.toolbar.show()
> + self._web_toolbar = WebToolbar(self._browser)
> + toolbox.add_toolbar(_('Browse'), self._web_toolbar)
> + self._web_toolbar.show()
>
> self._tray = HTray()
> self.set_tray(self._tray, gtk.POS_BOTTOM)
> self._tray.show()
>
> - self.viewtoolbar = ViewToolbar(self)
> - toolbox.add_toolbar(_('View'), self.viewtoolbar)
> - self.viewtoolbar.show()
> + self._view_toolbar = ViewToolbar(self)
> + toolbox.add_toolbar(_('View'), self._view_toolbar)
> + self._view_toolbar.show()
>
> self.set_toolbox(toolbox)
> toolbox.show()
> @@ -129,7 +129,7 @@ class WebActivity(activity.Activity):
> self.session_history = sessionhistory.get_instance()
> self.session_history.connect('session-link-changed',
> self._session_history_changed_cb)
> - self.toolbar.connect('add-link', self._link_add_button_cb)
> + self._web_toolbar.connect('add-link', self._link_add_button_cb)
>
> self._browser.connect("notify::title", self._title_changed_cb)
>
> @@ -344,7 +344,7 @@ class WebActivity(activity.Activity):
>
> 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)
> self._add_link()
> return True
> @@ -353,6 +353,11 @@ class WebActivity(activity.Activity):
> self.toolbox.set_current_toolbar(_TOOLBAR_EDIT)
> self._edit_toolbar.search_entry.grab_focus()
> return True
> + elif gtk.gdk.keyval_name(event.keyval) == "l":
> + _logger.debug('keyboard: Focus url entry')
> + self.toolbox.set_current_toolbar(_TOOLBAR_BROWSE)
> + self._web_toolbar.entry.grab_focus()
> + return True
> elif gtk.gdk.keyval_name(event.keyval) == "u":
> _logger.debug('keyboard: Show source of the current page')
> self._show_source()
> @@ -407,14 +412,14 @@ class WebActivity(activity.Activity):
> item.show()
> if self._tray.props.visible is False:
> self._tray.show()
> - self.viewtoolbar.traybutton.props.sensitive = True
> + self._view_toolbar.traybutton.props.sensitive = True
>
> def _link_removed_cb(self, button, hash):
> ''' remove a link from tray and delete it in the model '''
> self.model.remove_link(hash)
> self._tray.remove_item(button)
> if len(self._tray.get_children()) == 0:
> - self.viewtoolbar.traybutton.props.sensitive = False
> + self._view_toolbar.traybutton.props.sensitive = False
>
> def _link_clicked_cb(self, button, url):
> ''' an item of the link tray has been clicked '''
> diff --git a/webtoolbar.py b/webtoolbar.py
> index 8987a37..3d1877c 100755
> --- a/webtoolbar.py
> +++ b/webtoolbar.py
> @@ -67,13 +67,13 @@ class WebToolbar(gtk.Toolbar):
> self.insert(self._stop_and_reload, -1)
> self._stop_and_reload.show()
>
> - self._entry = AddressEntry()
> - self._entry.connect('activate', self._entry_activate_cb)
> + self.entry = AddressEntry()
> + self.entry.connect('activate', self._entry_activate_cb)
>
> entry_item = gtk.ToolItem()
> entry_item.set_expand(True)
> - entry_item.add(self._entry)
> - self._entry.show()
> + entry_item.add(self.entry)
> + self.entry.show()
>
> self.insert(entry_item, -1)
> entry_item.show()
> @@ -124,13 +124,13 @@ class WebToolbar(gtk.Toolbar):
> self._set_progress(progress)
>
> def _set_progress(self, progress):
> - self._entry.props.progress = progress
> + self.entry.props.progress = progress
>
> def _set_address(self, address):
> - self._entry.props.address = address
> + self.entry.props.address = address
>
> def _set_title(self, title):
> - self._entry.props.title = title
> + self.entry.props.title = title
>
> def _show_stop_icon(self):
> self._stop_and_reload.set_icon('media-playback-stop')
>
> _______________________________________________
> Sugar mailing list
> Sugar at lists.laptop.org
> http://lists.laptop.org/listinfo/sugar
>
>
More information about the Sugar
mailing list