Merge lp:~straemer/software-properties/fix-for-1058070 into lp:software-properties

Proposed by Stephen Kraemer
Status: Merged
Merged at revision: 824
Proposed branch: lp:~straemer/software-properties/fix-for-1058070
Merge into: lp:software-properties
Diff against target: 73 lines (+19/-5)
3 files modified
debian/changelog (+7/-0)
softwareproperties/gtk/SimpleGtkbuilderApp.py (+11/-5)
softwareproperties/gtk/SoftwarePropertiesGtk.py (+1/-0)
To merge this branch: bzr merge lp:~straemer/software-properties/fix-for-1058070
Reviewer Review Type Date Requested Status
Michael Vogt (community) Approve
Review via email: mp+140075@code.launchpad.net

Description of the change

Made software-properties only open one instance per session.

To post a comment you must log in.
Revision history for this message
Robert Roth (evfool) wrote :

The improvement looks fine, and it makes software properties a "singleton" app, allowing it to run only one instance per session.

However it does the single-instance handling via a custom dbus interface. Gtk Application [1] can do single-instance handling since gtk 3.6, along with other maybe-useful features, like appmenu, etc. I don't know whether there are any best-practices regarding single-instance apps, but if it has been added to the core gtk platform, maybe we could make use of that (I guess that GObject introspection works with the gtkapplication class too, so it shouldn't be too tricky)

[1] http://developer.gnome.org/gtk3/3.6/GtkApplication.html

Revision history for this message
Stephen Kraemer (straemer) wrote :

It doesn't look like GtkApplication is being used within this application. It looks like SimpleGtkbuilderApp is used instead. Would there be any issues in replacing this with GtkApplication?

825. By Stephen Kraemer

softwareproperties/gtk/SimpleGtkBuilderApp.py: Use GtkApplication to make this application a singleton.

Revision history for this message
Stephen Kraemer (straemer) wrote :

I updated this to make use of GtkApplication. It looks to be a lot cleaner of a solution to me.

Revision history for this message
Michael Vogt (mvo) wrote :

Looks good.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2012-11-09 17:44:47 +0000
3+++ debian/changelog 2013-01-08 04:15:26 +0000
4@@ -1,3 +1,10 @@
5+software-properties (0.92.13ubuntu3) UNRELEASED; urgency=low
6+
7+ * softwareproperties/gtk/SimpleGtkBuilderApp.py: Use GtkApplication to make this application a singleton.
8+ (LP: #1058070)
9+
10+ -- Stephen Kraemer <straemer@gmail.com> Mon, 07 Jan 2013 23:09:42 -0500
11+
12 software-properties (0.92.13) raring; urgency=low
13
14 * data/gtkbuilder/main.ui: Fixed alignment of combo boxes in Updates tab
15
16=== modified file 'softwareproperties/gtk/SimpleGtkbuilderApp.py'
17--- softwareproperties/gtk/SimpleGtkbuilderApp.py 2012-06-14 00:30:45 +0000
18+++ softwareproperties/gtk/SimpleGtkbuilderApp.py 2013-01-08 04:15:26 +0000
19@@ -20,15 +20,21 @@
20 # USA
21
22 import logging
23-from gi.repository import Gtk
24+from gi.repository import Gtk, Gio
25 from softwareproperties.gtk.utils import setup_ui
26 LOG=logging.getLogger(__name__)
27
28 # based on SimpleGladeApp
29-class SimpleGtkbuilderApp:
30+class SimpleGtkbuilderApp(Gtk.Application):
31
32 def __init__(self, path, domain):
33+ Gtk.Application.__init__(self, application_id="com.ubuntu.SoftwareProperties",
34+ flags=Gio.ApplicationFlags.FLAGS_NONE)
35 setup_ui(self, path, domain)
36+ self.connect("activate", self.on_activate)
37+
38+ def on_activate(self, data=None):
39+ self.add_window(self.window_main)
40
41 def run(self):
42 """
43@@ -40,9 +46,9 @@
44 Use this method for starting programs.
45 """
46 try:
47- Gtk.main()
48+ Gtk.Application.run(self, None)
49 except KeyboardInterrupt:
50- self.on_keyboard_interrupt()
51+ self.on_keyboard_Interrupt()
52
53 def on_keyboard_interrupt(self):
54 """
55@@ -60,5 +66,5 @@
56 For example, applications based on gstreamer needs to override
57 this method with gst.main_quit()
58 """
59- Gtk.main_quit()
60+ Gtk.Application.quit(self)
61
62
63=== modified file 'softwareproperties/gtk/SoftwarePropertiesGtk.py'
64--- softwareproperties/gtk/SoftwarePropertiesGtk.py 2012-11-23 09:24:47 +0000
65+++ softwareproperties/gtk/SoftwarePropertiesGtk.py 2013-01-08 04:15:26 +0000
66@@ -145,6 +145,7 @@
67 "AuthFailed", self.on_auth_failed)
68 self.backend.connect_to_signal(
69 "CdromScanFailed", self.on_cdrom_scan_failed)
70+
71
72 # Show what we have early
73 self.window_main.show()

Subscribers

People subscribed via source and target branches

to status/vote changes: