[Xfce4-commits] [apps/xfce4-taskmanager] 01/05: Rearrange the UI to resemble top

noreply at xfce.org noreply at xfce.org
Thu Dec 18 22:12:20 CET 2014


This is an automated email from the git hooks/post-receive script.

landry pushed a commit to branch master
in repository apps/xfce4-taskmanager.

commit 3486d3fab11b01ace555a16003ce03ddeefcb673
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date:   Wed Dec 17 22:50:41 2014 +0100

    Rearrange the UI to resemble top
    
    Moved the graphs below the toolbar and made them taller, so that they
    are more readable/usable. Converted the statusbar into a box, moved it
    below the graphs and rearranged the content to match the graphs.
---
 src/process-statusbar.c    |   48 +++++++++------------
 src/process-window-gtk3.ui |   99 +++++++++++++++++++++++++++++++-------------
 src/process-window.c       |   18 ++++----
 src/process-window.ui      |   82 ++++++++++++++++++++++++------------
 4 files changed, 153 insertions(+), 94 deletions(-)

diff --git a/src/process-statusbar.c b/src/process-statusbar.c
index 01a46e1..0044796 100644
--- a/src/process-statusbar.c
+++ b/src/process-statusbar.c
@@ -35,7 +35,7 @@ struct _XtmProcessStatusbarClass
 };
 struct _XtmProcessStatusbar
 {
-	GtkStatusbar		parent;
+	GtkHBox			parent;
 	/*<private>*/
 	XtmSettings *		settings;
 
@@ -49,7 +49,7 @@ struct _XtmProcessStatusbar
 	gchar			swap[64];
 	guint			num_processes;
 };
-G_DEFINE_TYPE (XtmProcessStatusbar, xtm_process_statusbar, GTK_TYPE_STATUSBAR)
+G_DEFINE_TYPE (XtmProcessStatusbar, xtm_process_statusbar, GTK_TYPE_BOX)
 
 static void	xtm_process_statusbar_finalize			(GObject *object);
 static void	xtm_process_statusbar_set_property		(GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
@@ -78,46 +78,36 @@ xtm_process_statusbar_class_init (XtmProcessStatusbarClass *klass)
 static void
 xtm_process_statusbar_init (XtmProcessStatusbar *statusbar)
 {
-	GtkWidget *area, *hbox;
-
+	GtkWidget *hbox, *hbox_cpu, *hbox_mem;
 	statusbar->settings = xtm_settings_get_default ();
 
-#if GTK_CHECK_VERSION(2,20,0)
-	area = gtk_statusbar_get_message_area (GTK_STATUSBAR (statusbar));
-#else
-	{
-		GtkShadowType shadow_type;
-		GtkWidget *frame;
-
-		gtk_widget_style_get (GTK_WIDGET (statusbar), "shadow-type", &shadow_type, NULL);
-		frame = gtk_frame_new (NULL);
-		gtk_frame_set_shadow_type (GTK_FRAME (frame), shadow_type);
-		gtk_box_pack_start (GTK_BOX (statusbar), frame, TRUE, TRUE, 0);
-
-		area = gtk_hbox_new (FALSE, 0);
-		gtk_container_add (GTK_CONTAINER (frame), area);
-		gtk_widget_show_all (frame);
-	}
-#endif
-
 #ifdef HAVE_GTK3
 	hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
+	hbox_cpu = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
+	hbox_mem = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 16);
 #else
 	hbox = gtk_hbox_new (FALSE, 16);
+	hbox_cpu = gtk_hbox_new (FALSE, 16);
+	hbox_mem = gtk_hbox_new (FALSE, 16);
 #endif
-	gtk_box_pack_start (GTK_BOX (area), hbox, TRUE, TRUE, 6);
-
-	statusbar->label_num_processes = gtk_label_new (NULL);
-	gtk_box_pack_start (GTK_BOX (hbox), statusbar->label_num_processes, FALSE, FALSE, 0);
 
 	statusbar->label_cpu = gtk_label_new (NULL);
-	gtk_box_pack_start (GTK_BOX (hbox), statusbar->label_cpu, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox_cpu), statusbar->label_cpu, TRUE, FALSE, 0);
+
+	statusbar->label_num_processes = gtk_label_new (NULL);
+	gtk_box_pack_start (GTK_BOX (hbox_cpu), statusbar->label_num_processes, TRUE, FALSE, 0);
 
 	statusbar->label_memory = gtk_label_new (NULL);
-	gtk_box_pack_start (GTK_BOX (hbox), statusbar->label_memory, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox_mem), statusbar->label_memory, TRUE, FALSE, 0);
 
 	statusbar->label_swap = gtk_label_new (NULL);
