Merge lp:~artem-anufrij/switchboard/Bugfix-1367206 into lp:~elementary-pantheon/switchboard/switchboard

Proposed by Artem Anufrij
Status: Merged
Approved by: Cody Garver
Approved revision: 519
Merged at revision: 517
Proposed branch: lp:~artem-anufrij/switchboard/Bugfix-1367206
Merge into: lp:~elementary-pantheon/switchboard/switchboard
Diff against target: 53 lines (+17/-6)
1 file modified
src/Switchboard.vala (+17/-6)
To merge this branch: bzr merge lp:~artem-anufrij/switchboard/Bugfix-1367206
Reviewer Review Type Date Requested Status
elementary Pantheon team Pending
Review via email: mp+241137@code.launchpad.net

Commit message

Only allow a single instance of Switchboard (lp:1367206)

Description of the change

Changed switchboard in a singular application

To post a comment you must log in.
518. By artem-anufrij

Changed switchboard in a singular application

519. By artem-anufrij

Changed switchboard in a singular application

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/Switchboard.vala'
2--- src/Switchboard.vala 2014-11-05 22:00:51 +0000
3+++ src/Switchboard.vala 2014-11-07 20:13:38 +0000
4@@ -32,7 +32,7 @@
5 // all its widgets are displayed.
6 cheese_gtk_init (ref args);
7
8- var app = new SwitchboardApp ();
9+ var app = SwitchboardApp.instance;
10 return app.run (args);
11 }
12
13@@ -84,6 +84,16 @@
14 about_license_type = Gtk.License.GPL_3_0;
15 }
16
17+ public static SwitchboardApp _instance = null;
18+
19+ public static SwitchboardApp instance {
20+ get {
21+ if (_instance == null)
22+ _instance = new SwitchboardApp ();
23+ return _instance;
24+ }
25+ }
26+
27 public override int command_line (ApplicationCommandLine command_line) {
28 hold ();
29 int res = _command_line (command_line);
30@@ -125,17 +135,18 @@
31 break;
32 }
33 }
34- // If app is already running, present the current window.
35- if (get_windows () != null) {
36- get_windows ().data.present ();
37- return 1;
38- }
39
40 // If plug_to_open was set from the command line
41 should_animate_next_transition = false;
42 opened_directly = true;
43 }
44
45+ // If app is already running, present the current window.
46+ if (get_windows () != null) {
47+ get_windows ().data.present ();
48+ return 1;
49+ }
50+
51 loaded_plugs = new Gee.LinkedList <string> ();
52 Switchboard.PlugsManager.get_default ();
53 settings = new GLib.Settings ("org.pantheon.switchboard.saved-state");

Subscribers

People subscribed via source and target branches

to all changes: