summaryrefslogtreecommitdiff
path: root/src/trg-main-window.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <alan@eth0.org.uk>2012-06-13 23:12:53 +0100
committerGravatar Alan Fitton <alan@eth0.org.uk>2012-06-13 23:12:53 +0100
commit338e194636b91413e765c8ac26079a972ed5cf56 (patch)
treef7d3c411f8560dae08247cec350047c213166fb7 /src/trg-main-window.c
parent05e8a8ab6ee73fa432268e5c2b408e40dea69550 (diff)
issue 182 - ctrl+k to focus on search entry like firefox
Diffstat (limited to 'src/trg-main-window.c')
-rw-r--r--src/trg-main-window.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/trg-main-window.c b/src/trg-main-window.c
index 1369b44..650e278 100644
--- a/src/trg-main-window.c
+++ b/src/trg-main-window.c
@@ -2555,6 +2555,18 @@ static void on_dropped_file(GtkWidget * widget, GdkDragContext * context,
}
}
+static gboolean window_key_press_handler(GtkWidget *widget, GdkEvent *event,
+ gpointer user_data) {
+ TrgMainWindow *win = TRG_MAIN_WINDOW(widget);
+
+ if ((event->key.state & GDK_CONTROL_MASK) && event->key.keyval == GDK_KEY_k) {
+ gtk_widget_grab_focus(win->priv->filterEntry);
+ return TRUE;
+ }
+
+ return FALSE;
+}
+
static GObject *trg_main_window_constructor(GType type,
guint n_construct_properties,
GObjectConstructParam *
@@ -2599,6 +2611,7 @@ static GObject *trg_main_window_constructor(GType type,
G_CALLBACK(window_state_event), NULL);
g_signal_connect(G_OBJECT(self), "configure-event",
G_CALLBACK(trg_main_window_config_event), NULL);
+ g_signal_connect (G_OBJECT(self), "key-press-event", G_CALLBACK (window_key_press_handler), NULL);
priv->torrentModel = trg_torrent_model_new();
trg_client_set_torrent_table(priv->client,