[gnome-settings-daemon/gnome-3-8] media-keys: Generalize ensure_drag_cancellable()
- From: Florian Müllner <fmuellner src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-settings-daemon/gnome-3-8] media-keys: Generalize ensure_drag_cancellable()
- Date: Wed, 6 Mar 2013 15:44:50 +0000 (UTC)
commit e9aaa11efab18b46585c5046e68cfa36423a92b9
Author: Florian Müllner <fmuellner gnome org>
Date: Sat Mar 2 16:48:32 2013 +0100
media-keys: Generalize ensure_drag_cancellable()
We will add another proxy for OSDs, changing the function to take
the address of a GCancellable* will make it reusable for that case.
https://bugzilla.gnome.org/show_bug.cgi?id=695021
plugins/media-keys/gsd-media-keys-manager.c | 20 ++++++++++----------
1 files changed, 10 insertions(+), 10 deletions(-)
---
diff --git a/plugins/media-keys/gsd-media-keys-manager.c b/plugins/media-keys/gsd-media-keys-manager.c
index 6f7a7af..683574b 100644
--- a/plugins/media-keys/gsd-media-keys-manager.c
+++ b/plugins/media-keys/gsd-media-keys-manager.c
@@ -374,14 +374,14 @@ get_key_string (GsdMediaKeysManager *manager,
}
static void
-ensure_grab_cancellable (GsdMediaKeysManager *manager)
+ensure_cancellable (GCancellable **cancellable)
{
- if (manager->priv->grab_cancellable == NULL) {
- manager->priv->grab_cancellable = g_cancellable_new ();
- g_object_add_weak_pointer (G_OBJECT (manager->priv->grab_cancellable),
- (gpointer *)&manager->priv->grab_cancellable);
+ if (*cancellable == NULL) {
+ *cancellable = g_cancellable_new ();
+ g_object_add_weak_pointer (G_OBJECT (*cancellable),
+ (gpointer *)cancellable);
} else {
- g_object_ref (manager->priv->grab_cancellable);
+ g_object_ref (*cancellable);
}
}
@@ -486,7 +486,7 @@ grab_media_keys (GsdMediaKeysManager *manager)
g_free (tmp);
}
- ensure_grab_cancellable (manager);
+ ensure_cancellable (&manager->priv->grab_cancellable);
shell_key_grabber_call_grab_accelerators (manager->priv->key_grabber,
g_variant_builder_end (&builder),
manager->priv->grab_cancellable,
@@ -524,7 +524,7 @@ grab_media_key (MediaKey *key,
data->manager = manager;
data->key = key;
- ensure_grab_cancellable (manager);
+ ensure_cancellable (&manager->priv->grab_cancellable);
shell_key_grabber_call_grab_accelerator (manager->priv->key_grabber,
tmp, key->modes,
manager->priv->grab_cancellable,
@@ -552,7 +552,7 @@ ungrab_media_key (MediaKey *key,
if (key->accel_id == 0)
return;
- ensure_grab_cancellable (manager);
+ ensure_cancellable (&manager->priv->grab_cancellable);
shell_key_grabber_call_ungrab_accelerator (manager->priv->key_grabber,
key->accel_id,
manager->priv->grab_cancellable,
@@ -2343,7 +2343,7 @@ start_media_keys_idle_cb (GsdMediaKeysManager *manager)
manager->priv->screen = gdk_display_get_screen (gdk_display_get_default (), 0);
- ensure_grab_cancellable (manager);
+ ensure_cancellable (&manager->priv->grab_cancellable);
shell_key_grabber_proxy_new_for_bus (G_BUS_TYPE_SESSION,
G_DBUS_PROXY_FLAGS_DO_NOT_AUTO_START,
SHELL_DBUS_NAME,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]