[gnome-system-monitor] Move End Process button in a toolbar



commit 10b8df02c680b15ba1d54dcbca3c561f8e5e5199
Author: Stefano Facchini <stefano facchini gmail com>
Date:   Fri Aug 16 10:50:02 2013 +0200

    Move End Process button in a toolbar
    
    https://bugzilla.gnome.org/show_bug.cgi?id=706065

 data/interface.ui |   61 ++++++++++++++++++++++++++++++++++++----------------
 src/application.h |    1 +
 src/interface.cpp |   19 +++++++++++-----
 3 files changed, 56 insertions(+), 25 deletions(-)
---
diff --git a/data/interface.ui b/data/interface.ui
index a5b0a48..b09d0e5 100644
--- a/data/interface.ui
+++ b/data/interface.ui
@@ -23,25 +23,6 @@
               </object>
             </child>
             <child>
-              <object class="GtkButton" id="end_process_button">
-                <property name="label" translatable="yes">End _Process</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="receives_default">True</property>
-                <property name="halign">end</property>
-                <property name="use_underline">True</property>
-                <property name="action_name">win.send-signal-end</property>
-                <property name="action_target">@i 15</property>
-                <accelerator key="Delete" signal="clicked"/>
-                <style>
-                    <class name="text-button"/>
-                </style>
-              </object>
-              <packing>
-                <property name="pack_type">start</property>
-              </packing>
-            </child>
-            <child>
               <object class="GtkToggleButton" id="search_button">
                 <property name="visible">True</property>
                 <property name="action_name">win.search</property>
@@ -138,6 +119,48 @@
                         <property name="position">1</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkRevealer" id="proc_toolbar_revealer">
+                        <property name="visible">True</property>
+                        <property name="transition_type">slide-up</property>
+                        <child>
+                          <object class="GtkBox" id="proc_toolbar_box">
+                            <property name="visible">True</property>
+                            <property name="orientation">horizontal</property>
+                            <property name="margin">6</property>
+                            <child>
+                              <object class="GtkButton" id="end_process_button">
+                                <property name="label" translatable="yes">End _Process</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">True</property>
+                                <property name="receives_default">True</property>
+                                <property name="halign">start</property>
+                                <property name="use_underline">True</property>
+                                <property name="action_name">win.send-signal-end</property>
+                                <property name="action_target">@i 15</property>
+                              </object>
+                            </child>
+                            <child>
+                              <object class="GtkButton" id="proc_properties_button">
+                                <property name="visible">True</property>
+                                <property name="tooltip_text" translatable="yes">Show process 
properties</property>
+                                <property name="action_name">win.process-properties</property>
+                                <child>
+                                  <object class="GtkImage" id="proc_properties_image">
+                                    <property name="visible">True</property>
+                                    <property name="icon_size">1</property>
+                                    <property name="icon_name">document-properties-symbolic</property>
+                                  </object>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="pack_type">end</property>
+                              </packing>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                    </child>
                   </object>
                   <packing>
                     <property name="expand">True</property>
diff --git a/src/application.h b/src/application.h
index 6c166ad..5767a2b 100644
--- a/src/application.h
+++ b/src/application.h
@@ -157,6 +157,7 @@ public:
     void shutdown();
 
     GtkWidget        *tree;
+    GtkWidget        *proc_toolbar_revealer;
     GtkWidget        *popup_menu;
     GtkWidget        *disk_list;
     GtkWidget        *stack;
diff --git a/src/interface.cpp b/src/interface.cpp
index 29ff567..cf1131b 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -76,6 +76,8 @@ create_proc_view(GsmApplication *app, GtkBuilder * builder)
 
     gtk_container_add (GTK_CONTAINER (scrolled), proctree);
 
+    app->proc_toolbar_revealer = GTK_WIDGET (gtk_builder_get_object (builder, "proc_toolbar_revealer"));
+
     /* create popup_menu for the processes tab */
     GMenuModel *menu_model = G_MENU_MODEL (gtk_builder_get_object (builder, "process-popup-menu"));
     app->popup_menu = gtk_menu_new_from_model (menu_model);
@@ -709,17 +711,22 @@ update_sensitivity(GsmApplication *app)
     GAction *action;
 
     processes_sensitivity = (strcmp (gtk_stack_get_visible_child_name (GTK_STACK (app->stack)), "processes") 
== 0);
-    selected_sensitivity = (processes_sensitivity && gtk_tree_selection_count_selected_rows (app->selection) 
0);
+    selected_sensitivity = gtk_tree_selection_count_selected_rows (app->selection) > 0;
 
-    for (i = 0; i != G_N_ELEMENTS(processes_actions); ++i) {
+    for (i = 0; i != G_N_ELEMENTS (processes_actions); ++i) {
         action = g_action_map_lookup_action (G_ACTION_MAP (app->main_window),
-                                              processes_actions[i]);
-        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), processes_sensitivity);
+                                             processes_actions[i]);
+        g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                     processes_sensitivity);
     }
 
-    for (i = 0; i != G_N_ELEMENTS(selected_actions); ++i) {
+    for (i = 0; i != G_N_ELEMENTS (selected_actions); ++i) {
         action = g_action_map_lookup_action (G_ACTION_MAP (app->main_window),
                                              selected_actions[i]);
-        g_simple_action_set_enabled (G_SIMPLE_ACTION (action), selected_sensitivity);
+        g_simple_action_set_enabled (G_SIMPLE_ACTION (action),
+                                     processes_sensitivity & selected_sensitivity);
     }
+
+    gtk_revealer_set_reveal_child (GTK_REVEALER (app->proc_toolbar_revealer),
+                                   selected_sensitivity);
 }


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