gnome-session r4769 - in branches/dbus_based: . gnome-session
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-session r4769 - in branches/dbus_based: . gnome-session
- Date: Tue, 24 Jun 2008 23:27:24 +0000 (UTC)
Author: mccann
Date: Tue Jun 24 23:27:24 2008
New Revision: 4769
URL: http://svn.gnome.org/viewvc/gnome-session?rev=4769&view=rev
Log:
2008-06-24 William Jon McCann <jmccann redhat com>
* gnome-session/gsm-inhibitor-store.c (gsm_inhibitor_store_lookup),
(foreach_remove_wrapper), (gsm_inhibitor_store_foreach_remove),
(gsm_inhibitor_store_add), (gsm_inhibitor_store_init):
* gnome-session/gsm-inhibitor-store.h:
* gnome-session/gsm-logout-inhibit-dialog.c (find_inhibitor),
(_util_icon_remove_extension), (_find_icon), (_load_icon),
(add_inhibitor), (on_store_inhibitor_added),
(on_store_inhibitor_removed),
(gsm_logout_inhibit_dialog_set_inhibitor_store),
(gsm_logout_inhibit_dialog_set_property),
(gsm_logout_inhibit_dialog_get_property), (name_cell_data_func),
(add_to_model), (populate_model), (setup_dialog),
(gsm_logout_inhibit_dialog_class_init),
(gsm_logout_inhibit_dialog_init),
(gsm_logout_inhibit_dialog_finalize),
(gsm_logout_inhibit_dialog_new):
* gnome-session/gsm-logout-inhibit-dialog.h:
* gnome-session/gsm-manager.c (inhibitor_has_bus_name),
(bus_name_owner_changed), (logout_inhibit_dialog_response),
(request_logout), (_generate_unique_cookie),
(gsm_manager_uninhibit):
Populate inhibit dialog.
Modified:
branches/dbus_based/ChangeLog
branches/dbus_based/gnome-session/gsm-inhibitor-store.c
branches/dbus_based/gnome-session/gsm-inhibitor-store.h
branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c
branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.h
branches/dbus_based/gnome-session/gsm-manager.c
Modified: branches/dbus_based/gnome-session/gsm-inhibitor-store.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-inhibitor-store.c (original)
+++ branches/dbus_based/gnome-session/gsm-inhibitor-store.c Tue Jun 24 23:27:24 2008
@@ -136,32 +136,58 @@
GsmInhibitor *
gsm_inhibitor_store_lookup (GsmInhibitorStore *store,
- guint *cookie)
+ guint cookie)
{
GsmInhibitor *inhibitor;
g_return_val_if_fail (store != NULL, NULL);
- g_return_val_if_fail (cookie != NULL, NULL);
inhibitor = g_hash_table_lookup (store->priv->inhibitors,
- cookie);
+ GUINT_TO_POINTER (cookie));
return inhibitor;
}
+typedef struct
+{
+ GsmInhibitorStoreFunc func;
+ gpointer user_data;
+ GsmInhibitorStore *store;
+} WrapperData;
+
+static gboolean
+foreach_remove_wrapper (guint *cookie,
+ GsmInhibitor *inhibitor,
+ WrapperData *data)
+{
+ gboolean res;
+
+ res = (data->func) (cookie, inhibitor, data->user_data);
+ if (res) {
+ g_signal_emit (data->store, signals [INHIBITOR_REMOVED], 0, gsm_inhibitor_get_cookie (inhibitor));
+ }
+
+ return res;
+}
+
guint
gsm_inhibitor_store_foreach_remove (GsmInhibitorStore *store,
GsmInhibitorStoreFunc func,
gpointer user_data)
{
- guint ret;
+ guint ret;
+ WrapperData data;
g_return_val_if_fail (store != NULL, 0);
g_return_val_if_fail (func != NULL, 0);
+ data.store = store;
+ data.user_data = user_data;
+ data.func = func;
+
ret = g_hash_table_foreach_remove (store->priv->inhibitors,
- (GHRFunc)func,
- user_data);
+ (GHRFunc)foreach_remove_wrapper,
+ &data);
return ret;
}
@@ -179,7 +205,7 @@
g_debug ("GsmInhibitorStore: Adding inhibitor %u to store", cookie);
g_hash_table_insert (store->priv->inhibitors,
- &cookie,
+ GUINT_TO_POINTER (cookie),
g_object_ref (inhibitor));
g_signal_emit (store, signals [INHIBITOR_ADDED], 0, cookie);
@@ -267,8 +293,8 @@
store->priv = GSM_INHIBITOR_STORE_GET_PRIVATE (store);
- store->priv->inhibitors = g_hash_table_new_full (g_int_hash,
- g_int_equal,
+ store->priv->inhibitors = g_hash_table_new_full (g_direct_hash,
+ g_direct_equal,
NULL,
(GDestroyNotify) inhibitor_unref);
}
Modified: branches/dbus_based/gnome-session/gsm-inhibitor-store.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-inhibitor-store.h (original)
+++ branches/dbus_based/gnome-session/gsm-inhibitor-store.h Tue Jun 24 23:27:24 2008
@@ -84,7 +84,7 @@
GsmInhibitorStoreFunc predicate,
gpointer user_data);
GsmInhibitor * gsm_inhibitor_store_lookup (GsmInhibitorStore *store,
- guint *cookie);
+ guint cookie);
G_END_DECLS
Modified: branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c
==============================================================================
--- branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c (original)
+++ branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.c Tue Jun 24 23:27:24 2008
@@ -34,20 +34,36 @@
#include <gconf/gconf-client.h>
#include "gsm-logout-inhibit-dialog.h"
+#include "eggdesktopfile.h"
#define GSM_LOGOUT_INHIBIT_DIALOG_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GSM_TYPE_LOGOUT_INHIBIT_DIALOG, GsmLogoutInhibitDialogPrivate))
#define GLADE_XML_FILE "gsm-logout-inhibit-dialog.glade"
+#ifndef DEFAULT_ICON_SIZE
+#define DEFAULT_ICON_SIZE 64
+#endif
+
struct GsmLogoutInhibitDialogPrivate
{
- GladeXML *xml;
- int action;
+ GladeXML *xml;
+ int action;
+ GsmInhibitorStore *inhibitors;
+ GtkListStore *list_store;
};
enum {
PROP_0,
PROP_ACTION,
+ PROP_INHIBITOR_STORE,
+};
+
+enum {
+ INHIBIT_IMAGE_COLUMN = 0,
+ INHIBIT_NAME_COLUMN,
+ INHIBIT_REASON_COLUMN,
+ INHIBIT_COOKIE_COLUMN,
+ NUMBER_OF_COLUMNS
};
static void gsm_logout_inhibit_dialog_class_init (GsmLogoutInhibitDialogClass *klass);
@@ -63,6 +79,281 @@
dialog->priv->action = action;
}
+static gboolean
+find_inhibitor (GsmLogoutInhibitDialog *dialog,
+ guint cookie,
+ GtkTreeIter *iter)
+{
+ GtkTreeModel *model;
+ gboolean found_item;
+
+ g_assert (GSM_IS_LOGOUT_INHIBIT_DIALOG (dialog));
+
+ found_item = FALSE;
+ model = GTK_TREE_MODEL (dialog->priv->list_store);
+
+ if (!gtk_tree_model_get_iter_first (model, iter)) {
+ return FALSE;
+ }
+
+ do {
+ guint item_cookie;
+
+ gtk_tree_model_get (model,
+ iter,
+ INHIBIT_COOKIE_COLUMN, &item_cookie,
+ -1);
+ g_debug ("Comparing cookie %u %u", item_cookie, cookie);
+ if (cookie == item_cookie) {
+ found_item = TRUE;
+ }
+ } while (!found_item && gtk_tree_model_iter_next (model, iter));
+
+ return found_item;
+}
+
+/* copied from gnome-panel panel-util.c */
+static char *
+_util_icon_remove_extension (const char *icon)
+{
+ char *icon_no_extension;
+ char *p;
+
+ icon_no_extension = g_strdup (icon);
+ p = strrchr (icon_no_extension, '.');
+ if (p &&
+ (strcmp (p, ".png") == 0 ||
+ strcmp (p, ".xpm") == 0 ||
+ strcmp (p, ".svg") == 0)) {
+ *p = 0;
+ }
+
+ return icon_no_extension;
+}
+
+/* copied from gnome-panel panel-util.c */
+static char *
+_find_icon (GtkIconTheme *icon_theme,
+ const char *icon_name,
+ gint size)
+{
+ GtkIconInfo *info;
+ char *retval;
+ char *icon_no_extension;
+
+ if (icon_name == NULL || strcmp (icon_name, "") == 0)
+ return NULL;
+
+ if (g_path_is_absolute (icon_name)) {
+ if (g_file_test (icon_name, G_FILE_TEST_EXISTS)) {
+ return g_strdup (icon_name);
+ } else {
+ char *basename;
+
+ basename = g_path_get_basename (icon_name);
+ retval = _find_icon (icon_theme, basename,
+ size);
+ g_free (basename);
+
+ return retval;
+ }
+ }
+
+ /* This is needed because some .desktop files have an icon name *and*
+ * an extension as icon */
+ icon_no_extension = _util_icon_remove_extension (icon_name);
+
+ info = gtk_icon_theme_lookup_icon (icon_theme, icon_no_extension,
+ size, 0);
+
+ g_free (icon_no_extension);
+
+ if (info) {
+ retval = g_strdup (gtk_icon_info_get_filename (info));
+ gtk_icon_info_free (info);
+ } else
+ retval = NULL;
+
+ return retval;
+}
+
+/* copied from gnome-panel panel-util.c */
+static GdkPixbuf *
+_load_icon (GtkIconTheme *icon_theme,
+ const char *icon_name,
+ int size,
+ int desired_width,
+ int desired_height,
+ char **error_msg)
+{
+ GdkPixbuf *retval;
+ char *file;
+ GError *error;
+
+ g_return_val_if_fail (error_msg == NULL || *error_msg == NULL, NULL);
+
+ file = _find_icon (icon_theme, icon_name, size);
+ if (!file) {
+ if (error_msg)
+ *error_msg = g_strdup_printf (_("Icon '%s' not found"),
+ icon_name);
+
+ return NULL;
+ }
+
+ error = NULL;
+ retval = gdk_pixbuf_new_from_file_at_size (file,
+ desired_width,
+ desired_height,
+ &error);
+ if (error) {
+ if (error_msg)
+ *error_msg = g_strdup (error->message);
+ g_error_free (error);
+ }
+
+ g_free (file);
+
+ return retval;
+}
+
+static void
+add_inhibitor (GsmLogoutInhibitDialog *dialog,
+ GsmInhibitor *inhibitor)
+{
+ const char *name;
+ const char *icon_name;
+ const char *app_id;
+ char *desktop_filename;
+ GdkPixbuf *pixbuf;
+ EggDesktopFile *desktop_file;
+ GError *error;
+
+ /* FIXME: get info from xid */
+
+ pixbuf = NULL;
+ app_id = gsm_inhibitor_get_app_id (inhibitor);
+
+ if (! g_str_has_suffix (app_id, ".desktop")) {
+ desktop_filename = g_strdup_printf ("%s.desktop", app_id);
+ } else {
+ desktop_filename = g_strdup (app_id);
+ }
+
+ error = NULL;
+ desktop_file = egg_desktop_file_new_from_data_dirs (desktop_filename, &error);
+ if (desktop_file == NULL) {
+ g_warning ("Unable to find desktop file '%s': %s", desktop_filename, error->message);
+ g_error_free (error);
+ name = app_id;
+ pixbuf = _load_icon (gtk_icon_theme_get_default (),
+ "gnome-windows",
+ DEFAULT_ICON_SIZE,
+ DEFAULT_ICON_SIZE,
+ DEFAULT_ICON_SIZE,
+ NULL);
+ } else {
+ name = egg_desktop_file_get_name (desktop_file);
+ icon_name = egg_desktop_file_get_icon (desktop_file);
+
+ pixbuf = _load_icon (gtk_icon_theme_get_default (),
+ icon_name,
+ DEFAULT_ICON_SIZE,
+ DEFAULT_ICON_SIZE,
+ DEFAULT_ICON_SIZE,
+ NULL);
+ }
+
+ gtk_list_store_insert_with_values (dialog->priv->list_store,
+ NULL, 0,
+ INHIBIT_IMAGE_COLUMN, pixbuf,
+ INHIBIT_NAME_COLUMN, name,
+ INHIBIT_REASON_COLUMN, gsm_inhibitor_get_reason (inhibitor),
+ INHIBIT_COOKIE_COLUMN, gsm_inhibitor_get_cookie (inhibitor),
+ -1);
+
+ g_free (desktop_filename);
+ if (pixbuf != NULL) {
+ g_object_unref (pixbuf);
+ }
+}
+
+static void
+on_store_inhibitor_added (GsmInhibitorStore *store,
+ guint cookie,
+ GsmLogoutInhibitDialog *dialog)
+{
+ GsmInhibitor *inhibitor;
+ GtkTreeIter iter;
+
+ g_debug ("GsmLogoutInhibitDialog: inhibitor added: %u", cookie);
+
+ inhibitor = gsm_inhibitor_store_lookup (store, cookie);
+
+ /* Add to model */
+ if (! find_inhibitor (dialog, cookie, &iter)) {
+ add_inhibitor (dialog, inhibitor);
+ }
+
+}
+
+static void
+on_store_inhibitor_removed (GsmInhibitorStore *store,
+ guint cookie,
+ GsmLogoutInhibitDialog *dialog)
+{
+ GtkTreeIter iter;
+
+ g_debug ("GsmLogoutInhibitDialog: inhibitor removed: %u", cookie);
+
+ /* Remove from model */
+ if (find_inhibitor (dialog, cookie, &iter)) {
+ gtk_list_store_remove (dialog->priv->list_store, &iter);
+ }
+
+ /* if there are no inhibitors left then trigger response */
+ if (! gtk_tree_model_get_iter_first (GTK_TREE_MODEL (dialog->priv->list_store), &iter)) {
+ gtk_dialog_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
+ }
+}
+
+static void
+gsm_logout_inhibit_dialog_set_inhibitor_store (GsmLogoutInhibitDialog *dialog,
+ GsmInhibitorStore *store)
+{
+ g_return_if_fail (GSM_IS_LOGOUT_INHIBIT_DIALOG (dialog));
+
+ if (store != NULL) {
+ g_object_ref (store);
+ }
+
+ if (dialog->priv->inhibitors != NULL) {
+ g_signal_handlers_disconnect_by_func (dialog->priv->inhibitors,
+ on_store_inhibitor_added,
+ dialog);
+ g_signal_handlers_disconnect_by_func (dialog->priv->inhibitors,
+ on_store_inhibitor_removed,
+ dialog);
+
+ g_object_unref (dialog->priv->inhibitors);
+ }
+
+
+ g_debug ("GsmLogoutInhibitDialog: setting store %p", store);
+
+ dialog->priv->inhibitors = store;
+
+ if (dialog->priv->inhibitors != NULL) {
+ g_signal_connect (dialog->priv->inhibitors,
+ "inhibitor-added",
+ G_CALLBACK (on_store_inhibitor_added),
+ dialog);
+ g_signal_connect (dialog->priv->inhibitors,
+ "inhibitor-removed",
+ G_CALLBACK (on_store_inhibitor_removed),
+ dialog);
+ }
+}
static void
gsm_logout_inhibit_dialog_set_property (GObject *object,
@@ -76,6 +367,9 @@
case PROP_ACTION:
gsm_logout_inhibit_dialog_set_action (dialog, g_value_get_int (value));
break;
+ case PROP_INHIBITOR_STORE:
+ gsm_logout_inhibit_dialog_set_inhibitor_store (dialog, g_value_get_object (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -94,6 +388,9 @@
case PROP_ACTION:
g_value_set_int (value, dialog->priv->action);
break;
+ case PROP_INHIBITOR_STORE:
+ g_value_set_object (value, dialog->priv->inhibitors);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -101,19 +398,60 @@
}
static void
-on_response (GsmLogoutInhibitDialog *dialog,
- gint response_id)
+name_cell_data_func (GtkTreeViewColumn *tree_column,
+ GtkCellRenderer *cell,
+ GtkTreeModel *model,
+ GtkTreeIter *iter,
+ GsmLogoutInhibitDialog *dialog)
+{
+ char *name;
+ char *reason;
+ char *markup;
+
+ name = NULL;
+ reason = NULL;
+ gtk_tree_model_get (model,
+ iter,
+ INHIBIT_NAME_COLUMN, &name,
+ INHIBIT_REASON_COLUMN, &reason,
+ -1);
+
+ markup = g_strdup_printf ("<b>%s</b>\n"
+ "<i><span size=\"x-small\">%s</span></i>",
+ name ? name : "(null)",
+ reason ? reason : "(null)");
+
+ g_free (name);
+ g_free (reason);
+
+ g_object_set (cell, "markup", markup, NULL);
+ g_free (markup);
+}
+
+static gboolean
+add_to_model (guint cookie,
+ GsmInhibitor *inhibitor,
+ GsmLogoutInhibitDialog *dialog)
{
- switch (response_id) {
- default:
- break;
- }
+ add_inhibitor (dialog, inhibitor);
+ return FALSE;
+}
+
+static void
+populate_model (GsmLogoutInhibitDialog *dialog)
+{
+ gsm_inhibitor_store_foreach_remove (dialog->priv->inhibitors,
+ (GsmInhibitorStoreFunc)add_to_model,
+ dialog);
}
static void
setup_dialog (GsmLogoutInhibitDialog *dialog)
{
- const char *button_text;
+ const char *button_text;
+ GtkWidget *treeview;
+ GtkTreeViewColumn *column;
+ GtkCellRenderer *renderer;
switch (dialog->priv->action) {
case GSM_LOGOUT_ACTION_SWITCH_USER:
@@ -140,8 +478,54 @@
}
gtk_dialog_add_button (GTK_DIALOG (dialog),
+ _("Cancel"),
+ GTK_RESPONSE_CANCEL);
+ gtk_dialog_add_button (GTK_DIALOG (dialog),
button_text,
GTK_RESPONSE_ACCEPT);
+
+ dialog->priv->list_store = gtk_list_store_new (NUMBER_OF_COLUMNS,
+ GDK_TYPE_PIXBUF,
+ G_TYPE_STRING,
+ G_TYPE_STRING,
+ G_TYPE_UINT);
+
+ treeview = glade_xml_get_widget (dialog->priv->xml, "inhibitors-treeview");
+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (treeview),
+ GTK_TREE_MODEL (dialog->priv->list_store));
+
+ /* IMAGE COLUMN */
+ renderer = gtk_cell_renderer_pixbuf_new ();
+ gtk_cell_renderer_set_fixed_size (renderer,
+ DEFAULT_ICON_SIZE,
+ DEFAULT_ICON_SIZE);
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_pack_start (column, renderer, FALSE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+
+ gtk_tree_view_column_set_attributes (column,
+ renderer,
+ "pixbuf", INHIBIT_IMAGE_COLUMN,
+ NULL);
+
+ g_object_set (renderer, "xalign", 1.0, NULL);
+
+ /* NAME COLUMN */
+ renderer = gtk_cell_renderer_text_new ();
+ column = gtk_tree_view_column_new ();
+ gtk_tree_view_column_pack_start (column, renderer, FALSE);
+ gtk_tree_view_append_column (GTK_TREE_VIEW (treeview), column);
+ gtk_tree_view_column_set_cell_data_func (column,
+ renderer,
+ (GtkTreeCellDataFunc) name_cell_data_func,
+ dialog,
+ NULL);
+
+ gtk_tree_view_set_tooltip_column (GTK_TREE_VIEW (treeview),
+ INHIBIT_REASON_COLUMN);
+
+ populate_model (dialog);
}
static GObject *
@@ -187,6 +571,13 @@
G_MAXINT,
-1,
G_PARAM_READWRITE));
+ g_object_class_install_property (object_class,
+ PROP_INHIBITOR_STORE,
+ g_param_spec_object ("inhibitor-store",
+ NULL,
+ NULL,
+ GSM_TYPE_INHIBITOR_STORE,
+ G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_type_class_add_private (klass, sizeof (GsmLogoutInhibitDialogPrivate));
}
@@ -215,11 +606,6 @@
"allow-shrink", FALSE,
"allow-grow", FALSE,
NULL);
-
- g_signal_connect (dialog,
- "response",
- G_CALLBACK (on_response),
- dialog);
}
static void
@@ -234,16 +620,30 @@
g_return_if_fail (dialog->priv != NULL);
+ g_debug ("GsmLogoutInhibitDialog: finalizing");
+
+ g_signal_handlers_disconnect_by_func (dialog->priv->inhibitors,
+ on_store_inhibitor_added,
+ dialog);
+ g_signal_handlers_disconnect_by_func (dialog->priv->inhibitors,
+ on_store_inhibitor_removed,
+ dialog);
+ if (dialog->priv->inhibitors != NULL) {
+ g_object_unref (dialog->priv->inhibitors);
+ }
+
G_OBJECT_CLASS (gsm_logout_inhibit_dialog_parent_class)->finalize (object);
}
GtkWidget *
-gsm_logout_inhibit_dialog_new (int action)
+gsm_logout_inhibit_dialog_new (GsmInhibitorStore *inhibitors,
+ int action)
{
GObject *object;
object = g_object_new (GSM_TYPE_LOGOUT_INHIBIT_DIALOG,
"action", action,
+ "inhibitor-store", inhibitors,
NULL);
return GTK_WIDGET (object);
Modified: branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.h
==============================================================================
--- branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.h (original)
+++ branches/dbus_based/gnome-session/gsm-logout-inhibit-dialog.h Tue Jun 24 23:27:24 2008
@@ -24,6 +24,8 @@
#include <glib-object.h>
#include <gtk/gtkdialog.h>
+#include "gsm-inhibitor-store.h"
+
G_BEGIN_DECLS
#define GSM_TYPE_LOGOUT_INHIBIT_DIALOG (gsm_logout_inhibit_dialog_get_type ())
@@ -58,7 +60,8 @@
GType gsm_logout_inhibit_dialog_get_type (void);
-GtkWidget * gsm_logout_inhibit_dialog_new (int action);
+GtkWidget * gsm_logout_inhibit_dialog_new (GsmInhibitorStore *inhibitors,
+ int action);
GtkTreeModel * gsm_logout_inhibit_dialog_get_model (GsmLogoutInhibitDialog *dialog);
G_END_DECLS
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 Tue Jun 24 23:27:24 2008
@@ -499,7 +499,6 @@
const char *bus_name_b;
bus_name_b = gsm_inhibitor_get_bus_name (inhibitor);
- g_debug ("GsmManager: comparing bus names %s %s", bus_name_a, bus_name_b);
matches = FALSE;
if (bus_name_a != NULL && bus_name_b != NULL) {
@@ -613,9 +612,6 @@
const char *new_service_name,
GsmManager *manager)
{
- g_debug ("GsmManager: name owner changed old:'%s' new:'%s'",
- old_service_name,
- new_service_name);
if (strlen (new_service_name) == 0
&& strlen (old_service_name) > 0) {
/* service removed */
@@ -1519,6 +1515,7 @@
}
gtk_widget_destroy (GTK_WIDGET (dialog));
+ manager->priv->inhibit_dialog = NULL;
}
static void
@@ -1531,7 +1528,14 @@
return;
}
- manager->priv->inhibit_dialog = gsm_logout_inhibit_dialog_new (GSM_LOGOUT_ACTION_LOGOUT);
+ if (manager->priv->inhibit_dialog != NULL) {
+ g_debug ("GsmManager: inhibit dialog already up");
+ gtk_window_present (GTK_WINDOW (manager->priv->inhibit_dialog));
+ return;
+ }
+
+ manager->priv->inhibit_dialog = gsm_logout_inhibit_dialog_new (manager->priv->inhibitors,
+ GSM_LOGOUT_ACTION_LOGOUT);
g_signal_connect (manager->priv->inhibit_dialog,
"response",
@@ -1921,7 +1925,7 @@
do {
cookie = generate_cookie ();
- } while (gsm_inhibitor_store_lookup (manager->priv->inhibitors, &cookie) != NULL);
+ } while (gsm_inhibitor_store_lookup (manager->priv->inhibitors, cookie) != NULL);
return cookie;
}
@@ -1991,7 +1995,7 @@
g_debug ("GsmManager: Uninhibit %u", cookie);
- inhibitor = gsm_inhibitor_store_lookup (manager->priv->inhibitors, &cookie);
+ inhibitor = gsm_inhibitor_store_lookup (manager->priv->inhibitors, cookie);
if (inhibitor == NULL) {
GError *new_error;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]