|
|
6683077 |
diff -up gnome-screensaver-2.28.0/src/gs-listener-dbus.c.remove-session-inhibits gnome-screensaver-2.28.0/src/gs-listener-dbus.c
|
|
|
6683077 |
--- gnome-screensaver-2.28.0/src/gs-listener-dbus.c.remove-session-inhibits 2009-08-19 19:19:14.000000000 -0400
|
|
|
6683077 |
+++ gnome-screensaver-2.28.0/src/gs-listener-dbus.c 2009-11-02 18:07:57.129864647 -0500
|
|
|
6683077 |
@@ -985,47 +985,40 @@ listener_dbus_remove_ref_entry (GSListen
|
|
|
6683077 |
}
|
|
|
6683077 |
|
|
|
6683077 |
static gboolean
|
|
|
6683077 |
-listener_ref_entry_has_connection (gpointer key,
|
|
|
6683077 |
- gpointer value,
|
|
|
6683077 |
- gpointer user_data)
|
|
|
6683077 |
-{
|
|
|
6683077 |
- GSListenerRefEntry *entry;
|
|
|
6683077 |
- const char *connection;
|
|
|
6683077 |
- gboolean matches;
|
|
|
6683077 |
-
|
|
|
6683077 |
- entry = (GSListenerRefEntry *)value;
|
|
|
6683077 |
- connection = (const char *) user_data;
|
|
|
6683077 |
-
|
|
|
6683077 |
- matches = FALSE;
|
|
|
6683077 |
- if (connection != NULL && entry->connection != NULL) {
|
|
|
6683077 |
- matches = (strcmp (connection, entry->connection) == 0);
|
|
|
6683077 |
- if (matches) {
|
|
|
6683077 |
- gs_debug ("removing %s from %s for reason '%s' on connection %s",
|
|
|
6683077 |
- get_name_for_entry_type (entry->entry_type),
|
|
|
6683077 |
- entry->application,
|
|
|
6683077 |
- entry->reason,
|
|
|
6683077 |
- entry->connection);
|
|
|
6683077 |
- }
|
|
|
6683077 |
- }
|
|
|
6683077 |
-
|
|
|
6683077 |
- return matches;
|
|
|
6683077 |
-}
|
|
|
6683077 |
-
|
|
|
6683077 |
-static gboolean
|
|
|
6683077 |
listener_ref_entry_remove_for_connection (GSListener *listener,
|
|
|
6683077 |
int entry_type,
|
|
|
6683077 |
const char *connection)
|
|
|
6683077 |
{
|
|
|
6683077 |
gboolean removed;
|
|
|
6683077 |
- guint n_removed;
|
|
|
6683077 |
GHashTable *hash;
|
|
|
6683077 |
+ GHashTableIter iter;
|
|
|
6683077 |
+ GSListenerRefEntry *entry;
|
|
|
6683077 |
+
|
|
|
6683077 |
+ if (connection == NULL)
|
|
|
6683077 |
+ return FALSE;
|
|
|
6683077 |
|
|
|
6683077 |
hash = get_hash_for_entry_type (listener, entry_type);
|
|
|
6683077 |
|
|
|
6683077 |
removed = FALSE;
|
|
|
6683077 |
- n_removed = g_hash_table_foreach_remove (hash, listener_ref_entry_has_connection, (gpointer)connection);
|
|
|
6683077 |
+ g_hash_table_iter_init (&iter, hash);
|
|
|
6683077 |
+ while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry)) {
|
|
|
6683077 |
+ if (entry->connection != NULL &&
|
|
|
6683077 |
+ strcmp (connection, entry->connection) == 0) {
|
|
|
6683077 |
+ gs_debug ("removing %s from %s for reason '%s' on connection %s",
|
|
|
6683077 |
+ get_name_for_entry_type (entry->entry_type),
|
|
|
6683077 |
+ entry->application,
|
|
|
6683077 |
+ entry->reason,
|
|
|
6683077 |
+ entry->connection);
|
|
|
6683077 |
+
|
|
|
6683077 |
+ if (entry->entry_type == REF_ENTRY_TYPE_INHIBIT) {
|
|
|
6683077 |
+ /* remove inhibit from gnome session */
|
|
|
6683077 |
+ remove_session_inhibit (listener, entry);
|
|
|
6683077 |
+ }
|
|
|
6683077 |
|
|
|
6683077 |
- removed = (n_removed > 0);
|
|
|
6683077 |
+ g_hash_table_iter_remove (&iter);
|
|
|
6683077 |
+ removed = TRUE;
|
|
|
6683077 |
+ }
|
|
|
6683077 |
+ }
|
|
|
6683077 |
|
|
|
6683077 |
return removed;
|
|
|
6683077 |
}
|