[latexila/gnome-3] GtkGrid migration (continued)
- From: SÃbastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [latexila/gnome-3] GtkGrid migration (continued)
- Date: Mon, 24 Oct 2011 00:19:36 +0000 (UTC)
commit 3c9f7567cefeea1db5e8609d678b2884d07f786d
Author: SÃbastien Wilmet <swilmet src gnome org>
Date: Sun Oct 23 23:27:30 2011 +0200
GtkGrid migration (continued)
src/build_tool_dialog.vala | 8 ++++----
src/main_window.vala | 34 +++++++++++++++++++---------------
src/utils.vala | 20 ++++++++++----------
3 files changed, 33 insertions(+), 29 deletions(-)
---
diff --git a/src/build_tool_dialog.vala b/src/build_tool_dialog.vala
index b63623e..9f5494a 100644
--- a/src/build_tool_dialog.vala
+++ b/src/build_tool_dialog.vala
@@ -79,7 +79,7 @@ private class BuildToolDialog : Dialog
builder.add_from_file (path);
// get objects
- VBox main_vbox = (VBox) builder.get_object ("main_vbox");
+ Box main_vbox = builder.get_object ("main_vbox") as Box;
main_vbox.unparent ();
entry_label = (Entry) builder.get_object ("entry_label");
@@ -94,8 +94,8 @@ private class BuildToolDialog : Dialog
button_down = (Button) builder.get_object ("button_down");
// packing widget
- Box content_area = (Box) get_content_area ();
- content_area.pack_start (main_vbox, true, true, 0);
+ Box content_area = get_content_area () as Box;
+ content_area.pack_start (main_vbox);
content_area.show_all ();
init_icon_treeview ();
@@ -109,7 +109,7 @@ private class BuildToolDialog : Dialog
Label label_error = new Label (message);
label_error.set_line_wrap (true);
- Box content_area = (Box) get_content_area ();
+ Box content_area = get_content_area () as Box;
content_area.pack_start (label_error, true, true, 0);
content_area.show_all ();
}
diff --git a/src/main_window.vala b/src/main_window.vala
index bead3b7..340a8cc 100644
--- a/src/main_window.vala
+++ b/src/main_window.vala
@@ -438,12 +438,14 @@ public class MainWindow : Window
SettingsBindFlags.DEFAULT);
/* packing widgets */
- VBox main_vbox = new VBox (false, 0);
- main_vbox.pack_start (menu, false, false, 0);
- main_vbox.pack_start (main_toolbar, false, false, 0);
- main_vbox.pack_start (edit_toolbar, false, false, 0);
+ Grid main_vgrid = new Grid ();
+ main_vgrid.orientation = Orientation.VERTICAL;
- main_vbox.show ();
+ main_vgrid.add (menu);
+ main_vgrid.add (main_toolbar);
+ main_vgrid.add (edit_toolbar);
+
+ main_vgrid.show ();
menu.show_all ();
main_toolbar.show_all ();
@@ -452,16 +454,18 @@ public class MainWindow : Window
// right: documents panel, search and replace, log zone, ...
main_hpaned = new HPaned ();
main_hpaned.set_position (settings.get_int ("side-panel-size"));
- main_vbox.pack_start (main_hpaned);
+ main_vgrid.add (main_hpaned);
main_hpaned.show ();
- // vbox source view: documents panel, goto line, search and replace
- VBox vbox_source_view = new VBox (false, 2);
- vbox_source_view.pack_start (documents_panel);
- vbox_source_view.pack_start (goto_line, false, false, 0);
- vbox_source_view.pack_start (search_and_replace.get_widget (), false, false);
+ // vgrid source view: documents panel, goto line, search and replace
+ Grid vgrid_source_view = new Grid ();
+ vgrid_source_view.orientation = Orientation.VERTICAL;
+ vgrid_source_view.set_row_spacing (2);
+ vgrid_source_view.add (documents_panel);
+ vgrid_source_view.add (goto_line);
+ vgrid_source_view.add (search_and_replace.get_widget ());
- vbox_source_view.show ();
+ vgrid_source_view.show ();
documents_panel.show_all ();
// vertical pane
@@ -471,7 +475,7 @@ public class MainWindow : Window
vpaned.set_position (settings.get_int ("vertical-paned-position"));
// when we resize the window, the bottom panel keeps the same height
- vpaned.pack1 (vbox_source_view, true, true);
+ vpaned.pack1 (vgrid_source_view, true, true);
vpaned.pack2 (build_view, false, true);
main_hpaned.add1 (side_panel);
@@ -480,10 +484,10 @@ public class MainWindow : Window
side_panel.show ();
vpaned.show ();
- main_vbox.pack_end (statusbar, false, false, 0);
+ main_vgrid.add (statusbar);
statusbar.show_all ();
- add (main_vbox);
+ add (main_vgrid);
show ();
show_or_hide_widgets ();
show_or_hide_build_messages ();
diff --git a/src/utils.vala b/src/utils.vala
index f451deb..462bf32 100644
--- a/src/utils.vala
+++ b/src/utils.vala
@@ -319,23 +319,23 @@ namespace Utils
public Widget get_dialog_component (string title, Widget widget)
{
- VBox vbox = new VBox (false, 6);
- vbox.border_width = 6;
+ Grid grid = new Grid ();
+ grid.orientation = Orientation.VERTICAL;
+ grid.set_row_spacing (6);
+ grid.border_width = 6;
// title in bold, left aligned
Label label = new Label (null);
label.set_markup ("<b>" + title + "</b>");
- label.xalign = (float) 0.0;
- vbox.pack_start (label, false, false);
+ label.set_halign (Align.START);
+ grid.add (label);
// left margin for the widget
- Alignment alignment = new Alignment ((float) 0.5, (float) 0.5, (float) 1.0,
- (float) 1.0);
- alignment.left_padding = 12;
- alignment.add (widget);
- vbox.pack_start (alignment);
+ widget.set_margin_left (12);
+ widget.set_hexpand (true);
+ grid.add (widget);
- return vbox;
+ return grid;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]