[ontv] Clean up applet frontend code



commit 7809c04f97562815cb4fef994e4e94696cb0941d
Author: Olof Kindgren <olki src gnome org>
Date:   Sat Apr 17 21:58:42 2010 +0200

    Clean up applet frontend code
    
    Command line options are removed from the applet code. The debug
    mode and force of configuring can be invoked from the status icon
    frontend instead. This made main.py obsolete, and was therefore
    merged into ontv-applet

 bin/ontv-applet.in |   27 ++++++++++++-
 ontv/Makefile.am   |    1 -
 ontv/main.py       |  104 ----------------------------------------------------
 3 files changed, 25 insertions(+), 107 deletions(-)
---
diff --git a/bin/ontv-applet.in b/bin/ontv-applet.in
index eb5e072..eba41b0 100644
--- a/bin/ontv-applet.in
+++ b/bin/ontv-applet.in
@@ -22,6 +22,16 @@
 import sys
 import os.path
 
+import pygtk
+pygtk.require("2.0")
+import gtk
+import gnome
+import gnomeapplet
+
+import ontv.gui
+from ontv.applet import OnTVApplet
+from ontv import NAME, VERSION, LOCALE_DIR
+
 PYTHON_DIR = "@PYTHONDIR@"
 
 # Try to determine if we run from source or install and fix path accordingly
@@ -35,9 +45,22 @@ if _check(name):
 elif PYTHON_DIR not in sys.path:
     sys.path.insert(0, os.path.abspath(PYTHON_DIR))
 
-from ontv import main
+def applet_factory(applet, iid=None, configure=False, debug=False):
+    ontvapplet = OnTVApplet(applet, configure, debug)
+    ontvapplet.run()
+    return True
 
 if __name__ == "__main__":
-    main.main()
+
+    gnome.init(NAME, VERSION)
+    gtk.gdk.threads_init()
+    gtk.window_set_default_icon_list(*ontv.gui.get_icon_list([16,22,24,32,48]))
+
+    configure = False
+    debug = False
+    gnomeapplet.bonobo_factory("OAFIID:GNOME_OnTVApplet_Factory",
+                               gnomeapplet.Applet.__gtype__, NAME, VERSION,
+                               applet_factory, (configure, debug, ))
+
 
 # vim: set sw=4 et sts=4 tw=79 fo+=l:
diff --git a/ontv/Makefile.am b/ontv/Makefile.am
index f5e13d3..d7fa1d3 100644
--- a/ontv/Makefile.am
+++ b/ontv/Makefile.am
@@ -10,7 +10,6 @@ ontv_PYTHON =			\
 	gui.py			\
 	__init__.py		\
 	listings.py		\
-	main.py			\
 	notify.py		\
 	ontv_core.py		\
 	program.py		\



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