[gnome-software] Add bundle information to GsApp



commit f2ab125840922a3abf1823f074c0e1fb734d8796
Author: Matthias Klumpp <matthias tenstral net>
Date:   Tue Jun 2 20:21:56 2015 +0200

    Add bundle information to GsApp
    
    Conflicts:
        src/gs-app.c

 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 c5d57a8..f495026 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -97,6 +97,7 @@ struct GsAppPrivate
        guint64                  install_date;
        guint64                  kudos;
        gboolean                 to_be_installed;
+       AsBundle                *bundle;
 };
 
 enum {
@@ -1928,6 +1929,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.
@@ -2180,6 +2205,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 927e818..3f45a81 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -257,6 +257,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 b36de4d..609baef 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -656,6 +656,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]