[gnome-software] Only refine the origin for display when required



commit 1b1d1937a6d907f38f8940bfb2591213ec6e309e
Author: Richard Hughes <richard hughsie com>
Date:   Fri Jul 8 09:37:57 2016 +0100

    Only refine the origin for display when required
    
    We kinda squashed two different things into one refine flag which meant making
    to special case various bits of code. Now ORIGIN_HOSTNAME exists there's no
    reason to not break this out.

 src/gs-cmd.c                              |    2 ++
 src/gs-plugin-loader.c                    |    2 ++
 src/gs-plugin.h                           |    2 ++
 src/gs-shell-details.c                    |    2 +-
 src/plugins/gs-plugin-packagekit-origin.c |    2 +-
 5 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index 74a2318..12b454c 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -142,6 +142,8 @@ gs_cmd_refine_flag_from_string (const gchar *flag, GError **error)
                return GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS;
        if (g_strcmp0 (flag, "origin-hostname") == 0)
                return GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME;
+       if (g_strcmp0 (flag, "origin-ui") == 0)
+               return GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI;
        g_set_error (error,
                     GS_PLUGIN_ERROR,
                     GS_PLUGIN_ERROR_NOT_SUPPORTED,
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index 1eb66f6..6c1dfb2 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -298,6 +298,8 @@ gs_plugin_loader_run_refine_internal (GsPluginLoader *plugin_loader,
        gboolean ret = TRUE;
 
        /* this implies the other */
+       if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI)
+               flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
        if (flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME)
                flags |= GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
 
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 6fe1b5f..61c9966 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -157,6 +157,7 @@ typedef enum {
  * @GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON:               Require the icon to be loaded
  * @GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS:                Require the needed permissions
  * @GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME:    Require the origin hostname
+ * @GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI:          Require the origin for UI
  *
  * The refine flags.
  **/
@@ -186,6 +187,7 @@ typedef enum {
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_ICON             = 1 << 21,
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_PERMISSIONS      = 1 << 22,
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_HOSTNAME  = 1 << 23,
+       GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI        = 1 << 24,
        /*< private >*/
        GS_PLUGIN_REFINE_FLAGS_LAST
 } GsPluginRefineFlags;
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 4448bc5..344d0fe 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -1522,7 +1522,7 @@ gs_shell_details_load (GsShellDetails *self)
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_VERSION |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
-                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN |
+                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
diff --git a/src/plugins/gs-plugin-packagekit-origin.c b/src/plugins/gs-plugin-packagekit-origin.c
index 04e76d0..45bd7c4 100644
--- a/src/plugins/gs-plugin-packagekit-origin.c
+++ b/src/plugins/gs-plugin-packagekit-origin.c
@@ -111,7 +111,7 @@ gs_plugin_refine_app (GsPlugin *plugin,
        const gchar *origin_ui;
 
        /* only run when required */
-       if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN) == 0)
+       if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN_UI) == 0)
                return TRUE;
 
        if (g_strcmp0 (gs_app_get_management_plugin (app), "packagekit") != 0)


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