[gnome-system-monitor/migrateui] Resources tab moved to UI files



commit 8c95e80401b1f2e3901f68ef871c8c06ff5d7155
Author: Robert Roth <robert roth off gmail com>
Date:   Fri Jul 27 21:35:52 2012 +0300

    Resources tab moved to UI files

 data/interface2.ui |  298 +++++++++++++++++++++++++++++++++++++++++++++++++++-
 src/interface.cpp  |  265 +++++++---------------------------------------
 src/load-graph.cpp |   10 ++
 3 files changed, 341 insertions(+), 232 deletions(-)
---
diff --git a/data/interface2.ui b/data/interface2.ui
index 517f068..c48be31 100644
--- a/data/interface2.ui
+++ b/data/interface2.ui
@@ -121,13 +121,13 @@
                 <property name="vexpand">True</property>
                 <property name="border_width">12</property>
                 <property name="orientation">vertical</property>
-                <property name="spacing">18</property>
+                <property name="spacing">12</property>
                 <child>
                   <object class="GtkBox" id="cpu_box">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                     <property name="orientation">vertical</property>
-                    <property name="spacing">6</property>
+                    <property name="spacing">10</property>
                     <child>
                       <object class="GtkLabel" id="cpu_label">
                         <property name="visible">True</property>
@@ -191,10 +191,300 @@
                   </packing>
                 </child>
                 <child>
-                  <placeholder/>
+                  <object class="GtkBox" id="mem_box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">10</property>
+                    <child>
+                      <object class="GtkLabel" id="mem_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Memory and Swap History</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="mem_graph_box">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkGrid" id="mem_table">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="margin_left">54</property>
+                            <property name="hexpand">True</property>
+                            <property name="row_spacing">6</property>
+                            <property name="column_spacing">6</property>
+                            <property name="row_homogeneous">True</property>
+                            <child>
+                              <object class="GtkLabel" id="memory_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Memory</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="swap_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Swap</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </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>
+                            <property name="fill">True</property>
+                            <property name="pack_type">end</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <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">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">1</property>
+                  </packing>
                 </child>
                 <child>
-                  <placeholder/>
+                  <object class="GtkBox" id="net_box">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <property name="orientation">vertical</property>
+                    <property name="spacing">10</property>
+                    <child>
+                      <object class="GtkLabel" id="net_label">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="xalign">0</property>
+                        <property name="label" translatable="yes">Network History</property>
+                        <attributes>
+                          <attribute name="weight" value="bold"/>
+                        </attributes>
+                      </object>
+                      <packing>
+                        <property name="expand">False</property>
+                        <property name="fill">True</property>
+                        <property name="position">0</property>
+                      </packing>
+                    </child>
+                    <child>
+                      <object class="GtkBox" id="net_graph_box">
+                        <property name="visible">True</property>
+                        <property name="can_focus">False</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                        <property name="orientation">vertical</property>
+                        <property name="spacing">6</property>
+                        <child>
+                          <object class="GtkGrid" id="net_table">
+                            <property name="visible">True</property>
+                            <property name="can_focus">False</property>
+                            <property name="margin_left">54</property>
+                            <property name="margin_right">38</property>
+                            <property name="hexpand">True</property>
+                            <property name="row_spacing">6</property>
+                            <property name="column_spacing">6</property>
+                            <property name="row_homogeneous">True</property>
+                            <child>
+                              <object class="GtkLabel" id="receiving_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Receiving</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="total_received_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Total Received</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">1</property>
+                                <property name="top_attach">1</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="sending_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Sent</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">5</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="total_sent_label">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="hexpand">True</property>
+                                <property name="xalign">0</property>
+                                <property name="label" translatable="yes">Total Sent</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">5</property>
+                                <property name="top_attach">1</property>
+                                <property name="width">1</property>
+                                <property name="height">1</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkLabel" id="spacer">
+                                <property name="width_request">38</property>
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="label" translatable="yes">
+</property>
+                              </object>
+                              <packing>
+                                <property name="left_attach">3</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkAlignment" id="receiving_picker_alignment">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="border_width">6</property>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">0</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <object class="GtkAlignment" id="sending_picker_alignment">
+                                <property name="visible">True</property>
+                                <property name="can_focus">False</property>
+                                <property name="border_width">6</property>
+                                <child>
+                                  <placeholder/>
+                                </child>
+                              </object>
+                              <packing>
+                                <property name="left_attach">4</property>
+                                <property name="top_attach">0</property>
+                                <property name="width">1</property>
+                                <property name="height">2</property>
+                              </packing>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                          </object>
+                          <packing>
+                            <property name="expand">False</property>
+                            <property name="fill">True</property>
+                            <property name="pack_type">end</property>
+                            <property name="position">0</property>
+                          </packing>
+                        </child>
+                        <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">False</property>
+                    <property name="fill">True</property>
+                    <property name="position">2</property>
+                  </packing>
                 </child>
               </object>
               <packing>
