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



commit 675e71b64cff305f14534182108e7f410ec0ca09
Author: Alessandro Bono <shadow openaliasbox org>
Date:   Sat Jul 25 17:54:00 2015 +0200

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

 src/application.js |    2 +-
 src/properties.js  |   21 +++++++++++----------
 src/selections.js  |    4 ++--
 3 files changed, 14 insertions(+), 13 deletions(-)
---
diff --git a/src/application.js b/src/application.js
index 9d3cbe1..943e49b 100644
--- a/src/application.js
+++ b/src/application.js
@@ -271,7 +271,7 @@ const Application = new Lang.Class({
             return;
 
         let dialog = new Properties.PropertiesDialog(doc.id);
-        dialog.widget.connect('response', Lang.bind(this,
+        dialog.connect('response', Lang.bind(this,
             function(widget, response) {
                 widget.destroy();
             }));
diff --git a/src/properties.js b/src/properties.js
index 9a3d363..2ad1b51 100644
--- a/src/properties.js
+++ b/src/properties.js
@@ -38,6 +38,7 @@ const _TITLE_ENTRY_TIMEOUT = 200;
 
 const PropertiesDialog = new Lang.Class({
     Name: 'PropertiesDialog',
+    Extends: Gtk.Dialog,
 
     _init: function(urn) {
         let doc = Application.documentManager.getItemById(urn);
@@ -52,14 +53,14 @@ const PropertiesDialog = new Lang.Class({
         }
 
         let toplevel = Application.application.get_windows()[0];
-        this.widget = new Gtk.Dialog ({ resizable: false,
-                                        transient_for: toplevel,
-                                        modal: true,
-                                        destroy_with_parent: true,
-                                        use_header_bar: true,
-                                        default_width: 400,
-                                        title: _("Properties"),
-                                        hexpand: true });
+        this.parent({ resizable: false,
+                      transient_for: toplevel,
+                      modal: true,
+                      destroy_with_parent: true,
+                      use_header_bar: true,
+                      default_width: 400,
+                      title: _("Properties"),
+                      hexpand: true });
 
         let grid = new Gtk.Grid ({ orientation: Gtk.Orientation.VERTICAL,
                                    row_homogeneous: true,
@@ -72,7 +73,7 @@ const PropertiesDialog = new Lang.Class({
                                    margin_end: 24,
                                    margin_bottom: 12 });
 
-        let contentArea = this.widget.get_content_area();
+        let contentArea = this.get_content_area();
         contentArea.pack_start(grid, true, true, 2);
 
         // Title item
@@ -213,6 +214,6 @@ const PropertiesDialog = new Lang.Class({
                                                  halign: Gtk.Align.START });
         grid.attach_next_to (this._documentTypeData, this._docType, Gtk.PositionType.RIGHT, 2, 1);
 
-        this.widget.show_all();
+        this.show_all();
     }
 });
diff --git a/src/selections.js b/src/selections.js
index 66789cf..675d748 100644
--- a/src/selections.js
+++ b/src/selections.js
@@ -927,9 +927,9 @@ const SelectionToolbar = new Lang.Class({
         let selection = Application.selectionController.getSelection();
         let dialog = new Properties.PropertiesDialog(selection[0]);
 
-        dialog.widget.connect('response', Lang.bind(this,
+        dialog.connect('response', Lang.bind(this,
             function(widget, response) {
-                dialog.widget.destroy();
+                dialog.destroy();
                 Application.selectionController.setSelectionMode(false);
             }));
     },


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