summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBastien Nocera <hadess@hadess.net>2014-05-13 08:39:52 +0200
committerBastien Nocera <hadess@hadess.net>2015-02-17 13:35:17 +0100
commitc65c68bd8aa302869782e12a6be93494c5909fc1 (patch)
tree32d7221a2121dc17bd59231735e92823edd3f820
parent6329e1be0d3e585ccbdf5d6fbf416c15ce6f93f4 (diff)
downloadgrilo-c65c68bd8aa302869782e12a6be93494c5909fc1.tar.gz
core: Rename GrlOperationOptions "flags" to "resolution-flags"
And add the associated functions as well. Deprecate the old functions. https://bugzilla.gnome.org/show_bug.cgi?id=724308
-rw-r--r--examples/browsing-pls.c2
-rw-r--r--examples/browsing.c2
-rw-r--r--examples/efficient-metadata-resolution.c4
-rw-r--r--examples/multivalues.c2
-rw-r--r--examples/searching.c2
-rw-r--r--libs/pls/grl-pls.c4
-rw-r--r--src/grl-caps.c2
-rw-r--r--src/grl-operation-options-priv.h2
-rw-r--r--src/grl-operation-options.c54
-rw-r--r--src/grl-operation-options.h7
-rw-r--r--src/grl-source.c34
-rw-r--r--tools/grilo-launch/grl-launch.c8
-rw-r--r--tools/grilo-test-ui/main.c4
13 files changed, 85 insertions, 42 deletions
diff --git a/examples/browsing-pls.c b/examples/browsing-pls.c
index 9f6ad33..4d07080 100644
--- a/examples/browsing-pls.c
+++ b/examples/browsing-pls.c
@@ -97,7 +97,7 @@ source_browser (gpointer data,
caps = grl_source_get_caps (source, GRL_OP_BROWSE);
options = grl_operation_options_new (caps);
grl_operation_options_set_count (options, BROWSE_CHUNK_SIZE);
- grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY);
+ grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_IDLE_RELAY);
media_elements = grl_pls_browse_sync (GRL_SOURCE (source),
media, keys,
options,
diff --git a/examples/browsing.c b/examples/browsing.c
index c58f020..3b1606d 100644
--- a/examples/browsing.c
+++ b/examples/browsing.c
@@ -94,7 +94,7 @@ source_added_cb (GrlRegistry *registry, GrlSource *source, gpointer user_data)
caps = grl_source_get_caps (source, GRL_OP_BROWSE);
options = grl_operation_options_new (caps);
grl_operation_options_set_count (options, 5);
- grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY);
+ grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_IDLE_RELAY);
grl_source_browse (source,
NULL,
diff --git a/examples/efficient-metadata-resolution.c b/examples/efficient-metadata-resolution.c
index 49412e0..7ba204b 100644
--- a/examples/efficient-metadata-resolution.c
+++ b/examples/efficient-metadata-resolution.c
@@ -61,7 +61,7 @@ search_cb (GrlSource *source,
caps = grl_source_get_caps (source, GRL_OP_RESOLVE);
options = grl_operation_options_new (caps);
- grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY);
+ grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_IDLE_RELAY);
grl_source_resolve (source,
media,
keys,
@@ -96,7 +96,7 @@ source_added_cb (GrlRegistry *registry, GrlSource *source, gpointer user_data)
caps = grl_source_get_caps (source, GRL_OP_SEARCH);
options = grl_operation_options_new (caps);
grl_operation_options_set_count (options, 5);
- grl_operation_options_set_flags (options,
+ grl_operation_options_set_resolution_flags (options,
GRL_RESOLVE_IDLE_RELAY
| GRL_RESOLVE_FAST_ONLY);
diff --git a/examples/multivalues.c b/examples/multivalues.c
index 389410d..c5056fd 100644
--- a/examples/multivalues.c
+++ b/examples/multivalues.c
@@ -74,7 +74,7 @@ source_added_cb (GrlRegistry *registry, GrlSource *source, gpointer user_data)
options = grl_operation_options_new (caps);
grl_operation_options_set_skip (options, 0);
grl_operation_options_set_count (options, 5);
- grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY);
+ grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_IDLE_RELAY);
g_debug ("Searching \"rock\" in Youtube");
grl_source_search (source,
diff --git a/examples/searching.c b/examples/searching.c
index bd5c4ae..dab0033 100644
--- a/examples/searching.c
+++ b/examples/searching.c
@@ -70,7 +70,7 @@ source_added_cb (GrlRegistry *registry, GrlSource *source, gpointer user_data)
caps = grl_source_get_caps (source, GRL_OP_SEARCH);
options = grl_operation_options_new (caps);
grl_operation_options_set_count (options, 5);
- grl_operation_options_set_flags (options, GRL_RESOLVE_IDLE_RELAY);
+ grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_IDLE_RELAY);
g_debug ("Searching \"rock\" in Jamendo");
grl_source_search (source,
diff --git a/libs/pls/grl-pls.c b/libs/pls/grl-pls.c
index 712ef78..7b21ff4 100644
--- a/libs/pls/grl-pls.c
+++ b/libs/pls/grl-pls.c
@@ -522,7 +522,7 @@ grl_media_new_from_pls_entry (const gchar *uri,
file = g_file_new_for_uri (uri);
options = grl_operation_options_new (NULL);
- grl_operation_options_set_flags (options, GRL_RESOLVE_FAST_ONLY);
+ grl_operation_options_set_resolution_flags (options, GRL_RESOLVE_FAST_ONLY);
media = grl_pls_file_to_media (NULL, file, NULL, FALSE, options);
g_object_unref (options);
g_object_unref (file);
@@ -1133,7 +1133,7 @@ set_container_childcount (GFile *file,
so we can only check if the directory is totally empty (no subdirs,
and no files), otherwise we just say we do not know the actual
childcount */
- if (grl_operation_options_get_flags (options) & GRL_RESOLVE_FAST_ONLY) {
+ if (grl_operation_options_get_resolution_flags (options) & GRL_RESOLVE_FAST_ONLY) {
grl_media_box_set_childcount (GRL_MEDIA_BOX (media),
GRL_METADATA_KEY_CHILDCOUNT_UNKNOWN);
return;
diff --git a/src/grl-caps.c b/src/grl-caps.c
index 19d3ad3..d755de4 100644
--- a/src/grl-caps.c
+++ b/src/grl-caps.c
@@ -141,7 +141,7 @@ grl_caps_test_option (GrlCaps *caps, const gchar *key, const GValue *value)
{
if (0 == g_strcmp0 (key, GRL_OPERATION_OPTION_SKIP)
|| 0 == g_strcmp0 (key, GRL_OPERATION_OPTION_COUNT)
- || 0 == g_strcmp0 (key, GRL_OPERATION_OPTION_FLAGS))
+ || 0 == g_strcmp0 (key, GRL_OPERATION_OPTION_RESOLUTION_FLAGS))
/* these options must always be handled by plugins */
return TRUE;
diff --git a/src/grl-operation-options-priv.h b/src/grl-operation-options-priv.h
index 172edb2..49de323 100644
--- a/src/grl-operation-options-priv.h
+++ b/src/grl-operation-options-priv.h
@@ -33,7 +33,7 @@
* GQuarks */
#define GRL_OPERATION_OPTION_SKIP "skip"
#define GRL_OPERATION_OPTION_COUNT "count"
-#define GRL_OPERATION_OPTION_FLAGS "flags"
+#define GRL_OPERATION_OPTION_RESOLUTION_FLAGS "resolution-flags"
#define GRL_OPERATION_OPTION_TYPE_FILTER "type-filter"
#define GRL_OPERATION_OPTION_KEY_EQUAL_FILTER "key-equal-filter"
#define GRL_OPERATION_OPTION_KEY_RANGE_FILTER "key-range-filter"
diff --git a/src/grl-operation-options.c b/src/grl-operation-options.c
index 3d71fe9..73c9774 100644
--- a/src/grl-operation-options.c
+++ b/src/grl-operation-options.c
@@ -52,7 +52,7 @@ struct _GrlOperationOptionsPrivate {
#define SKIP_DEFAULT 0;
#define COUNT_DEFAULT GRL_COUNT_INFINITY;
-#define FLAGS_DEFAULT GRL_RESOLVE_NORMAL;
+#define RESOLUTION_FLAGS_DEFAULT GRL_RESOLVE_NORMAL;
#define TYPE_FILTER_DEFAULT GRL_TYPE_FILTER_ALL;
static void
@@ -212,7 +212,7 @@ grl_operation_options_obey_caps (GrlOperationOptions *options,
/* these options are always supported */
copy_option (options, *supported_options, GRL_OPERATION_OPTION_SKIP);
copy_option (options, *supported_options, GRL_OPERATION_OPTION_COUNT);
- copy_option (options, *supported_options, GRL_OPERATION_OPTION_FLAGS);
+ copy_option (options, *supported_options, GRL_OPERATION_OPTION_RESOLUTION_FLAGS);
}
if (unsupported_options)
@@ -283,7 +283,7 @@ grl_operation_options_copy (GrlOperationOptions *options)
copy_option (options, copy, GRL_OPERATION_OPTION_SKIP);
copy_option (options, copy, GRL_OPERATION_OPTION_COUNT);
- copy_option (options, copy, GRL_OPERATION_OPTION_FLAGS);
+ copy_option (options, copy, GRL_OPERATION_OPTION_RESOLUTION_FLAGS);
copy_option (options, copy, GRL_OPERATION_OPTION_TYPE_FILTER);
g_hash_table_foreach (options->priv->key_filter,
@@ -428,40 +428,76 @@ grl_operation_options_get_count (GrlOperationOptions *options)
* Returns: %TRUE if @flags could be set, %FALSE otherwise.
*
* Since: 0.2.0
+ * Deprecated: 0.2.12: Use grl_operation_options_set_resolution_flags() instead.
*/
gboolean
grl_operation_options_set_flags (GrlOperationOptions *options,
GrlResolutionFlags flags)
{
+ return grl_operation_options_set_resolution_flags (options, flags);
+}
+
+/**
+ * grl_operation_options_get_flags:
+ * @options: a #GrlOperationOptions instance
+ *
+ * Returns: resolution flags of @options.
+ *
+ * Since: 0.2.0
+ * Deprecated: 0.2.12: Use grl_operation_options_get_resolution_flags() instead.
+ */
+GrlResolutionFlags
+grl_operation_options_get_flags (GrlOperationOptions *options)
+{
+ return grl_operation_options_get_resolution_flags (options);
+}
+
+/**
+ * grl_operation_options_set_resolution_flags:
+ * @options: a #GrlOperationOptions instance
+ * @flags: the resolution flags to be set for an operation. See
+ * #GrlResolutionFlags for possible values.
+ *
+ * Set the resolution flags for an operation. Will only succeed if @flags obey
+ * to the inherent capabilities of @options.
+ *
+ * Returns: %TRUE if @flags could be set, %FALSE otherwise.
+ *
+ * Since: 0.2.12
+ */
+gboolean
+grl_operation_options_set_resolution_flags (GrlOperationOptions *options,
+ GrlResolutionFlags flags)
+{
GValue value = { 0, };
/* FIXME: I think we should use mk_enum to have a GType for
* GrlResolutionFlags */
g_value_init (&value, G_TYPE_UINT);
g_value_set_uint (&value, flags);
- set_value (options, GRL_OPERATION_OPTION_FLAGS, &value);
+ set_value (options, GRL_OPERATION_OPTION_RESOLUTION_FLAGS, &value);
g_value_unset (&value);
return TRUE;
}
/**
- * grl_operation_options_get_flags:
+ * grl_operation_options_get_resolution_flags:
* @options: a #GrlOperationOptions instance
*
* Returns: resolution flags of @options.
*
- * Since: 0.2.0
+ * Since: 0.2.12
*/
GrlResolutionFlags
-grl_operation_options_get_flags (GrlOperationOptions *options)
+grl_operation_options_get_resolution_flags (GrlOperationOptions *options)
{
const GValue *value = g_hash_table_lookup (options->priv->data,
- GRL_OPERATION_OPTION_FLAGS);
+ GRL_OPERATION_OPTION_RESOLUTION_FLAGS);
if (value)
return g_value_get_uint (value);
- return FLAGS_DEFAULT;
+ return RESOLUTION_FLAGS_DEFAULT;
}
/**
diff --git a/src/grl-operation-options.h b/src/grl-operation-options.h
index c6445bc..ef407fc 100644
--- a/src/grl-operation-options.h
+++ b/src/grl-operation-options.h
@@ -113,11 +113,18 @@ guint grl_operation_options_get_skip (GrlOperationOptions *options);
gboolean grl_operation_options_set_count (GrlOperationOptions *options, gint count);
gint grl_operation_options_get_count (GrlOperationOptions *options);
+GLIB_DEPRECATED_FOR(grl_operation_options_set_resolution_flags)
gboolean grl_operation_options_set_flags (GrlOperationOptions *options,
GrlResolutionFlags flags);
+GLIB_DEPRECATED_FOR(grl_operation_options_get_resolution_flags)
GrlResolutionFlags
grl_operation_options_get_flags (GrlOperationOptions *options);
+gboolean grl_operation_options_set_resolution_flags (GrlOperationOptions *options,
+ GrlResolutionFlags flags);
+GrlResolutionFlags
+ grl_operation_options_get_resolution_flags (GrlOperationOptions *options);
+
gboolean grl_operation_options_set_type_filter (GrlOperationOptions *options,
GrlTypeFilter filter);
diff --git a/src/grl-source.c b/src/grl-source.c
index f07b7ce..c4d5ba4 100644
--- a/src/grl-source.c
+++ b/src/grl-source.c
@@ -1845,11 +1845,11 @@ media_decorate (GrlSource *main_source,
GrlOperationOptions *supported_options;
GrlResolutionFlags flags;
- flags = grl_operation_options_get_flags (options);
+ flags = grl_operation_options_get_resolution_flags (options);
if (flags & GRL_RESOLVE_FULL) {
decorate_options = grl_operation_options_copy (options);
- grl_operation_options_set_flags (decorate_options,
- flags & ~GRL_RESOLVE_FULL);
+ grl_operation_options_set_resolution_flags (decorate_options,
+ flags & ~GRL_RESOLVE_FULL);
} else {
decorate_options = g_object_ref (options);
}
@@ -1932,7 +1932,7 @@ media_from_uri_result_relay_cb (GrlSource *source,
return;
}
- if (grl_operation_options_get_flags (rrc->options) & GRL_RESOLVE_FULL) {
+ if (grl_operation_options_get_resolution_flags (rrc->options) & GRL_RESOLVE_FULL) {
/* Check if there are unsolved keys that need to be solved by other
sources */
unknown_keys = filter_known_keys (media, rrc->keys);
@@ -2025,7 +2025,7 @@ resolve_result_relay_cb (GrlSource *source,
rrc->specs_to_invoke = g_hash_table_get_values (rrc->resolve_specs);
if (rrc->specs_to_invoke) {
guint id;
- id = g_idle_add_full (grl_operation_options_get_flags (rrc->options) & GRL_RESOLVE_IDLE_RELAY?
+ id = g_idle_add_full (grl_operation_options_get_resolution_flags (rrc->options) & GRL_RESOLVE_IDLE_RELAY?
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
resolve_idle,
rrc,
@@ -2033,7 +2033,7 @@ resolve_result_relay_cb (GrlSource *source,
g_source_set_name_by_id (id, "[grilo] resolve_idle");
} else {
guint id;
- id = g_idle_add_full (grl_operation_options_get_flags (rrc->options) & GRL_RESOLVE_IDLE_RELAY?
+ id = g_idle_add_full (grl_operation_options_get_resolution_flags (rrc->options) & GRL_RESOLVE_IDLE_RELAY?
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
resolve_all_done,
rrc,
@@ -2167,7 +2167,7 @@ queue_add_media (struct BrowseRelayCb *brc,
qelement->remaining = remaining;
/* Media is ready if we do not need to ask other sources to complete it */
qelement->is_ready = TRUE;
- if (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_FULL) {
+ if (grl_operation_options_get_resolution_flags (brc->options) & GRL_RESOLVE_FULL) {
unknown_keys = filter_known_keys (media, brc->keys);
if (unknown_keys) {
qelement->is_ready = FALSE;
@@ -2230,7 +2230,7 @@ auto_split_run_next_chunk (struct BrowseRelayCb *brc)
GRL_DEBUG ("auto-split: requesting chunk (skip=%u, count=%u)",
grl_operation_options_get_skip (brc->spec.browse->options),
grl_operation_options_get_count (brc->spec.browse->options));
- id = g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
+ id = g_idle_add_full (grl_operation_options_get_resolution_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
browse_idle,
brc->spec.browse,
@@ -2246,7 +2246,7 @@ auto_split_run_next_chunk (struct BrowseRelayCb *brc)
GRL_DEBUG ("auto-split: requesting chunk (skip=%u, count=%u)",
grl_operation_options_get_skip (brc->spec.search->options),
grl_operation_options_get_count (brc->spec.search->options));
- id = g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
+ id = g_idle_add_full (grl_operation_options_get_resolution_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
search_idle,
brc->spec.search,
@@ -2262,7 +2262,7 @@ auto_split_run_next_chunk (struct BrowseRelayCb *brc)
GRL_DEBUG ("auto-split: requesting chunk (skip=%u, count=%u)",
grl_operation_options_get_skip (brc->spec.query->options),
grl_operation_options_get_count (brc->spec.query->options));
- id = g_idle_add_full (grl_operation_options_get_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
+ id = g_idle_add_full (grl_operation_options_get_resolution_flags (brc->options) & GRL_RESOLVE_IDLE_RELAY?
G_PRIORITY_DEFAULT_IDLE: G_PRIORITY_HIGH_IDLE,
query_idle,
brc->spec.query,
@@ -2338,7 +2338,7 @@ browse_result_relay_cb (GrlSource *source,
}
/* If we need further processing of media, put it in a queue */
- if (grl_operation_options_get_flags (brc->options) &
+ if (grl_operation_options_get_resolution_flags (brc->options) &
(GRL_RESOLVE_FULL | GRL_RESOLVE_IDLE_RELAY)) {
queue_add_media (brc, media, remaining, error);
} else {
@@ -3248,7 +3248,7 @@ grl_source_resolve (GrlSource *source,
/* By default assume we will use the parameters specified by the user */
_keys = filter_known_keys (media, (GList *) keys);
- flags = grl_operation_options_get_flags (options);
+ flags = grl_operation_options_get_resolution_flags (options);
if (flags & GRL_RESOLVE_FULL) {
GRL_DEBUG ("requested full metadata");
@@ -3262,7 +3262,7 @@ grl_source_resolve (GrlSource *source,
}
flags &= ~GRL_RESOLVE_FULL;
resolve_options = grl_operation_options_copy (options);
- grl_operation_options_set_flags (resolve_options, flags);
+ grl_operation_options_set_resolution_flags (resolve_options, flags);
} else {
/* Consider only this source, if it supports resolve() */
if (grl_source_supported_operations (source) & GRL_OP_RESOLVE) {
@@ -3549,7 +3549,7 @@ grl_source_get_media_from_uri (GrlSource *source,
g_return_val_if_fail (check_options (source, GRL_OP_MEDIA_FROM_URI, options), 0);
_keys = g_list_copy ((GList *) keys);
- flags = grl_operation_options_get_flags (options);
+ flags = grl_operation_options_get_resolution_flags (options);
if (flags & GRL_RESOLVE_FAST_ONLY) {
filter_slow (source, &_keys, FALSE);
@@ -3701,7 +3701,7 @@ grl_source_browse (GrlSource *source,
/* By default assume we will use the parameters specified by the user */
_keys = g_list_copy ((GList *) keys);
- flags = grl_operation_options_get_flags (options);
+ flags = grl_operation_options_get_resolution_flags (options);
if (flags & GRL_RESOLVE_FAST_ONLY) {
GRL_DEBUG ("requested fast keys");
@@ -3869,7 +3869,7 @@ grl_source_search (GrlSource *source,
/* By default assume we will use the parameters specified by the user */
_keys = g_list_copy ((GList *) keys);
- flags = grl_operation_options_get_flags (options);
+ flags = grl_operation_options_get_resolution_flags (options);
if (flags & GRL_RESOLVE_FAST_ONLY) {
GRL_DEBUG ("requested fast keys");
@@ -4032,7 +4032,7 @@ grl_source_query (GrlSource *source,
/* By default assume we will use the parameters specified by the user */
_keys = g_list_copy ((GList *) keys);
- flags = grl_operation_options_get_flags (options);
+ flags = grl_operation_options_get_resolution_flags (options);
if (flags & GRL_RESOLVE_FAST_ONLY) {
GRL_DEBUG ("requested fast keys");
diff --git a/tools/grilo-launch/grl-launch.c b/tools/grilo-launch/grl-launch.c
index e338061..ffdd5eb 100644
--- a/tools/grilo-launch/grl-launch.c
+++ b/tools/grilo-launch/grl-launch.c
@@ -424,7 +424,7 @@ run_search (gchar **search_params)
keys = get_keys ();
options = grl_operation_options_new (NULL);
- grl_operation_options_set_flags (options, get_flags ());
+ grl_operation_options_set_resolution_flags (options, get_flags ());
grl_operation_options_set_count (options, count);
grl_operation_options_set_skip (options, skip);
@@ -468,7 +468,7 @@ run_browse (gchar **browse_params)
keys = get_keys();
options = grl_operation_options_new (NULL);
- grl_operation_options_set_flags (options, get_flags ());
+ grl_operation_options_set_resolution_flags (options, get_flags ());
grl_operation_options_set_count (options, count);
grl_operation_options_set_skip (options, skip);
@@ -524,7 +524,7 @@ run_resolve (gchar **resolve_params)
}
options = grl_operation_options_new (NULL);
- grl_operation_options_set_flags (options, get_flags ());
+ grl_operation_options_set_resolution_flags (options, get_flags ());
print_titles (print_keys);
@@ -626,7 +626,7 @@ run_query (gchar **query_params)
keys = get_keys ();
options = grl_operation_options_new (NULL);
- grl_operation_options_set_flags (options, get_flags ());
+ grl_operation_options_set_resolution_flags (options, get_flags ());
grl_operation_options_set_count (options, count);
grl_operation_options_set_skip (options, skip);
diff --git a/tools/grilo-test-ui/main.c b/tools/grilo-test-ui/main.c
index 1454ad8..faf78d2 100644
--- a/tools/grilo-test-ui/main.c
+++ b/tools/grilo-test-ui/main.c
@@ -1835,12 +1835,12 @@ static void
options_setup (void)
{
default_options = grl_operation_options_new (NULL);
- grl_operation_options_set_flags (default_options, BROWSE_FLAGS);
+ grl_operation_options_set_resolution_flags (default_options, BROWSE_FLAGS);
grl_operation_options_set_skip (default_options, 0);
grl_operation_options_set_count (default_options, BROWSE_CHUNK_SIZE);
default_resolve_options = grl_operation_options_new (NULL);
- grl_operation_options_set_flags (default_resolve_options, RESOLVE_FLAGS);
+ grl_operation_options_set_resolution_flags (default_resolve_options, RESOLVE_FLAGS);
}
static gboolean