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
=== modified file 'debian/changelog'
--- debian/changelog 2012-11-09 17:44:47 +0000
+++ debian/changelog 2013-01-08 04:15:26 +0000
@@ -1,3 +1,10 @@
1software-properties (0.92.13ubuntu3) UNRELEASED; urgency=low
2
3 * softwareproperties/gtk/SimpleGtkBuilderApp.py: Use GtkApplication to make this application a singleton.
4 (LP: #1058070)
5
6 -- Stephen Kraemer <straemer@gmail.com> Mon, 07 Jan 2013 23:09:42 -0500
7
1software-properties (0.92.13) raring; urgency=low8software-properties (0.92.13) raring; urgency=low
29
3 * data/gtkbuilder/main.ui: Fixed alignment of combo boxes in Updates tab10 * data/gtkbuilder/main.ui: Fixed alignment of combo boxes in Updates tab
411
=== modified file 'softwareproperties/gtk/SimpleGtkbuilderApp.py'
--- softwareproperties/gtk/SimpleGtkbuilderApp.py 2012-06-14 00:30:45 +0000
+++ softwareproperties/gtk/SimpleGtkbuilderApp.py 2013-01-08 04:15:26 +0000
@@ -20,15 +20,21 @@
20# USA20# USA
2121
22import logging22import logging
23from gi.repository import Gtk23from gi.repository import Gtk, Gio
24from softwareproperties.gtk.utils import setup_ui24from softwareproperties.gtk.utils import setup_ui
25LOG=logging.getLogger(__name__)25LOG=logging.getLogger(__name__)
2626
27# based on SimpleGladeApp27# based on SimpleGladeApp
28class SimpleGtkbuilderApp:28class SimpleGtkbuilderApp(Gtk.Application):
2929
30 def __init__(self, path, domain):30 def __init__(self, path, domain):
31 Gtk.Application.__init__(self, application_id="com.ubuntu.SoftwareProperties",
32 flags=Gio.ApplicationFlags.FLAGS_NONE)
31 setup_ui(self, path, domain)33 setup_ui(self, path, domain)
34 self.connect("activate", self.on_activate)
35
36 def on_activate(self, data=None):
37 self.add_window(self.window_main)
3238
33 def run(self):39 def run(self):
34 """40 """
@@ -40,9 +46,9 @@
40 Use this method for starting programs.46 Use this method for starting programs.
41 """47 """
42 try:48 try:
43 Gtk.main()49 Gtk.Application.run(self, None)
44 except KeyboardInterrupt:50 except KeyboardInterrupt:
45 self.on_keyboard_interrupt()51 self.on_keyboard_Interrupt()
4652
47 def on_keyboard_interrupt(self):53 def on_keyboard_interrupt(self):
48 """54 """
@@ -60,5 +66,5 @@
60 For example, applications based on gstreamer needs to override66 For example, applications based on gstreamer needs to override
61 this method with gst.main_quit()67 this method with gst.main_quit()
62 """68 """
63 Gtk.main_quit()69 Gtk.Application.quit(self)
6470
6571
=== modified file 'softwareproperties/gtk/SoftwarePropertiesGtk.py'
--- softwareproperties/gtk/SoftwarePropertiesGtk.py 2012-11-23 09:24:47 +0000
+++ softwareproperties/gtk/SoftwarePropertiesGtk.py 2013-01-08 04:15:26 +0000
@@ -145,6 +145,7 @@
145 "AuthFailed", self.on_auth_failed)145 "AuthFailed", self.on_auth_failed)
146 self.backend.connect_to_signal(146 self.backend.connect_to_signal(
147 "CdromScanFailed", self.on_cdrom_scan_failed)147 "CdromScanFailed", self.on_cdrom_scan_failed)
148
148 149
149 # Show what we have early150 # Show what we have early
150 self.window_main.show()151 self.window_main.show()

Subscribers

People subscribed via source and target branches

to status/vote changes: