[gnome-software/wip/mak/limba] Add bundle information to AsApp
- From: Matthias Klumpp <mak src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/mak/limba] Add bundle information to AsApp
- Date: Tue, 2 Jun 2015 18:23:25 +0000 (UTC)
commit e90a2e6d7018b568061e6949092a2ae41fc668f6
Author: Matthias Klumpp <matthias tenstral net>
Date: Tue Jun 2 20:21:56 2015 +0200
Add bundle information to AsApp
src/gs-app.c | 27 +++++++++++++++++++++++++++
src/gs-app.h | 4 ++++
src/plugins/gs-plugin-appstream.c | 5 +++++
3 files changed, 36 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-app.c b/src/gs-app.c
index 2fad5d1..cf46aae 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -98,6 +98,7 @@ struct GsAppPrivate
guint64 install_date;
guint64 kudos;
gboolean to_be_installed;
+ AsBundle *bundle;
};
enum {
@@ -1900,6 +1901,30 @@ gs_app_set_to_be_installed (GsApp *app, gboolean to_be_installed)
}
/**
+ * gs_app_set_bundle:
+ */
+void
+gs_app_set_bundle (GsApp *app, AsBundle *bundle)
+{
+ g_return_if_fail (GS_IS_APP (app));
+
+ /* set default bundle */
+ g_clear_object (&APP_PRIV (app)->bundle);
+ if (bundle != NULL)
+ APP_PRIV (app)->bundle = g_object_ref (bundle);
+}
+
+/**
+ * gs_app_get_bundle:
+ */
+AsBundle*
+gs_app_get_bundle (GsApp *app)
+{
+ g_return_val_if_fail (GS_IS_APP (app), NULL);
+ return APP_PRIV (app)->bundle;
+}
+
+/**
* gs_app_subsume:
*
* Imports all the useful data from @other into @app.
@@ -2253,6 +2278,8 @@ gs_app_finalize (GObject *object)
g_ptr_array_unref (priv->categories);
if (priv->keywords != NULL)
g_ptr_array_unref (priv->keywords);
+ if (priv->bundle)
+ g_object_unref (priv->bundle);
G_OBJECT_CLASS (gs_app_parent_class)->finalize (object);
}
diff --git a/src/gs-app.h b/src/gs-app.h
index 56761bb..2294d85 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -254,6 +254,10 @@ void gs_app_set_search_sort_key (GsApp *app,
guint match_value);
const gchar *gs_app_get_search_sort_key (GsApp *app);
+AsBundle *gs_app_get_bundle (GsApp *app);
+void gs_app_set_bundle (GsApp *app,
+ AsBundle *bundle);
+
G_END_DECLS
#endif /* __GS_APP_H */
diff --git a/src/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 14e57b3..6e39275 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -650,6 +650,11 @@ gs_plugin_refine_item (GsPlugin *plugin,
break;
}
}
+
+ /* set default bundle (if any) */
+ gs_app_set_bundle (app,
+ as_app_get_bundle_default (item));
+
return TRUE;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]