[gnome-software/wip/hughsie/non-free: 4/6] f a99465783cb5abdad6af7553f54f6d236117881e
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/non-free: 4/6] f a99465783cb5abdad6af7553f54f6d236117881e
- Date: Mon, 29 Aug 2016 18:47:20 +0000 (UTC)
commit 3c56b7fca3c5a0a3c417bd6640cd35b3ff39b2a0
Author: Richard Hughes <richard hughsie com>
Date: Mon Aug 29 18:33:36 2016 +0100
f a99465783cb5abdad6af7553f54f6d236117881e
src/gs-sources-dialog.c | 43 ++++++++++++++++++++++++-------------------
1 files changed, 24 insertions(+), 19 deletions(-)
---
diff --git a/src/gs-sources-dialog.c b/src/gs-sources-dialog.c
index 8c0dd24..bb4393f 100644
--- a/src/gs-sources-dialog.c
+++ b/src/gs-sources-dialog.c
@@ -52,32 +52,35 @@ struct _GsSourcesDialog
G_DEFINE_TYPE (GsSourcesDialog, gs_sources_dialog, GTK_TYPE_DIALOG)
static gchar *
-get_source_installed_text (GsApp *app)
+get_source_installed_text (GPtrArray *sources)
{
- GPtrArray *related;
guint cnt_addon = 0;
guint cnt_apps = 0;
guint i;
+ guint j;
g_autofree gchar *addons_text = NULL;
g_autofree gchar *apps_text = NULL;
/* split up the types */
- related = gs_app_get_related (app);
- for (i = 0; i < related->len; i++) {
- GsApp *app_tmp = g_ptr_array_index (related, i);
- switch (gs_app_get_kind (app_tmp)) {
- case AS_APP_KIND_WEB_APP:
- case AS_APP_KIND_DESKTOP:
- cnt_apps++;
- break;
- case AS_APP_KIND_FONT:
- case AS_APP_KIND_CODEC:
- case AS_APP_KIND_INPUT_METHOD:
- case AS_APP_KIND_ADDON:
- cnt_addon++;
- break;
- default:
- break;
+ for (j = 0; j < sources->len; j++) {
+ GsApp *app = g_ptr_array_index (sources, j);
+ GPtrArray *related = gs_app_get_related (app);
+ for (i = 0; i < related->len; i++) {
+ GsApp *app_tmp = g_ptr_array_index (related, i);
+ switch (gs_app_get_kind (app_tmp)) {
+ case AS_APP_KIND_WEB_APP:
+ case AS_APP_KIND_DESKTOP:
+ cnt_apps++;
+ break;
+ case AS_APP_KIND_FONT:
+ case AS_APP_KIND_CODEC:
+ case AS_APP_KIND_INPUT_METHOD:
+ case AS_APP_KIND_ADDON:
+ cnt_addon++;
+ break;
+ default:
+ break;
+ }
}
}
@@ -129,11 +132,13 @@ add_source (GtkListBox *listbox, GsApp *app)
{
GtkWidget *row;
g_autofree gchar *text = NULL;
+ g_autoptr(GPtrArray) sources = g_ptr_array_new ();
row = gs_sources_dialog_row_new ();
gs_sources_dialog_row_set_name (GS_SOURCES_DIALOG_ROW (row),
gs_app_get_name (app));
- text = get_source_installed_text (app);
+ g_ptr_array_add (sources, app);
+ text = get_source_installed_text (sources);
gs_sources_dialog_row_set_description (GS_SOURCES_DIALOG_ROW (row),
text);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]