[gnome-software] Remove the unused ACTION_ADD_SOURCE vfunc
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Remove the unused ACTION_ADD_SOURCE vfunc
- Date: Tue, 26 Jul 2016 08:45:51 +0000 (UTC)
commit a04d5989eca9ee7e0fe9df8df30993af75f1ffcc
Author: Richard Hughes <richard hughsie com>
Date: Tue Jul 26 09:41:33 2016 +0100
Remove the unused ACTION_ADD_SOURCE vfunc
This can be achieved by just calling ACTION_INSTALL on the GsApp, and it was
super confusing to have two things (add_source and add_sources) with such
similar names.
src/gs-plugin-loader.c | 3 ---
src/gs-plugin-loader.h | 1 -
src/gs-plugin-vfuncs.h | 20 --------------------
src/gs-self-test.c | 2 +-
src/plugins/gs-flatpak.c | 16 ++++++++++++----
src/plugins/gs-flatpak.h | 4 ----
src/plugins/gs-plugin-flatpak-system.c | 10 ----------
src/plugins/gs-plugin-flatpak-user.c | 10 ----------
8 files changed, 13 insertions(+), 53 deletions(-)
---
diff --git a/src/gs-plugin-loader.c b/src/gs-plugin-loader.c
index c5a05c7..74e8566 100644
--- a/src/gs-plugin-loader.c
+++ b/src/gs-plugin-loader.c
@@ -3057,9 +3057,6 @@ gs_plugin_loader_app_action_async (GsPluginLoader *plugin_loader,
case GS_PLUGIN_LOADER_ACTION_REMOVE_SHORTCUT:
state->function_name = "gs_plugin_remove_shortcut";
break;
- case GS_PLUGIN_LOADER_ACTION_ADD_SOURCE:
- state->function_name = "gs_plugin_add_source";
- break;
default:
g_assert_not_reached ();
break;
diff --git a/src/gs-plugin-loader.h b/src/gs-plugin-loader.h
index 3b07f7a..dc72e71 100644
--- a/src/gs-plugin-loader.h
+++ b/src/gs-plugin-loader.h
@@ -57,7 +57,6 @@ typedef enum {
GS_PLUGIN_LOADER_ACTION_UPDATE_CANCEL,
GS_PLUGIN_LOADER_ACTION_ADD_SHORTCUT,
GS_PLUGIN_LOADER_ACTION_REMOVE_SHORTCUT,
- GS_PLUGIN_LOADER_ACTION_ADD_SOURCE,
GS_PLUGIN_LOADER_ACTION_LAST
} GsPluginLoaderAction;
diff --git a/src/gs-plugin-vfuncs.h b/src/gs-plugin-vfuncs.h
index 0473515..d3701fd 100644
--- a/src/gs-plugin-vfuncs.h
+++ b/src/gs-plugin-vfuncs.h
@@ -605,26 +605,6 @@ gboolean gs_plugin_update_app (GsPlugin *plugin,
GError **error);
/**
- * gs_plugin_add_source:
- * @plugin: a #GsPlugin
- * @app: a #GsApp, with kind %AS_ID_KIND_SOURCE
- * @cancellable: a #GCancellable, or %NULL
- * @error: a #GError, or %NULL
- *
- * Adds a specific source to the system.
- *
- * Adding a source means that applications can be installed from that source,
- * along with any new search results.
- * A new entry is also shown in the "Sources" dialog.
- *
- * Returns: %TRUE for success or if not relevant
- **/
-gboolean gs_plugin_add_source (GsPlugin *plugin,
- GsApp *app,
- GCancellable *cancellable,
- GError **error);
-
-/**
* gs_plugin_app_upgrade_download:
* @plugin: a #GsPlugin
* @app: a #GsApp, with kind %AS_APP_KIND_OS_UPGRADE
diff --git a/src/gs-self-test.c b/src/gs-self-test.c
index bae2461..8b09a13 100644
--- a/src/gs-self-test.c
+++ b/src/gs-self-test.c
@@ -717,7 +717,7 @@ gs_plugin_loader_flatpak_func (GsPluginLoader *plugin_loader)
gs_app_set_state (app_source, AS_APP_STATE_AVAILABLE);
gs_app_set_url (app_source, AS_URL_KIND_HOMEPAGE, testdir_repourl);
ret = gs_plugin_loader_app_action (plugin_loader, app_source,
- GS_PLUGIN_LOADER_ACTION_ADD_SOURCE,
+ GS_PLUGIN_LOADER_ACTION_INSTALL,
NULL,
&error);
g_assert_no_error (error);
diff --git a/src/plugins/gs-flatpak.c b/src/plugins/gs-flatpak.c
index 4dc7fed..ed1dedf 100644
--- a/src/plugins/gs-flatpak.c
+++ b/src/plugins/gs-flatpak.c
@@ -495,10 +495,10 @@ gs_flatpak_add_sources (GsFlatpak *self, GsAppList *list,
return TRUE;
}
-gboolean
-gs_flatpak_add_source (GsFlatpak *self, GsApp *app,
- GCancellable *cancellable,
- GError **error)
+static gboolean
+gs_flatpak_app_install_source (GsFlatpak *self, GsApp *app,
+ GCancellable *cancellable,
+ GError **error)
{
const gchar *gpg_key;
g_autoptr(FlatpakRemote) xremote = NULL;
@@ -1383,6 +1383,14 @@ gs_flatpak_app_install (GsFlatpak *self,
/* install */
gs_app_set_state (app, AS_APP_STATE_INSTALLING);
+ /* add a source */
+ if (gs_app_get_kind (app) == AS_APP_KIND_SOURCE) {
+ return gs_flatpak_app_install_source (self,
+ app,
+ cancellable,
+ error);
+ }
+
/* install required runtime if not already installed */
if (gs_app_get_kind (app) == AS_APP_KIND_DESKTOP) {
GsApp *runtime;
diff --git a/src/plugins/gs-flatpak.h b/src/plugins/gs-flatpak.h
index 0f1ee57..c84e4ef 100644
--- a/src/plugins/gs-flatpak.h
+++ b/src/plugins/gs-flatpak.h
@@ -63,10 +63,6 @@ gboolean gs_flatpak_add_sources (GsFlatpak *self,
GsAppList *list,
GCancellable *cancellable,
GError **error);
-gboolean gs_flatpak_add_source (GsFlatpak *self,
- GsApp *app,
- GCancellable *cancellable,
- GError **error);
gboolean gs_flatpak_add_updates (GsFlatpak *self,
GsAppList *list,
GCancellable *cancellable,
diff --git a/src/plugins/gs-plugin-flatpak-system.c b/src/plugins/gs-plugin-flatpak-system.c
index 715eb44..a1b629a 100644
--- a/src/plugins/gs-plugin-flatpak-system.c
+++ b/src/plugins/gs-plugin-flatpak-system.c
@@ -98,16 +98,6 @@ gs_plugin_add_sources (GsPlugin *plugin,
}
gboolean
-gs_plugin_add_source (GsPlugin *plugin,
- GsApp *app,
- GCancellable *cancellable,
- GError **error)
-{
- GsPluginData *priv = gs_plugin_get_data (plugin);
- return gs_flatpak_add_source (priv->flatpak, app, cancellable, error);
-}
-
-gboolean
gs_plugin_add_updates (GsPlugin *plugin,
GsAppList *list,
GCancellable *cancellable,
diff --git a/src/plugins/gs-plugin-flatpak-user.c b/src/plugins/gs-plugin-flatpak-user.c
index 7334373..c87efbd 100644
--- a/src/plugins/gs-plugin-flatpak-user.c
+++ b/src/plugins/gs-plugin-flatpak-user.c
@@ -98,16 +98,6 @@ gs_plugin_add_sources (GsPlugin *plugin,
}
gboolean
-gs_plugin_add_source (GsPlugin *plugin,
- GsApp *app,
- GCancellable *cancellable,
- GError **error)
-{
- GsPluginData *priv = gs_plugin_get_data (plugin);
- return gs_flatpak_add_source (priv->flatpak, app, cancellable, error);
-}
-
-gboolean
gs_plugin_add_updates (GsPlugin *plugin,
GsAppList *list,
GCancellable *cancellable,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]