Re: [PATCH 2/7] core: Add API to handle "content-changed" signal




On Tue, 1 Feb 2011 18:09:07 +0100, "Juan A. Suarez Romero" <jasuarez igalia com> wrote:
(...)
+gboolean
+grl_media_source_notify_changed_start (GrlMediaSource *source,
+                                       GError **error)
+{
+  g_return_val_if_fail (GRL_IS_MEDIA_SOURCE (source), FALSE);
+  g_return_val_if_fail (grl_media_source_supported_operations
(GRL_METADATA_SOURCE (source)) &
+                        GRL_OP_NOTIFY_CHANGED, FALSE);
+
+ return GRL_MEDIA_SOURCE_GET_CLASS (source)->notify_changed_start (source, + error);
+}
+
+/**
+ * grl_media_source_notify_changed_stop:
+ * @source: a media source
+ *
+ * This will drop emission of ::content-changed signals from
@source. When this
+ * is done @source should stop the machinery required for it to
track changes in
+ * the content.
+ */
+void grl_media_source_notify_changed_stop (GrlMediaSource *source)
+{
+  g_return_if_fail (GRL_IS_MEDIA_SOURCE (source));
+ GrlMediaSourceClass *source_class = GRL_MEDIA_SOURCE_GET_CLASS (source);
+
+  if (source_class->notify_changed_stop) {
+    source_class->notify_changed_stop (source);
+  }
+}

For consistency, I would rather have:

g_return_val_if_fail (grl_media_source_supported_operations (GRL_METADATA_SOURCE (source)) &
                        GRL_OP_NOTIFY_CHANGED, FALSE);

and remove the if() checking for the presence of notify_changed_stop below, just like in notify_start.

Iago


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