[gitg/wip/headerbar] Add done button



commit 95e89a8bb37f87efc220d7fdda8052e1fef6d8da
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Sat Jul 6 21:45:37 2013 +0200

    Add done button

 gitg/gitg-header-bar.vala            |   14 +++++++++++++-
 gitg/gitg-window.vala                |    3 +++
 gitg/resources/ui/gitg-header-bar.ui |   20 ++++++++++++++++++++
 3 files changed, 36 insertions(+), 1 deletions(-)
---
diff --git a/gitg/gitg-header-bar.vala b/gitg/gitg-header-bar.vala
index 8072d8f..2a33fc0 100644
--- a/gitg/gitg-header-bar.vala
+++ b/gitg/gitg-header-bar.vala
@@ -39,11 +39,15 @@ public class HeaderBar : Gtk.HeaderBar
        private Gtk.StackSwitcher d_activities_switcher;
 
        [GtkChild]
+       private Gtk.Button d_done_button;
+
+       [GtkChild]
        private Gtk.Separator d_close_button_separator;
        [GtkChild]
        private Gtk.Button d_close_button;
 
        public signal void request_dash();
+       public signal void exit_mode();
 
        public enum Mode
        {
@@ -70,6 +74,7 @@ public class HeaderBar : Gtk.HeaderBar
                                d_activities_switcher.hide();
                                d_close_button_separator.hide();
                                d_close_button.hide();
+                               d_done_button.show();
                        }
                        else
                        {
@@ -79,6 +84,7 @@ public class HeaderBar : Gtk.HeaderBar
                                d_search_button.show();
                                d_close_button_separator.show();
                                d_close_button.show();
+                               d_done_button.hide();
                        }
 
                        if (d_mode == Mode.DASH)
@@ -106,11 +112,17 @@ public class HeaderBar : Gtk.HeaderBar
        }
 
        [GtkCallback]
-       private void dash_button_clicked(Gtk.Button dash)
+       private void dash_button_clicked(Gtk.Button button)
        {
                request_dash();
        }
 
+       [GtkCallback]
+       private void done_button_clicked(Gtk.Button button)
+       {
+               exit_mode();
+       }
+
        construct
        {
                string menuname;
diff --git a/gitg/gitg-window.vala b/gitg/gitg-window.vala
index 13dbb60..c0adaf2 100644
--- a/gitg/gitg-window.vala
+++ b/gitg/gitg-window.vala
@@ -115,6 +115,9 @@ public class Window : Gtk.ApplicationWindow, GitgExt.Application, Initable
                d_header_bar.request_dash.connect(() => {
                        repository = null;
                });
+               d_header_bar.exit_mode.connect(() => {
+                       d_header_bar.mode = HeaderBar.Mode.ACTIVITIES;
+               });
 
                d_environment = new Gee.HashMap<string, string>();
 
diff --git a/gitg/resources/ui/gitg-header-bar.ui b/gitg/resources/ui/gitg-header-bar.ui
index cb34fc8..cfeb49d 100644
--- a/gitg/resources/ui/gitg-header-bar.ui
+++ b/gitg/resources/ui/gitg-header-bar.ui
@@ -69,6 +69,26 @@
       </packing>
     </child>
     <child>
+      <object class="GtkButton" id="d_done_button">
+        <property name="valign">center</property>
+        <property name="relief">none</property>
+        <signal name="clicked" handler="done_button_clicked" swapped="no"/>
+        <style>
+          <class name="text-button"/>
+          <class name="suggested-action"/>
+        </style>
+        <child>
+          <object class="GtkLabel" id="done_label">
+            <property name="visible">True</property>
+            <property name="label" translatable="yes">Done</property>
+          </object>
+        </child>
+      </object>
+      <packing>
+        <property name="pack_type">end</property>
+      </packing>
+    </child>
+    <child>
       <object class="GtkSeparator" id="d_close_button_separator">
         <property name="orientation">vertical</property>
         <property name="valign">fill</property>



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