[PATCH 08/15] core: added grl_metadata_source_get_caps()
- From: gemont igalia com
- To: grilo-list gnome org
- Subject: [PATCH 08/15] core: added grl_metadata_source_get_caps()
- Date: Fri, 2 Dec 2011 18:36:34 +0100
From: Guillaume Emont <gemont igalia com>
---
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 e2122de..8c63b9f 100644
--- a/src/grl-metadata-source.c
+++ b/src/grl-metadata-source.c
@@ -1611,3 +1611,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_ */
--
1.7.5.4
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]