[gnome-system-monitor] Port Refresh to GAction



commit 1406c6bcb6533d343b7b1be8cc4e4fb53ef1b092
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Thu Jul 18 14:48:43 2013 +0200

    Port Refresh to GAction
    
    https://bugzilla.gnome.org/show_bug.cgi?id=704467

 data/interface.ui   |    1 +
 src/callbacks.cpp   |    9 ---------
 src/callbacks.h     |    1 -
 src/interface.cpp   |   23 +++++++++++------------
 src/procman-app.cpp |    1 +
 5 files changed, 13 insertions(+), 22 deletions(-)
---
diff --git a/data/interface.ui b/data/interface.ui
index db76ef3..faf8403 100644
--- a/data/interface.ui
+++ b/data/interface.ui
@@ -49,6 +49,7 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="receives_default">False</property>
+                        <property name="action_name">win.refresh</property>
                       </object>
                       <packing>
                         <property name="expand">False</property>
diff --git a/src/callbacks.cpp b/src/callbacks.cpp
index 7a13b3b..d149de5 100644
--- a/src/callbacks.cpp
+++ b/src/callbacks.cpp
@@ -377,15 +377,6 @@ cb_tree_popup_menu (GtkWidget *widget, gpointer data)
 
 
 gint
-cb_user_refresh (GtkAction*, gpointer data)
-{
-    ProcmanApp * const app = static_cast<ProcmanApp *>(data);
-    proctable_update_all(app);
-    return FALSE;
-}
-
-
-gint
 cb_timeout (gpointer data)
 {
     ProcmanApp * const app = static_cast<ProcmanApp *>(data);
diff --git a/src/callbacks.h b/src/callbacks.h
index ff091b2..6b083a8 100644
--- a/src/callbacks.h
+++ b/src/callbacks.h
@@ -57,7 +57,6 @@ gboolean        cb_tree_button_pressed (GtkWidget *widget, GdkEventButton *event
                                         gpointer data);
 
 gint            cb_update_disks (gpointer data);
-gint            cb_user_refresh (GtkAction* action, gpointer data);
 gint            cb_timeout (gpointer data);
 
 void            cb_refresh_icons (GtkIconTheme *theme, gpointer data);
diff --git a/src/interface.cpp b/src/interface.cpp
index 55170d4..f6be564 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -53,9 +53,6 @@ static const GtkActionEntry menu_entries[] =
     { "ChangePriority", NULL, N_("_Change Priority"), NULL,
       N_("Change the order of priority of process"), NULL },
 
-    { "Refresh", NULL, N_("_Refresh"), "<control>R",
-      N_("Refresh the process list"), G_CALLBACK(cb_user_refresh) },
-
     { "MemoryMaps", NULL, N_("_Memory Maps"), "<control>M",
       N_("Open the memory maps associated with a process"), G_CALLBACK (cb_show_memory_maps) },
     // Translators: this means 'Files that are open' (open is no verb here)
@@ -87,7 +84,6 @@ create_proc_view(ProcmanApp *app, GtkBuilder * builder)
     GtkWidget *proctree;
     GtkWidget *scrolled;
     GtkWidget *viewmenu;
-    GtkWidget *button;
     GtkAction *action;
     char* string;
 
@@ -106,12 +102,6 @@ create_proc_view(ProcmanApp *app, GtkBuilder * builder)
     g_signal_connect (G_OBJECT (app->endprocessbutton), "clicked",
                       G_CALLBACK (cb_end_process_button_pressed), app);
 
-    button = GTK_WIDGET (gtk_builder_get_object (builder, "viewmenubutton"));
-
-    button = GTK_WIDGET (gtk_builder_get_object (builder, "refreshbutton"));
-    action = gtk_action_group_get_action (app->action_group, "Refresh");
-    gtk_activatable_set_related_action (GTK_ACTIVATABLE (button), action);
-
     /* create popup_menu for the processes tab */
     app->popup_menu = gtk_ui_manager_get_widget (app->uimanager, "/PopupMenu");
 }
@@ -283,6 +273,14 @@ on_activate_about (GSimpleAction *, GVariant *, gpointer data)
 }
 
 static void
+on_activate_refresh (GSimpleAction *, GVariant *, gpointer data)
+{
+    ProcmanApp *app = (ProcmanApp *) data;
+    proctable_update_all (app);
+}
+
+
+static void
 on_activate_radio (GSimpleAction *action, GVariant *parameter, gpointer data)
 {
     g_action_change_state (G_ACTION (action), parameter);
@@ -398,6 +396,7 @@ create_main_window (ProcmanApp *app)
 
     GActionEntry win_action_entries[] = {
         { "about", on_activate_about, NULL, NULL, NULL },
+        { "refresh", on_activate_refresh, NULL, NULL, NULL },
         { "show-page", on_activate_radio, "i", "0", change_show_page_state },
         { "show-whose-processes", on_activate_radio, "s", "'all'", change_show_processes_state },
         { "show-dependencies", on_activate_toggle, NULL, "false", change_show_dependencies_state }
@@ -523,8 +522,8 @@ update_sensitivity(ProcmanApp *app)
                                               "OpenFiles",
                                               "ProcessProperties" };
 
-    // FIXME: add Refresh when ported
-    const char * const processes_actions[] = { "show-whose-processes",
+    const char * const processes_actions[] = { "refresh",
+                                               "show-whose-processes",
                                                "show-dependencies" };
 
     size_t i;
diff --git a/src/procman-app.cpp b/src/procman-app.cpp
index 5632341..a6d58fe 100644
--- a/src/procman-app.cpp
+++ b/src/procman-app.cpp
@@ -670,6 +670,7 @@ void ProcmanApp::on_startup()
     add_accelerator ("<Alt>1", "win.show-page", g_variant_new_int32 (PROCMAN_TAB_PROCESSES));
     add_accelerator ("<Alt>2", "win.show-page", g_variant_new_int32 (PROCMAN_TAB_RESOURCES));
     add_accelerator ("<Alt>3", "win.show-page", g_variant_new_int32 (PROCMAN_TAB_DISKS));
+    add_accelerator ("<Primary>r", "win.refresh", NULL);
 
     gtk_widget_show (main_window);
 }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]