[gnome-sound-recorder] fileUtil.js, mainWindow.js: Add a title to the headerbar



commit 0cfe506a987b242947089c8f70ea6e23b7258a70
Author: Meg Ford <meg387 gmail com>
Date:   Sun Mar 2 03:02:15 2014 -0600

    fileUtil.js, mainWindow.js: Add a title to the headerbar

 src/fileUtil.js   |    8 +++++---
 src/mainWindow.js |   11 +++++++----
 2 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/src/fileUtil.js b/src/fileUtil.js
index c09de79..994e260 100644
--- a/src/fileUtil.js
+++ b/src/fileUtil.js
@@ -35,6 +35,7 @@ const Record = imports.record;
 
 const _OFFSET_STEP = 20;
 let CurrentEndIdx;
+let totItems;
 
 const OffsetController = new Lang.Class({
     Name: 'OffsetController',
@@ -51,11 +52,12 @@ const OffsetController = new Lang.Class({
     },
     
     getEndIdx: function() {
-        this.totItems = MainWindow.list.getItemCount();
-        if (CurrentEndIdx < this.totItems) {
+        totItems = MainWindow.list.getItemCount();
+        log(totItems);
+        if (CurrentEndIdx < totItems) {
             this.endIdx = CurrentEndIdx -1;
         } else {
-            this.endIdx = this.totItems - 1;
+            this.endIdx = totItems - 1;
         }
         
         return this.endIdx;
diff --git a/src/mainWindow.js b/src/mainWindow.js
index 7d2f578..79bb708 100644
--- a/src/mainWindow.js
+++ b/src/mainWindow.js
@@ -40,6 +40,7 @@ let audioProfile = null;
 let displayTime = null;
 let grid = null;
 let groupGrid;
+let header;
 let list = null;
 let loadMoreButton = null;
 let offsetController = null;
@@ -98,8 +99,8 @@ const MainWindow = new Lang.Class({
                                        default_height: 480 });
         this.parent(params);
 
-        let header = new Gtk.HeaderBar({ hexpand: true,
-                                         show_close_button: true });
+        header = new Gtk.HeaderBar({ hexpand: true,
+                                     show_close_button: true });
         this.set_titlebar(header);
         header.get_style_context().add_class('titlebar');
 
@@ -315,7 +316,9 @@ const MainView = new Lang.Class({
                   
         this.groupGrid.add(this._scrolledWin);
         this._scrolledWin.show();
-        
+        let itemNumber = list.getItemCount();
+        let title = _("%d Recorded Sounds").format(itemNumber);
+        header.set_title(title);
         this.listBox = null;
         this._startIdx = 0;
         this._endIdx = offsetController.getEndIdx();
@@ -422,7 +425,7 @@ const MainView = new Lang.Class({
                 this._playLabelBox = new Gtk.Box({ orientation: Gtk.Orientation.HORIZONTAL,
                                                    name: "PlayLabelBox",
                                                    height_request: 45 });
-                this.rowGrid.attach(this._playLabelBox, 3, 1, 6, 1);
+                this.rowGrid.attach(this._playLabelBox, 3, 1, 5, 1);
                 this._playLabelBox.show();       
                 this.playDurationLabel = new Gtk.Label({ margin_left: rtl ? 0 : 15,
                                                          margin_right: rtl ? 15 : 0,


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