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