Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 295227
Collapse All | Expand All

(-)gnome-screensaver-2.28.0/src/gs-listener-dbus.c (-30 / +23 lines)
Lines 985-1031 Link Here
985
}
985
}
986
986
987
static gboolean
987
static gboolean
988
listener_ref_entry_has_connection (gpointer key,
989
                                   gpointer value,
990
                                   gpointer user_data)
991
{
992
        GSListenerRefEntry *entry;
993
        const char         *connection;
994
        gboolean            matches;
995
996
        entry = (GSListenerRefEntry *)value;
997
        connection = (const char *) user_data;
998
999
        matches = FALSE;
1000
        if (connection != NULL && entry->connection != NULL) {
1001
                matches = (strcmp (connection, entry->connection) == 0);
1002
                if (matches) {
1003
                        gs_debug ("removing %s from %s for reason '%s' on connection %s",
1004
                                  get_name_for_entry_type (entry->entry_type),
1005
                                  entry->application,
1006
                                  entry->reason,
1007
                                  entry->connection);
1008
                }
1009
        }
1010
1011
        return matches;
1012
}
1013
1014
static gboolean
1015
listener_ref_entry_remove_for_connection (GSListener  *listener,
988
listener_ref_entry_remove_for_connection (GSListener  *listener,
1016
                                          int          entry_type,
989
                                          int          entry_type,
1017
                                          const char  *connection)
990
                                          const char  *connection)
1018
{
991
{
1019
        gboolean    removed;
992
        gboolean    removed;
1020
        guint       n_removed;
1021
        GHashTable *hash;
993
        GHashTable *hash;
994
        GHashTableIter iter;
995
        GSListenerRefEntry *entry;
996
997
        if (connection == NULL)
998
                return FALSE;
1022
999
1023
        hash = get_hash_for_entry_type (listener, entry_type);
1000
        hash = get_hash_for_entry_type (listener, entry_type);
1024
1001
1025
        removed = FALSE;
1002
        removed = FALSE;
1026
        n_removed = g_hash_table_foreach_remove (hash, listener_ref_entry_has_connection, (gpointer)connection);
1003
        g_hash_table_iter_init (&iter, hash);
1004
        while (g_hash_table_iter_next (&iter, NULL, (gpointer *)&entry)) {
1005
                if (entry->connection != NULL &&
1006
                    strcmp (connection, entry->connection) == 0) {
1007
                        gs_debug ("removing %s from %s for reason '%s' on connection %s",
1008
                                  get_name_for_entry_type (entry->entry_type),
1009
                                  entry->application,
1010
                                  entry->reason,
1011
                                  entry->connection);
1012
1013
                        if (entry->entry_type == REF_ENTRY_TYPE_INHIBIT) {
1014
                                /* remove inhibit from gnome session */
1015
                                remove_session_inhibit (listener, entry);
1016
                        }
1027
1017
1028
        removed = (n_removed > 0);
1018
                        g_hash_table_iter_remove (&iter);
1019
                        removed = TRUE;
1020
                }
1021
        }
1029
1022
1030
        return removed;
1023
        return removed;
1031
}
1024
}

Return to bug 295227