gnome-session r4926 - in trunk: . gnome-session



Author: mccann
Date: Fri Aug  8 17:36:50 2008
New Revision: 4926
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4926&view=rev

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

	* gnome-session/gsm-inhibit-dialog.c (add_inhibitor),
	(gsm_inhibit_dialog_set_client_store),
	(gsm_inhibit_dialog_set_property),
	(gsm_inhibit_dialog_get_property), (gsm_inhibit_dialog_class_init),
	(gsm_inhibit_dialog_new):
	* gnome-session/gsm-inhibit-dialog.h:
	* gnome-session/gsm-manager.c (query_end_session_complete),
	(on_client_end_session_response), (request_reboot),
	(request_shutdown), (request_suspend), (request_hibernate),
	(request_switch_user):
	Try to get application name for client when not responding
	and we don't have an app-id for it.
	Should fix #546755



Modified:
   trunk/ChangeLog
   trunk/gnome-session/gsm-inhibit-dialog.c
   trunk/gnome-session/gsm-inhibit-dialog.h
   trunk/gnome-session/gsm-manager.c

Modified: trunk/gnome-session/gsm-inhibit-dialog.c
==============================================================================
--- trunk/gnome-session/gsm-inhibit-dialog.c	(original)
+++ trunk/gnome-session/gsm-inhibit-dialog.c	Fri Aug  8 17:36:50 2008
@@ -36,6 +36,7 @@
 
 #include "gsm-inhibit-dialog.h"
 #include "gsm-store.h"
+#include "gsm-client.h"
 #include "gsm-inhibitor.h"
 #include "eggdesktopfile.h"
 #include "gsm-util.h"
@@ -66,6 +67,7 @@
         int                action;
         gboolean           is_done;
         GsmStore          *inhibitors;
+        GsmStore          *clients;
         GtkListStore      *list_store;
         gboolean           have_xrender;
         int                xrender_event_base;
@@ -76,6 +78,7 @@
         PROP_0,
         PROP_ACTION,
         PROP_INHIBITOR_STORE,
+        PROP_CLIENT_STORE,
 };
 
 enum {
@@ -489,11 +492,14 @@
         GError         *error;
         char          **search_dirs;
         guint           xid;
+        char           *freeme;
 
         /* FIXME: get info from xid */
 
         name = NULL;
         pixbuf = NULL;
+        freeme = NULL;
+
         app_id = gsm_inhibitor_peek_app_id (inhibitor);
 
         if (IS_STRING_EMPTY (app_id)) {
@@ -553,6 +559,19 @@
                 }
         }
 
+        /* try client info */
+        if (name == NULL) {
+                const char *client_id;
+                client_id = gsm_inhibitor_peek_client_id (inhibitor);
+                if (! IS_STRING_EMPTY (client_id)) {
+                        GsmClient *client;
+                        client = gsm_store_lookup (dialog->priv->clients, client_id);
+                        if (client != NULL) {
+                                freeme = name = gsm_client_get_app_name (client);
+                        }
+                }
+        }
+
         if (name == NULL) {
                 if (! IS_STRING_EMPTY (app_id)) {
                         name = app_id;
@@ -579,6 +598,7 @@
                                            -1);
 
         g_free (desktop_filename);
+        g_free (freeme);
         if (pixbuf != NULL) {
                 g_object_unref (pixbuf);
         }
@@ -714,6 +734,23 @@
 }
 
 static void
