gnome-session r4808 - in branches/dbus_based: . gnome-session



Author: mccann
Date: Thu Jul 17 18:00:31 2008
New Revision: 4808
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4808&view=rev

Log:
2008-07-17  William Jon McCann  <jmccann redhat com>

	* gnome-session/gsm-client.c (gsm_client_get_app_name):
	* gnome-session/gsm-client.h:
	* gnome-session/gsm-dbus-client.c (dbus_client_get_app_name),
	(gsm_dbus_client_class_init):
	* gnome-session/gsm-manager.c (on_client_end_session_response):
	* gnome-session/gsm-xsmp-client.c (xsmp_get_app_name),
	(gsm_xsmp_client_class_init), (interact_request_callback):
	Try to get something like an app-id for XSMP clients to
	display info in inhibit dialog.



Modified:
   branches/dbus_based/ChangeLog
   branches/dbus_based/gnome-session/gsm-client.c
   branches/dbus_based/gnome-session/gsm-client.h
   branches/dbus_based/gnome-session/gsm-dbus-client.c
   branches/dbus_based/gnome-session/gsm-manager.c
   branches/dbus_based/gnome-session/gsm-xsmp-client.c

Modified: branches/dbus_based/gnome-session/gsm-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-client.c	(original)
+++ branches/dbus_based/gnome-session/gsm-client.c	Thu Jul 17 18:00:31 2008
@@ -324,6 +324,14 @@
         return client->priv->app_id;
 }
 
+char *
+gsm_client_get_app_name (GsmClient *client)
+{
+        g_return_val_if_fail (GSM_IS_CLIENT (client), NULL);
+
+        return GSM_CLIENT_GET_CLASS (client)->impl_get_app_name (client);
+}
+
 void
 gsm_client_query_end_session (GsmClient *client,
                               guint      flags)

Modified: branches/dbus_based/gnome-session/gsm-client.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-client.h	(original)
+++ branches/dbus_based/gnome-session/gsm-client.h	Thu Jul 17 18:00:31 2008
@@ -63,6 +63,7 @@
                                                     const char *reason);
 
         /* virtual methods */
+        char *       (*impl_get_app_name)         (GsmClient *client);
         void         (*impl_query_end_session)    (GsmClient *client,
                                                    guint      flags);
         void         (*impl_end_session)          (GsmClient *client,
@@ -76,6 +77,8 @@
 const char *gsm_client_get_id                     (GsmClient  *client);
 const char *gsm_client_get_startup_id             (GsmClient  *client);
 const char *gsm_client_get_app_id                 (GsmClient  *client);
+char       *gsm_client_get_app_name               (GsmClient  *client);
+
 void        gsm_client_set_app_id                 (GsmClient  *client,
                                                    const char *app_id);
 int         gsm_client_get_status                 (GsmClient  *client);

Modified: branches/dbus_based/gnome-session/gsm-dbus-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-dbus-client.c	(original)
+++ branches/dbus_based/gnome-session/gsm-dbus-client.c	Thu Jul 17 18:00:31 2008
@@ -253,6 +253,13 @@
         g_signal_emit (dbus_client, signals[END_SESSION], 0, flags);
 }
 
+static char *
+dbus_client_get_app_name (GsmClient *client)
+{
+        /* Always use app-id instead */
+        return NULL;
+}
+
 #if 0
 static void
 dbus_client_query_end_session (GsmClient *client,
@@ -365,6 +372,7 @@
         client_class->impl_stop              = dbus_client_stop;
         client_class->impl_query_end_session = dbus_client_query_end_session;
         client_class->impl_end_session       = dbus_client_end_session;
+        client_class->impl_get_app_name      = dbus_client_get_app_name;
 
         signals [STOP] =
                 g_signal_new ("stop",

Modified: branches/dbus_based/gnome-session/gsm-manager.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-manager.c	(original)
+++ branches/dbus_based/gnome-session/gsm-manager.c	Thu Jul 17 18:00:31 2008
@@ -843,12 +843,21 @@
         if (! is_ok) {
                 guint         cookie;
                 GsmInhibitor *inhibitor;
+                const char   *app_id;
 
                 /* FIXME: do we support updating the reason? */
 
+                /* Create JIT inhibit */
+
+                app_id = gsm_client_get_app_id (client);
+                if (app_id == NULL || app_id[0] == '\0') {
+                        /* XSMP clients don't give us an app id unless we start them */
+                        app_id = gsm_client_get_app_name (client);
+                }
+
                 cookie = _generate_unique_cookie (manager);
                 inhibitor = gsm_inhibitor_new_for_client (gsm_client_get_id (client),
-                                                          gsm_client_get_app_id (client),
+                                                          app_id,
                                                           GSM_INHIBITOR_FLAG_LOGOUT,
                                                           reason,
                                                           cookie);

Modified: branches/dbus_based/gnome-session/gsm-xsmp-client.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-xsmp-client.c	(original)
+++ branches/dbus_based/gnome-session/gsm-xsmp-client.c	Thu Jul 17 18:00:31 2008
@@ -515,6 +515,18 @@
         xsmp_save_yourself (client, FALSE);
 }
 
+static char *
+xsmp_get_app_name (GsmClient *client)
+{
+        SmProp *prop;
+        char   *name;
+
+        prop = find_property (GSM_XSMP_CLIENT (client), SmProgram, NULL);
+        name = prop_to_command (prop);
+
+        return name;
+}
+
 static void
 gsm_client_set_ice_connection (GsmXSMPClient *client,
                                gpointer       conn)
@@ -618,6 +630,7 @@
         client_class->impl_stop              = xsmp_stop;
         client_class->impl_query_end_session = xsmp_query_end_session;
         client_class->impl_end_session       = xsmp_end_session;
+        client_class->impl_get_app_name      = xsmp_get_app_name;
 
         signals[REGISTER_REQUEST] =
                 g_signal_new ("register-request",
@@ -809,9 +822,10 @@
 
         gdm_client_end_session_response (GSM_CLIENT (client),
                                          FALSE,
-                                         _("Requesting user input"));
+                                         _("This program is blocking log out."));
 
-        xsmp_interact (GSM_CLIENT (client));
+        /* Can't just call back with Interact because session client
+           grabs keyboard in that case! */
 }
 
 static void



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]