[gjs: 2/4] Cleanup GTK static symbol naming.



commit 8ae56755714370e0b1aa70a4671a8ca1463bf10f
Author: rockon999 <rockon999 users noreply github com>
Date:   Fri Jul 20 10:50:51 2018 -0500

    Cleanup GTK static symbol naming.

 modules/overrides/GObject.js | 27 +++++++++++++++------------
 modules/overrides/Gtk.js     |  8 ++++----
 2 files changed, 19 insertions(+), 16 deletions(-)
---
diff --git a/modules/overrides/GObject.js b/modules/overrides/GObject.js
index fc238a47..7b3d4f72 100644
--- a/modules/overrides/GObject.js
+++ b/modules/overrides/GObject.js
@@ -33,10 +33,10 @@ var requires = Symbol('GObject interface requires');
 var signals = Symbol('GObject signals');
 
 // These four will be aliased to GTK
-var _children = Symbol('GTK widget template children');
-var _cssName = Symbol('GTK widget CSS name');
-var _internalChildren = Symbol('GTK widget template internal children');
-var _template = Symbol('GTK widget template');
+var _gtkChildren = Symbol('GTK widget template children');
+var _gtkCssName = Symbol('GTK widget CSS name');
+var _gtkInternalChildren = Symbol('GTK widget template internal children');
+var _gtkTemplate = Symbol('GTK widget template');
 
 function registerClass(klass) {
     if (arguments.length == 2) {
@@ -67,13 +67,13 @@ function registerClass(klass) {
         if ('Requires' in metaInfo)
             klass[requires] = metaInfo.Requires;
         if ('CssName' in metaInfo)
-            klass[_cssName] = metaInfo.CssName;
+            klass[_gtkCssName] = metaInfo.CssName;
         if ('Template' in metaInfo)
-            klass[_template] = metaInfo.Template;
+            klass[_gtkTemplate] = metaInfo.Template;
         if ('Children' in metaInfo)
-            klass[_children] = metaInfo.Children;
+            klass[_gtkChildren] = metaInfo.Children;
         if ('InternalChildren' in metaInfo)
-            klass[_internalChildren] = metaInfo.InternalChildren;
+            klass[_gtkInternalChildren] = metaInfo.InternalChildren;
     }
 
     if (!(klass.prototype instanceof GObject.Object) &&
@@ -436,10 +436,13 @@ function _init() {
         get name() { return 'NotImplementedError'; }
     };
 
-    GObject._cssName = _cssName;
-    GObject._template = _template;
-    GObject._children = _children;
-    GObject._internalChildren = _internalChildren;
+    // These will be copied in the Gtk overrides
+    // Use __X__ syntax to indicate these variables should not be used publicly.
+
+    GObject.__gtkCssName__ = _gtkCssName;
+    GObject.__gtkTemplate__ = _gtkTemplate;
+    GObject.__gtkChildren__ = _gtkChildren;
+    GObject.__gtkInternalChildren__ = _gtkInternalChildren;
 
     // fake enum for signal accumulators, keep in sync with gi/object.c
     GObject.AccumulatorType = {
diff --git a/modules/overrides/Gtk.js b/modules/overrides/Gtk.js
index 2eaaf914..239c0c2e 100644
--- a/modules/overrides/Gtk.js
+++ b/modules/overrides/Gtk.js
@@ -28,10 +28,10 @@ function _init() {
 
     Gtk = this;
 
-    Gtk.children = GObject._children;
-    Gtk.cssName = GObject._cssName;
-    Gtk.internalChildren = GObject._internalChildren;
-    Gtk.template = GObject._template;
+    Gtk.children = GObject.__gtkChildren__;
+    Gtk.cssName = GObject.__gtkCssName__;
+    Gtk.internalChildren = GObject.__gtkInternalChildren__;
+    Gtk.template = GObject.__gtkTemplate__;
 
     let {GtkWidgetClass} = Legacy.defineGtkLegacyObjects(GObject, Gtk);
     Gtk.Widget.prototype.__metaclass__ = GtkWidgetClass;


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