[grilo-plugins] optical-media: Add a cancellable for other ops



commit c8fdaedb69e733a6fece70e1954bc10714ea48a3
Author: Bastien Nocera <hadess hadess net>
Date:   Mon Jan 20 19:07:37 2014 +0100

    optical-media: Add a cancellable for other ops
    
    https://bugzilla.gnome.org/show_bug.cgi?id=722629

 src/optical-media/grl-optical-media.c |    5 +++++
 1 files changed, 5 insertions(+), 0 deletions(-)
---
diff --git a/src/optical-media/grl-optical-media.c b/src/optical-media/grl-optical-media.c
index 5771e87..97590a4 100644
--- a/src/optical-media/grl-optical-media.c
+++ b/src/optical-media/grl-optical-media.c
@@ -59,6 +59,7 @@ struct _GrlOpticalMediaSourcePrivate {
   GVolumeMonitor *monitor;
   guint monitor_signal_ids[NUM_MONITOR_SIGNALS];
   GList *list; /* GrlMedia */
+  GCancellable *cancellable;
 };
 
 /* --- Data types --- */
@@ -160,6 +161,7 @@ grl_optical_media_source_init (GrlOpticalMediaSource *source)
 
   source->priv = GRL_OPTICAL_MEDIA_SOURCE_GET_PRIVATE (source);
 
+  source->priv->cancellable = g_cancellable_new ();
   source->priv->monitor = g_volume_monitor_get ();
 
   for (i = 0; i < G_N_ELEMENTS (monitor_signals); i++) {
@@ -175,6 +177,9 @@ grl_optical_media_source_finalize (GObject *object)
   GrlOpticalMediaSource *source = GRL_OPTICAL_MEDIA_SOURCE (object);
   guint i;
 
+  g_cancellable_cancel (source->priv->cancellable);
+  g_clear_object (&source->priv->cancellable);
+
   for (i = 0; i < NUM_MONITOR_SIGNALS; i++) {
     g_signal_handler_disconnect (G_OBJECT (source->priv->monitor),
                                  source->priv->monitor_signal_ids[i]);


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]