+gsm_inhibit_dialog_set_client_store (GsmInhibitDialog *dialog,
+                                     GsmStore         *store)
+{
+        g_return_if_fail (GSM_IS_INHIBIT_DIALOG (dialog));
+
+        if (store != NULL) {
+                g_object_ref (store);
+        }
+
+        if (dialog->priv->clients != NULL) {
+                g_object_unref (dialog->priv->clients);
+        }
+
+        dialog->priv->clients = store;
+}
+
+static void
 gsm_inhibit_dialog_set_property (GObject        *object,
                                  guint           prop_id,
                                  const GValue   *value,
@@ -728,6 +765,9 @@
         case PROP_INHIBITOR_STORE:
                 gsm_inhibit_dialog_set_inhibitor_store (dialog, g_value_get_object (value));
                 break;
+        case PROP_CLIENT_STORE:
+                gsm_inhibit_dialog_set_client_store (dialog, g_value_get_object (value));
+                break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                 break;
@@ -749,6 +789,9 @@
         case PROP_INHIBITOR_STORE:
                 g_value_set_object (value, dialog->priv->inhibitors);
                 break;
+        case PROP_CLIENT_STORE:
+                g_value_set_object (value, dialog->priv->clients);
+                break;
         default:
                 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
                 break;
@@ -982,6 +1025,13 @@
                                                               NULL,
                                                               GSM_TYPE_STORE,
                                                               G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
+        g_object_class_install_property (object_class,
+                                         PROP_CLIENT_STORE,
+                                         g_param_spec_object ("client-store",
+                                                              NULL,
+                                                              NULL,
+                                                              GSM_TYPE_STORE,
+                                                              G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
 
         g_type_class_add_private (klass, sizeof (GsmInhibitDialogPrivate));
 }
@@ -1031,6 +1081,7 @@
 
 GtkWidget *
 gsm_inhibit_dialog_new (GsmStore *inhibitors,
+                        GsmStore *clients,
                         int       action)
 {
         GObject *object;
@@ -1038,6 +1089,7 @@
         object = g_object_new (GSM_TYPE_INHIBIT_DIALOG,
                                "action", action,
                                "inhibitor-store", inhibitors,
+                               "client-store", clients,
                                NULL);
 
         return GTK_WIDGET (object);

Modified: trunk/gnome-session/gsm-inhibit-dialog.h
==============================================================================
--- trunk/gnome-session/gsm-inhibit-dialog.h	(original)
+++ trunk/gnome-session/gsm-inhibit-dialog.h	Fri Aug  8 17:36:50 2008
@@ -61,6 +61,7 @@
 GType                  gsm_inhibit_dialog_get_type           (void);
 
 GtkWidget            * gsm_inhibit_dialog_new                (GsmStore         *inhibitors,
+                                                              GsmStore         *clients,
                                                               int               action);
 GtkTreeModel         * gsm_inhibit_dialog_get_model          (GsmInhibitDialog *dialog);
 

Modified: trunk/gnome-session/gsm-manager.c
==============================================================================
--- trunk/gnome-session/gsm-manager.c	(original)
+++ trunk/gnome-session/gsm-manager.c	Fri Aug  8 17:36:50 2008
@@ -806,6 +806,7 @@
         }
 
         manager->priv->inhibit_dialog = gsm_inhibit_dialog_new (manager->priv->inhibitors,
+                                                                manager->priv->clients,
                                                                 GSM_LOGOUT_ACTION_LOGOUT);
 
         g_signal_connect (manager->priv->inhibit_dialog,
@@ -1437,7 +1438,7 @@
                 inhibitor = gsm_inhibitor_new_for_client (gsm_client_peek_id (client),
                                                           app_id,
                                                           GSM_INHIBITOR_FLAG_LOGOUT,
-                                                          reason,
+                                                          reason != NULL ? reason : _("Not responding"),
                                                           bus_name,
                                                           cookie);
                 g_free (app_id);
@@ -2181,6 +2182,7 @@
         }
 
         manager->priv->inhibit_dialog = gsm_inhibit_dialog_new (manager->priv->inhibitors,
+                                                                manager->priv->clients,
                                                                 GSM_LOGOUT_ACTION_REBOOT);
 
         g_signal_connect (manager->priv->inhibit_dialog,
@@ -2208,6 +2210,7 @@
         }
 
         manager->priv->inhibit_dialog = gsm_inhibit_dialog_new (manager->priv->inhibitors,
+                                                                manager->priv->clients,
                                                                 GSM_LOGOUT_ACTION_SHUTDOWN);
 
         g_signal_connect (manager->priv->inhibit_dialog,
@@ -2234,6 +2237,7 @@
         }
 
         manager->priv->inhibit_dialog = gsm_inhibit_dialog_new (manager->priv->inhibitors,
+                                                                manager->priv->clients,
                                                                 GSM_LOGOUT_ACTION_SLEEP);
 
         g_signal_connect (manager->priv->inhibit_dialog,
@@ -2261,6 +2265,7 @@
         }
 
         manager->priv->inhibit_dialog = gsm_inhibit_dialog_new (manager->priv->inhibitors,
+                                                                manager->priv->clients,
                                                                 GSM_LOGOUT_ACTION_HIBERNATE);
 
         g_signal_connect (manager->priv->inhibit_dialog,
@@ -2297,6 +2302,7 @@
         }
 
         manager->priv->inhibit_dialog = gsm_inhibit_dialog_new (manager->priv->inhibitors,
+                                                                manager->priv->clients,
                                                                 GSM_LOGOUT_ACTION_SWITCH_USER);
 
         g_signal_connect (manager->priv->inhibit_dialog,



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