diff --git a/src/interface.cpp b/src/interface.cpp
index b8ab89f..b1ec431 100644
--- a/src/interface.cpp
+++ b/src/interface.cpp
@@ -240,13 +240,12 @@ create_proc_view(ProcData *procdata, GtkBuilder * builder)
 static GtkWidget *
 create_sys_view (ProcData *procdata, GtkBuilder * builder)
 {
-    GtkWidget *vbox, *hbox;
-    GtkWidget *mem_box, *net_box;
+    GtkWidget *vbox;
     GtkWidget *cpu_graph_box, *mem_graph_box, *net_graph_box;
-    GtkWidget *label,*cpu_label, *spacer;
+    GtkWidget *label,*cpu_label;
     GtkWidget *table;
     GtkWidget *color_picker;
-    GtkWidget *mem_legend_box, *net_legend_box;
+    GtkWidget *picker_alignment;
     LoadGraph *cpu_graph, *mem_graph, *net_graph;
 
     gint i;
@@ -270,27 +269,7 @@ create_sys_view (ProcData *procdata, GtkBuilder * builder)
                         TRUE,
                         0);
 
-    hbox = GTK_WIDGET (gtk_builder_get_object (builder, "hbox"));
-    //spacer = gtk_label_new ("");
-    //gtk_widget_set_size_request(GTK_WIDGET(spacer), 57, -1);
-    //gtk_box_pack_start (GTK_BOX (hbox), spacer,
-    //                    FALSE, FALSE, 0);
-
-
-    //gtk_box_pack_start (GTK_BOX (cpu_graph_box), hbox,
-    //                    FALSE, FALSE, 0);
-
-    /*cpu_legend_box = gtk_hbox_new(TRUE, 10);
-      gtk_box_pack_start (GTK_BOX (hbox), cpu_legend_box,
-      TRUE, TRUE, 0);*/
-
     GtkWidget* cpu_table = GTK_WIDGET (gtk_builder_get_object (builder, "cpu_table"));
-    // gtk_table_new(std::min(procdata->config.num_cpus / 4, 1),
-    //                                   std::min(procdata->config.num_cpus, 4),
-    //                                     TRUE);
-    //gtk_table_set_row_spacings(GTK_TABLE(cpu_table), 6);
-    //gtk_table_set_col_spacings(GTK_TABLE(cpu_table), 6);
-    //gtk_box_pack_start(GTK_BOX(hbox), cpu_table, TRUE, TRUE, 0);
     gint cols = 4;
     for (i=0;i<procdata->config.num_cpus; i++) {
         GtkWidget *temp_hbox;
@@ -326,22 +305,15 @@ create_sys_view (ProcData *procdata, GtkBuilder * builder)
 
         cpu_label = gtk_label_new (NULL);
         gtk_misc_set_alignment (GTK_MISC (cpu_label), 0.0, 0.5);
-        gtk_box_pack_start (GTK_BOX (temp_hbox), cpu_label, TRUE, TRUE, 0);
+        gtk_box_pack_start (GTK_BOX (temp_hbox), cpu_label, FALSE, FALSE, 0);
         load_graph_get_labels(cpu_graph)->cpu[i] = cpu_label;
 
     }
 
     procdata->cpu_graph = cpu_graph;
 
-    mem_box = gtk_vbox_new (FALSE, 6);
-    gtk_box_pack_start (GTK_BOX (vbox), mem_box, TRUE, TRUE, 0);
-
-    label = make_title_label (_("Memory and Swap History"));
-    gtk_box_pack_start (GTK_BOX (mem_box), label, FALSE, FALSE, 0);
-
-    mem_graph_box = gtk_vbox_new (FALSE, 6);
-    gtk_box_pack_start (GTK_BOX (mem_box), mem_graph_box, TRUE, TRUE, 0);
-
+    /** The memory box */
+    mem_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "mem_graph_box"));
 
     mem_graph = new LoadGraph(LOAD_GRAPH_MEM);
     gtk_box_pack_start (GTK_BOX (mem_graph_box),
@@ -350,93 +322,33 @@ create_sys_view (ProcData *procdata, GtkBuilder * builder)
                         TRUE,
                         0);
 
