[gnome-software] Check the application source does not exist before adding
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Check the application source does not exist before adding
- Date: Wed, 29 Jan 2014 11:41:27 +0000 (UTC)
commit 96a3f592789803f39400defb68896f96de4f38e4
Author: Richard Hughes <richard hughsie com>
Date: Tue Jan 28 22:11:32 2014 +0000
Check the application source does not exist before adding
src/gs-app.c | 9 +++++++++
1 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index b689793..97f355e 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -593,6 +593,15 @@ gs_app_get_source_default (GsApp *app)
void
gs_app_add_source (GsApp *app, const gchar *source)
{
+ const gchar *tmp;
+ guint i;
+
+ /* check source doesn't already exist */
+ for (i = 0; i < app->priv->sources->len; i++) {
+ tmp = g_ptr_array_index (app->priv->sources, i);
+ if (g_strcmp0 (tmp, source) == 0)
+ return;
+ }
g_ptr_array_add (app->priv->sources, g_strdup (source));
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]