gnome-session r4812 - in branches/dbus_based: . gnome-session
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-session r4812 - in branches/dbus_based: . gnome-session
- Date: Thu, 17 Jul 2008 21:06:42 +0000 (UTC)
Author: mccann
Date: Thu Jul 17 21:06:42 2008
New Revision: 4812
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4812&view=rev
Log:
2008-07-17 William Jon McCann <jmccann redhat com>
* gnome-session/gsm-inhibitor.c (gsm_inhibitor_new_for_client):
* gnome-session/gsm-inhibitor.h:
* gnome-session/gsm-manager.c (_debug_inhibitor),
(debug_inhibitors), (inhibitor_has_bus_name),
(remove_inhibitors_for_connection),
(on_client_end_session_response), (on_query_end_session_timeout):
Also clear JIT inhibitors from DBus clients when they leave the
bus.
Modified:
branches/dbus_based/ChangeLog
branches/dbus_based/gnome-session/gsm-inhibitor.c
branches/dbus_based/gnome-session/gsm-inhibitor.h
branches/dbus_based/gnome-session/gsm-manager.c
Modified: branches/dbus_based/gnome-session/gsm-inhibitor.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-inhibitor.c (original)
+++ branches/dbus_based/gnome-session/gsm-inhibitor.c Thu Jul 17 21:06:42 2008
@@ -399,6 +399,7 @@
const char *app_id,
guint flags,
const char *reason,
+ const char *bus_name,
guint cookie)
{
GsmInhibitor *inhibitor;
@@ -407,6 +408,7 @@
"client-id", client_id,
"app-id", app_id,
"reason", reason,
+ "bus-name", bus_name,
"flags", flags,
"cookie", cookie,
NULL);
Modified: branches/dbus_based/gnome-session/gsm-inhibitor.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-inhibitor.h (original)
+++ branches/dbus_based/gnome-session/gsm-inhibitor.h Thu Jul 17 21:06:42 2008
@@ -67,6 +67,7 @@
const char *app_id,
guint flags,
const char *reason,
+ const char *bus_name,
guint cookie);
const char * gsm_inhibitor_get_app_id (GsmInhibitor *inhibitor);
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 21:06:42 2008
@@ -183,6 +183,27 @@
}
static gboolean
+_debug_inhibitor (const char *id,
+ GsmInhibitor *inhibitor,
+ GsmManager *manager)
+{
+ g_debug ("GsmManager: Inhibitor app:%s client:%s bus-name:%s reason:%s",
+ gsm_inhibitor_get_app_id (inhibitor),
+ gsm_inhibitor_get_client_id (inhibitor),
+ gsm_inhibitor_get_bus_name (inhibitor),
+ gsm_inhibitor_get_reason (inhibitor));
+ return FALSE;
+}
+
+static void
+debug_inhibitors (GsmManager *manager)
+{
+ gsm_inhibitor_store_foreach (manager->priv->inhibitors,
+ (GsmInhibitorStoreFunc)_debug_inhibitor,
+ manager);
+}
+
+static gboolean
_find_by_startup_id (const char *id,
GsmClient *client,
const char *startup_id_a)
@@ -517,9 +538,9 @@
}
static gboolean
-inhibitor_has_bus_name (gpointer key,
- GsmInhibitor *inhibitor,
- const char *bus_name_a)
+inhibitor_has_bus_name (gpointer key,
+ GsmInhibitor *inhibitor,
+ RemoveClientData *data)
{
gboolean matches;
const char *bus_name_b;
@@ -527,8 +548,8 @@
bus_name_b = gsm_inhibitor_get_bus_name (inhibitor);
matches = FALSE;
- if (bus_name_a != NULL && bus_name_b != NULL) {
- matches = (strcmp (bus_name_a, bus_name_b) == 0);
+ if (data->service_name != NULL && bus_name_b != NULL) {
+ matches = (strcmp (data->service_name, bus_name_b) == 0);
if (matches) {
g_debug ("GsmManager: removing inhibitor from %s for reason '%s' on connection %s",
gsm_inhibitor_get_app_id (inhibitor),
@@ -537,8 +558,6 @@
}
}
- /* FIXME: also look for inhibitors from client with dbus name */
-
return matches;
}
@@ -546,11 +565,17 @@
remove_inhibitors_for_connection (GsmManager *manager,
const char *service_name)
{
- guint n_removed;
+ guint n_removed;
+ RemoveClientData data;
+
+ data.service_name = service_name;
+ data.manager = manager;
+
+ debug_inhibitors (manager);
n_removed = gsm_inhibitor_store_foreach_remove (manager->priv->inhibitors,
(GsmInhibitorStoreFunc)inhibitor_has_bus_name,
- (gpointer)service_name);
+ &data);
}
static gboolean
@@ -844,10 +869,16 @@
guint cookie;
GsmInhibitor *inhibitor;
const char *app_id;
+ const char *bus_name;
/* FIXME: do we support updating the reason? */
/* Create JIT inhibit */
+ if (GSM_IS_DBUS_CLIENT (client)) {
+ bus_name = gsm_dbus_client_get_bus_name (GSM_DBUS_CLIENT (client));
+ } else {
+ bus_name = NULL;
+ }
app_id = gsm_client_get_app_id (client);
if (app_id == NULL || app_id[0] == '\0') {
@@ -860,6 +891,7 @@
app_id,
GSM_INHIBITOR_FLAG_LOGOUT,
reason,
+ bus_name,
cookie);
gsm_inhibitor_store_add (manager->priv->inhibitors, inhibitor);
g_object_unref (inhibitor);
@@ -1914,17 +1946,24 @@
for (l = manager->priv->query_clients; l != NULL; l = l->next) {
guint cookie;
GsmInhibitor *inhibitor;
+ const char *bus_name;
g_warning ("Client '%s' failed to reply before timeout",
gsm_client_get_id (l->data));
/* Add JIT inhibit for unresponsive client */
+ if (GSM_IS_DBUS_CLIENT (l->data)) {
+ bus_name = gsm_dbus_client_get_bus_name (l->data);
+ } else {
+ bus_name = NULL;
+ }
cookie = _generate_unique_cookie (manager);
inhibitor = gsm_inhibitor_new_for_client (gsm_client_get_id (l->data),
gsm_client_get_app_id (l->data),
GSM_INHIBITOR_FLAG_LOGOUT,
_("Not responding"),
+ bus_name,
cookie);
gsm_inhibitor_store_add (manager->priv->inhibitors, inhibitor);
g_object_unref (inhibitor);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]