[gnome-music] Set headerbar as titlebar



commit 94879a8bca888f66025925cb519cd0676f9c9d3d
Author: Ignacio Casal Quinteiro <icq gnome org>
Date:   Thu May 30 18:47:16 2013 +0200

    Set headerbar as titlebar
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702822

 src/toolbar.js |   17 +++++++++++++++++
 src/window.js  |    3 +--
 2 files changed, 18 insertions(+), 2 deletions(-)
---
diff --git a/src/toolbar.js b/src/toolbar.js
index 01bf21a..cf33c1f 100644
--- a/src/toolbar.js
+++ b/src/toolbar.js
@@ -51,6 +51,7 @@ const Toolbar = new Lang.Class({
         this._addBackButton();
         this._addSearchButton();
         this._addSelectButton();
+        this._addCloseButton();
     },
 
     set_stack: function(stack) {
@@ -93,6 +94,14 @@ const Toolbar = new Lang.Class({
             this._backButton.show();
         else
             this._backButton.hide();
+
+        if (this._selectionMode) {
+            this._closeSeparator.hide();
+            this._closeButton.hide();
+        } else {
+            this._closeSeparator.show();
+            this._closeButton.show();
+        }
     },
 
     _addBackButton: function() {
@@ -117,6 +126,14 @@ const Toolbar = new Lang.Class({
                                                         label: _("Select") });
         this.pack_end(this._selectButton);
         this._selectButton.show();
+    },
+
+    _addCloseButton: function() {
+        this._closeSeparator = new Gtk.Separator({ orientation: Gtk.Orientation.VERTICAL });
+        this.pack_end(this._closeSeparator);
+
+        this._closeButton = new Gd.HeaderCloseButton();
+        this.pack_end(this._closeButton);
     }
 });
 Signals.addSignalMethods(Toolbar.prototype);
diff --git a/src/window.js b/src/window.js
index ae2c7c8..20b70ed 100644
--- a/src/window.js
+++ b/src/window.js
@@ -44,7 +44,6 @@ const MainWindow = new Lang.Class({
             application: app,
             title: _('Music'),
             window_position: Gtk.WindowPosition.CENTER,
-            hide_titlebar_when_maximized: true
         });
         this.connect('focus-in-event', Lang.bind(this, this._windowsFocusCb));
 
@@ -104,6 +103,7 @@ const MainWindow = new Lang.Class({
         this.player = new Player.Player();
 
         this.toolbar = new Toolbar.Toolbar();
+        this.set_titlebar(this.toolbar);
         this._stack = new Gtk.Stack({
             transition_type: Gtk.StackTransitionType.CROSSFADE,
             transition_duration: 100,
@@ -111,7 +111,6 @@ const MainWindow = new Lang.Class({
         });
         this.toolbar.set_stack(this._stack);
 
-        this._box.pack_start(this.toolbar, false, false, 0);
         this._box.pack_start(this._stack, true, true, 0);
         this._box.pack_start(this.player.eventBox, false, false, 0);
         this.add(this._box);


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