[gnome-clocks] Use close button from HeaderBar



commit f6825b0045376b4ea0846ea3272eae87c256da28
Author: Evgeny Bobkin <evgen ibqn gmail com>
Date:   Mon Aug 12 14:26:06 2013 +0200

    Use close button from HeaderBar
    
    Headerbar widget has a build-in close button support. Therefore no
    custom cunstruction of it is needed anymore.

 configure.ac    |    2 +-
 src/window.vala |   25 +------------------------
 2 files changed, 2 insertions(+), 25 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index dfd3291..79c8db0 100644
--- a/configure.ac
+++ b/configure.ac
@@ -51,7 +51,7 @@ PKG_PROG_PKG_CONFIG([0.22])
 PKG_CHECK_MODULES(CLOCKS, [
     gio-2.0 >= 2.30.0
     glib-2.0 >= 2.36
-    gtk+-3.0 >= 3.9.7
+    gtk+-3.0 >= 3.9.11
     libcanberra >= 0.30
     gweather-3.0 >= 3.9.3
     gnome-desktop-3.0 >= 3.7.90
diff --git a/src/window.vala b/src/window.vala
index b632771..8178842 100644
--- a/src/window.vala
+++ b/src/window.vala
@@ -38,8 +38,6 @@ public class Window : Gtk.ApplicationWindow {
     private Gtk.StackSwitcher stack_switcher;
     private GLib.Settings settings;
     private Gtk.Widget[] panels;
-    private Gtk.Separator separator;
-    private Gtk.Button close_button;
 
     public Window (Application app) {
         Object (application: app);
@@ -71,24 +69,6 @@ public class Window : Gtk.ApplicationWindow {
 
         stack_switcher.set_stack (stack);
 
-        separator = new Gtk.Separator (Gtk.Orientation.VERTICAL);
-        separator.no_show_all = true;
-        separator.valign = Gtk.Align.FILL;
-        header_bar.pack_end (separator);
-
-        close_button = new Gtk.Button ();
-        Gtk.Image close_image = new Gtk.Image.from_icon_name ("window-close-symbolic", Gtk.IconSize.MENU);
-        close_button.set_image (close_image);
-        close_button.get_style_context ().add_class ("image-button");
-        close_button.no_show_all = true;
-        close_button.relief = Gtk.ReliefStyle.NONE;
-        close_button.valign = Gtk.Align.CENTER;
-        close_button.clicked.connect (() => {
-            close();
-        });
-
-        header_bar.pack_end (close_button);
-
         var stack_id = stack.notify["visible-child"].connect (() => {
             update_header_bar ();
         });
@@ -202,10 +182,7 @@ public class Window : Gtk.ApplicationWindow {
             header_bar.custom_title = stack_switcher;
         }
 
-        if (header_bar.mode != HeaderBar.Mode.SELECTION) {
-            separator.show ();
-            close_button.show ();
-        }
+        header_bar.set_show_close_button (header_bar.mode != HeaderBar.Mode.SELECTION);
     }
 }
 


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