From 85546aef12e338ceac55cf5b973092f275a42e4d Mon Sep 17 00:00:00 2001 From: infirit Date: Wed, 17 Dec 2014 16:21:23 +0100 Subject: Added ability to navigate tabs using Alt-N MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Taken from GSM commit: a2bccca48724fc5873c72978d11f106af2a6aaf4 From: Chris Kühl Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=496750 --- src/interface.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/interface.cpp b/src/interface.cpp index a6ae2b6..a609c7c 100644 --- a/src/interface.cpp +++ b/src/interface.cpp @@ -42,6 +42,7 @@ #include "gsm_color_button.h" static void cb_toggle_tree (GtkAction *action, gpointer data); +static void cb_proc_goto_tab (gint tab); static const GtkActionEntry menu_entries[] = { @@ -602,6 +603,7 @@ disconnect_proxy_cb (GtkUIManager *manager, void create_main_window (ProcData *procdata) { + gint i; gint width, height; GtkWidget *app; GtkAction *action; @@ -718,6 +720,17 @@ create_main_window (ProcData *procdata) G_CALLBACK (cb_app_delete), procdata); + GtkAccelGroup *accel_group; + GClosure *goto_tab_closure[4]; + accel_group = gtk_accel_group_new (); + gtk_window_add_accel_group (GTK_WINDOW(app), accel_group); + for (i = 0; i < 4; ++i) { + goto_tab_closure[i] = g_cclosure_new_swap (G_CALLBACK (cb_proc_goto_tab), + (gpointer) i, NULL); + gtk_accel_group_connect (accel_group, '0'+(i+1), + GDK_MOD1_MASK, GTK_ACCEL_VISIBLE, + goto_tab_closure[i]); + } /* create the statusbar */ procdata->statusbar = gtk_statusbar_new(); @@ -811,3 +824,9 @@ cb_toggle_tree (GtkAction *action, gpointer data) g_settings_set_boolean (settings, "show-tree", show); } +static void +cb_proc_goto_tab (gint tab) +{ + ProcData *data = ProcData::get_instance (); + gtk_notebook_set_current_page (GTK_NOTEBOOK (data->notebook), tab); +} -- cgit v1.2.1