[latexila/gnome-3] GtkGrid migration (continued)



commit 4c03e0e9c650616aac043aee4c95aa9d2fe31f6c
Author: SÃbastien Wilmet <swilmet src gnome org>
Date:   Sun Oct 23 01:34:30 2011 +0200

    GtkGrid migration (continued)

 src/build_view.vala      |   22 +++++++++++++---------
 src/document_tab.vala    |   24 ++++++++++++++----------
 src/file_browser.vala    |    1 -
 src/project_dialogs.vala |   21 ++++++++++++---------
 src/search.vala          |   17 ++++++++++-------
 src/structure.vala       |    1 -
 src/tab_info_bar.vala    |   20 +++++++++++---------
 7 files changed, 60 insertions(+), 46 deletions(-)
---
diff --git a/src/build_view.vala b/src/build_view.vala
index 2eb7d47..17ff9e5 100644
--- a/src/build_view.vala
+++ b/src/build_view.vala
@@ -51,7 +51,7 @@ public struct BuildMsg
     public bool expand;
 }
 
-public class BuildView : HBox
+public class BuildView : Grid
 {
     private enum BuildInfo
     {
@@ -81,6 +81,7 @@ public class BuildView : HBox
     public BuildView (MainWindow main_window, Toolbar toolbar,
         ToggleAction view_bottom_panel)
     {
+        orientation = Orientation.HORIZONTAL;
         _main_window = main_window;
         _action_view_bottom_panel = view_bottom_panel;
 
@@ -163,6 +164,11 @@ public class BuildView : HBox
         // double-click
         _view.row_activated.connect ((path) => select_row (_filtered_model, path));
 
+        // with a scrollbar
+        Widget sw = Utils.add_scrollbar (_view);
+        sw.expand = true;
+        add (sw);
+
         // close button
         Button close_button = new Button ();
         close_button.relief = ReliefStyle.NONE;
@@ -175,14 +181,12 @@ public class BuildView : HBox
             _action_view_bottom_panel.active = false;
         });
 
-        // with a scrollbar
-        Widget sw = Utils.add_scrollbar (_view);
-        pack_start (sw);
-
-        VBox vbox = new VBox (false, 0);
-        vbox.pack_start (close_button, false, false);
-        vbox.pack_start (toolbar);
-        pack_start (vbox, false, false);
+        Grid grid = new Grid ();
+        grid.orientation = Orientation.VERTICAL;
+        grid.add (close_button);
+        toolbar.set_vexpand (true);
+        grid.add (toolbar);
+        add (grid);
     }
 
     private bool select_row (TreeModel model, TreePath path)
diff --git a/src/document_tab.vala b/src/document_tab.vala
index 7a64234..1adfe88 100644
--- a/src/document_tab.vala
+++ b/src/document_tab.vala
@@ -19,18 +19,18 @@
 
 using Gtk;
 
-public class DocumentTab : VBox
+public class DocumentTab : Grid
 {
     public DocumentView view { get; private set; }
     public Document document { get; private set; }
 
     private bool ask_if_externally_modified = false;
 
-    private HBox _label;
+    private Grid _label;
     private Label _label_text = new Label (null);
     private Label _label_mark = new Label (null);
 
-    public HBox label
+    public Grid label
     {
         get { return _label; }
     }
@@ -164,7 +164,8 @@ public class DocumentTab : VBox
         sw.show_all ();
 
         // pack at the end so we can display message above
-        pack_end (sw, true, true, 0);
+        sw.expand = true;
+        attach (sw, 0, 0, 1, 1);
 
         update_label_text ();
 
@@ -176,14 +177,17 @@ public class DocumentTab : VBox
         close_button.add (new Image.from_stock (Stock.CLOSE, IconSize.MENU));
         close_button.clicked.connect (() => this.close_document ());
 
-        _label = new HBox (false, 0);
-        _label.pack_start (_label_mark, false, false, 0);
-        _label.pack_start (_label_text, true, false, 0);
-        _label.pack_start (close_button, false, false, 0);
+        _label = new Grid ();
+        _label.set_hexpand (false);
+        _label.orientation = Orientation.HORIZONTAL;
+        _label.add (_label_mark);
+        _label_text.set_hexpand (true);
+        _label_text.set_halign (Align.CENTER);
+        _label.add (_label_text);
+        _label.add (close_button);
         update_label_tooltip ();
         _label.show_all ();
 
-
         /* auto save */
         GLib.Settings settings =
             new GLib.Settings ("org.gnome.latexila.preferences.editor");
@@ -205,7 +209,7 @@ public class DocumentTab : VBox
         MessageType msg_type)
     {
         TabInfoBar infobar = new TabInfoBar (primary_msg, secondary_msg, msg_type);
-        pack_start (infobar, false, false, 0);
+        attach_next_to (infobar, get_child_at (0, 0), PositionType.TOP, 1, 1);
         return infobar;
     }
 
