After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 586911 - Sessions dialog can have multiple instances
Sessions dialog can have multiple instances
Status: RESOLVED OBSOLETE
Product: gnome-session
Classification: Core
Component: gnome-session-properties
2.26.x
Other All
: Normal minor
: ---
Assigned To: Session Maintainers
Session Maintainers
Depends on:
Blocks:
 
 
Reported: 2009-06-25 05:29 UTC by Dennis Craven
Modified: 2014-03-05 11:39 UTC
See Also:
GNOME target: ---
GNOME version: 2.27/2.28


Attachments
session-properties-uniqueapp.patch (3.26 KB, patch)
2010-02-03 19:25 UTC, Romain Perier
reviewed Details | Review
session-properties-uniqueapp.patch (3.04 KB, patch)
2010-02-06 18:07 UTC, Romain Perier
reviewed Details | Review

Description Dennis Craven 2009-06-25 05:29:21 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
Comment 1 Romain Perier 2010-02-03 19:25:09 UTC
Created attachment 152957 [details] [review]
session-properties-uniqueapp.patch
Comment 2 Romain Perier 2010-02-03 19:27:13 UTC
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. :)
Comment 3 Vincent Untz 2010-02-03 20:20:27 UTC
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).
Comment 4 Romain Perier 2010-02-06 18:07:18 UTC
Created attachment 153154 [details] [review]
session-properties-uniqueapp.patch
Comment 5 Romain Perier 2010-02-06 18:07:48 UTC
The above patch is better ? :)
Comment 6 Vincent Untz 2010-03-09 00:23:15 UTC
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.
Comment 7 Matthias Clasen 2014-03-05 11:39:20 UTC
gnome-session-properties is no longer included in gnome-session.