[meld] Enable loading multiple objects from builder file, and fix prefs pane



commit d89fde7b23abfd70b6d6a33db7d6656811c60901
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Wed Oct 6 18:49:43 2010 +1000

    Enable loading multiple objects from builder file, and fix prefs pane
    
    In the gtk.Builder world, parts of the UI subtree can rely on objects
    outside their subtree, such as GtkAdjustments. This commit changes
    the gnomeglade.Component initialisation to allow an extra argument to
    account for this possibility, and fixes a non-working spinner in the
    preferences dialog using this.

 meld/preferences.py   |    3 ++-
 meld/ui/gnomeglade.py |    4 +++-
 2 files changed, 5 insertions(+), 2 deletions(-)
---
diff --git a/meld/preferences.py b/meld/preferences.py
index 658cc97..7d90da3 100644
--- a/meld/preferences.py
+++ b/meld/preferences.py
@@ -119,7 +119,8 @@ class ListWidget(gnomeglade.Component):
 class PreferencesDialog(gnomeglade.Component):
 
     def __init__(self, parentapp):
-        gnomeglade.Component.__init__(self, paths.ui_dir("preferences.ui"), "preferencesdialog")
+        gnomeglade.Component.__init__(self, paths.ui_dir("preferences.ui"),
+                                      "preferencesdialog", ["adjustment1"])
         self.widget.set_transient_for(parentapp.widget)
         self.prefs = parentapp.prefs
         if not self.prefs.use_custom_font:
diff --git a/meld/ui/gnomeglade.py b/meld/ui/gnomeglade.py
index 6047e5e..a4336bc 100644
--- a/meld/ui/gnomeglade.py
+++ b/meld/ui/gnomeglade.py
@@ -41,11 +41,13 @@ class Component(object):
     object, which is sadly sometimes necessary.
     """
 
-    def __init__(self, filename, root):
+    def __init__(self, filename, root, extra=None):
         """Load the widgets from the node 'root' in file 'filename'.
         """
         self.builder = gtk.Builder()
         self.builder.set_translation_domain(locale_domain)
+        if extra:
+            self.builder.add_objects_from_file(filename, extra)
         self.builder.add_objects_from_file(filename, [root])
         self.builder.connect_signals(self)
         self.widget = getattr(self, root)



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