-	gtk_box_pack_start (GTK_BOX (hbox), statusbar->label_swap, FALSE, FALSE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox_mem), statusbar->label_swap, TRUE, FALSE, 0);
+
+	gtk_box_pack_start (GTK_BOX (hbox), hbox_cpu, TRUE, TRUE, 0);
+	gtk_box_pack_start (GTK_BOX (hbox), hbox_mem, TRUE, TRUE, 0);
+	gtk_box_set_homogeneous (GTK_BOX (hbox), TRUE);
+
+	gtk_box_pack_start (GTK_BOX (statusbar), hbox, TRUE, TRUE, 0);
 
 	gtk_widget_show_all (hbox);
 }
diff --git a/src/process-window-gtk3.ui b/src/process-window-gtk3.ui
index 5bd62d8..e828ff8 100644
--- a/src/process-window-gtk3.ui
+++ b/src/process-window-gtk3.ui
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.16.1 -->
 <interface>
   <requires lib="gtk+" version="3.0"/>
   <object class="GtkWindow" id="process-window">
@@ -20,50 +20,94 @@
             <property name="show_arrow">False</property>
             <property name="icon_size">1</property>
             <child>
-              <object class="GtkToolItem" id="cpu-toolitem">
+              <object class="GtkToolButton" id="toolbutton-about">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">2</property>
-                <child>
-                  <placeholder/>
-                </child>
+                <property name="use_underline">True</property>
+                <property name="stock_id">gtk-about</property>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="homogeneous">True</property>
               </packing>
             </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkBox" id="graph-vbox">
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
+            <property name="orientation">vertical</property>
             <child>
-              <object class="GtkToolItem" id="mem-toolitem">
+              <object class="GtkBox" id="graph-hbox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">2</property>
                 <child>
-                  <placeholder/>
+                  <object class="GtkFrame" id="cpu-toolitem">
+                    <property name="height_request">100</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">False</property>
+                    <property name="border_width">2</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child type="label_item">
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkFrame" id="mem-toolitem">
+                    <property name="height_request">100</property>
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">False</property>
+                    <property name="border_width">2</property>
+                    <property name="label_xalign">0</property>
+                    <property name="shadow_type">none</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child type="label_item">
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
                 </child>
               </object>
               <packing>
-                <property name="expand">True</property>
-                <property name="homogeneous">True</property>
+                <property name="expand">False</property>
+                <property name="fill">True</property>
+                <property name="position">0</property>
               </packing>
             </child>
             <child>
-              <object class="GtkToolButton" id="toolbutton-about">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="use_underline">True</property>
-                <property name="stock_id">gtk-about</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="homogeneous">True</property>
-              </packing>
+              <placeholder/>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">0</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
@@ -105,7 +149,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
         <child>
@@ -122,7 +166,7 @@
             <property name="expand">False</property>
             <property name="fill">False</property>
             <property name="padding">2</property>
-            <property name="position">2</property>
+            <property name="position">3</property>
           </packing>
         </child>
         <child>
@@ -149,12 +193,9 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">3</property>
+            <property name="position">4</property>
           </packing>
         </child>
-        <child>
-          <placeholder/>
-        </child>
       </object>
     </child>
   </object>
diff --git a/src/process-window.c b/src/process-window.c
index b463c23..1df538c 100644
--- a/src/process-window.c
+++ b/src/process-window.c
@@ -140,6 +140,9 @@ xtm_process_window_init (XtmProcessWindow *window)
 	window->settings_button = xtm_settings_tool_button_new ();
 	gtk_toolbar_insert (GTK_TOOLBAR (window->toolbar), GTK_TOOL_ITEM (window->settings_button), 1);
 
+	button = GTK_WIDGET (gtk_builder_get_object (window->builder, "toolbutton-about"));
+	g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_about_dialog), window);
+
 	{
 		GtkWidget *toolitem;
 		guint refresh_rate;
@@ -161,8 +164,9 @@ xtm_process_window_init (XtmProcessWindow *window)
 		g_signal_connect_swapped (window->settings, "notify::refresh-rate", G_CALLBACK (monitor_update_step_size), window);
 	}
 
