[gnumeric] More GtkGrid and layout fixed.



commit 3794559a3b736e58edab6074390515364ee8ba20
Author: Jean Brefort <jean brefort normalesup org>
Date:   Fri Mar 1 19:44:27 2013 +0100

    More GtkGrid and layout fixed.

 ChangeLog                   |    6 +++
 src/dialogs/ChangeLog       |    4 ++
 src/dialogs/kaplan-meier.ui |   20 +++++-----
 src/gui-file.c              |   32 +++++++++--------
 src/print.c                 |   80 ++++++++++++++++++++++++-------------------
 src/sheet-object-graph.c    |   16 +++++---
 6 files changed, 92 insertions(+), 66 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index fd9f3ae..b020f8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2013-03-01  Jean Brefort  <jean brefort normalesup org>
+
+       * src/gui-file.c (gui_file_open): GtkTable to GtkGrid.
+       * src/print.c (gnm_create_widget_cb): ditto.
+       * src/sheet-object-graph.c (sheet_object_graph_guru): ditto.
+
 2013-03-01  Morten Welinder  <terra gnome org>
 
        * src/mathfunc.h: Make sure the "q" functions take "p" as their
diff --git a/src/dialogs/ChangeLog b/src/dialogs/ChangeLog
index 0250145..575d6d1 100644
--- a/src/dialogs/ChangeLog
+++ b/src/dialogs/ChangeLog
@@ -1,5 +1,9 @@
 2013-03-01  Jean Brefort  <jean brefort normalesup org>
 
+       * kaplan-meier.ui: fixed layout.
+
+2013-03-01  Jean Brefort  <jean brefort normalesup org>
+
        * chi-squared.ui: fixed layout.
        * dialog-preferences.c (pref_create_label),
        (bool_pref_create_widget), (enum_pref_create_widget),
diff --git a/src/dialogs/kaplan-meier.ui b/src/dialogs/kaplan-meier.ui
index bcbb351..f689bb7 100644
--- a/src/dialogs/kaplan-meier.ui
+++ b/src/dialogs/kaplan-meier.ui
@@ -110,7 +110,6 @@
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
                         <property name="xalign">0</property>
-                        <property name="xpad">5</property>
                         <property name="label" translatable="yes">_Time column:</property>
                         <property name="use_underline">True</property>
                         <property name="justify">right</property>
@@ -145,6 +144,7 @@
                       <object class="GtkLabel" id="var2-label">
                         <property name="visible">True</property>
                         <property name="can_focus">False</property>
+                        <property name="margin_left">24</property>
                         <property name="xalign">0</property>
                         <property name="label" translatable="yes">Censor co_lumn:</property>
                         <property name="use_underline">True</property>
@@ -344,15 +344,6 @@
                   </packing>
                 </child>
                 <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
-                  <placeholder/>
-                </child>
-                <child>
                   <object class="GtkLabel" id="label7">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
@@ -365,6 +356,15 @@
                     <property name="height">1</property>
                   </packing>
                 </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
+                <child>
+                  <placeholder/>
+                </child>
               </object>
               <packing>
                 <property name="position">1</property>
