[totem] grilo: Add and use new strv_has_prefix() helper
- From: Bastien Nocera <hadess src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [totem] grilo: Add and use new strv_has_prefix() helper
- Date: Thu, 23 Jan 2014 20:05:44 +0000 (UTC)
commit cad52bc8b2da27d586e409184b74fec8550d99bb
Author: Bastien Nocera <hadess hadess net>
Date: Thu Jan 23 16:00:42 2014 +0100
grilo: Add and use new strv_has_prefix() helper
src/plugins/grilo/totem-grilo.c | 33 +++++++++++++++++----------------
1 files changed, 17 insertions(+), 16 deletions(-)
---
diff --git a/src/plugins/grilo/totem-grilo.c b/src/plugins/grilo/totem-grilo.c
index 6b446a2..12b71a1 100644
--- a/src/plugins/grilo/totem-grilo.c
+++ b/src/plugins/grilo/totem-grilo.c
@@ -853,6 +853,21 @@ item_activated_cb (GdMainView *view,
}
static gboolean
+strv_has_prefix (const char **strv,
+ const char *str)
+{
+ const char **s = strv;
+
+ while (*s) {
+ if (g_str_has_prefix (str, *s))
+ return TRUE;
+ s++;
+ }
+
+ return FALSE;
+}
+
+static gboolean
source_is_blacklisted (GrlSource *source)
{
const char *id;
@@ -865,18 +880,11 @@ source_is_blacklisted (GrlSource *source)
"grl-podcasts",
NULL
};
- const char **s = sources;
id = grl_source_get_id (source);
g_assert (id);
- while (*s) {
- if (g_str_has_prefix (id, *s))
- return TRUE;
- s++;
- }
-
- return FALSE;
+ return strv_has_prefix (sources, id);
}
static gboolean
@@ -888,18 +896,11 @@ source_is_browse_blacklisted (GrlSource *source)
"grl-youtube",
NULL
};
- const char **s = sources;
id = grl_source_get_id (source);
g_assert (id);
- while (*s) {
- if (g_str_has_prefix (id, *s))
- return TRUE;
- s++;
- }
-
- return FALSE;
+ return strv_has_prefix (sources, id);
}
static gboolean
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]