[gnome-system-monitor] File systems tab moved to separate UI file



commit a7e27a2529cd88ed355397b6562589a6eefc8adc
Author: Robert Roth <robert roth off gmail com>
Date:   Fri Jul 27 22:23:31 2012 +0300

    File systems tab moved to separate UI file

 data/interface2.ui |   62 +++++++++++++++++++++++++++++++++++----------------
 src/disks.cpp      |   21 ++---------------
 src/disks.h        |    4 +-
 src/interface.cpp  |   17 ++++----------
 4 files changed, 52 insertions(+), 52 deletions(-)
---
diff --git a/data/interface2.ui b/data/interface2.ui
index c48be31..a479051 100644
--- a/data/interface2.ui
+++ b/data/interface2.ui
@@ -64,7 +64,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="GtkScrolledWindow" id="scrolled">
+                  <object class="GtkScrolledWindow" id="processes_scrolled">
                     <property name="visible">True</property>
                     <property name="can_focus">True</property>
                     <property name="hexpand">True</property>
@@ -165,6 +165,30 @@
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -265,18 +289,6 @@
                             <child>
                               <placeholder/>
                             </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -455,12 +467,6 @@
                             <child>
                               <placeholder/>
                             </child>
-                            <child>
-                              <placeholder/>
-                            </child>
-                            <child>
-                              <placeholder/>
-                            </child>
                           </object>
                           <packing>
                             <property name="expand">False</property>
@@ -506,9 +512,25 @@
               <object class="GtkBox" id="fs_box">
                 <property name="visible">True</property>
                 <property name="can_focus">False</property>
+                <property name="border_width">12</property>
                 <property name="orientation">vertical</property>
+                <property name="spacing">6</property>
                 <child>
-                  <placeholder/>
+                  <object class="GtkScrolledWindow" id="disks_scrolled">
+                    <property name="visible">True</property>
+                    <property name="can_focus">True</property>
+                    <property name="hexpand">True</property>
+                    <property name="vexpand">True</property>
+                    <property name="shadow_type">in</property>
+                    <child>
+                      <placeholder/>
+                    </child>
+                  </object>
+                  <packing>
+                    <property name="expand">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">0</property>
+                  </packing>
                 </child>
               </object>
               <packing>
diff --git a/src/disks.cpp b/src/disks.cpp
index 121765f..0638558 100644
--- a/src/disks.cpp
+++ b/src/disks.cpp
@@ -284,10 +284,9 @@ static void open_dir(GtkTreeView       *tree_view,
     g_free(dir);
 }
 
-GtkWidget *
-create_disk_view(ProcData *procdata)
+void
+create_disk_view(ProcData *procdata, GtkBuilder *builder)
 {
-    GtkWidget *disk_box;
     GtkWidget *scrolled;
     GtkWidget *disk_tree;
     GtkListStore *model;
@@ -305,18 +304,7 @@ create_disk_view(ProcData *procdata)
         N_("Used")
     };
 
-    disk_box = gtk_vbox_new(FALSE, 6);
-
-    gtk_container_set_border_width(GTK_CONTAINER(disk_box), 12);
-
-    scrolled = gtk_scrolled_window_new(NULL, NULL);
-    gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled),
-                                   GTK_POLICY_AUTOMATIC,
-                                   GTK_POLICY_AUTOMATIC);
-    gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolled),
-                                        GTK_SHADOW_IN);
-
-    gtk_box_pack_start(GTK_BOX(disk_box), scrolled, TRUE, TRUE, 0);
+    scrolled = GTK_WIDGET (gtk_builder_get_object (builder, "disks_scrolled"));
 
     model = gtk_list_store_new(DISK_N_COLUMNS,      /* n columns */
                                G_TYPE_STRING,       /* DISK_DEVICE */
@@ -409,13 +397,10 @@ create_disk_view(ProcData *procdata)
 
     /* numeric sort */
 
-    gtk_widget_show_all(disk_box);
-
     procman_get_tree_state(procdata->settings, disk_tree,
                            "disktreenew");
 
     g_signal_connect (G_OBJECT(disk_tree), "columns-changed",
                       G_CALLBACK(cb_disk_columns_changed), procdata);
 
-    return disk_box;
 }
