[ontv] Stop passing applet to submodules



commit a908ef688dfb0096e72b4ffbe1d3c51561902340
Author: Olof Kindgren <olki src gnome org>
Date:   Thu Feb 25 19:27:16 2010 +0100

    Stop passing applet to submodules
    
    This is the beginning of a refactoring. The applet class is no
    longer being passed as an argument to other classes.

 ontv/applet.py       |    7 ++++---
 ontv/dbus_service.py |    8 ++++----
 ontv/dialogs.py      |   13 ++++++-------
 ontv/window.py       |    4 +---
 4 files changed, 15 insertions(+), 17 deletions(-)
---
diff --git a/ontv/applet.py b/ontv/applet.py
index 49d5bb3..924beb6 100644
--- a/ontv/applet.py
+++ b/ontv/applet.py
@@ -60,10 +60,11 @@ class OnTVApplet(object):
             self.reminders = self.reminders.load()
 
 
-        self.pw = ProgramWindow(self.xmltvfile, self.applet,
+        self.pw = ProgramWindow(self.xmltvfile,
                                 self.get_docking_data)
         self.sd = SearchDialog(self.xmltvfile, self.reminders)
-        self.pd = PreferencesDialog(self)
+        self.pd = PreferencesDialog(self.config, self.xmltvfile,
+									self.reminders, self.pw, self.sd)
 
         self.applet.set_applet_flags(gnomeapplet.EXPAND_MINOR)
 
@@ -106,7 +107,7 @@ class OnTVApplet(object):
                 remote_object.ShowSearch()
             exit()
         else:
-            DBusService(self)
+            DBusService(self.pw, self.sd, self.xmltvfile)
 
     def __update_listings(self, uicomponent=None, verb=None):
         self.xmltvfile.download()
diff --git a/ontv/dbus_service.py b/ontv/dbus_service.py
index 6b45554..25f4249 100644
--- a/ontv/dbus_service.py
+++ b/ontv/dbus_service.py
@@ -1,11 +1,11 @@
 import dbus.service
 class DBusService(dbus.service.Object):
-    def __init__(self, applet):
+    def __init__(self, pw, sd, xmltvfile):
         bus_name = dbus.service.BusName('org.gnome.OnTV', dbus.SessionBus())
         dbus.service.Object.__init__(self, bus_name, '/DBusService')
-        self.pw = applet.pw
-        self.xmltvfile = applet.xmltvfile
-        self.sd = applet.sd
+        self.pw = pw
+        self.xmltvfile = xmltvfile
+        self.sd = sd
 
     @dbus.service.method("org.gnome.OnTV",
                          in_signature='', out_signature='')
diff --git a/ontv/dialogs.py b/ontv/dialogs.py
index b9f2a57..3bf7296 100644
--- a/ontv/dialogs.py
+++ b/ontv/dialogs.py
@@ -122,13 +122,12 @@ class ChannelDialog:
         self.dialog.destroy()
 
 class PreferencesDialog:
-    def __init__(self, ontvapplet):
-        self.ontvapplet = ontvapplet
-        self.config = ontvapplet.config
-        self.xmltvfile = ontvapplet.xmltvfile
-        self.reminders = ontvapplet.reminders
-        self.pw = ontvapplet.pw
-        self.sd = ontvapplet.sd
+    def __init__(self, config, xmltvfile, reminders, pw, sd):
+        self.config = config
+        self.xmltvfile = xmltvfile
+        self.reminders = reminders
+        self.pw = pw
+        self.sd = sd
 
         self.xmltvfile.connect("loading", self.__xmltvfile_loading)
         self.xmltvfile.connect("loading-done", self.__xmltvfile_loading_done)
diff --git a/ontv/window.py b/ontv/window.py
index 944a83d..2df3e3c 100644
--- a/ontv/window.py
+++ b/ontv/window.py
@@ -273,10 +273,9 @@ class ProgramTimeLeftBar(ProgramBar, gtk.Label):
         return True
 
 class ProgramWindow(gtk.Window):
-    def __init__(self, xmltvfile, applet, get_docking_data):
+    def __init__(self, xmltvfile, get_docking_data):
         gtk.Window.__init__(self, gtk.WINDOW_TOPLEVEL)
         xmltvfile.connect("loading-done", self.__xmltvfile_loading_done)
-        self.applet = applet
         self.get_docking_data = get_docking_data
 
         self.cpt = CurrentProgramTable(xmltvfile.listings)
@@ -318,7 +317,6 @@ class ProgramWindow(gtk.Window):
 
     def __key_press_event(self, window, event):
         if event.keyval == gtk.keysyms.Escape:
-            self.applet.set_state(gtk.STATE_NORMAL)
             window.hide()
 
     def position_window(self):



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