[geary] Use GtkHeaderBar for Accounts & Prefs dialogs: Bug #741240



commit b7f989685b937887ce1ec262fe2b9985ad9edf2b
Author: Georges Basile Stavracas Neto <georges stavracas gmail com>
Date:   Mon Dec 8 15:18:34 2014 -0800

    Use GtkHeaderBar for Accounts & Prefs dialogs: Bug #741240

 .../accounts/account-dialog-account-list-pane.vala |    3 -
 src/client/accounts/account-dialog.vala            |   11 ++--
 ui/account_list.glade                              |   40 ++------------
 ui/preferences.glade                               |   57 +++++---------------
 4 files changed, 23 insertions(+), 88 deletions(-)
---
diff --git a/src/client/accounts/account-dialog-account-list-pane.vala 
b/src/client/accounts/account-dialog-account-list-pane.vala
index 79a4eeb..0e11c06 100644
--- a/src/client/accounts/account-dialog-account-list-pane.vala
+++ b/src/client/accounts/account-dialog-account-list-pane.vala
@@ -22,8 +22,6 @@ public class AccountDialogAccountListPane : AccountDialogPane {
     
     public signal void delete_account(string email_address);
     
-    public signal void close();
-    
     public AccountDialogAccountListPane(Gtk.Stack stack) {
         base(stack);
         Gtk.Builder builder = GearyApplication.instance.create_builder("account_list.glade");
@@ -58,7 +56,6 @@ public class AccountDialogAccountListPane : AccountDialogPane {
             on_account_added(account);
         
         // Hook up signals.
-        actions.get_action("close").activate.connect(() => { close(); });
         actions.get_action("add_account").activate.connect(() => { add_account(); });
         edit_action.activate.connect(notify_edit_account);
         delete_action.activate.connect(notify_delete_account);
diff --git a/src/client/accounts/account-dialog.vala b/src/client/accounts/account-dialog.vala
index 192be9d..09b7a49 100644
--- a/src/client/accounts/account-dialog.vala
+++ b/src/client/accounts/account-dialog.vala
@@ -13,15 +13,19 @@ public class AccountDialog : Gtk.Dialog {
     private AccountDialogSpinnerPane spinner_pane;
     private AccountDialogRemoveConfirmPane remove_confirm_pane;
     private AccountDialogRemoveFailPane remove_fail_pane;
+    private Gtk.HeaderBar headerbar = new Gtk.HeaderBar();
     
     public AccountDialog(Gtk.Window parent) {
         set_size_request(450, -1); // Sets min size.
-        title = _("Accounts");
+        headerbar.title = _("Accounts");
+        headerbar.show_close_button = true;
         set_transient_for(parent);
         set_modal(true);
+        set_titlebar (headerbar);
         get_content_area().margin_top = MARGIN;
         get_content_area().margin_left = MARGIN;
         get_content_area().margin_right = MARGIN;
+        get_content_area().margin_bottom = MARGIN;
         
         // Add pages to stack.
         account_list_pane = new AccountDialogAccountListPane(stack);
@@ -31,7 +35,6 @@ public class AccountDialog : Gtk.Dialog {
         remove_fail_pane = new AccountDialogRemoveFailPane(stack);
         
         // Connect signals from pages.
-        account_list_pane.close.connect(on_close);
         account_list_pane.add_account.connect(on_add_account);
         account_list_pane.edit_account.connect(on_edit_account);
         account_list_pane.delete_account.connect(on_delete_account);
@@ -51,10 +54,6 @@ public class AccountDialog : Gtk.Dialog {
         
     }
     
-    private void on_close() {
-        response(Gtk.ResponseType.CLOSE);
-    }
-    
     private void on_add_account() {
         add_edit_pane.reset_all();
         add_edit_pane.set_mode(AddEditPage.PageMode.ADD);
diff --git a/ui/account_list.glade b/ui/account_list.glade
index 2265a77..0cc9782 100644
--- a/ui/account_list.glade
+++ b/ui/account_list.glade
@@ -1,6 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.0"/>
   <object class="GtkActionGroup" id="account list actions">
     <child>
       <object class="GtkAction" id="add_account">
@@ -60,9 +61,6 @@
         <property name="toolbar_style">icons</property>
         <property name="show_arrow">False</property>
         <property name="icon_size">2</property>
-        <style>
-          <class name="inline-toolbar"/>
-        </style>
         <child>
           <object class="GtkToolButton" id="add_button">
             <property name="related_action">add_account</property>
@@ -102,6 +100,9 @@
             <property name="homogeneous">True</property>
           </packing>
         </child>
+        <style>
+          <class name="inline-toolbar"/>
+        </style>
       </object>
       <packing>
         <property name="expand">False</property>
@@ -109,36 +110,5 @@
         <property name="position">1</property>
       </packing>
     </child>
-    <child>
-      <object class="GtkButtonBox" id="buttonbox1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="margin_top">5</property>
-        <property name="spacing">5</property>
-        <property name="layout_style">end</property>
-        <child>
-          <object class="GtkButton" id="close_button">
-            <property name="label" translatable="yes">_Close</property>
-            <property name="use_action_appearance">False</property>
-            <property name="related_action">close</property>
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="receives_default">False</property>
-            <property name="use_underline">True</property>
-            <property name="yalign">0.54000002145767212</property>
-          </object>
-          <packing>
-            <property name="expand">False</property>
-            <property name="fill">True</property>
-            <property name="position">0</property>
-          </packing>
-        </child>
-      </object>
-      <packing>
-        <property name="expand">False</property>
-        <property name="fill">True</property>
-        <property name="position">2</property>
-      </packing>
-    </child>
   </object>
 </interface>
diff --git a/ui/preferences.glade b/ui/preferences.glade
index 2342747..dba4eb0 100644
--- a/ui/preferences.glade
+++ b/ui/preferences.glade
@@ -1,13 +1,11 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <interface>
-  <!-- interface-requires gtk+ 3.0 -->
+  <requires lib="gtk+" version="3.10"/>
   <object class="GtkDialog" id="dialog">
     <property name="can_focus">False</property>
-    <property name="border_width">5</property>
+    <property name="border_width">12</property>
     <property name="window_position">center-on-parent</property>
     <property name="type_hint">dialog</property>
-    <property name="has_resize_grip">False</property>
-    <property name="title" translatable="yes">Preferences</property>
     <child internal-child="vbox">
       <object class="GtkBox" id="dialog-vbox1">
         <property name="can_focus">False</property>
@@ -17,22 +15,6 @@
           <object class="GtkButtonBox" id="dialog-action_area1">
             <property name="can_focus">False</property>
             <property name="layout_style">end</property>
-            <child>
-              <object class="GtkButton" id="close_button">
-                <property name="label" translatable="yes">_Close</property>
-                <property name="visible">True</property>
-                <property name="can_focus">True</property>
-                <property name="can_default">True</property>
-                <property name="has_default">True</property>
-                <property name="receives_default">True</property>
-                <property name="use_underline">True</property>
-              </object>
-              <packing>
-                <property name="expand">False</property>
-                <property name="fill">True</property>
-                <property name="position">0</property>
-              </packing>
-            </child>
           </object>
           <packing>
             <property name="expand">False</property>
@@ -52,8 +34,8 @@
                 <property name="margin_right">5</property>
                 <property name="margin_top">5</property>
                 <property name="margin_bottom">5</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes">Reading</property>
+                <property name="xalign">0</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -61,8 +43,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">0</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -82,8 +62,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">1</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -103,8 +81,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">3</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -114,8 +90,8 @@
                 <property name="margin_right">5</property>
                 <property name="margin_top">5</property>
                 <property name="margin_bottom">5</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes">Composer</property>
+                <property name="xalign">0</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -123,8 +99,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">4</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -144,8 +118,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">5</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -155,8 +127,8 @@
                 <property name="margin_right">5</property>
                 <property name="margin_top">5</property>
                 <property name="margin_bottom">5</property>
-                <property name="xalign">0</property>
                 <property name="label" translatable="yes">Notifications</property>
+                <property name="xalign">0</property>
                 <attributes>
                   <attribute name="weight" value="bold"/>
                 </attributes>
@@ -164,8 +136,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">6</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -185,8 +155,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">7</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -206,8 +174,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">8</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -227,8 +193,6 @@
               <packing>
                 <property name="left_attach">0</property>
                 <property name="top_attach">9</property>
-                <property name="width">1</property>
-                <property name="height">1</property>
               </packing>
             </child>
             <child>
@@ -243,8 +207,13 @@
         </child>
       </object>
     </child>
-    <action-widgets>
-      <action-widget response="0">close_button</action-widget>
-    </action-widgets>
+    <child type="titlebar">
+      <object class="GtkHeaderBar" id="headerbar">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="title">Preferences</property>
+        <property name="show_close_button">True</property>
+      </object>
+    </child>
   </object>
 </interface>


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