[gnome-tweak-tool] Give tweaks a reference to the main window



commit 073044133c9ab5a28be6959e2bb611be1dd8ba6c
Author: John Stowers <john stowers gmail com>
Date:   Thu Aug 22 00:11:26 2013 +0200

    Give tweaks a reference to the main window

 gtweak/tweakmodel.py |    7 ++++++-
 gtweak/tweakview.py  |    2 +-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/gtweak/tweakmodel.py b/gtweak/tweakmodel.py
index ee85a66..1e6f344 100644
--- a/gtweak/tweakmodel.py
+++ b/gtweak/tweakmodel.py
@@ -66,6 +66,9 @@ class Tweak(object):
         self._notification = Notification(summary, desc)
 
 class TweakGroup(object):
+
+    main_window = None
+
     def __init__(self, name, *tweaks, **options):
         self.name = name
         self.tweaks = [t for t in tweaks if t.loaded]
@@ -94,7 +97,7 @@ class TweakModel(Gtk.ListStore):
     def tweak_groups(self):
         return (row[TweakModel.COLUMN_TWEAK] for row in self)
 
-    def load_tweaks(self):
+    def load_tweaks(self, main_window):
         tweak_files = [
                 os.path.splitext(os.path.split(f)[-1])[0]
                     for f in glob.glob(os.path.join(self._tweak_dir, "tweak_group_*.py"))]
@@ -115,9 +118,11 @@ class TweakModel(Gtk.ListStore):
         schemas = SchemaList() 
    
         for g in groups:
+            g.main_window = main_window
             if g.tweaks:
                 self.add_tweak_group(g)
                 for i in g.tweaks:
+                    i.main_window = main_window
                     try:
                         schemas.insert(i.key_name, i.schema_name)
                     except:
diff --git a/gtweak/tweakview.py b/gtweak/tweakview.py
index b1897fd..af3e951 100644
--- a/gtweak/tweakview.py
+++ b/gtweak/tweakview.py
@@ -48,7 +48,7 @@ class Window(Gtk.ApplicationWindow):
         
         self.load_css()      
         self._model = model
-        self._model.load_tweaks()
+        self._model.load_tweaks(self)
         self.load_model_data()
 
         self.connect("key-press-event", self._on_key_press)


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