[gnome-software/wip/hughsie/flatpak-branch: 1/4] flatpak: Use the branch attribute in the base object



commit 496aba76031055c68e166836040cf71bf4e990cc
Author: Richard Hughes <richard hughsie com>
Date:   Tue Jun 25 13:47:36 2019 +0100

    flatpak: Use the branch attribute in the base object
    
    It makes no sense to duplicate this property when the original is unused.

 plugins/flatpak/gs-flatpak-app.c | 14 +-------------
 plugins/flatpak/gs-flatpak-app.h |  3 ---
 plugins/flatpak/gs-flatpak.c     | 17 ++++++++---------
 3 files changed, 9 insertions(+), 25 deletions(-)
---
diff --git a/plugins/flatpak/gs-flatpak-app.c b/plugins/flatpak/gs-flatpak-app.c
index 78e4e9b1..083bea33 100644
--- a/plugins/flatpak/gs-flatpak-app.c
+++ b/plugins/flatpak/gs-flatpak-app.c
@@ -23,12 +23,6 @@ gs_flatpak_app_get_ref_arch (GsApp *app)
        return gs_app_get_metadata_item (app, "flatpak::RefArch");
 }
 
-const gchar *
-gs_flatpak_app_get_ref_branch (GsApp *app)
-{
-       return gs_app_get_metadata_item (app, "flatpak::RefBranch");
-}
-
 const gchar *
 gs_flatpak_app_get_commit (GsApp *app)
 {
@@ -94,7 +88,7 @@ gs_flatpak_app_get_ref_display (GsApp *app)
        const gchar *ref_kind_as_str = gs_flatpak_app_get_ref_kind_as_str (app);
        const gchar *ref_name = gs_flatpak_app_get_ref_name (app);
        const gchar *ref_arch = gs_flatpak_app_get_ref_arch (app);
-       const gchar *ref_branch = gs_flatpak_app_get_ref_branch (app);
+       const gchar *ref_branch = gs_app_get_branch (app);
 
        g_return_val_if_fail (ref_kind_as_str != NULL, NULL);
        g_return_val_if_fail (ref_name != NULL, NULL);
@@ -120,12 +114,6 @@ gs_flatpak_app_set_ref_arch (GsApp *app, const gchar *val)
        gs_app_set_metadata (app, "flatpak::RefArch", val);
 }
 
