[gnome-system-monitor] Added ability to navigate tabs using Alt-N.
- From: Chris Kühl <chriskuehl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-system-monitor] Added ability to navigate tabs using Alt-N.
- Date: Mon, 13 Jun 2011 22:04:31 +0000 (UTC)
commit a2bccca48724fc5873c72978d11f106af2a6aaf4
Author: Chris Kühl <chrisk openismus com>
Date: Tue Jun 14 00:01:26 2011 +0200
Added ability to navigate tabs using Alt-N.
https://bugzilla.gnome.org/show_bug.cgi?id=496750
src/interface.cpp | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
---
diff --git a/src/interface.cpp b/src/interface.cpp
index ac625d3..9da7b1b 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;
@@ -712,6 +714,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();
@@ -803,3 +816,10 @@ 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);
+}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]