diff --git a/src/gui-file.c b/src/gui-file.c
index f43a9fd..dd7911a 100644
--- a/src/gui-file.c
+++ b/src/gui-file.c
@@ -384,28 +384,30 @@ gui_file_open (WBCGtk *wbcg, file_open_t type, char const *default_format)
 
        {
                GtkWidget *label;
-               GtkWidget *box = gtk_table_new (2, 2, FALSE);
-
-               gtk_table_attach (GTK_TABLE (box),
-                                 GTK_WIDGET (format_combo),
-                                 1, 2, 0, 1, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 5, 2);
+               GtkWidget *grid = gtk_grid_new ();
+
+               g_object_set (grid,
+                             "column-spacing", 12,
+                             "row-spacing", 6,
+                             NULL);
+               gtk_widget_set_hexpand (GTK_WIDGET (format_combo), TRUE);
+               gtk_grid_attach (GTK_GRID (grid),
+                                GTK_WIDGET (format_combo),
+                                1, 0, 1, 1);
                label = gtk_label_new_with_mnemonic (_("File _type:"));
-               gtk_table_attach (GTK_TABLE (box), label,
-                                 0, 1, 0, 1, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2);
+               gtk_grid_attach (GTK_GRID (grid), label, 0, 0, 1, 1);
                gtk_label_set_mnemonic_widget (GTK_LABEL (label), GTK_WIDGET (format_combo));
 
-               gtk_table_attach (GTK_TABLE (box),
-                                 go_charmap_sel,
-                                 1, 2, 1, 2, GTK_EXPAND | GTK_FILL, GTK_SHRINK, 5, 2);
-               gtk_table_attach (GTK_TABLE (box), data.charmap_label,
-                                 0, 1, 1, 2, GTK_SHRINK | GTK_FILL, GTK_SHRINK, 5, 2);
+               gtk_widget_set_hexpand (go_charmap_sel, TRUE);
+               gtk_grid_attach (GTK_GRID (grid), go_charmap_sel, 1, 1, 1, 1);
+               gtk_grid_attach (GTK_GRID (grid), data.charmap_label, 0, 1, 1, 1);
                gtk_label_set_mnemonic_widget (GTK_LABEL (data.charmap_label),
                                               go_charmap_sel);
 
-               g_object_ref_sink (box);
+               g_object_ref_sink (grid);
                g_object_set_data_full (G_OBJECT (advanced_button), "extra",
-                                       box, g_object_unref);
-               gtk_widget_show_all (box);
+                                       grid, g_object_unref);
+               gtk_widget_show_all (grid);
                g_signal_connect (G_OBJECT (advanced_button),
                                  "clicked",
                                  G_CALLBACK (cb_advanced_clicked),
diff --git a/src/print.c b/src/print.c
index 1940f42..dd326f1 100644
--- a/src/print.c
+++ b/src/print.c
@@ -1458,7 +1458,7 @@ static GObject*
 gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
 {
        PrintingInstance * pi = (PrintingInstance *) user_data;
-       GtkWidget *frame, *table;
+       GtkWidget *grid;
        GtkWidget *button_all_sheets, *button_selected_sheet, *button_spec_sheets;
        GtkWidget *button_selection, *button_ignore_printarea;
        GtkWidget *button_print_hidden_sheets;
@@ -1468,69 +1468,79 @@ gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
        GtkPrintSettings * settings;
        guint n_sheets = workbook_visible_sheet_count (pi->wb);
 
-       frame = gtk_frame_new (NULL);
-       gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE);
-       gtk_container_set_border_width (GTK_CONTAINER (frame), 5);
-
-       table = gtk_table_new (9, 7, FALSE);
-       gtk_table_set_col_spacing (GTK_TABLE (table), 1,20);
-       gtk_container_add (GTK_CONTAINER (frame), table);
-
+       grid = gtk_grid_new ();
+       g_object_set (grid,
+                     "column-spacing", 12,
+                     "row-spacing", 6,
+                     "border-width", 6,
+                     NULL);
 
        button_all_sheets = gtk_radio_button_new_with_mnemonic (NULL,
                                                                _("_All workbook sheets"));
-       gtk_table_attach (GTK_TABLE (table), button_all_sheets, 1, 3, 1, 2,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       gtk_widget_set_hexpand (button_all_sheets, TRUE);
+       gtk_grid_attach (GTK_GRID (grid), button_all_sheets, 0, 0, 5, 1);
 
        button_print_hidden_sheets  = gtk_check_button_new_with_mnemonic
                (_("Also print _hidden sheets"));
-       gtk_table_attach (GTK_TABLE (table), button_print_hidden_sheets, 2, 7, 2, 3,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       g_object_set (button_print_hidden_sheets,
+                    "hexpand", TRUE,
+                    "margin-left", 24,
+                    NULL);
+       gtk_grid_attach (GTK_GRID (grid), button_print_hidden_sheets, 0, 1, 5, 1);
 
        button_selected_sheet = gtk_radio_button_new_with_mnemonic_from_widget
                (GTK_RADIO_BUTTON (button_all_sheets), _("A_ctive workbook sheet"));
-       gtk_table_attach (GTK_TABLE (table), button_selected_sheet, 1, 3, 3, 4,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       gtk_widget_set_hexpand (button_selected_sheet, TRUE);
+       gtk_grid_attach (GTK_GRID (grid), button_selected_sheet, 0, 2, 5, 1);
 
        button_spec_sheets = gtk_radio_button_new_with_mnemonic_from_widget
                (GTK_RADIO_BUTTON (button_all_sheets), _("_Workbook sheets:"));
-       gtk_table_attach (GTK_TABLE (table), button_spec_sheets, 1, 3, 6, 7,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       gtk_widget_set_hexpand (button_spec_sheets, TRUE);
+       gtk_grid_attach (GTK_GRID (grid), button_spec_sheets, 0, 5, 1, 1);
 
        button_selection = gtk_check_button_new_with_mnemonic
                (_("Current _selection only"));
-       gtk_table_attach (GTK_TABLE (table), button_selection, 2, 7, 4, 5,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       g_object_set (button_selection,
+                    "hexpand", TRUE,
+                    "margin-left", 24,
+                    NULL);
+       gtk_grid_attach (GTK_GRID (grid), button_selection, 0, 3, 5, 1);
 
        button_ignore_printarea  = gtk_check_button_new_with_mnemonic
                (_("_Ignore defined print area"));
-       gtk_table_attach (GTK_TABLE (table), button_ignore_printarea, 2, 7, 5, 6,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       g_object_set (button_ignore_printarea,
+                    "hexpand", TRUE,
+                    "margin-left", 24,
+                    NULL);
+       gtk_grid_attach (GTK_GRID (grid), button_ignore_printarea, 0, 4, 5, 1);
 
        label_from = gtk_label_new (_("from:"));
-       gtk_table_attach (GTK_TABLE (table), label_from, 3, 4, 6, 7,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       g_object_set (label_from,
+                    "hexpand", TRUE,
+                    "margin-left", 24,
+                    NULL);
+       gtk_grid_attach (GTK_GRID (grid), label_from, 1, 5, 1, 1);
 
        spin_from = gtk_spin_button_new_with_range (1, n_sheets, 1);
-       gtk_table_attach (GTK_TABLE (table), spin_from, 4, 5, 6, 7,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       gtk_widget_set_hexpand (spin_from, TRUE);
+       gtk_grid_attach (GTK_GRID (grid), spin_from, 2, 5, 1, 1);
 
        label_to = gtk_label_new (_("to:"));
-       gtk_table_attach (GTK_TABLE (table), label_to, 5, 6, 6, 7,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       gtk_widget_set_hexpand (label_to, TRUE);
+       gtk_grid_attach (GTK_GRID (grid), label_to, 3, 5, 1, 1);
 
        spin_to = gtk_spin_button_new_with_range (1, n_sheets, 1);
-       gtk_table_attach (GTK_TABLE (table), spin_to, 6, 7, 6, 7,
-                         GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       gtk_widget_set_hexpand (spin_to, TRUE);
+       gtk_grid_attach (GTK_GRID (grid), spin_to, 4, 5, 1, 1);
        gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin_to), n_sheets);
 
        button_ignore_page_breaks = gtk_separator_new (GTK_ORIENTATION_HORIZONTAL);
-       gtk_table_attach (GTK_TABLE (table), button_ignore_page_breaks, 1, 7, 7, 8,
-                 GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,5,5);
+       gtk_widget_set_hexpand (button_ignore_page_breaks, TRUE);
+       gtk_grid_attach (GTK_GRID (grid), button_ignore_page_breaks, 0, 6, 5, 1);
 
        button_ignore_page_breaks = gtk_check_button_new_with_mnemonic (_("Ignore all _manual page breaks"));
-       gtk_table_attach (GTK_TABLE (table), button_ignore_page_breaks, 1, 7, 8, 9,
-                 GTK_EXPAND | GTK_FILL,GTK_SHRINK | GTK_FILL,0,0);
+       gtk_widget_set_hexpand (button_ignore_page_breaks, TRUE);
+       gtk_grid_attach (GTK_GRID (grid), button_ignore_page_breaks, 0, 7, 5, 1);
        gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (button_ignore_page_breaks), TRUE);
 
        g_signal_connect_after (G_OBJECT (button_selected_sheet), "toggled",
@@ -1601,7 +1611,7 @@ gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
        gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (button_selected_sheet));
        gtk_toggle_button_toggled (GTK_TOGGLE_BUTTON (button_spec_sheets));
 
-       gtk_widget_show_all (frame);
+       gtk_widget_show_all (grid);
 
        /* Let's save the widgets */
        pi->button_all_sheets = button_all_sheets;
@@ -1614,7 +1624,7 @@ gnm_create_widget_cb (GtkPrintOperation *operation, gpointer user_data)
        pi->spin_to = spin_to;
        pi->button_ignore_page_breaks = button_ignore_page_breaks;
 
-       return G_OBJECT (frame);
+       return G_OBJECT (grid);
 }
 
 static void
diff --git a/src/sheet-object-graph.c b/src/sheet-object-graph.c
index 234903d..28da73c 100644
--- a/src/sheet-object-graph.c
+++ b/src/sheet-object-graph.c
@@ -744,14 +744,18 @@ sheet_object_graph_guru (WBCGtk *wbcg, GogGraph *graph,
                GO_CMD_CONTEXT (wbcg), closure);
        if (!graph) {
                GnmGraphDataClosure *data = (GnmGraphDataClosure *) g_new0 (GnmGraphDataClosure, 1);
-               GtkWidget *custom = gtk_table_new (2, 3, FALSE), *w;
+               GtkWidget *custom = gtk_grid_new (), *w;
                GObject *object;
 
                data->dalloc = GOG_DATA_ALLOCATOR (wbcg);
-               g_object_set (custom, "row-spacing", 6, "column-spacing", 12, NULL);
+               g_object_set (custom,
+                             "row-spacing", 6,
+                             "column-spacing", 12,
+                             "margin-top", 6,
+                             NULL);
                w = gtk_label_new (_("Series as:"));
                g_object_set (w, "xalign", 0., NULL);
-               gtk_table_attach (GTK_TABLE (custom), w, 0, 1, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+               gtk_grid_attach (GTK_GRID (custom), w, 0, 0, 1, 1);
                w = gtk_combo_box_text_new ();
                gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), _("Auto"));
                /*Translators: Series as "Columns"*/
@@ -760,13 +764,13 @@ sheet_object_graph_guru (WBCGtk *wbcg, GogGraph *graph,
                gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (w), C_("graph", "Rows"));
                gtk_combo_box_set_active (GTK_COMBO_BOX (w), 0);
                g_signal_connect (G_OBJECT (w), "changed", G_CALLBACK (cb_selection_mode_changed), data);
-               gtk_table_attach (GTK_TABLE (custom), w, 1, 2, 0, 1, GTK_FILL, GTK_FILL, 0, 0);
+               gtk_grid_attach (GTK_GRID (custom), w, 1, 0, 1, 1);
                w = gtk_check_button_new_with_label (_("Use first series as shared abscissa"));
                g_signal_connect (G_OBJECT (w), "toggled", G_CALLBACK (cb_shared_mode_changed), data);
-               gtk_table_attach (GTK_TABLE (custom), w, 0, 2, 1, 2, GTK_FILL, GTK_FILL, 0, 0);
+               gtk_grid_attach (GTK_GRID (custom), w, 0, 1, 2, 1);
                w = gtk_check_button_new_with_label (_("New graph sheet"));
                g_signal_connect (G_OBJECT (w), "toggled", G_CALLBACK (cb_sheet_target_changed), data);
-               gtk_table_attach (GTK_TABLE (custom), w, 0, 2, 2, 3, GTK_FILL, GTK_FILL, 0, 0);
+               gtk_grid_attach (GTK_GRID (custom), w, 0, 2, 2, 1);
                data->obj = G_OBJECT (custom);
                gog_guru_add_custom_widget (dialog, custom);
                object = (GObject*) g_object_get_data (data->obj, "graph");


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