[gnome-characters] categoryList: Use Gtk.Stack.add_titled if possible



commit 0e27a55974b6da170c1392565a6044e1021c569b
Author: Daiki Ueno <dueno src gnome org>
Date:   Wed Nov 26 11:47:12 2014 +0900

    categoryList: Use Gtk.Stack.add_titled if possible

 src/categoryList.js |   20 ++++++++++----------
 src/window.js       |   10 +++++++---
 2 files changed, 17 insertions(+), 13 deletions(-)
---
diff --git a/src/categoryList.js b/src/categoryList.js
index ab8f647..d867491 100644
--- a/src/categoryList.js
+++ b/src/categoryList.js
@@ -28,55 +28,55 @@ const Category = [
     {
         name: 'recent',
         category: Gc.Category.NONE,
-        label: N_('Recently Used'),
+        title: N_('Recently Used'),
         icon_name: 'document-open-recent-symbolic'
     },
     {
         name: 'punctuation',
         category: Gc.Category.PUNCTUATION,
-        label: N_('Punctuation'),
+        title: N_('Punctuation'),
         icon_name: 'characters-punctuation-symbolic'
     },
     {
         name: 'arrow',
         category: Gc.Category.ARROW,
-        label: N_('Arrows'),
+        title: N_('Arrows'),
         icon_name: 'characters-arrow-symbolic'
     },
     {
         name: 'bullet',
         category: Gc.Category.BULLET,
-        label: N_('Bullets'),
+        title: N_('Bullets'),
         icon_name: 'characters-bullet-symbolic'
     },
     {
         name: 'picture',
         category: Gc.Category.PICTURE,
-        label: N_('Pictures'),
+        title: N_('Pictures'),
         icon_name: 'characters-picture-symbolic'
     },
     {
         name: 'currency',
         category: Gc.Category.CURRENCY,
-        label: N_('Currencies'),
+        title: N_('Currencies'),
         icon_name: 'characters-currency-symbolic'
     },
     {
         name: 'math',
         category: Gc.Category.MATH,
-        label: N_('Math'),
+        title: N_('Math'),
         icon_name: 'characters-math-symbolic'
     },
     {
         name: 'latin',
         category: Gc.Category.LATIN,
-        label: N_('Latin'),
+        title: N_('Latin'),
         icon_name: 'characters-latin-symbolic'
     },
     {
         name: 'emoticon',
         category: Gc.Category.EMOTICON,
-        label: N_('Emoticons'),
+        title: N_('Emoticons'),
         icon_name: 'face-smile-symbolic'
     }
 ];
@@ -99,7 +99,7 @@ const CategoryListRowWidget = new Lang.Class({
         image.get_style_context().add_class('category-image');
         hbox.pack_start(image, false, false, 2);
 
-        let label = new Gtk.Label({ label: Gettext.gettext(category.label),
+        let label = new Gtk.Label({ label: Gettext.gettext(category.title),
                                     halign: Gtk.Align.START });
         label.get_style_context().add_class('category-label');
         hbox.pack_start(label, true, true, 0);
diff --git a/src/window.js b/src/window.js
index 94cc43e..0d93da4 100644
--- a/src/window.js
+++ b/src/window.js
@@ -167,6 +167,9 @@ const MainWindow = new Lang.Class({
 
     _category: function(action, v) {
         let [name, length] = v.get_string()
+
+        // FIXME: we could use Gtk.Container.get_child to obtain the
+        // title, but it is not introspectable.
         let category = null;
         for (let index in CategoryList.Category) {
             category = CategoryList.Category[index];
@@ -176,7 +179,7 @@ const MainWindow = new Lang.Class({
 
         Util.assertNotEqual(category, null);
         this._mainView.setPage(category.name);
-        this._headerBar.title = Gettext.gettext(category.label);
+        this._headerBar.title = Gettext.gettext(category.title);
     },
 
     _character: function(action, v) {
@@ -202,8 +205,9 @@ const MainView = new Lang.Class({
             characterList.get_accessible().accessible_name =
                 _('%s Character List').format(category.label);
             this._characterListWidgets[category.name] = characterList;
-            this.add_named(this._createScrolledWindow(characterList),
-                           category.name);
+            this.add_titled(this._createScrolledWindow(characterList),
+                            category.name,
+                            category.title);
         }
 
         characterList = this._createCharacterList();


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