[gnome-documents] edit: Use inheritance instead of composition



commit ae98d8c8957a5bd278044e9f73a14b5ceb00376e
Author: Alessandro Bono <shadow openaliasbox org>
Date:   Tue Jul 28 13:39:24 2015 +0200

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

 src/edit.js  |   11 ++++++-----
 src/embed.js |    4 ++--
 2 files changed, 8 insertions(+), 7 deletions(-)
---
diff --git a/src/edit.js b/src/edit.js
index b914789..0629ebf 100644
--- a/src/edit.js
+++ b/src/edit.js
@@ -43,12 +43,13 @@ const _BLANK_URI = "about:blank";
 
 const EditView = new Lang.Class({
     Name: 'EditView',
+    Extends: Gtk.Overlay,
 
     _init: function() {
         this._uri = null;
 
-        this.widget = new Gtk.Overlay();
-        this.widget.get_style_context().add_class('documents-scrolledwin');
+        this.parent();
+        this.get_style_context().add_class('documents-scrolledwin');
 
         let context = WebKit.WebContext.get_default();
 
@@ -62,11 +63,11 @@ const EditView = new Lang.Class({
         this._progressBar = new Gtk.ProgressBar({ halign: Gtk.Align.FILL,
                                                   valign: Gtk.Align.START });
         this._progressBar.get_style_context().add_class('osd');
-        this.widget.add_overlay(this._progressBar);
+        this.add_overlay(this._progressBar);
 
         this._createView();
 
-        this.widget.show_all();
+        this.show_all();
 
         this._editAction = Application.application.lookup_action('edit-current');
         this._editAction.enabled = false;
@@ -108,7 +109,7 @@ const EditView = new Lang.Class({
 
     _createView: function() {
         this.view = new WebKit.WebView();
-        this.widget.add(this.view);
+        this.add(this.view);
         this.view.show();
         this.view.connect('notify::estimated-load-progress', Lang.bind(this, this._onProgressChanged));
     },
diff --git a/src/embed.js b/src/embed.js
index 1737c7f..32b54ba 100644
--- a/src/embed.js
+++ b/src/embed.js
@@ -119,8 +119,8 @@ const Embed = new Lang.Class({
         this._preview = new Preview.PreviewView(this._stackOverlay);
         this._stack.add_named(this._preview, 'preview');
 
-        this._edit = new Edit.EditView(this._stackOverlay);
-        this._stack.add_named(this._edit.widget, 'edit');
+        this._edit = new Edit.EditView();
+        this._stack.add_named(this._edit, 'edit');
 
         this._spinnerBox = new SpinnerBox();
         this._stack.add_named(this._spinnerBox, 'spinner');


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