[gnome-weather] window: Use GtkHeaderBar::show-close-button



commit 9b9a8a1786690f355a73ccf27cdfb40384c3be44
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Aug 6 12:03:36 2013 +0200

    window: Use GtkHeaderBar::show-close-button
    
    ... instead of creating and managing it on our own.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=705552

 data/window.ui |   34 +---------------------------------
 src/window.js  |    7 +------
 2 files changed, 2 insertions(+), 39 deletions(-)
---
diff --git a/data/window.ui b/data/window.ui
index 0dbf888..eb50cc4 100644
--- a/data/window.ui
+++ b/data/window.ui
@@ -56,6 +56,7 @@
   <object class="GtkHeaderBar" id="header-bar">
     <property name="visible">True</property>
     <property name="vexpand">False</property>
+    <property name="show-close-button">True</property>
     <child>
       <object class="GtkButton" id="new-button">
         <property name="visible">True</property>
@@ -148,39 +149,6 @@
         <property name="pack_type">end</property>
       </packing>
     </child>
-    <child>
-      <object class="GtkSeparator" id="close-button-separator">
-        <property name="visible">True</property>
-        <property name="orientation">vertical</property>
-        <property name="valign">fill</property>
-      </object>
-      <packing>
-        <property name="pack_type">end</property>
-      </packing>
-    </child>
-    <child>
-      <object class="GtkButton" id="close-button">
-        <property name="visible">True</property>
-        <property name="can_focus">True</property>
-        <property name="valign">center</property>
-        <property name="relief">none</property>
-        <property name="action-name">win.close</property>
-        <style>
-          <class name="image-button"/>
-        </style>
-        <child>
-          <object class="GtkImage" id="close-button-image">
-            <property name="visible">True</property>
-            <property name="can_focus">False</property>
-            <property name="icon_name">window-close-symbolic</property>
-            <property name="icon_size">1</property>
-          </object>
-        </child>
-      </object>
-      <packing>
-        <property name="pack_type">end</property>
-      </packing>
-    </child>
   </object>
   <object class="GtkGrid" id="main-panel">
     <property name="visible">True</property>
diff --git a/src/window.js b/src/window.js
index 4c0c7e4..ec20df2 100644
--- a/src/window.js
+++ b/src/window.js
@@ -132,9 +132,6 @@ const MainWindow = new Lang.Class({
         this._selectionMenuButtonLabel = builder.get_object('selection-menu-button-label');
         this._stack = builder.get_object('main-stack');
 
-        let closeButton = builder.get_object('close-button');
-        let closeButtonSeparator = builder.get_object('close-button-separator');
-
         this._deleteButton = builder.get_object('delete-button');
 
         this._cityView = new City.WeatherView({ hexpand: true,
@@ -162,9 +159,7 @@ const MainWindow = new Lang.Class({
 
         iconView.bind_property('selection-mode', newButton, 'visible',
                                GObject.BindingFlags.INVERT_BOOLEAN);
-        iconView.bind_property('selection-mode', closeButtonSeparator, 'visible',
-                               GObject.BindingFlags.INVERT_BOOLEAN);
-        iconView.bind_property('selection-mode', closeButton, 'visible',
+        iconView.bind_property('selection-mode', this._header, 'show-close-button',
                                GObject.BindingFlags.INVERT_BOOLEAN);
         iconView.bind_property('selection-mode', select, 'visible',
                                GObject.BindingFlags.INVERT_BOOLEAN);


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