GNOME Bugzilla – Bug 586911
Sessions dialog can have multiple instances
Last modified: 2014-03-05 11:39:20 UTC
- how to produce - To manage the (startup) sessions from the GUI, the user can startup the session manager using the following steps: system > preferences > sessions. Open 2 or more dialogs this way. - problem - In this dialog the user can choose which services to start (and which not). The problem occurs when there are multiple instances open from this dialog and when the settings in these dialogs are different (changed by the user). The user does not know which settings will be stored, because there are multiple dialogs with different settings. - suggestion - make this dialog window a single instance version and refocus this window if the user tries to open another window. Other information: This bug was filed in Launchpad: https://bugs.launchpad.net/ubuntu/+source/gnome-session/+bug/391925
Created attachment 152957 [details] [review] session-properties-uniqueapp.patch
I hope this patch will solve the problem, as I said in the patch (as comment) the fix itself is pretty simple, we've just to use libunique. When the second instance is executed, it sends an UNIQUE_ACTIVATE to the first one, and in this case the unique instance "present" the dialog. :)
Review of attachment 152957 [details] [review]: ::: capplet/main.c @@ +84,3 @@ + gpointer user_data) +{ + GtkWindow *dialog = (GtkWindow *)user_data; It should be GTK_WINDOW (user_data). Also, I think the coding style here is: GtkWindow *dialog; dialog = GTK_WINDOW (user_data); @@ +88,3 @@ + switch (command) { + case UNIQUE_ACTIVATE: + /* We must use the timestamp or not ? (really necessary ?) */ Yes, please use the timestamp (with gtk_window_present_with_time()). @@ +93,3 @@ + default: + g_assert_not_reached (); + } (inset empty line here) @@ +119,3 @@ return 0; } + app = unique_app_new ("org.gnome.gnome-session-properties", NULL); Shouldn't this be org.gnome.GnomeSessionProperties? @@ +128,2 @@ + if (response != UNIQUE_RESPONSE_OK) + g_error ("Activate UniqueApp failed with response %d", response); I guess we can fallback to just displaying the dialog, instead of g_error() @@ +129,3 @@ + g_error ("Activate UniqueApp failed with response %d", response); + } + else { } else { (one line) @@ +138,3 @@ + "message-received", + G_CALLBACK (message_received_cb), + GTK_WINDOW (dialog)); You can use dialog instead of GTK_WINDOW (dialog).
Created attachment 153154 [details] [review] session-properties-uniqueapp.patch
The above patch is better ? :)
Review of attachment 153154 [details] [review]: Sorry for the late review. It's probably too late for 2.30.0, and so it will have to wait until the next cycle. ::: capplet/main.c @@ +94,3 @@ + default: + break; + } Insert empty line here. Again :-) @@ +125,3 @@ + UniqueResponse response; + + response = unique_app_send_message (app, UNIQUE_ACTIVATE, NULL); If response is not UNIQUE_RESPONSE_OK, we probably want to fallback to the else that is below. @@ +139,3 @@ + + gtk_main (); + } Insert empty line here.
gnome-session-properties is no longer included in gnome-session.