-void
-gs_flatpak_app_set_ref_branch (GsApp *app, const gchar *val)
-{
-       gs_app_set_metadata (app, "flatpak::RefBranch", val);
-}
-
 void
 gs_flatpak_app_set_commit (GsApp *app, const gchar *val)
 {
diff --git a/plugins/flatpak/gs-flatpak-app.h b/plugins/flatpak/gs-flatpak-app.h
index ba4c23cd..ef7b0b75 100644
--- a/plugins/flatpak/gs-flatpak-app.h
+++ b/plugins/flatpak/gs-flatpak-app.h
@@ -24,7 +24,6 @@ GsApp                 *gs_flatpak_app_new                     (const gchar    *id);
 
 const gchar            *gs_flatpak_app_get_ref_name            (GsApp          *app);
 const gchar            *gs_flatpak_app_get_ref_arch            (GsApp          *app);
-const gchar            *gs_flatpak_app_get_ref_branch          (GsApp          *app);
 FlatpakRefKind          gs_flatpak_app_get_ref_kind            (GsApp          *app);
 const gchar            *gs_flatpak_app_get_ref_kind_as_str     (GsApp          *app);
 gchar                  *gs_flatpak_app_get_ref_display         (GsApp          *app);
@@ -40,8 +39,6 @@ void                   gs_flatpak_app_set_ref_name            (GsApp          *app,
                                                                 const gchar    *val);
 void                    gs_flatpak_app_set_ref_arch            (GsApp          *app,
                                                                 const gchar    *val);
-void                    gs_flatpak_app_set_ref_branch          (GsApp          *app,
-                                                                const gchar    *val);
 void                    gs_flatpak_app_set_ref_kind            (GsApp          *app,
                                                                 FlatpakRefKind ref_kind);
 
diff --git a/plugins/flatpak/gs-flatpak.c b/plugins/flatpak/gs-flatpak.c
index dfb05a36..7d181be3 100644
--- a/plugins/flatpak/gs-flatpak.c
+++ b/plugins/flatpak/gs-flatpak.c
@@ -214,7 +214,6 @@ gs_flatpak_set_metadata (GsFlatpak *self, GsApp *app, FlatpakRef *xref)
        gs_flatpak_app_set_ref_kind (app, flatpak_ref_get_kind (xref));
        gs_flatpak_app_set_ref_name (app, flatpak_ref_get_name (xref));
        gs_flatpak_app_set_ref_arch (app, flatpak_ref_get_arch (xref));
-       gs_flatpak_app_set_ref_branch (app, flatpak_ref_get_branch (xref));
        gs_flatpak_app_set_commit (app, flatpak_ref_get_commit (xref));
 
        /* map the flatpak kind to the gnome-software kind */
@@ -1619,7 +1618,7 @@ gs_plugin_refine_item_origin (GsFlatpak *self,
                                                                   gs_flatpak_app_get_ref_kind (app),
                                                                   gs_flatpak_app_get_ref_name (app),
                                                                   gs_flatpak_app_get_ref_arch (app),
-                                                                  gs_flatpak_app_get_ref_branch (app),
+                                                                  gs_app_get_branch (app),
                                                                   cancellable,
                                                                   &error_local);
                if (xref != NULL) {
@@ -1651,7 +1650,7 @@ gs_flatpak_create_fake_ref (GsApp *app, GError **error)
                              gs_flatpak_app_get_ref_kind_as_str (app),
                              gs_flatpak_app_get_ref_name (app),
                              gs_flatpak_app_get_ref_arch (app),
-                             gs_flatpak_app_get_ref_branch (app));
+                             gs_app_get_branch (app));
        xref = flatpak_ref_parse (id, error);
        if (xref == NULL) {
                gs_flatpak_error_convert (error);
@@ -1695,7 +1694,7 @@ gs_flatpak_refine_app_state_unlocked (GsFlatpak *self,
                if (g_strcmp0 (origin, gs_app_get_origin (app)) == 0 &&
                    g_strcmp0 (name, gs_flatpak_app_get_ref_name (app)) == 0 &&
                    g_strcmp0 (arch, gs_flatpak_app_get_ref_arch (app)) == 0 &&
-                   g_strcmp0 (branch, gs_flatpak_app_get_ref_branch (app)) == 0) {
+                   g_strcmp0 (branch, gs_app_get_branch (app)) == 0) {
                        ref = g_object_ref (ref_tmp);
                        break;
                }
@@ -1802,7 +1801,7 @@ gs_flatpak_create_runtime (GsFlatpak *self, GsApp *parent, const gchar *runtime)
        gs_flatpak_app_set_ref_kind (app, FLATPAK_REF_KIND_RUNTIME);
        gs_flatpak_app_set_ref_name (app, split[0]);
        gs_flatpak_app_set_ref_arch (app, split[1]);
-       gs_flatpak_app_set_ref_branch (app, split[2]);
+       gs_app_set_branch (app, split[2]);
 
        /* save in the cache */
        gs_plugin_cache_add (self->plugin, NULL, app);
@@ -1945,7 +1944,7 @@ gs_plugin_refine_item_metadata (GsFlatpak *self,
                                         gs_flatpak_app_get_ref_kind_as_str (app),
                                         gs_flatpak_app_get_ref_name (app),
                                         gs_flatpak_app_get_ref_arch (app),
-                                        gs_flatpak_app_get_ref_branch (app),
+                                        gs_app_get_branch (app),
                                         "active",
                                         "metadata",
                                         NULL);
@@ -1978,7 +1977,7 @@ gs_flatpak_get_installed_ref (GsFlatpak *self,
                                                      gs_flatpak_app_get_ref_kind (app),
                                                      gs_flatpak_app_get_ref_name (app),
                                                      gs_flatpak_app_get_ref_arch (app),
-                                                     gs_flatpak_app_get_ref_branch (app),
+                                                     gs_app_get_branch (app),
                                                      cancellable,
                                                      error);
        if (ref == NULL)
@@ -2191,7 +2190,7 @@ gs_flatpak_refine_app_unlocked (GsFlatpak *self,
        if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION) {
                if (gs_app_get_version (app) == NULL) {
                        const gchar *branch;
-                       branch = gs_flatpak_app_get_ref_branch (app);
+                       branch = gs_app_get_branch (app);
                        gs_app_set_version (app, branch);
                }
        }
@@ -2303,7 +2302,7 @@ gs_flatpak_launch (GsFlatpak *self,
        if (!flatpak_installation_launch (self->installation,
                                          gs_flatpak_app_get_ref_name (app),
                                          gs_flatpak_app_get_ref_arch (app),
-                                         gs_flatpak_app_get_ref_branch (app),
+                                         gs_app_get_branch (app),
                                          NULL,
                                          cancellable,
                                          error)) {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]