-    hbox = gtk_hbox_new(FALSE, 0);
-    spacer = gtk_label_new ("");
-    gtk_widget_set_size_request(GTK_WIDGET(spacer), 54, -1);
-    gtk_box_pack_start (GTK_BOX (hbox), spacer,
-                        FALSE, FALSE, 0);
+    table = GTK_WIDGET (gtk_builder_get_object (builder, "mem_table"));
 
-
-    gtk_box_pack_start (GTK_BOX (mem_graph_box), hbox,
-                        FALSE, FALSE, 0);
-
-    mem_legend_box = gtk_hbox_new(TRUE, 10);
-    gtk_box_pack_start (GTK_BOX (hbox), mem_legend_box,
-                        TRUE, TRUE, 0);
-
-    table = gtk_table_new (2, 7, FALSE);
-    gtk_table_set_row_spacings (GTK_TABLE (table), 6);
-    gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-    gtk_box_pack_start (GTK_BOX (mem_legend_box), table,
-                        TRUE, TRUE, 0);
-
-    label_text = g_strdup(_("Memory"));
     color_picker = load_graph_get_mem_color_picker(mem_graph);
     g_signal_connect (G_OBJECT (color_picker), "color_set",
                       G_CALLBACK (cb_mem_color_changed), procdata);
-    title_text = g_strdup_printf(title_template, label_text);
+    title_text = g_strdup_printf(title_template, _("Memory"));
     gsm_color_button_set_title(GSM_COLOR_BUTTON(color_picker), title_text);
     g_free(title_text);
