[Xfce4-commits] <postler:master> Handle resizing of the expander in account dialogue

Christian Dywan noreply at xfce.org
Wed Mar 30 23:14:01 CEST 2011


Updating branch refs/heads/master
         to 3a68366395b519d833834a07e501fc34256a0ff1 (commit)
       from d9087f4cdd2eba03eceac87db430ebd94955cfec (commit)

commit 3a68366395b519d833834a07e501fc34256a0ff1
Author: Sergio Spinatelli <spinatelli.sergio at gmail.com>
Date:   Sat Mar 26 14:12:20 2011 +0100

    Handle resizing of the expander in account dialogue
    
    Fixes: https://bugs.launchpad.net/postler/+bug/722273

 postler/postler-accountsetup.vala |   26 ++++++++++++++++++++++++--
 1 files changed, 24 insertions(+), 2 deletions(-)

diff --git a/postler/postler-accountsetup.vala b/postler/postler-accountsetup.vala
index 4ec362e..1b4bde7 100644
--- a/postler/postler-accountsetup.vala
+++ b/postler/postler-accountsetup.vala
@@ -23,6 +23,7 @@ public class Postler.AccountWidget : Gtk.VBox {
     Elementary.Entry organization;
     Gtk.TextView signature;
 
+    public Gtk.Expander expander;
     Elementary.Entry receiver;
     Elementary.Entry username;
     Elementary.Entry prefix;
@@ -100,7 +101,7 @@ public class Postler.AccountWidget : Gtk.VBox {
             _("Insert -- to render part of the signature gray.")), false, false, 4);
         (signature.parent as Gtk.ScrolledWindow).shadow_type = Gtk.ShadowType.ETCHED_OUT;
 
-        var expander = new Gtk.Expander.with_mnemonic (_("_Advanced"));
+        expander = new Gtk.Expander.with_mnemonic (_("_Advanced"));
         content_area.pack_start (expander, false, false, 4);
         advanced_area = new Gtk.VBox (false, 4);
         expander.add (advanced_area);
@@ -251,11 +252,15 @@ public class Postler.AccountWidget : Gtk.VBox {
 
 public class Postler.AccountSetup : Gtk.Dialog {
     AccountWidget widget;
+    int x;
+    int y;
+    Gtk.Allocation widget_alloc;
 
     public signal void done (AccountInfo? info);
 
     private AccountSetup (AccountInfo? info=null) {
-        GLib.Object (title: _("Account Properties"));
+        GLib.Object (title: _("Account Properties"),
+                     resizable: false);
         widget = new AccountWidget (info);
         widget.done.connect ((info) => {
             hide ();
@@ -265,6 +270,23 @@ public class Postler.AccountSetup : Gtk.Dialog {
         (get_content_area () as Gtk.Box).pack_start (widget, true, true, 0);
         widget.show ();
         response.connect (responded);
+
+        widget.expander.activate.connect ( () => {
+            /* The window won't shrink when un-expanding.
+               Re-size the widget and window. Also hide to avoid artifacts. */
+            if (widget.expander.get_expanded ()) {
+                    widget.expander.get_child ().hide ();
+                    resize (x, y);
+                    widget.set_size_request (widget_alloc.width, widget_alloc.height);
+                    set_size_request (-1, -1);
+                } else {
+                    widget.get_allocation (out widget_alloc);
+                    get_size (out x, out y);
+                    widget.expander.get_child ().show ();
+                    widget.set_size_request (-1, -1);
+                    set_size_request (-1, -1);
+                }
+        });
     }
 
     void responded (int response) {



More information about the Xfce4-commits mailing list