[gnome-documents] manager: Use inheritence instead of composition



commit ba3ab4f130867741acb347d3fc4cb341b98b8284
Author: Alessandro Bono <shadow openaliasbox org>
Date:   Sat Jul 25 14:47:48 2015 +0200

    manager: Use inheritence instead of composition
    
    https://bugzilla.gnome.org/show_bug.cgi?id=752792

 src/manager.js   |    7 ++++---
 src/searchbar.js |    2 +-
 2 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/src/manager.js b/src/manager.js
index 9dac51b..6171d5d 100644
--- a/src/manager.js
+++ b/src/manager.js
@@ -181,9 +181,10 @@ Signals.addSignalMethods(BaseManager.prototype);
 
 const BaseModel = new Lang.Class({
     Name: 'BaseModel',
+    Extends: Gio.Menu,
 
     _init: function(manager) {
-        this.model = new Gio.Menu();
+        this.parent();
         this._manager = manager;
         this._manager.connect('item-added', Lang.bind(this, this._refreshModel));
         this._manager.connect('item-removed', Lang.bind(this, this._refreshModel));
@@ -202,14 +203,14 @@ const BaseModel = new Lang.Class({
     },
 
     _refreshModel: function() {
-        this.model.remove_all();
+        this.remove_all();
 
         let menuItem;
         let title = this._manager.getTitle();
         let actionId = this._manager.getActionId();
 
         let section = new Gio.Menu();
-        this.model.append_section(title, section);
+        this.append_section(title, section);
 
         let items = this._manager.getItems();
         for (let idx in items) {
diff --git a/src/searchbar.js b/src/searchbar.js
index 57df4d8..296993c 100644
--- a/src/searchbar.js
+++ b/src/searchbar.js
@@ -138,7 +138,7 @@ const Dropdown = new Lang.Class({
 
              // HACK: see https://bugzilla.gnome.org/show_bug.cgi?id=733977
              let popover = new Gtk.Popover();
-             popover.bind_model(model.model, 'app');
+             popover.bind_model(model, 'app');
              let w = popover.get_child();
              w.reparent(grid);
              w.valign = Gtk.Align.START;


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