[gnome-software/wip/hughsie/unique_id: 9/10] trivial: Remove use of gs_app_get_id_no_prefix()



commit 5cfefe757e340daa82d8371b1a07732566d5fcfa
Author: Richard Hughes <richard hughsie com>
Date:   Wed Aug 3 15:16:01 2016 +0100

    trivial: Remove use of gs_app_get_id_no_prefix()
    
    The ID is always unprefixed now.

 src/gs-app-list.c                          |   10 +++++-----
 src/gs-plugin.c                            |    2 +-
 src/gs-shell-search.c                      |    4 ++--
 src/plugins/gs-plugin-dummy.c              |    6 +++---
 src/plugins/gs-plugin-epiphany.c           |    6 +++---
 src/plugins/gs-plugin-hardcoded-featured.c |    2 +-
 src/plugins/gs-plugin-odrs.c               |   12 ++++++------
 7 files changed, 21 insertions(+), 21 deletions(-)
---
diff --git a/src/gs-app-list.c b/src/gs-app-list.c
index 3b28fb9..ce0bfcc 100644
--- a/src/gs-app-list.c
+++ b/src/gs-app-list.c
@@ -268,7 +268,7 @@ gs_app_list_filter_duplicates (GsAppList *list, GsAppListFilterFlags flags)
                app = gs_app_list_index (list, i);
                id = gs_app_get_unique_id (app);
                if (flags & GS_APP_LIST_FILTER_FLAG_PRIORITY)
-                       id = gs_app_get_id_no_prefix (app);
+                       id = gs_app_get_id (app);
                if (id == NULL) {
                        g_autofree gchar *str = gs_app_to_string (app);
                        g_debug ("ignoring as no application id for: %s", str);
@@ -276,7 +276,7 @@ gs_app_list_filter_duplicates (GsAppList *list, GsAppListFilterFlags flags)
                }
                found = g_hash_table_lookup (hash, id);
                if (found == NULL) {
-                       g_debug ("found new %s", gs_app_get_id (app));
+                       g_debug ("found new %s", id);
                        g_hash_table_insert (hash,
                                             g_strdup (id),
                                             g_object_ref (app));
@@ -288,7 +288,7 @@ gs_app_list_filter_duplicates (GsAppList *list, GsAppListFilterFlags flags)
                        if (gs_app_get_priority (app) >
                            gs_app_get_priority (found)) {
                                g_debug ("using better %s (priority %u > %u)",
-                                        gs_app_get_id (app),
+                                        id,
                                         gs_app_get_priority (app),
                                         gs_app_get_priority (found));
                                g_hash_table_insert (hash,
@@ -297,12 +297,12 @@ gs_app_list_filter_duplicates (GsAppList *list, GsAppListFilterFlags flags)
                                continue;
                        }
                        g_debug ("ignoring worse duplicate %s (priority %u > %u)",
-                                gs_app_get_id (app),
+                                id,
                                 gs_app_get_priority (app),
                                 gs_app_get_priority (found));
                        continue;
                }
-               g_debug ("ignoring duplicate %s", gs_app_get_id (app));
+               g_debug ("ignoring duplicate %s", id);
                continue;
        }
 
diff --git a/src/gs-plugin.c b/src/gs-plugin.c
index a596089..d6f9b52 100644
--- a/src/gs-plugin.c
+++ b/src/gs-plugin.c
@@ -801,7 +801,7 @@ gs_plugin_app_launch (GsPlugin *plugin, GsApp *app, GError **error)
        const gchar *desktop_id;
        g_autoptr(GAppInfo) appinfo = NULL;
 
