[gnome-software] Add a refine flag for setting the menu path



commit 233279e2cdac4f4e2509557f18f7f48dfc0ff1f6
Author: Richard Hughes <richard hughsie com>
Date:   Fri Feb 28 17:38:45 2014 +0000

    Add a refine flag for setting the menu path
    
    It shows up on the profing now, so only retrieve it when it's going to be shown.

 src/gs-cmd.c                             |    2 ++
 src/gs-plugin.h                          |    1 +
 src/gs-shell-details.c                   |    1 +
 src/plugins/gs-plugin-menu-spec-refine.c |    5 +++++
 4 files changed, 9 insertions(+), 0 deletions(-)
---
diff --git a/src/gs-cmd.c b/src/gs-cmd.c
index b31ea36..c56f340 100644
--- a/src/gs-cmd.c
+++ b/src/gs-cmd.c
@@ -137,6 +137,8 @@ gs_cmd_refine_flag_from_string (const gchar *flag, GError **error)
                return GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN;
        if (g_strcmp0 (flag, "related") == 0)
                return GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED;
+       if (g_strcmp0 (flag, "menu-path") == 0)
+               return GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH;
        g_set_error (error,
                     GS_PLUGIN_ERROR,
                     GS_PLUGIN_ERROR_NOT_SUPPORTED,
diff --git a/src/gs-plugin.h b/src/gs-plugin.h
index 58b0d0b..ffde42d 100644
--- a/src/gs-plugin.h
+++ b/src/gs-plugin.h
@@ -94,6 +94,7 @@ typedef enum {
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_UPDATE_DETAILS   = 1 << 9,
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN           = 1 << 10,
        GS_PLUGIN_REFINE_FLAGS_REQUIRE_RELATED          = 1 << 11,
+       GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH        = 1 << 12,
        GS_PLUGIN_REFINE_FLAGS_LAST
 } GsPluginRefineFlags;
 
diff --git a/src/gs-shell-details.c b/src/gs-shell-details.c
index 43e106a..c792cc5 100644
--- a/src/gs-shell-details.c
+++ b/src/gs-shell-details.c
@@ -891,6 +891,7 @@ gs_shell_details_set_app (GsShellDetails *shell_details, GsApp *app)
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_HISTORY |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_SETUP_ACTION |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_ORIGIN |
+                                          GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH |
                                           GS_PLUGIN_REFINE_FLAGS_REQUIRE_URL,
                                           priv->cancellable,
                                           gs_shell_details_app_refine_cb,
diff --git a/src/plugins/gs-plugin-menu-spec-refine.c b/src/plugins/gs-plugin-menu-spec-refine.c
index b4507cc..99cc83b 100644
--- a/src/plugins/gs-plugin-menu-spec-refine.c
+++ b/src/plugins/gs-plugin-menu-spec-refine.c
@@ -123,6 +123,10 @@ gs_plugin_refine (GsPlugin *plugin,
        GsApp *app;
        gboolean ret;
 
+       /* nothing to do here */
+       if ((flags & GS_PLUGIN_REFINE_FLAGS_REQUIRE_MENU_PATH) == 0)
+               goto out;
+
        for (l = *list; l != NULL; l = l->next) {
                app = GS_APP (l->data);
                if (gs_app_get_menu_path (app) == NULL) {
@@ -133,5 +137,6 @@ gs_plugin_refine (GsPlugin *plugin,
                        }
                }
        }
+out:
        return TRUE;
 }


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