|
|
b83518 |
--- a/shell/ev-media-player-keys.c
|
|
|
b83518 |
+++ b/shell/ev-media-player-keys.c
|
|
|
b83518 |
@@ -41,8 +41,9 @@ struct _EvMediaPlayerKeys
|
|
|
b83518 |
{
|
|
|
b83518 |
GObject parent;
|
|
|
b83518 |
|
|
|
b83518 |
- GDBusProxy *proxy;
|
|
|
b83518 |
- gboolean has_name_owner;
|
|
|
b83518 |
+ GDBusProxy *proxy;
|
|
|
b83518 |
+ gboolean has_name_owner;
|
|
|
b83518 |
+ GCancellable *cancellable;
|
|
|
b83518 |
};
|
|
|
b83518 |
|
|
|
b83518 |
struct _EvMediaPlayerKeysClass
|
|
|
b83518 |
@@ -163,7 +164,7 @@ mediakeys_service_appeared_cb (GObject *source_object,
|
|
|
b83518 |
GAsyncResult *res,
|
|
|
b83518 |
gpointer user_data)
|
|
|
b83518 |
{
|
|
|
b83518 |
- EvMediaPlayerKeys *keys = EV_MEDIA_PLAYER_KEYS (user_data);
|
|
|
b83518 |
+ EvMediaPlayerKeys *keys;
|
|
|
b83518 |
GDBusProxy *proxy;
|
|
|
b83518 |
|
|
|
b83518 |
proxy = g_dbus_proxy_new_for_bus_finish (res, NULL);
|
|
|
b83518 |
@@ -172,6 +173,7 @@ mediakeys_service_appeared_cb (GObject *source_object,
|
|
|
b83518 |
return;
|
|
|
b83518 |
}
|
|
|
b83518 |
|
|
|
b83518 |
+ keys = EV_MEDIA_PLAYER_KEYS (user_data);
|
|
|
b83518 |
g_signal_connect (proxy, "g-signal",
|
|
|
b83518 |
G_CALLBACK (media_player_key_pressed_cb),
|
|
|
b83518 |
keys);
|
|
|
b83518 |
@@ -187,13 +189,15 @@ mediakeys_service_appeared_cb (GObject *source_object,
|
|
|
b83518 |
static void
|
|
|
b83518 |
ev_media_player_keys_init (EvMediaPlayerKeys *keys)
|
|
|
b83518 |
{
|
|
|
b83518 |
+ keys->cancellable = g_cancellable_new ();
|
|
|
b83518 |
+
|
|
|
b83518 |
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION,
|
|
|
b83518 |
G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES,
|
|
|
b83518 |
NULL,
|
|
|
b83518 |
SD_NAME,
|
|
|
b83518 |
SD_OBJECT_PATH,
|
|
|
b83518 |
SD_INTERFACE,
|
|
|
b83518 |
- NULL,
|
|
|
b83518 |
+ keys->cancellable,
|
|
|
b83518 |
mediakeys_service_appeared_cb,
|
|
|
b83518 |
keys);
|
|
|
b83518 |
}
|
|
|
b83518 |
@@ -212,6 +216,9 @@ ev_media_player_keys_finalize (GObject *object)
|
|
|
b83518 |
{
|
|
|
b83518 |
EvMediaPlayerKeys *keys = EV_MEDIA_PLAYER_KEYS (object);
|
|
|
b83518 |
|
|
|
b83518 |
+ g_cancellable_cancel (keys->cancellable);
|
|
|
b83518 |
+ g_object_unref (keys->cancellable);
|
|
|
b83518 |
+
|
|
|
b83518 |
if (keys->proxy != NULL) {
|
|
|
b83518 |
ev_media_player_keys_release_keys (keys);
|
|
|
b83518 |
g_object_unref (keys->proxy);
|