[gnome-maps/wip/gtk-builder: 5/6] Util: add getUIObject



commit 5edbd55df0b73e8c93b40111104fecc918507f6d
Author: Mattias Bengtsson <mattias jc bengtsson gmail com>
Date:   Mon Jun 17 18:23:07 2013 +0200

    Util: add getUIObject
    
    Add getUIObject, a helper function for working with GtkBuilder.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=702657

 src/utils.js |   10 ++++++++++
 1 files changed, 10 insertions(+), 0 deletions(-)
---
diff --git a/src/utils.js b/src/utils.js
index ccd0a29..2da13ce 100644
--- a/src/utils.js
+++ b/src/utils.js
@@ -137,3 +137,13 @@ function CreateActorFromImageFile(path) {
         return null;
     }
 }
+
+function getUIObject(res, ids) {
+    let builder = new Gtk.Builder();
+    builder.add_from_resource('/org/gnome/maps/' + res + '.ui');
+    let ret = {};
+    ids.forEach(function(id) {
+        ret[id] = builder.get_object(id);
+    });
+    return ret;
+}


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