[gnome-software/wip/kalev/gnome-3-22: 66/96] trivial: Add some flags to GsFlatpak



commit 78c544270a03e872a3d7afa5b6cd32708618c5f8
Author: Richard Hughes <richard hughsie com>
Date:   Wed Feb 22 10:04:08 2017 +0000

    trivial: Add some flags to GsFlatpak
    
    These will allow us to control the operation mode in future patches.

 src/plugins/gs-flatpak.c        |   13 +++++++++++++
 src/plugins/gs-flatpak.h        |    9 +++++++++
 src/plugins/gs-plugin-flatpak.c |    5 +++++
 3 files changed, 27 insertions(+), 0 deletions(-)
---
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 4f4648a..4079588 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -37,6 +37,7 @@
 
 struct _GsFlatpak {
        GObject                  parent_instance;
+       GsFlatpakFlags           flags;
        FlatpakInstallation     *installation;
        GHashTable              *broken_remotes;
        GFileMonitor            *monitor;
@@ -2813,6 +2814,18 @@ gs_flatpak_get_scope (GsFlatpak *self)
        return self->scope;
 }
 
+void
+gs_flatpak_set_flags (GsFlatpak *self, GsFlatpakFlags flags)
+{
+       self->flags = flags;
+}
+
+GsFlatpakFlags
+gs_flatpak_get_flags (GsFlatpak *self)
+{
+       return self->flags;
+}
+
 static void
 gs_flatpak_finalize (GObject *object)
 {
diff --git a/src/plugins/gs-flatpak.h b/src/plugins/gs-flatpak.h
index 0b72a7a..af80dfd 100644
--- a/src/plugins/gs-flatpak.h
+++ b/src/plugins/gs-flatpak.h
@@ -46,8 +46,17 @@ G_DECLARE_FINAL_TYPE (GsFlatpak, gs_flatpak, GS, FLATPAK, GObject)
 #define        gs_app_set_flatpak_file_type(app,val)   gs_app_set_metadata(app,"flatpak::file-type",val)
 #define        gs_app_set_flatpak_object_id(app,val)   gs_app_set_metadata(app,"flatpak::object-id",val)
 
+typedef enum {
+       GS_FLATPAK_FLAG_NONE                    = 0,
+       /*< private >*/
+       GS_FLATPAK_FLAG_LAST
+} GsFlatpakFlags;
+
 GsFlatpak      *gs_flatpak_new                 (GsPlugin               *plugin,
                                                 FlatpakInstallation    *installation);
+void           gs_flatpak_set_flags            (GsFlatpak              *self,
+                                                GsFlatpakFlags          flags);
+GsFlatpakFlags gs_flatpak_get_flags            (GsFlatpak              *self);
 AsAppScope     gs_flatpak_get_scope            (GsFlatpak              *self);
 const gchar    *gs_flatpak_get_id              (GsFlatpak              *self);
 gboolean       gs_flatpak_setup                (GsFlatpak              *self,
diff --git a/src/plugins/gs-plugin-flatpak.c b/src/plugins/gs-plugin-flatpak.c
index 6dc7f3b..158db83 100644
--- a/src/plugins/gs-plugin-flatpak.c
+++ b/src/plugins/gs-plugin-flatpak.c
@@ -102,6 +102,7 @@ gs_plugin_adopt_app (GsPlugin *plugin, GsApp *app)
 static gboolean
 gs_plugin_flatpak_add_installation (GsPlugin *plugin,
                                    FlatpakInstallation *installation,
+                                   GsFlatpakFlags flags,
                                    GCancellable *cancellable,
                                    GError **error)
 {
@@ -115,6 +116,7 @@ gs_plugin_flatpak_add_installation (GsPlugin *plugin,
 
        /* create and set up */
        flatpak = gs_flatpak_new (plugin, installation);
+       gs_flatpak_set_flags (flatpak, flags);
        if (!gs_flatpak_setup (flatpak, cancellable, error))
                return FALSE;
        g_debug ("successfully set up %s", gs_flatpak_get_id (flatpak));
@@ -140,6 +142,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                        return FALSE;
                }
                if (!gs_plugin_flatpak_add_installation (plugin, installation,
+                                                        GS_FLATPAK_FLAG_NONE,
                                                         cancellable, error)) {
                        return FALSE;
                }
@@ -160,6 +163,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                        return FALSE;
                }
                if (!gs_plugin_flatpak_add_installation (plugin, installation,
+                                                        GS_FLATPAK_FLAG_NONE,
                                                         cancellable, error)) {
                        return FALSE;
                }
@@ -173,6 +177,7 @@ gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
                        return FALSE;
                }
                if (!gs_plugin_flatpak_add_installation (plugin, installation,
+                                                        GS_FLATPAK_FLAG_NONE,
                                                         cancellable, error)) {
                        return FALSE;
                }


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