[grilo] core: added grl_metadata_source_get_caps()
- From: Guillaume JÃrÃme Emont <guijemont src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [grilo] core: added grl_metadata_source_get_caps()
- Date: Wed, 14 Dec 2011 13:57:05 +0000 (UTC)
commit 188271d492d6c37d48bf36a1568d7aac3b33eb4e
Author: Guillaume Emont <gemont igalia com>
Date: Wed Apr 6 20:53:13 2011 +0200
core: added grl_metadata_source_get_caps()
src/grl-metadata-source.c | 27 +++++++++++++++++++++++++++
src/grl-metadata-source.h | 8 +++++++-
2 files changed, 34 insertions(+), 1 deletions(-)
---
diff --git a/src/grl-metadata-source.c b/src/grl-metadata-source.c
index 63aa8bb..9ed6686 100644
--- a/src/grl-metadata-source.c
+++ b/src/grl-metadata-source.c
@@ -1612,3 +1612,30 @@ grl_metadata_source_operation_is_ongoing (GrlMetadataSource *source,
return op_state && !op_state->cancelled;
}
+
+/**
+ * grl_metadata_source_get_caps:
+ * @source: a metadata source
+ * @operation: a supported operation. Even though the type allows to specify
+ * several operations, only one should be provided here.
+ *
+ *
+ * Get the capabilities of @source for @operation.
+ *
+ * Returns: (transfer none): The capabilities
+ */
+GrlCaps *
+grl_metadata_source_get_caps (GrlMetadataSource *source,
+ GrlSupportedOps operation)
+{
+ static GrlCaps *default_caps = NULL;
+ GrlMetadataSourceClass *klass = GRL_METADATA_SOURCE_GET_CLASS (source);
+
+ if (klass->get_caps)
+ return klass->get_caps (source, operation);
+
+ if (!default_caps)
+ default_caps = grl_caps_new ();
+
+ return default_caps;
+}
diff --git a/src/grl-metadata-source.h b/src/grl-metadata-source.h
index 37764fe..ac14a3d 100644
--- a/src/grl-metadata-source.h
+++ b/src/grl-metadata-source.h
@@ -235,6 +235,7 @@ typedef struct _GrlMetadataSourceClass GrlMetadataSourceClass;
* with a list of keys that would be needed to resolve. See
* grl_metadata_source_may_resolve().
* @cancel: cancel the current operation
+ * @get_caps: the capabilities that @source supports for @operation
*
* Grilo MetadataSource class. Override the vmethods to implement the
* element functionality.
@@ -264,8 +265,10 @@ struct _GrlMetadataSourceClass {
void (*cancel) (GrlMetadataSource *source, guint operation_id);
+ GrlCaps * (*get_caps) (GrlMetadataSource *source, GrlSupportedOps operation);
+
/*< private >*/
- gpointer _grl_reserved[GRL_PADDING - 3];
+ gpointer _grl_reserved[GRL_PADDING - 4];
};
G_BEGIN_DECLS
@@ -329,6 +332,9 @@ const gchar *grl_metadata_source_get_name (GrlMetadataSource *source);
const gchar *grl_metadata_source_get_description (GrlMetadataSource *source);
+GrlCaps *grl_metadata_source_get_caps (GrlMetadataSource *source,
+ GrlSupportedOps operation);
+
G_END_DECLS
#endif /* _GRL_METADATA_SOURCE_H_ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]