summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorinfirit <[email protected]>2014-12-17 16:21:23 +0100
committerinfirit <[email protected]>2014-12-17 17:23:02 +0100
commit85546aef12e338ceac55cf5b973092f275a42e4d (patch)
treecd1641d62d8baa5b6cbc99e01f7a7ecf52968a68
parent502a570bfeb3c1aa912cd167a17d0c1457d4113b (diff)
downloadmate-system-monitor-85546aef12e338ceac55cf5b973092f275a42e4d.tar.bz2
mate-system-monitor-85546aef12e338ceac55cf5b973092f275a42e4d.tar.xz
Added ability to navigate tabs using Alt-N
Taken from GSM commit: a2bccca48724fc5873c72978d11f106af2a6aaf4 From: Chris Kühl <[email protected]> Gnome bug: https://bugzilla.gnome.org/show_bug.cgi?id=496750
-rw-r--r--src/interface.cpp19
1 files changed, 19 insertions, 0 deletions
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);
+}