diff --git a/src/file_browser.vala b/src/file_browser.vala
index 50791b5..a8f2602 100644
--- a/src/file_browser.vala
+++ b/src/file_browser.vala
@@ -52,7 +52,6 @@ public class FileBrowser : Grid
 
     public FileBrowser (MainWindow main_window)
     {
-//        GLib.Object (spacing: 3);
         row_spacing = 3;
         orientation = Orientation.VERTICAL;
         this.main_window = main_window;
diff --git a/src/project_dialogs.vala b/src/project_dialogs.vala
index b59885b..6254966 100644
--- a/src/project_dialogs.vala
+++ b/src/project_dialogs.vala
@@ -30,7 +30,7 @@ namespace ProjectDialogs
             null);
 
         /* create dialog widgets */
-        VBox content_area = dialog.get_content_area () as VBox;
+        Box content_area = dialog.get_content_area () as Box;
 
         // directory
         FileChooserButton directory_chooser = new FileChooserButton (_("Directory"),
@@ -119,13 +119,14 @@ namespace ProjectDialogs
             null);
 
         /* create dialog widgets */
-        VBox content_area = dialog.get_content_area () as VBox;
+        Box content_area = dialog.get_content_area () as Box;
 
         // directory
         string project_dir = project.directory.get_parse_name ();
         project_dir = Utils.replace_home_dir_with_tilde (project_dir) + "/";
         Label location = new Label (project_dir);
         location.set_line_wrap (true);
+        location.set_halign (Align.START);
 
         Widget component = Utils.get_dialog_component (_("Location of the project"),
             location);
@@ -181,7 +182,8 @@ namespace ProjectDialogs
             Stock.CLOSE, ResponseType.OK,
             null);
 
