[gnome-software] trivial: Fix up minor issues with the bundle code from previous commit



commit fbb178fe7a01acf435decbf98946c3a88b0afa4e
Author: Kalev Lember <klember redhat com>
Date:   Wed Jun 24 15:40:00 2015 +0200

    trivial: Fix up minor issues with the bundle code from previous commit
    
    Bump appstream-glib requirement to 0.3.5; drop the AsBundle reference in
    dispose, not finalize; and finally add guards to not overwrite the
    bundle information when refining an app that already has it set.

 configure.ac                      |    2 +-
 src/gs-app.c                      |    3 +--
 src/plugins/gs-plugin-appstream.c |    9 +++++----
 3 files changed, 7 insertions(+), 7 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index acc11e7..916ca49 100644
--- a/configure.ac
+++ b/configure.ac
@@ -61,7 +61,7 @@ dnl - Check library dependencies
 dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.16 gio-unix-2.0)
 PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 1.0.0)
-PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.3.4)
+PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.3.5)
 PKG_CHECK_MODULES(SQLITE, sqlite3)
 PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.42)
 PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 3.11.5)
diff --git a/src/gs-app.c b/src/gs-app.c
index f495026..9a79866 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -2159,6 +2159,7 @@ gs_app_dispose (GObject *object)
        GsApp *app = GS_APP (object);
        GsAppPrivate *priv = APP_PRIV (app);
 
+       g_clear_object (&priv->bundle);
        g_clear_object (&priv->featured_pixbuf);
        g_clear_object (&priv->icon);
        g_clear_object (&priv->pixbuf);
@@ -2205,8 +2206,6 @@ 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/plugins/gs-plugin-appstream.c b/src/plugins/gs-plugin-appstream.c
index 609baef..7ead1de 100644
--- a/src/plugins/gs-plugin-appstream.c
+++ b/src/plugins/gs-plugin-appstream.c
@@ -580,6 +580,11 @@ gs_plugin_refine_item (GsPlugin *plugin,
            gs_app_get_project_group (app) == NULL)
                gs_app_set_project_group (app, as_app_get_project_group (item));
 
+       /* set default bundle (if any) */
+       if (as_app_get_bundle_default (item) != NULL &&
+           gs_app_get_bundle (app) == NULL)
+               gs_app_set_bundle (app, as_app_get_bundle_default (item));
+
        /* this is a core application for the desktop and cannot be removed */
        if (as_app_has_compulsory_for_desktop (item, "GNOME") &&
            gs_app_get_kind (app) == GS_APP_KIND_NORMAL)
@@ -657,10 +662,6 @@ gs_plugin_refine_item (GsPlugin *plugin,
                }
        }
 
-       /* 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]