diff --git a/src/disks.h b/src/disks.h
index c42ffc3..311cd9e 100644
--- a/src/disks.h
+++ b/src/disks.h
@@ -3,8 +3,8 @@
 
 #include "procman.h"
 
-GtkWidget *
-create_disk_view(ProcData *procdata);
+void
+create_disk_view(ProcData *procdata, GtkBuilder *builder);
 
 int
 cb_update_disks(gpointer procdata);
diff --git a/src/interface.cpp b/src/interface.cpp
index b1ec431..b98d47c 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -225,7 +225,7 @@ create_proc_view(ProcData *procdata, GtkBuilder * builder)
     g_free (string);
 
     proctree = proctable_new (procdata);
-    scrolled = GTK_WIDGET (gtk_builder_get_object (builder, "scrolled"));
+    scrolled = GTK_WIDGET (gtk_builder_get_object (builder, "processes_scrolled"));
 
     gtk_container_add (GTK_CONTAINER (scrolled), proctree);
 
@@ -237,10 +237,9 @@ create_proc_view(ProcData *procdata, GtkBuilder * builder)
     procdata->popup_menu = gtk_ui_manager_get_widget (procdata->uimanager, "/PopupMenu");
 }
 
-static GtkWidget *
+static void
 create_sys_view (ProcData *procdata, GtkBuilder * builder)
 {
-    GtkWidget *vbox;
     GtkWidget *cpu_graph_box, *mem_graph_box, *net_graph_box;
     GtkWidget *label,*cpu_label;
     GtkWidget *table;
@@ -256,8 +255,6 @@ create_sys_view (ProcData *procdata, GtkBuilder * builder)
     // Translators: color picker title, %s is CPU, Memory, Swap, Receiving, Sending
     title_template = g_strdup(_("Pick a Color for '%s'"));
 
-    vbox = GTK_WIDGET (gtk_builder_get_object (builder, "res_box"));
-
     /* The CPU BOX */
 
     cpu_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "cpu_graph_box"));
@@ -274,7 +271,7 @@ create_sys_view (ProcData *procdata, GtkBuilder * builder)
     for (i=0;i<procdata->config.num_cpus; i++) {
         GtkWidget *temp_hbox;
 
-        temp_hbox = gtk_hbox_new (FALSE, 0);
+        temp_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
         if (i < cols) {
             gtk_grid_insert_column(GTK_GRID(cpu_table), i%cols);
         }
@@ -394,7 +391,6 @@ create_sys_view (ProcData *procdata, GtkBuilder * builder)
     procdata->net_graph = net_graph;
     g_free(title_template);
 
-    return vbox;
 }
 
 void
@@ -407,7 +403,6 @@ create_main_window (ProcData *procdata)
     GtkWidget *menubar;
     GtkWidget *main_box;
     GtkWidget *notebook;
-    GtkWidget *devices_box;
 
     gchar* filename = g_build_filename (GSM_DATA_DIR, "interface2.ui", NULL);
 
@@ -483,10 +478,8 @@ create_main_window (ProcData *procdata)
 
     create_sys_view (procdata, builder);
     
-    devices_box = create_disk_view (procdata);
-    GtkWidget *fs_box = GTK_WIDGET (gtk_builder_get_object (builder, "fs_box"));
-    gtk_box_pack_end(GTK_BOX (fs_box), devices_box, TRUE, TRUE, 0);
-
+    create_disk_view (procdata, builder);
+    
     g_signal_connect (G_OBJECT (notebook), "switch-page",
                       G_CALLBACK (cb_switch_page), procdata);
     g_signal_connect (G_OBJECT (notebook), "change-current-page",



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