-        VBox content_area = (VBox) dialog.get_content_area ();
+        Box content_area = dialog.get_content_area () as Box;
+        content_area.set_size_request (400, 250);
 
         /* treeview */
         ListStore store = new ListStore (ProjectColumn.N_COLUMNS, typeof (string),
@@ -189,7 +191,6 @@ namespace ProjectDialogs
         update_model (store);
 
         TreeView treeview = new TreeView.with_model (store);
-        treeview.set_size_request (400, 150);
         treeview.rules_hint = true;
 
         // column directory
@@ -227,8 +228,10 @@ namespace ProjectDialogs
         content_area.pack_start (sw);
 
         /* buttons */
-        HBox hbox = new HBox (false, 5);
-        content_area.pack_start (hbox, false, false, 5);
+        Grid grid = new Grid ();
+        grid.orientation = Orientation.HORIZONTAL;
+        grid.set_column_spacing (5);
+        content_area.pack_start (grid, false, false, 5);
 
         Button edit_button = new Button.from_stock (Stock.PROPERTIES);
         Button delete_button = new Button.from_stock (Stock.DELETE);
@@ -237,9 +240,9 @@ namespace ProjectDialogs
         Image image = new Image.from_stock (Stock.CLEAR, IconSize.MENU);
         clear_all_button.set_image (image);
 
-        hbox.pack_start (edit_button);
-        hbox.pack_start (delete_button);
-        hbox.pack_start (clear_all_button);
+        grid.add (edit_button);
+        grid.add (delete_button);
+        grid.add (clear_all_button);
 
         content_area.show_all ();
 
diff --git a/src/search.vala b/src/search.vala
index 43046d1..2f9fb5f 100644
--- a/src/search.vala
+++ b/src/search.vala
@@ -19,28 +19,31 @@
 
 using Gtk;
 
-public class GotoLine : HBox
+public class GotoLine : Grid
 {
     private unowned MainWindow main_window;
     private Entry entry;
 
     public GotoLine (MainWindow main_window)
     {
+        orientation = Orientation.HORIZONTAL;
+        set_column_spacing (3);
         this.main_window = main_window;
-        spacing = 3;
 
         Button close_button = new Button ();
-        pack_start (close_button, false, false, 0);
+        add (close_button);
         close_button.set_relief (ReliefStyle.NONE);
         Image img = new Image.from_stock (Stock.CLOSE, IconSize.MENU);
         close_button.add (img);
         close_button.clicked.connect (() => hide ());
 
         Label label = new Label (_("Go to Line:"));
-        pack_start (label, false, false, 2);
+        label.margin_left = 2;
+        label.margin_right = 2;
+        add (label);
 
         entry = new Entry ();
-        pack_start (entry, false, false, 0);
+        add (entry);
         entry.set_icon_from_stock (EntryIconPosition.SECONDARY, Stock.JUMP_TO);
         entry.set_icon_activatable (EntryIconPosition.SECONDARY, true);
         entry.set_tooltip_text (_("Line you want to move the cursor to"));
@@ -102,7 +105,7 @@ public class SearchAndReplace : GLib.Object
     private Entry entry_replace;
     private Frame frame_replace;
 
-    private HBox hbox_replace;
+    private Box hbox_replace;
 
     private CheckMenuItem check_case_sensitive;
     private CheckMenuItem check_entire_word;
@@ -159,7 +162,7 @@ public class SearchAndReplace : GLib.Object
             Button button_replace_all =
                 (Button) builder.get_object ("button_replace_all");
 
-            hbox_replace = (HBox) builder.get_object ("hbox_replace");
+            hbox_replace = builder.get_object ("hbox_replace") as Box;
 
             Button button_previous = (Button) builder.get_object ("button_previous");
             Button button_next = (Button) builder.get_object ("button_next");
diff --git a/src/structure.vala b/src/structure.vala
index 760c232..7a38acc 100644
--- a/src/structure.vala
+++ b/src/structure.vala
@@ -89,7 +89,6 @@ public class Structure : Grid
 
     public Structure (MainWindow main_window, UIManager ui_manager)
     {
-//        GLib.Object (spacing: 3);
         orientation = Orientation.VERTICAL;
         row_spacing = 3;
         _main_window = main_window;
diff --git a/src/tab_info_bar.vala b/src/tab_info_bar.vala
index 38aef92..fd7deaa 100644
--- a/src/tab_info_bar.vala
+++ b/src/tab_info_bar.vala
@@ -23,7 +23,7 @@ public class TabInfoBar : InfoBar
 {
     public TabInfoBar (string primary_msg, string secondary_msg, MessageType msg_type)
     {
-        HBox content_area = (HBox) get_content_area ();
+        Box content_area = get_content_area () as Box;
 
         // icon
         string stock_id;
@@ -45,23 +45,25 @@ public class TabInfoBar : InfoBar
         }
 
         Image image = new Image.from_stock (stock_id, IconSize.DIALOG);
-        image.set_alignment ((float) 0.5, (float) 0.0);
+        image.set_valign (Align.START);
         content_area.pack_start (image, false, false, 0);
 
         // text
-        VBox vbox = new VBox (false, 10);
-        content_area.pack_start (vbox, true, true, 0);
+        Grid grid = new Grid ();
+        grid.orientation = Orientation.VERTICAL;
+        grid.set_row_spacing (10);
+        content_area.pack_start (grid);
 
         Label primary_label = new Label ("<b>" + primary_msg + "</b>");
-        vbox.pack_start (primary_label, false, false, 0);
-        primary_label.set_alignment ((float) 0.0, (float) 0.5);
+        grid.add (primary_label);
+        primary_label.set_halign (Align.START);
         primary_label.set_selectable (true);
         primary_label.set_line_wrap (true);
         primary_label.set_use_markup (true);
 
         Label secondary_label = new Label ("<small>" + secondary_msg + "</small>");
-        vbox.pack_start (secondary_label, false, false, 0);
-        secondary_label.set_alignment ((float) 0.0, (float) 0.5);
+        grid.add (secondary_label);
+        secondary_label.set_halign (Align.START);
         secondary_label.set_selectable (true);
         secondary_label.set_line_wrap (true);
         secondary_label.set_use_markup (true);
@@ -82,7 +84,7 @@ public class TabInfoBar : InfoBar
 
     public void add_stock_button_with_text (string text, string stock_id, int response_id)
     {
-        Button button = (Button) add_button (text, response_id);
+        Button button = add_button (text, response_id) as Button;
         Image image = new Image.from_stock (stock_id, IconSize.BUTTON);
         button.set_image (image);
     }



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