On Sun, 2005-09-04 at 23:50 +0200, Kristoffer Lundén wrote: > > How about a better fix? Well, if we could allow a keyboard shortcut to > > go to a smart bookmark field, we could bind "Ctrl-K" to a default > > "google" smart bookmark, as done in Firefox. I personally dislike that > > behavior, because I'm used to typing anything I want into the one, big > > "location" field. (In my experience, 90% of Firefox browsing sessions > > begin by typing a whole lot of words into that 10-character-wide field; > > and the Location bar is rarely -- if ever -- used.) > > Completely agree. I've had FF set up in old Epiphany behaviour for at > least a year, and always remove that box completely from my interface. > Not a good solution. Okay, here's a dinky extension which may appeal to some: "Ctrl-K Search". I've attached the source files. I wrote it up in about 10 minutes, and I gave its UI absolutely 0 consideration. All it does is make Ctrl-K work. (See attached.) > Ok, now that was a longwinded letter alright. Sorry about that. I am > not trying to pick a fight - at least not for the purpose of fighting, > but I am very concerned about the direction Epiphany is taking. I > would extremely much want it to be as great as it can possibly be, and > I want to use it myself. So I'm a bit vehement about issues like > these, which I feel are going in the wrong direction. I hope you can > have some understanding. :) Don't worry, I understand completely, and I think the other Epiphany developers do, too. Your email is definitely insightful. -- Adam Hooper <adamh densi com>
#!/usr/bin/env python
import gtk
import epiphany
import urllib
def dialog_cb(dialog, response_id, window, entry):
dialog.hide()
if response_id == gtk.RESPONSE_ACCEPT:
window.load_url("http://www.google.com/search?q=%s" % \
urllib.quote_plus(entry.get_text()))
def ctrlk_cb(action, window):
dialog = gtk.Dialog("Search",
window,
gtk.DIALOG_DESTROY_WITH_PARENT,
(gtk.STOCK_OK, gtk.RESPONSE_ACCEPT,
gtk.STOCK_CANCEL, gtk.RESPONSE_REJECT))
hbox = gtk.HBox()
hbox.pack_start(gtk.Label("Search for:"))
entry = gtk.Entry()
entry.connect("activate",
lambda e: dialog.response(gtk.RESPONSE_ACCEPT))
hbox.pack_start(entry)
dialog.vbox.pack_start(hbox)
dialog.connect("response", dialog_cb, window, entry)
dialog.show_all()
_actions = [
('CtrlKSearch', None, 'Search', '<Ctrl>k', None, ctrlk_cb),
]
def attach_window(window):
ui_manager = window.get_ui_manager()
group = gtk.ActionGroup('CtrlKSearch')
group.add_actions(_actions, window)
ui_manager.insert_action_group(group, 0)
ui_id = ui_manager.new_merge_id()
ui_manager.add_ui(ui_id, '/menubar/ToolsMenu', 'CtrlKSearch',
'CtrlKSearch', gtk.UI_MANAGER_MENUITEM, False)
window._ctrl_k_search_data = (group, ui_id)
def detach_window(window):
ui_manager = window.get_ui_manager()
group, ui_id = window._ctrl_k_search_data
del window._ctrl_k_search_data
ui_manager.remove_ui(ui_id)
ui_manager.remove_action_group(group)
<?xml version="1.0" encoding="UTF-8"?> <extension> <name>Ctrl-K Search</name> <description>Make Ctrl-K open a Google search</description> <author>Adam Hooper <adamh densi com></author> <url>http://www.gnome.org/projects/epiphany/extensions.html</url> <version>1</version> <gettext-domain>epiphany-extensions-1.8</gettext-domain> <locale-directory>/this/means/nothing/to/me</locale-directory> <loader type="python"> <attribute name="module">ctrl_k_search</attribute> </loader> </extension>
Attachment:
signature.asc
Description: This is a digitally signed message part