-       desktop_id = gs_app_get_id_no_prefix (app);
+       desktop_id = gs_app_get_id (app);
        if (desktop_id == NULL) {
                g_set_error (error,
                             GS_PLUGIN_ERROR,
diff --git a/src/gs-shell-search.c b/src/gs-shell-search.c
index 995782f..6fb9bfb 100644
--- a/src/gs-shell-search.c
+++ b/src/gs-shell-search.c
@@ -111,8 +111,8 @@ _gs_app_list_is_duplicate (GsAppList *list, GsApp *app)
                }
 
                /* same D-Bus ID */
-               if (g_strcmp0 (gs_app_get_id_no_prefix (tmp),
-                              gs_app_get_id_no_prefix (app)) == 0) {
+               if (g_strcmp0 (gs_app_get_id (tmp),
+                              gs_app_get_id (app)) == 0) {
                        return TRUE;
                }
 
diff --git a/src/plugins/gs-plugin-dummy.c b/src/plugins/gs-plugin-dummy.c
index 1b59c7b..b17abd4 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -385,9 +385,9 @@ gs_plugin_refine_app (GsPlugin *plugin,
                      GError **error)
 {
        /* default */
-       if (g_strcmp0 (gs_app_get_id_no_prefix (app), "chiron.desktop") == 0 ||
-           g_strcmp0 (gs_app_get_id_no_prefix (app), "mate-spell.desktop") == 0 ||
-           g_strcmp0 (gs_app_get_id_no_prefix (app), "zeus.desktop") == 0) {
+       if (g_strcmp0 (gs_app_get_id (app), "chiron.desktop") == 0 ||
+           g_strcmp0 (gs_app_get_id (app), "mate-spell.desktop") == 0 ||
+           g_strcmp0 (gs_app_get_id (app), "zeus.desktop") == 0) {
                if (gs_app_get_state (app) == AS_APP_STATE_UNKNOWN)
                        gs_app_set_state (app, AS_APP_STATE_INSTALLED);
                if (gs_app_get_kind (app) == AS_APP_KIND_UNKNOWN)
diff --git a/src/plugins/gs-plugin-epiphany.c b/src/plugins/gs-plugin-epiphany.c
index 0c8ffaf..a64bb18 100644
--- a/src/plugins/gs-plugin-epiphany.c
+++ b/src/plugins/gs-plugin-epiphany.c
@@ -63,7 +63,7 @@ _gs_app_get_id_nonfull (GsApp *app)
        gchar *id;
        gchar *tmp;
 
-       id = g_strdup (gs_app_get_id_no_prefix (app));
+       id = g_strdup (gs_app_get_id (app));
        tmp = g_strrstr (id, ".desktop");
        if (tmp != NULL)
                *tmp = '\0';
@@ -191,7 +191,7 @@ gs_plugin_app_install (GsPlugin *plugin, GsApp *app,
        /* symlink it to somewhere the shell will notice */
        app_desktop = g_build_filename (g_get_user_data_dir (),
                                        "applications",
-                                       gs_app_get_id_no_prefix (app),
+                                       gs_app_get_id (app),
                                        NULL);
        symlink_desktop = g_file_new_for_path (app_desktop);
        ret = g_file_make_symbolic_link (symlink_desktop,
@@ -231,7 +231,7 @@ gs_plugin_app_remove (GsPlugin *plugin, GsApp *app,
        /* remove the shared desktop file */
        app_desktop = g_build_filename (g_get_user_data_dir (),
                                        "applications",
-                                       gs_app_get_id_no_prefix (app),
+                                       gs_app_get_id (app),
                                        NULL);
        file_app = g_file_new_for_path (app_desktop);
        if (!g_file_delete (file_app, NULL, error))
diff --git a/src/plugins/gs-plugin-hardcoded-featured.c b/src/plugins/gs-plugin-hardcoded-featured.c
index 66c8721..009617e 100644
--- a/src/plugins/gs-plugin-hardcoded-featured.c
+++ b/src/plugins/gs-plugin-hardcoded-featured.c
@@ -235,7 +235,7 @@ gs_plugin_refine_app (GsPlugin *plugin,
        const gchar *key = "GnomeSoftware::FeatureTile-css";
        guint i;
        for (i = 0; myapps[i].id != NULL; i++) {
-               if (g_strcmp0 (gs_app_get_id_no_prefix (app),
+               if (g_strcmp0 (gs_app_get_id (app),
                               myapps[i].id) != 0)
                        continue;
                if (gs_app_get_metadata_item (app, key) != NULL)
diff --git a/src/plugins/gs-plugin-odrs.c b/src/plugins/gs-plugin-odrs.c
index ddd066b..db1c10a 100644
--- a/src/plugins/gs-plugin-odrs.c
+++ b/src/plugins/gs-plugin-odrs.c
@@ -469,7 +469,7 @@ gs_plugin_refine_ratings (GsPlugin *plugin,
 
        /* get ratings */
        review_ratings = g_hash_table_lookup (priv->ratings,
-                                             gs_app_get_id_no_prefix (app));
+                                             gs_app_get_id (app));
        if (review_ratings == NULL)
                return TRUE;
        gs_app_set_review_ratings (app, review_ratings);
@@ -503,7 +503,7 @@ gs_plugin_odrs_fetch_for_app (GsPlugin *plugin, GsApp *app, GError **error)
        g_autoptr(SoupMessage) msg = NULL;
 
        /* look in the cache */
-       cachefn_basename = g_strdup_printf ("%s.json", gs_app_get_id_no_prefix (app));
+       cachefn_basename = g_strdup_printf ("%s.json", gs_app_get_id (app));
        cachefn = gs_utils_get_cache_filename ("reviews",
                                               cachefn_basename,
                                               GS_UTILS_CACHE_FLAG_WRITEABLE,
@@ -516,7 +516,7 @@ gs_plugin_odrs_fetch_for_app (GsPlugin *plugin, GsApp *app, GError **error)
                if (!g_file_get_contents (cachefn, &json_data, NULL, error))
                        return NULL;
                g_debug ("got review data for %s from %s",
-                        gs_app_get_id_no_prefix (app), cachefn);
+                        gs_app_get_id (app), cachefn);
                return gs_plugin_odrs_parse_reviews (plugin,
                                                     json_data, -1,
                                                     error);
@@ -533,7 +533,7 @@ gs_plugin_odrs_fetch_for_app (GsPlugin *plugin, GsApp *app, GError **error)
        json_builder_set_member_name (builder, "user_hash");
        json_builder_add_string_value (builder, priv->user_hash);
        json_builder_set_member_name (builder, "app_id");
-       json_builder_add_string_value (builder, gs_app_get_id_no_prefix (app));
+       json_builder_add_string_value (builder, gs_app_get_id (app));
        json_builder_set_member_name (builder, "locale");
        json_builder_add_string_value (builder, gs_plugin_get_locale (plugin));
        json_builder_set_member_name (builder, "distro");
@@ -639,7 +639,7 @@ gs_plugin_refine_app (GsPlugin *plugin,
        /* not valid */
        if (gs_app_get_kind (app) == AS_APP_KIND_ADDON)
                return TRUE;
-       if (gs_app_get_id_no_prefix (app) == NULL)
+       if (gs_app_get_id (app) == NULL)
                return TRUE;
 
        /* add reviews if possible */
@@ -730,7 +730,7 @@ gs_plugin_review_submit (GsPlugin *plugin,
 
        /* save as we don't re-request the review from the server */
        as_review_set_reviewer_name (review, g_get_real_name ());
-       as_review_add_metadata (review, "app_id", gs_app_get_id_no_prefix (app));
+       as_review_add_metadata (review, "app_id", gs_app_get_id (app));
        as_review_add_metadata (review, "user_skey",
                                gs_app_get_metadata_item (app, "ODRS::user_skey"));
 


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