[gnome-software/wip/hughsie/unique_id: 3/5] Remove the now-pointless gs_app_get_id_no_prefix()
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software/wip/hughsie/unique_id: 3/5] Remove the now-pointless gs_app_get_id_no_prefix()
- Date: Thu, 28 Jul 2016 16:42:41 +0000 (UTC)
commit 68fd891d59147678c8963e13d308c2cd32f96cb9
Author: Richard Hughes <richard hughsie com>
Date: Thu Jul 28 16:35:24 2016 +0100
Remove the now-pointless gs_app_get_id_no_prefix()
src/gs-app-list.c | 2 +-
src/gs-app.c | 21 ---------------------
src/gs-app.h | 1 -
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 ++++++------
9 files changed, 17 insertions(+), 39 deletions(-)
---
diff --git a/src/gs-app-list.c b/src/gs-app-list.c
index 9a02bbf..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);
diff --git a/src/gs-app.c b/src/gs-app.c
index f6ad782..abda9b4 100644
--- a/src/gs-app.c
+++ b/src/gs-app.c
@@ -499,27 +499,6 @@ gs_app_get_id (GsApp *app)
}
/**
- * gs_app_get_id_no_prefix:
- * @app: a #GsApp
- *
- * Gets the application ID without any prefix set.
- *
- * Returns: The whole ID, e.g. gimp.desktop" or "org.gnome.Gimp.desktop"
- **/
-const gchar *
-gs_app_get_id_no_prefix (GsApp *app)
-{
- gchar *tmp;
- g_return_val_if_fail (GS_IS_APP (app), NULL);
- if (app->id == NULL)
- return NULL;
- tmp = g_strrstr (app->id, ":");
- if (tmp != NULL)
- return tmp + 1;
- return app->id;
-}
-
-/**
* gs_app_set_id:
* @app: a #GsApp
* @id: a application ID, e.g. "gimp.desktop"
diff --git a/src/gs-app.h b/src/gs-app.h
index c65e570..f6e1672 100644
--- a/src/gs-app.h
+++ b/src/gs-app.h
@@ -103,7 +103,6 @@ gchar *gs_app_to_string (GsApp *app);
const gchar *gs_app_get_id (GsApp *app);
void gs_app_set_id (GsApp *app,
const gchar *id);
-const gchar *gs_app_get_id_no_prefix (GsApp *app);
AsAppKind gs_app_get_kind (GsApp *app);
void gs_app_set_kind (GsApp *app,
AsAppKind kind);
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 84b49e1..10dfdfe 100644
--- a/src/plugins/gs-plugin-dummy.c
+++ b/src/plugins/gs-plugin-dummy.c
@@ -384,9 +384,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]