-	button = GTK_WIDGET (gtk_builder_get_object (window->builder, "toolbutton-about"));
-	g_signal_connect_swapped (button, "clicked", G_CALLBACK (show_about_dialog), window);
+	window->statusbar = xtm_process_statusbar_new ();
+	gtk_widget_show (window->statusbar);
+	gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (window->builder, "graph-vbox")), window->statusbar, FALSE, FALSE, 0);
 
 	if (geteuid () == 0)
 	{
@@ -181,10 +185,6 @@ xtm_process_window_init (XtmProcessWindow *window)
 	g_signal_connect (G_OBJECT(window->filter_entry), "icon-press", G_CALLBACK(filter_entry_icon_pressed_cb), NULL);
 	g_signal_connect (G_OBJECT(window->filter_entry), "changed", G_CALLBACK(filter_entry_keyrelease_handler), window->treeview);
 
-	window->statusbar = xtm_process_statusbar_new ();
-	gtk_widget_show (window->statusbar);
-	gtk_box_pack_start (GTK_BOX (gtk_builder_get_object (window->builder, "process-vbox")), window->statusbar, FALSE, FALSE, 0);
-
 	gtk_widget_grab_focus (GTK_WIDGET (window->treeview));
 
 	g_object_unref (window->builder);
@@ -212,7 +212,7 @@ xtm_process_window_finalize (GObject *object)
 	if (GTK_IS_TREE_VIEW (window->treeview))
 		gtk_widget_destroy (window->treeview);
 
-	if (GTK_IS_STATUSBAR (window->statusbar))
+	if (GTK_IS_BOX (window->statusbar))
 		gtk_widget_destroy (window->statusbar);
 
 	if (GTK_IS_TOOL_ITEM (window->exec_button))
@@ -412,7 +412,7 @@ xtm_process_window_set_system_info (XtmProcessWindow *window, guint num_processe
 	gchar value[4];
 
 	g_return_if_fail (XTM_IS_PROCESS_WINDOW (window));
-	g_return_if_fail (GTK_IS_STATUSBAR (window->statusbar));
+	g_return_if_fail (GTK_IS_BOX (window->statusbar));
 
 	g_object_set (window->statusbar, "num-processes", num_processes, "cpu", cpu, "memory", memory_str, "swap", swap_str, NULL);
 
@@ -430,6 +430,6 @@ void
 xtm_process_window_show_swap_usage (XtmProcessWindow *window, gboolean show_swap_usage)
 {
 	g_return_if_fail (XTM_IS_PROCESS_WINDOW (window));
-	g_return_if_fail (GTK_IS_STATUSBAR (window->statusbar));
+	g_return_if_fail (GTK_IS_BOX (window->statusbar));
 	g_object_set (window->statusbar, "show-swap", show_swap_usage, NULL);
 }
diff --git a/src/process-window.ui b/src/process-window.ui
index 173211c..823e465 100644
--- a/src/process-window.ui
+++ b/src/process-window.ui
@@ -19,50 +19,81 @@
             <property name="show_arrow">False</property>
             <property name="icon_size">1</property>
             <child>
-              <object class="GtkToolItem" id="cpu-toolitem">
+              <object class="GtkToolButton" id="toolbutton-about">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">2</property>
-                <child>
-                  <placeholder/>
-                </child>
+                <property name="use_action_appearance">False</property>
+                <property name="use_underline">True</property>
+                <property name="stock_id">gtk-about</property>
               </object>
               <packing>
-                <property name="expand">True</property>
+                <property name="expand">False</property>
                 <property name="homogeneous">True</property>
               </packing>
             </child>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkVBox" id="graph-vbox">
+            <property name="height_request">100</property>
+            <property name="visible">True</property>
+            <property name="can_focus">False</property>
             <child>
-              <object class="GtkToolItem" id="mem-toolitem">
+              <object class="GtkHBox" id="graph-hbox">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
-                <property name="border_width">2</property>
                 <child>
-                  <placeholder/>
+                  <object class="GtkToolItem" id="cpu-toolitem">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">2</property>
+                    <property name="use_action_appearance">False</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
+                </child>
+                <child>
+                  <object class="GtkToolItem" id="mem-toolitem">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="border_width">2</property>
+                    <property name="use_action_appearance">False</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">True</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
                 </child>
               </object>
               <packing>
                 <property name="expand">True</property>
-                <property name="homogeneous">True</property>
+                <property name="fill">True</property>
+                <property name="position">-1</property>
               </packing>
             </child>
             <child>
-              <object class="GtkToolButton" id="toolbutton-about">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-                <property name="use_underline">True</property>
-                <property name="stock_id">gtk-about</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="homogeneous">True</property>
-              </packing>
+              <placeholder/>
             </child>
           </object>
           <packing>
             <property name="expand">False</property>
             <property name="fill">True</property>
-            <property name="position">0</property>
+            <property name="position">1</property>
           </packing>
         </child>
         <child>
@@ -103,7 +134,7 @@
           <packing>
             <property name="expand">False</property>
             <property name="fill">False</property>
-            <property name="position">1</property>
+            <property name="position">2</property>
           </packing>
         </child>
         <child>
@@ -122,7 +153,7 @@
             <property name="expand">False</property>
             <property name="fill">False</property>
             <property name="padding">2</property>
-            <property name="position">2</property>
+            <property name="position">3</property>
           </packing>
         </child>
         <child>
@@ -150,12 +181,9 @@
           <packing>
             <property name="expand">True</property>
             <property name="fill">True</property>
-            <property name="position">3</property>
+            <property name="position">4</property>
           </packing>
         </child>
-        <child>
-          <placeholder/>
-        </child>
       </object>
     </child>
   </object>

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the Xfce4-commits mailing list