[latexila/gnome-3] GtkGrid migration: close unsaved documents dialog



commit 8115b4b5ad5013e3deba1bdf9fd0e1497930eb7a
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Sat Oct 22 01:47:34 2011 +0200

    GtkGrid migration: close unsaved documents dialog

 src/clean_build_files.vala |    7 +++----
 src/dialogs.vala           |   39 +++++++++++++++++++--------------------
 2 files changed, 22 insertions(+), 24 deletions(-)
---
diff --git a/src/clean_build_files.vala b/src/clean_build_files.vala
index fa8c9e9..270fc16 100644
--- a/src/clean_build_files.vala
+++ b/src/clean_build_files.vala
@@ -238,7 +238,6 @@ public class CleanBuildFiles : GLib.Object
             null);
 
         Grid grid = new Grid ();
-        grid.set_orientation (Orientation.HORIZONTAL);
         grid.set_column_spacing (12);
         grid.set_row_spacing (8);
         grid.border_width = 5;
@@ -248,14 +247,14 @@ public class CleanBuildFiles : GLib.Object
 
         /* image */
         Image image = new Image.from_stock (Stock.DIALOG_WARNING, IconSize.DIALOG);
-        image.set_alignment ((float) 0.5, (float) 0.0);
+        image.set_valign (Align.START);
         grid.attach (image, 0, 0, 1, 3);
 
         /* primary label */
         Label primary_label = new Label (null);
         primary_label.set_line_wrap (true);
         primary_label.set_use_markup (true);
-        primary_label.set_alignment ((float) 0.0, (float) 0.5);
+        primary_label.set_halign (Align.START);
         primary_label.set_selectable (true);
         primary_label.margin_bottom = 4;
         primary_label.set_markup ("<span weight=\"bold\" size=\"larger\">"
@@ -266,7 +265,7 @@ public class CleanBuildFiles : GLib.Object
         /* secondary label */
         Label select_label = new Label (_("Select the files you want to delete:"));
         select_label.set_line_wrap (true);
-        select_label.set_alignment ((float) 0.0, (float) 0.5);
+        select_label.set_halign (Align.START);
         grid.attach (select_label, 1, 1, 1, 1);
 
         /* list of files with a scrollbar */
diff --git a/src/dialogs.vala b/src/dialogs.vala
index 24ecb29..0566428 100644
--- a/src/dialogs.vala
+++ b/src/dialogs.vala
@@ -42,39 +42,37 @@ namespace Dialogs
             Stock.SAVE, ResponseType.ACCEPT,
             null);
 
-        HBox hbox = new HBox (false, 12);
-        hbox.border_width = 5;
-        VBox content_area = (VBox) dialog.get_content_area ();
-        content_area.pack_start (hbox, true, true, 0);
+        Grid grid = new Grid ();
+        grid.set_column_spacing (12);
+        grid.set_row_spacing (8);
+        grid.border_width = 5;
+
+        Box content_area = dialog.get_content_area () as Box;
+        content_area.pack_start (grid);
 
         /* image */
         Image image = new Image.from_stock (Stock.DIALOG_WARNING, IconSize.DIALOG);
-        image.set_alignment ((float) 0.5, (float) 0.0);
-        hbox.pack_start (image, false, false, 0);
-
-        VBox vbox = new VBox (false, 12);
-        hbox.pack_start (vbox, true, true, 0);
+        image.set_valign (Align.START);
+        grid.attach (image, 0, 0, 1, 4);
 
         /* primary label */
         Label primary_label = new Label (null);
         primary_label.set_line_wrap (true);
         primary_label.set_use_markup (true);
-        primary_label.set_alignment ((float) 0.0, (float) 0.5);
+        primary_label.set_halign (Align.START);
         primary_label.set_selectable (true);
+        primary_label.margin_bottom = 4;
         primary_label.set_markup ("<span weight=\"bold\" size=\"larger\">"
             + _("There are %d documents with unsaved changes. Save changes before closing?")
             .printf (unsaved_docs.length ())
             + "</span>");
 
-        vbox.pack_start (primary_label, false, false, 0);
-
-        VBox vbox2 = new VBox (false, 8);
-        vbox.pack_start (vbox2, false, false, 0);
+        grid.attach (primary_label, 1, 0, 1, 1);
 
         Label select_label = new Label (_("Select the documents you want to save:"));
         select_label.set_line_wrap (true);
-        select_label.set_alignment ((float) 0.0, (float) 0.5);
-        vbox2.pack_start (select_label, false, false, 0);
+        select_label.set_halign (Align.START);
+        grid.attach (select_label, 1, 1, 1, 1);
 
         /* unsaved documents list with checkboxes */
         TreeView treeview = new TreeView ();
@@ -123,17 +121,18 @@ namespace Dialogs
         // with a scrollbar
         ScrolledWindow sw = (ScrolledWindow) Utils.add_scrollbar (treeview);
         sw.set_shadow_type (ShadowType.IN);
-        vbox2.pack_start (sw, true, true, 0);
+        sw.expand = true;
+        grid.attach (sw, 1, 2, 1, 1);
 
         /* secondary label */
         Label secondary_label = new Label (
             _("If you don't save, all your changes will be permanently lost."));
         secondary_label.set_line_wrap (true);
-        secondary_label.set_alignment ((float) 0.0, (float) 0.5);
+        secondary_label.set_halign (Align.START);
         secondary_label.set_selectable (true);
-        vbox2.pack_start (secondary_label, false, false, 0);
+        grid.attach (secondary_label, 1, 3, 1, 1);
 
-        hbox.show_all ();
+        grid.show_all ();
 
         int resp = dialog.run ();
 



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