[PATCH] grl-metadata-source: allow set_metadata calls without callbacks



From: Lionel Landwerlin <lionel g landwerlin linux intel com>

Signed-off-by: Lionel Landwerlin <lionel g landwerlin linux intel com>
---
 src/grl-metadata-source.c |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/grl-metadata-source.c b/src/grl-metadata-source.c
index ab475f4..12a9b67 100644
--- a/src/grl-metadata-source.c
+++ b/src/grl-metadata-source.c
@@ -322,11 +322,12 @@ set_metadata_ctl_cb (GrlMetadataSource *source,
 			       GRL_CORE_ERROR_SET_METADATA_FAILED,
 			       "Some keys could not be written");
     }
-    smctlcb->user_callback (smctlcb->source,
-			    media,
-			    smctlcb->failed_keys,
-			    smctlcb->user_data,
-			    own_error);
+    if (smctlcb->user_callback)
+      smctlcb->user_callback (smctlcb->source,
+                              media,
+                              smctlcb->failed_keys,
+                              smctlcb->user_data,
+                              own_error);
     if (own_error) {
       g_error_free (own_error);
     }
@@ -1317,7 +1318,6 @@ grl_metadata_source_set_metadata (GrlMetadataSource *source,
   GRL_DEBUG ("grl_metadata_source_set_metadata");
 
   g_return_if_fail (GRL_IS_METADATA_SOURCE (source));
-  g_return_if_fail (callback != NULL);
   g_return_if_fail (media != NULL);
   g_return_if_fail (keys != NULL);
   g_return_if_fail (grl_metadata_source_supported_operations (source) &
@@ -1328,7 +1328,8 @@ grl_metadata_source_set_metadata (GrlMetadataSource *source,
     error = g_error_new (GRL_CORE_ERROR,
 			 GRL_CORE_ERROR_SET_METADATA_FAILED,
 			 "None of the specified keys is writable");
-    callback (source, media, failed_keys, user_data, error);
+    if (callback)
+      callback (source, media, failed_keys, user_data, error);
     g_error_free (error);
     g_list_free (failed_keys);
     return;
-- 
1.7.4.1



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