The unified diff between revisions [888c98d8..] and [c6aabce4..] is displayed below. It can also be downloaded as a raw diff.
#
#
# patch "interapplet.py"
# from [cba2df27c7627d95d3a89b4276dcaa93c8f7f8b7]
# to [a9e10bbf1adbce7431ec972777985407577d6ad6]
#
============================================================
--- interapplet.py cba2df27c7627d95d3a89b4276dcaa93c8f7f8b7
+++ interapplet.py a9e10bbf1adbce7431ec972777985407577d6ad6
@@ -97,6 +97,7 @@ class InterfaceApplet(gnomeapplet.Applet
self.currently_running = None
self.applet = applet
+ self.applet.connect("delete-event", self.cleanup)
self.box = gtk.EventBox()
self.icon = gtk.Image()
self.set_normal_logo()
@@ -139,6 +140,10 @@ class InterfaceApplet(gnomeapplet.Applet
# watch gamin for events
gobject.io_add_watch(self.mon.get_fd(), gobject.IO_IN, self.mon_cb)
+ def cleanup(self):
+ # some awful un-python thing we have to do to stop memory leaks
+ del self.applet
+ gtk.main_quit()
def set_normal_logo(self):
self.icon.set_from_file(normal_logo)
def set_active_logo(self):
@@ -406,17 +411,20 @@ def interface_applet_factory(applet, iid
InterfaceApplet(applet, iid)
return gtk.TRUE
-gnomeapplet.bonobo_factory("OAFIID:GNOME_InterApplet_Factory",
- gnomeapplet.Applet.__gtype__,
- "InterApplet", "0", interface_applet_factory)
if __name__ == '__main__':
- main_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
- main_window.set_title('Network Location Applet')
- main_window.connect('destroy', gtk.main_quit)
- app = gnomeapplet.Applet()
- interface_applet_factory(app, None)
- app.reparent(main_window)
- main_window.show_all()
- gtk.main()
+ if len(sys.argv) > 1 and sys.argv[1] == 'run-in-window':
+ main_window = gtk.Window(gtk.WINDOW_TOPLEVEL)
+ main_window.set_title('Network Location Applet')
+ main_window.connect('destroy', gtk.main_quit)
+ app = gnomeapplet.Applet()
+ interface_applet_factory(app, None)
+ app.reparent(main_window)
+ main_window.show_all()
+ gtk.main()
+ else:
+ gnomeapplet.bonobo_factory("OAFIID:GNOME_InterApplet_Factory",
+ gnomeapplet.Applet.__gtype__,
+ "InterApplet", "0", interface_applet_factory)
sys.exit()
+