diff options
author | Alan Fitton <alan@eth0.org.uk> | 2012-06-13 23:12:53 +0100 |
---|---|---|
committer | Alan Fitton <alan@eth0.org.uk> | 2012-06-13 23:12:53 +0100 |
commit | 338e194636b91413e765c8ac26079a972ed5cf56 (patch) | |
tree | f7d3c411f8560dae08247cec350047c213166fb7 /src | |
parent | 05e8a8ab6ee73fa432268e5c2b408e40dea69550 (diff) |
issue 182 - ctrl+k to focus on search entry like firefox
Diffstat (limited to 'src')
-rw-r--r-- | src/trg-main-window.c | 13 | ||||
-rw-r--r-- | src/util.c | 1 |
2 files changed, 14 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, @@ -19,6 +19,7 @@ /* Many of these functions are taken from the Transmission Project. */ +#include <limits.h> #include <stdlib.h> #include <math.h> #include <string.h> |