[geary] Hide attachment widgets when no attachments



commit a49cf8821fcb9c73e08d8a6867dbe7ccbdf4d077
Author: Robert Schroll <rschroll gmail com>
Date:   Fri May 16 00:23:17 2014 -0700

    Hide attachment widgets when no attachments
    
    This saves a bit of space.

 src/client/composer/composer-widget.vala |   17 ++++++++++++++++-
 ui/composer.glade                        |    3 ++-
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/client/composer/composer-widget.vala b/src/client/composer/composer-widget.vala
index 6454366..76c60b1 100644
--- a/src/client/composer/composer-widget.vala
+++ b/src/client/composer/composer-widget.vala
@@ -160,6 +160,7 @@ public class ComposerWidget : Gtk.EventBox {
     private Gtk.Button detach_button;
     private Gtk.Label message_overlay_label;
     private WebKit.DOM.Element? prev_selected_link = null;
+    private Gtk.Separator attachments_separator;
     private Gtk.Box attachments_box;
     private Gtk.Button add_attachment_button;
     private Gtk.Button pending_attachments_button;
@@ -230,6 +231,7 @@ public class ComposerWidget : Gtk.EventBox {
         add_attachment_button.clicked.connect(on_add_attachment_button_clicked);
         pending_attachments_button = builder.get_object("add_pending_attachments") as Gtk.Button;
         pending_attachments_button.clicked.connect(on_pending_attachments_button_clicked);
+        attachments_separator = builder.get_object("separator") as Gtk.Separator;
         attachments_box = builder.get_object("attachments_box") as Gtk.Box;
         hidden_on_attachment_drag_over = (Gtk.Alignment) 
builder.get_object("hidden_on_attachment_drag_over");
         hidden_on_attachment_drag_over_child = (Gtk.Widget) 
builder.get_object("hidden_on_attachment_drag_over_child");
@@ -246,6 +248,7 @@ public class ComposerWidget : Gtk.EventBox {
         // Set the visibilities later, after show_all is called on the widget.
         Idle.add(() => {
             inline_reply = (compose_type != ComposeType.NEW_MESSAGE);
+            show_attachments();
             return false;
         });
         
@@ -1054,7 +1057,7 @@ public class ComposerWidget : Gtk.EventBox {
         box.pack_start(remove_button, false, false);
         remove_button.clicked.connect(() => remove_attachment(attachment_file, box));
         
-        attachments_box.show_all();
+        show_attachments();
         
         check_pending_attachments();
         
@@ -1077,9 +1080,21 @@ public class ComposerWidget : Gtk.EventBox {
             }
         }
         
+        show_attachments();
+        
         check_pending_attachments();
     }
     
+    private void show_attachments() {
+        if (attachment_files.size > 0 ) {
+            attachments_box.show_all();
+            attachments_separator.show();
+        } else {
+            attachments_box.hide();
+            attachments_separator.hide();
+        }
+    }
+    
     private void on_subject_changed() {
         reset_draft_timer();
     }
diff --git a/ui/composer.glade b/ui/composer.glade
index 426fe05..ab9a94b 100644
--- a/ui/composer.glade
+++ b/ui/composer.glade
@@ -537,7 +537,7 @@
       <packing>
         <property name="expand">False</property>
         <property name="fill">True</property>
-        <property name="padding">8</property>
+        <property name="padding">2</property>
         <property name="position">5</property>
       </packing>
     </child>
@@ -547,6 +547,7 @@
         <property name="can_focus">False</property>
         <property name="margin_left">6</property>
         <property name="margin_right">6</property>
+        <property name="margin_top">6</property>
         <property name="margin_bottom">6</property>
         <property name="spacing">8</property>
         <property name="layout_style">start</property>


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