remove_session_inhibit (GSListener         *listener,
                        GSListenerRefEntry *entry)
{
        DBusMessage    *message;
        DBusMessage    *reply;
        DBusMessageIter iter;
        DBusError       error;

        g_return_if_fail (listener != NULL);

        if (entry->foreign_cookie == 0) {
                gs_debug ("Can't remove inhibitor from session: Session cookie not set");
                return;
        }

        dbus_error_init (&error);

        message = dbus_message_new_method_call (SESSION_NAME,
                                                SESSION_PATH,
                                                SESSION_INTERFACE,
                                                "Uninhibit");
        if (message == NULL) {
                gs_debug ("Couldn't allocate the dbus message");
                return;
        }

        dbus_message_iter_init_append (message, &iter);
        dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &entry->foreign_cookie);

        /* FIXME: use async? */
        reply = dbus_connection_send_with_reply_and_block (listener->priv->connection,
                                                           message,
                                                           -1,
                                                           &error);
        dbus_message_unref (message);

        if (dbus_error_is_set (&error)) {
                gs_debug ("%s raised:\n %s\n\n", error.name, error.message);
                dbus_error_free (&error);
                return;
        }

        dbus_message_unref (reply);
}
remove_session_inhibit (GSListener         *listener,
                        GSListenerRefEntry *entry)
{
        DBusMessage    *message;
        DBusMessage    *reply;
        DBusMessageIter iter;
        DBusError       error;

        g_return_if_fail (listener != NULL);

        if (entry->foreign_cookie == 0) {
                gs_debug ("Can't remove inhibitor from session: Session cookie not set");
                return;
        }

        dbus_error_init (&error);

        message = dbus_message_new_method_call (SESSION_NAME,
                                                SESSION_PATH,
                                                SESSION_INTERFACE,
                                                "Uninhibit");
        if (message == NULL) {
                gs_debug ("Couldn't allocate the dbus message");
                return;
        }

        dbus_message_iter_init_append (message, &iter);
        dbus_message_iter_append_basic (&iter, DBUS_TYPE_UINT32, &entry->foreign_cookie);

         
        reply = dbus_connection_send_with_reply_and_block (listener->priv->connection,
                                                           message,
                                                           -1,
                                                           &error);
        dbus_message_unref (message);

        if (dbus_error_is_set (&error)) {
                gs_debug ("%s raised:\n %s\n\n", error.name, error.message);
                dbus_error_free (&error);
                return;
        }

        dbus_message_unref (reply);
}