[Xfce4-commits] <design:master> Fix window resize, improve spacing.

Jannis Pohlmann noreply at xfce.org
Tue May 31 19:10:01 CEST 2011


Updating branch refs/heads/master
         to 973fd78b80998d19b29bec942bce982ffecad788 (commit)
       from df3ed4bf8401d91388cae90f3ce3ea6394a1044e (commit)

commit 973fd78b80998d19b29bec942bce982ffecad788
Author: Jannis Pohlmann <jannis at xfce.org>
Date:   Tue May 31 19:07:57 2011 +0200

    Fix window resize, improve spacing.

 .../merge-with-xfrun/demo-code/mockup.vala         |   73 ++++++++++++-------
 1 files changed, 46 insertions(+), 27 deletions(-)

diff --git a/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala b/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala
index 4d4bed2..817435f 100644
--- a/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala
+++ b/xfce4-appfinder/merge-with-xfrun/demo-code/mockup.vala
@@ -118,7 +118,8 @@ public class DetailsView : Paned {
 
 
 
-public class AppfinderView : Table {
+public class AppfinderView : HBox {
+  private Table table { get; set; }
   private Image image { get; set; }
   private Entry entry { get; set; }
   private DetailsView details_view { get; set; }
@@ -127,19 +128,25 @@ public class AppfinderView : Table {
 
   public AppfinderView () {
     set_homogeneous (false);
-    set_col_spacings (12);
-    set_row_spacings (6);
+
+    var image_box = new VBox (false, 0);
+    pack_start (image_box, false, false, 0);
 
     image = new Image.from_icon_name ("claws-mail", IconSize.DIALOG);
-    attach (image, 0, 1, 0, 1, AttachOptions.SHRINK, AttachOptions.SHRINK, 0, 0);
+    image_box.pack_start (image, false, false, 0);
+
+    table = new Table (3, 2, false);
+    table.set_col_spacings (12);
+    table.set_row_spacings (3);
+    add (table);
 
     entry = new Entry ();
     entry.set_icon_from_stock (EntryIconPosition.PRIMARY, Stock.FIND);
     entry.set_icon_from_stock (EntryIconPosition.SECONDARY, Stock.GO_DOWN);
-    attach (entry, 1, 2, 0, 1,
-            AttachOptions.FILL | AttachOptions.EXPAND,
-            AttachOptions.SHRINK,
-            0, 0);
+    table.attach (entry, 1, 2, 0, 1,
+                  AttachOptions.FILL | AttachOptions.EXPAND,
+                  AttachOptions.SHRINK,
+                  0, 0);
 
     entry.icon_press.connect ((icon_pos, event) => {
       if (icon_pos == EntryIconPosition.SECONDARY) {
@@ -149,15 +156,37 @@ public class AppfinderView : Table {
 
     details_view = new DetailsView ();
     details_view.set_no_show_all (true);
-    attach (details_view, 1, 2, 1, 2,
-            AttachOptions.FILL | AttachOptions.EXPAND,
-            AttachOptions.FILL | AttachOptions.EXPAND,
-            0, 0);
+    table.attach (details_view, 1, 2, 1, 2,
+                  AttachOptions.FILL | AttachOptions.EXPAND,
+                  AttachOptions.FILL | AttachOptions.EXPAND,
+                  0, 0);
+
+    var buttons = new HButtonBox ();
+    buttons.set_spacing (6);
+    buttons.set_layout (ButtonBoxStyle.END);
+    table.attach (buttons, 1, 2, 2, 3,
+                  AttachOptions.FILL | AttachOptions.EXPAND,
+                  AttachOptions.SHRINK,
+                  0, 0);
+
+    var cancel = new Button.from_stock (Stock.CANCEL);
+    buttons.pack_start (cancel, false, true, 0);
+
+    cancel.clicked.connect (Gtk.main_quit);
+
+    var launch = new Button.with_mnemonic ("_Launch");
+    launch.set_image (new Image.from_stock (Stock.EXECUTE, IconSize.BUTTON));
+    buttons.pack_start (launch, false, true, 0);
+
+    cancel.clicked.connect (Gtk.main_quit);
 
     notify["expanded"].connect (() => {
       details_view.set_visible (expanded);
+      table.set_row_spacings (expanded ? 6 : 3);
       entry.set_icon_from_stock (EntryIconPosition.SECONDARY,
                                  expanded ? Stock.GO_UP : Stock.GO_DOWN);
+      table.check_resize ();
+      check_resize ();
     });
   }
 
@@ -184,21 +213,11 @@ int main (string[] args) {
   var view = new AppfinderView ();
   vbox.add (view);
 
-  var buttons = new HButtonBox ();
-  buttons.set_spacing (6);
-  buttons.set_layout (ButtonBoxStyle.END);
-  vbox.pack_start (buttons, false, true, 0);
-
-  var cancel = new Button.from_stock (Stock.CANCEL);
-  buttons.pack_start (cancel, false, true, 0);
-
-  cancel.clicked.connect (Gtk.main_quit);
-
-  var launch = new Button.with_mnemonic ("_Launch");
-  launch.set_image (new Image.from_stock (Stock.EXECUTE, IconSize.BUTTON));
-  buttons.pack_start (launch, false, true, 0);
-
-  cancel.clicked.connect (Gtk.main_quit);
+  view.notify["expanded"].connect (() => {
+    int width, height;
+    window.get_size (out width, out height);
+    window.resize (width, 1);
+  });
 
   window.show_all ();
 



More information about the Xfce4-commits mailing list