-    gtk_table_attach (GTK_TABLE (table), color_picker, 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
-    label = gtk_label_new (label_text);
-    g_free(label_text);
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    gtk_table_attach (GTK_TABLE (table), label, 1, 7, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-
-    gtk_table_attach (GTK_TABLE (table),
-                      load_graph_get_labels(mem_graph)->memory,
-                      1,
-                      2,
-                      1,
-                      2,
-                      GTK_FILL,
-                      GTK_FILL,
-                      0,
-                      0);
-
-    table = gtk_table_new (2, 7, FALSE);
-    gtk_table_set_row_spacings (GTK_TABLE (table), 6);
-    gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-    gtk_box_pack_start (GTK_BOX (mem_legend_box), table,
-                        TRUE, TRUE, 0);
-
-    label_text = g_strdup(_("Swap"));
+    
+    gtk_grid_attach (GTK_GRID (table), color_picker, 0, 0, 1, 2);
+
+    gtk_grid_attach (GTK_GRID (table), load_graph_get_labels(mem_graph)->memory, 1, 1, 1, 1);
+
     color_picker = load_graph_get_swap_color_picker(mem_graph);
     g_signal_connect (G_OBJECT (color_picker), "color_set",
                       G_CALLBACK (cb_swap_color_changed), procdata);
-    title_text = g_strdup_printf(title_template, label_text);
+    title_text = g_strdup_printf(title_template, _("Swap"));
     gsm_color_button_set_title(GSM_COLOR_BUTTON(color_picker), title_text);
     g_free(title_text);
-    gtk_table_attach (GTK_TABLE (table), color_picker, 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
-    label = gtk_label_new (label_text);
-    g_free(label_text);
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    gtk_table_attach (GTK_TABLE (table), label, 1, 7, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-
-    gtk_table_attach (GTK_TABLE (table),
-                      load_graph_get_labels(mem_graph)->swap,
-                      1,
-                      2,
-                      1,
-                      2,
-                      GTK_FILL,
-                      GTK_FILL,
-                      0,
-                      0);
+    gtk_grid_attach (GTK_GRID (table), color_picker, 2, 0, 1, 2);
+
+    gtk_grid_attach (GTK_GRID (table),  load_graph_get_labels(mem_graph)->swap, 3, 1, 1, 1);
 
     procdata->mem_graph = mem_graph;
 
     /* The net box */
-    net_box = gtk_vbox_new (FALSE, 6);
-    gtk_box_pack_start (GTK_BOX (vbox), net_box, TRUE, TRUE, 0);
-
-    label = make_title_label (_("Network History"));
-    gtk_box_pack_start (GTK_BOX (net_box), label, FALSE, FALSE, 0);
-
-    net_graph_box = gtk_vbox_new (FALSE, 6);
-    gtk_box_pack_start (GTK_BOX (net_box), net_graph_box, TRUE, TRUE, 0);
+    net_graph_box = GTK_WIDGET (gtk_builder_get_object (builder, "net_graph_box"));
 
     net_graph = new LoadGraph(LOAD_GRAPH_NET);
     gtk_box_pack_start (GTK_BOX (net_graph_box),
@@ -445,142 +357,39 @@ create_sys_view (ProcData *procdata, GtkBuilder * builder)
                         TRUE,
                         0);
 
-    hbox = gtk_hbox_new(FALSE, 0);
-    spacer = gtk_label_new ("");
-    gtk_widget_set_size_request(GTK_WIDGET(spacer), 54, -1);
-    gtk_box_pack_start (GTK_BOX (hbox), spacer,
-                        FALSE, FALSE, 0);
-
-
-    gtk_box_pack_start (GTK_BOX (net_graph_box), hbox,
-                        FALSE, FALSE, 0);
-
-    net_legend_box = gtk_hbox_new(TRUE, 10);
-    gtk_box_pack_start (GTK_BOX (hbox), net_legend_box,
-                        TRUE, TRUE, 0);
-
-    table = gtk_table_new (2, 4, FALSE);
-    gtk_table_set_row_spacings (GTK_TABLE (table), 6);
-    gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-    gtk_box_pack_start (GTK_BOX (net_legend_box), table,
-                        TRUE, TRUE, 0);
-
-    label_text = g_strdup(_("Receiving"));
+    table = GTK_WIDGET (gtk_builder_get_object (builder, "net_table"));
 
     color_picker = gsm_color_button_new (
         &net_graph->colors.at(0), GSMCP_TYPE_NETWORK_IN);
     g_signal_connect (G_OBJECT (color_picker), "color_set",
                       G_CALLBACK (cb_net_in_color_changed), procdata);
-    title_text = g_strdup_printf(title_template, label_text);
+    title_text = g_strdup_printf(title_template, _("Receiving"));
     gsm_color_button_set_title(GSM_COLOR_BUTTON(color_picker), title_text);
     g_free(title_text);
-    gtk_table_attach (GTK_TABLE (table), color_picker, 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
-    label = gtk_label_new (label_text);
-    g_free(label_text);
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-
-    gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_in),
-                            1.0,
-                            0.5);
-/*
-  hbox = gtk_hbox_new (FALSE, 0);
-  g_signal_connect (G_OBJECT (hbox), "size_request",
-  G_CALLBACK(size_request), &net_size);
-  gtk_box_pack_start (GTK_BOX (hbox),
-  load_graph_get_labels(net_graph)->net_in,
-  TRUE,
-  TRUE,
-  0);
-*/
-    gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_in), 100, -1);
-    gtk_table_attach (GTK_TABLE (table), load_graph_get_labels(net_graph)->net_in, 2, 3, 0, 1,
-                      static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL), GTK_FILL, 0, 0);
-
-    label = gtk_label_new (_("Total Received"));
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
-
-    gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_in_total),
-                            1.0,
-                            0.5);
-    gtk_table_attach (GTK_TABLE (table),
-                      load_graph_get_labels(net_graph)->net_in_total,
-                      2,
-                      3,
-                      1,
-                      2,
-                      GTK_FILL,
-                      GTK_FILL,
-                      0,
-                      0);
-
-    spacer = gtk_label_new ("");
-    gtk_widget_set_size_request(GTK_WIDGET(spacer), 38, -1);
-    gtk_table_attach (GTK_TABLE (table), spacer, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-
-    table = gtk_table_new (2, 3, FALSE);
-    gtk_table_set_row_spacings (GTK_TABLE (table), 6);
-    gtk_table_set_col_spacings (GTK_TABLE (table), 6);
-    gtk_box_pack_start (GTK_BOX (net_legend_box), table,
-                        TRUE, TRUE, 0);
-
-    label_text = g_strdup(_("Sending"));
+    picker_alignment = GTK_WIDGET (gtk_builder_get_object (builder, "receiving_picker_alignment"));
+    gtk_container_add (GTK_CONTAINER (picker_alignment), color_picker);
+
+    //gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_in), 100, -1);
+    gtk_grid_attach (GTK_GRID (table), load_graph_get_labels(net_graph)->net_in, 2, 0, 1, 1);
+
+    gtk_grid_attach (GTK_GRID (table), load_graph_get_labels(net_graph)->net_in_total, 2, 1, 1, 1);
 
     color_picker = gsm_color_button_new (
         &net_graph->colors.at(1), GSMCP_TYPE_NETWORK_OUT);
     g_signal_connect (G_OBJECT (color_picker), "color_set",
                       G_CALLBACK (cb_net_out_color_changed), procdata);
-    title_text = g_strdup_printf(title_template, label_text);
+    title_text = g_strdup_printf(title_template, _("Sending"));
     gsm_color_button_set_title(GSM_COLOR_BUTTON(color_picker), title_text);
     g_free(title_text);
-    gtk_table_attach (GTK_TABLE (table), color_picker, 0, 1, 0, 2, GTK_SHRINK, GTK_SHRINK, 0, 0);
-
-    label = gtk_label_new (label_text);
-    g_free(label_text);
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
-
-    gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_out),
-                            1.0,
-                            0.5);
-/*
-  hbox = gtk_hbox_new (FALSE, 0);
-  g_signal_connect (G_OBJECT (load_graph_get_labels(net_graph)->net_out), "size_request",
-  G_CALLBACK(size_request), &net_size);
-
-  gtk_box_pack_start (GTK_BOX (hbox),
-  load_graph_get_labels(net_graph)->net_out,
-  TRUE,
-  TRUE,
-  0);
-*/
-    gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_out), 100, -1);
-    gtk_table_attach (GTK_TABLE (table), load_graph_get_labels(net_graph)->net_out, 2, 3, 0, 1,
-                      static_cast<GtkAttachOptions>(GTK_EXPAND | GTK_FILL), GTK_FILL, 0, 0);
-
-    label = gtk_label_new (_("Total Sent"));
-    gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-    gtk_table_attach (GTK_TABLE (table), label, 1, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
-
-    gtk_misc_set_alignment (GTK_MISC (load_graph_get_labels(net_graph)->net_out_total),
-                            1.0,
-                            0.5);
-    gtk_table_attach (GTK_TABLE (table),
-                      load_graph_get_labels(net_graph)->net_out_total,
-                      2,
-                      3,
-                      1,
-                      2,
-                      GTK_FILL,
-                      GTK_FILL,
-                      0,
-                      0);
-
-    spacer = gtk_label_new ("");
-    gtk_widget_set_size_request(GTK_WIDGET(spacer), 38, -1);
-    gtk_table_attach (GTK_TABLE (table), spacer, 3, 4, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+
+    picker_alignment = GTK_WIDGET (gtk_builder_get_object (builder, "sending_picker_alignment"));
+    gtk_container_add (GTK_CONTAINER (picker_alignment), color_picker);
+
+    //gtk_widget_set_size_request(GTK_WIDGET(load_graph_get_labels(net_graph)->net_out), 100, -1);
+    
+    gtk_grid_attach (GTK_GRID (table), load_graph_get_labels(net_graph)->net_out, 6, 0, 1, 1);
+
+    gtk_grid_attach (GTK_GRID (table),  load_graph_get_labels(net_graph)->net_out_total, 6, 1, 1, 1);
 
     procdata->net_graph = net_graph;
     g_free(title_template);
diff --git a/src/load-graph.cpp b/src/load-graph.cpp
index 6d5854c..849418c 100644
--- a/src/load-graph.cpp
+++ b/src/load-graph.cpp
@@ -702,7 +702,9 @@ LoadGraph::LoadGraph(guint type)
         case LOAD_GRAPH_MEM:
             n = 2;
             labels.memory = gtk_label_new(NULL);
+            gtk_misc_set_alignment (GTK_MISC (labels.memory), 0.0, 0.5);
             labels.swap = gtk_label_new(NULL);
+            gtk_misc_set_alignment (GTK_MISC (labels.swap), 0.0, 0.5);
             break;
 
         case LOAD_GRAPH_NET:
@@ -710,9 +712,17 @@ LoadGraph::LoadGraph(guint type)
             n = 2;
             net.max = 1;
             labels.net_in = gtk_label_new(NULL);
+            gtk_label_set_width_chars(GTK_LABEL(labels.net_in), 15);
+            gtk_misc_set_alignment (GTK_MISC (labels.net_in), 1.0, 0.5);
             labels.net_in_total = gtk_label_new(NULL);
+            gtk_misc_set_alignment (GTK_MISC (labels.net_in_total), 1.0, 0.5);
+            gtk_label_set_width_chars(GTK_LABEL(labels.net_in_total), 15);
             labels.net_out = gtk_label_new(NULL);
+            gtk_misc_set_alignment (GTK_MISC (labels.net_out), 1.0, 0.5);
+            gtk_label_set_width_chars(GTK_LABEL(labels.net_out), 15);
             labels.net_out_total = gtk_label_new(NULL);
+            gtk_misc_set_alignment (GTK_MISC (labels.net_out_total), 1.0, 0.5);
+            gtk_label_set_width_chars(GTK_LABEL(labels.net_out_total), 15);
             break;
     }
 



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