[gnome-software] Remove GsAuth support.
- From: Richard Hughes <rhughes src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-software] Remove GsAuth support.
- Date: Fri, 12 Jul 2019 07:38:10 +0000 (UTC)
commit 145bb821d140de60a55ffe41b1f9133d398f4ce4
Author: Robert Ancell <robert ancell canonical com>
Date: Fri Jul 12 10:46:47 2019 +1200
Remove GsAuth support.
This used to be used in the Snap and Ubuntu Reviews plugins, but is now no
longer required. The remaining usage in the Snap plugin is not a common
case on desktop and not necessary to support anymore.
doc/api/gnome-software-docs.xml | 1 -
lib/gnome-software.h | 1 -
lib/gs-auth.c | 470 --------------------------------------
lib/gs-auth.h | 39 ----
lib/gs-plugin-job-private.h | 1 -
lib/gs-plugin-job.c | 32 ---
lib/gs-plugin-job.h | 3 -
lib/gs-plugin-loader.c | 31 ---
lib/gs-plugin-loader.h | 4 -
lib/gs-plugin.c | 61 -----
lib/gs-plugin.h | 5 -
lib/meson.build | 2 -
plugins/dummy/gs-plugin-dummy.c | 23 --
plugins/snap/gs-plugin-snap.c | 73 ------
po/POTFILES.in | 2 -
src/gnome-software.gresource.xml | 1 -
src/gs-auth-dialog.c | 475 ---------------------------------------
src/gs-auth-dialog.h | 25 ---
src/gs-auth-dialog.ui | 129 -----------
src/gs-details-page.c | 41 ----
src/gs-page.c | 135 -----------
src/gs-page.h | 6 -
src/gs-shell.c | 134 -----------
src/meson.build | 1 -
24 files changed, 1695 deletions(-)
---
diff --git a/doc/api/gnome-software-docs.xml b/doc/api/gnome-software-docs.xml
index cce7512a..385ea5cd 100644
--- a/doc/api/gnome-software-docs.xml
+++ b/doc/api/gnome-software-docs.xml
@@ -603,7 +603,6 @@ gs_plugin_adopt_app (GsPlugin *plugin, GsApp *app)
<xi:include href="xml/gs-app-list.xml"/>
<xi:include href="xml/gs-app.xml"/>
<xi:include href="xml/gs-category.xml"/>
- <xi:include href="xml/gs-auth.xml"/>
<xi:include href="xml/gs-os-release.xml"/>
<xi:include href="xml/gs-plugin.xml"/>
<xi:include href="xml/gs-plugin-event.xml"/>
diff --git a/lib/gnome-software.h b/lib/gnome-software.h
index f90b17f5..2833d0ff 100644
--- a/lib/gnome-software.h
+++ b/lib/gnome-software.h
@@ -14,7 +14,6 @@
#include <gs-app.h>
#include <gs-app-list.h>
#include <gs-app-collation.h>
-#include <gs-auth.h>
#include <gs-autocleanups.h>
#include <gs-category.h>
#include <gs-os-release.h>
diff --git a/lib/gs-plugin-job-private.h b/lib/gs-plugin-job-private.h
index 487e603b..0fa0d2d0 100644
--- a/lib/gs-plugin-job-private.h
+++ b/lib/gs-plugin-job-private.h
@@ -30,7 +30,6 @@ guint64 gs_plugin_job_get_age (GsPluginJob
*self);
GsAppListSortFunc gs_plugin_job_get_sort_func (GsPluginJob *self);
gpointer gs_plugin_job_get_sort_func_data (GsPluginJob *self);
const gchar *gs_plugin_job_get_search (GsPluginJob *self);
-GsAuth *gs_plugin_job_get_auth (GsPluginJob *self);
GsApp *gs_plugin_job_get_app (GsPluginJob *self);
GsAppList *gs_plugin_job_get_list (GsPluginJob *self);
GFile *gs_plugin_job_get_file (GsPluginJob *self);
diff --git a/lib/gs-plugin-job.c b/lib/gs-plugin-job.c
index 54de3c55..24830a9b 100644
--- a/lib/gs-plugin-job.c
+++ b/lib/gs-plugin-job.c
@@ -28,7 +28,6 @@ struct _GsPluginJob
GsAppListSortFunc sort_func;
gpointer sort_func_data;
gchar *search;
- GsAuth *auth;
GsApp *app;
GsAppList *list;
GFile *file;
@@ -46,7 +45,6 @@ enum {
PROP_FILTER_FLAGS,
PROP_DEDUPE_FLAGS,
PROP_INTERACTIVE,
- PROP_AUTH,
PROP_APP,
PROP_LIST,
PROP_FILE,
@@ -109,10 +107,6 @@ gs_plugin_job_to_string (GsPluginJob *self)
g_string_append_printf (str, " with review=%s",
as_review_get_id (self->review));
}
- if (self->auth != NULL) {
- g_string_append_printf (str, " with auth=%s",
- gs_auth_get_auth_id (self->auth));
- }
if (self->file != NULL) {
g_autofree gchar *path = g_file_get_path (self->file);
g_string_append_printf (str, " with file=%s", path);
@@ -315,20 +309,6 @@ gs_plugin_job_get_search (GsPluginJob *self)
return self->search;
}
-void
-gs_plugin_job_set_auth (GsPluginJob *self, GsAuth *auth)
-{
- g_return_if_fail (GS_IS_PLUGIN_JOB (self));
- g_set_object (&self->auth, auth);
-}
-
-GsAuth *
-gs_plugin_job_get_auth (GsPluginJob *self)
-{
- g_return_val_if_fail (GS_IS_PLUGIN_JOB (self), NULL);
- return self->auth;
-}
-
void
gs_plugin_job_set_app (GsPluginJob *self, GsApp *app)
{
@@ -446,9 +426,6 @@ gs_plugin_job_get_property (GObject *obj, guint prop_id, GValue *value, GParamSp
case PROP_SEARCH:
g_value_set_string (value, self->search);
break;
- case PROP_AUTH:
- g_value_set_object (value, self->auth);
- break;
case PROP_APP:
g_value_set_object (value, self->app);
break;
@@ -503,9 +480,6 @@ gs_plugin_job_set_property (GObject *obj, guint prop_id, const GValue *value, GP
case PROP_SEARCH:
gs_plugin_job_set_search (self, g_value_get_string (value));
break;
- case PROP_AUTH:
- gs_plugin_job_set_auth (self, g_value_get_object (value));
- break;
case PROP_APP:
gs_plugin_job_set_app (self, g_value_get_object (value));
break;
@@ -538,7 +512,6 @@ gs_plugin_job_finalize (GObject *obj)
{
GsPluginJob *self = GS_PLUGIN_JOB (obj);
g_free (self->search);
- g_clear_object (&self->auth);
g_clear_object (&self->app);
g_clear_object (&self->list);
g_clear_object (&self->file);
@@ -595,11 +568,6 @@ gs_plugin_job_class_init (GsPluginJobClass *klass)
G_PARAM_READWRITE);
g_object_class_install_property (object_class, PROP_SEARCH, pspec);
- pspec = g_param_spec_object ("auth", NULL, NULL,
- GS_TYPE_AUTH,
- G_PARAM_READWRITE);
- g_object_class_install_property (object_class, PROP_AUTH, pspec);
-
pspec = g_param_spec_object ("app", NULL, NULL,
GS_TYPE_APP,
G_PARAM_READWRITE);
diff --git a/lib/gs-plugin-job.h b/lib/gs-plugin-job.h
index 20a1b04f..5100fdf0 100644
--- a/lib/gs-plugin-job.h
+++ b/lib/gs-plugin-job.h
@@ -10,7 +10,6 @@
#include <glib-object.h>
#include "gs-app-list-private.h"
-#include "gs-auth.h"
#include "gs-category.h"
#include "gs-plugin-types.h"
@@ -40,8 +39,6 @@ void gs_plugin_job_set_sort_func_data (GsPluginJob *self,
gpointer sort_func_data);
void gs_plugin_job_set_search (GsPluginJob *self,
const gchar *search);
-void gs_plugin_job_set_auth (GsPluginJob *self,
- GsAuth *auth);
void gs_plugin_job_set_app (GsPluginJob *self,
GsApp *app);
void gs_plugin_job_set_list (GsPluginJob *self,
diff --git a/lib/gs-plugin-loader.c b/lib/gs-plugin-loader.c
index 4bfb7a01..937986fd 100644
--- a/lib/gs-plugin-loader.c
+++ b/lib/gs-plugin-loader.c
@@ -36,7 +36,6 @@ typedef struct
gchar *language;
gboolean plugin_dir_dirty;
SoupSession *soup_session;
- GPtrArray *auth_array;
GPtrArray *file_monitors;
GsPluginStatus global_status_last;
@@ -127,10 +126,6 @@ typedef gboolean (*GsPluginReviewFunc) (GsPlugin *plugin,
AsReview *review,
GCancellable *cancellable,
GError **error);
-typedef gboolean (*GsPluginAuthFunc) (GsPlugin *plugin,
- GsAuth *auth,
- GCancellable *cancellable,
- GError **error);
typedef gboolean (*GsPluginRefineFunc) (GsPlugin *plugin,
GsAppList *list,
GsPluginRefineFlags refine_flags,
@@ -2074,7 +2069,6 @@ gs_plugin_loader_open_plugin (GsPluginLoader *plugin_loader,
G_CALLBACK (gs_plugin_loader_allow_updates_cb),
plugin_loader);
gs_plugin_set_soup_session (plugin, priv->soup_session);
- gs_plugin_set_auth_array (plugin, priv->auth_array);
gs_plugin_set_locale (plugin, priv->locale);
gs_plugin_set_language (plugin, priv->language);
gs_plugin_set_scale (plugin, gs_plugin_loader_get_scale (plugin_loader));
@@ -2105,29 +2099,6 @@ gs_plugin_loader_get_scale (GsPluginLoader *plugin_loader)
return priv->scale;
}
-GsAuth *
-gs_plugin_loader_get_auth_by_id (GsPluginLoader *plugin_loader,
- const gchar *auth_id)
-{
- GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
- guint i;
-
- /* match on ID */
- for (i = 0; i < priv->auth_array->len; i++) {
- GsAuth *auth = g_ptr_array_index (priv->auth_array, i);
- if (g_strcmp0 (gs_auth_get_auth_id (auth), auth_id) == 0)
- return auth;
- }
- return NULL;
-}
-
-GPtrArray *
-gs_plugin_loader_get_auths (GsPluginLoader *plugin_loader)
-{
- GsPluginLoaderPrivate *priv = gs_plugin_loader_get_instance_private (plugin_loader);
- return priv->auth_array;
-}
-
void
gs_plugin_loader_add_location (GsPluginLoader *plugin_loader, const gchar *location)
{
@@ -2608,7 +2579,6 @@ gs_plugin_loader_dispose (GObject *object)
g_clear_object (&priv->network_monitor);
g_clear_object (&priv->soup_session);
g_clear_object (&priv->settings);
- g_clear_pointer (&priv->auth_array, g_ptr_array_unref);
g_clear_pointer (&priv->pending_apps, g_ptr_array_unref);
G_OBJECT_CLASS (gs_plugin_loader_parent_class)->dispose (object);
@@ -2732,7 +2702,6 @@ gs_plugin_loader_init (GsPluginLoader *plugin_loader)
get_max_parallel_ops (),
FALSE,
NULL);
- priv->auth_array = g_ptr_array_new_with_free_func ((GFreeFunc) g_object_unref);
priv->file_monitors = g_ptr_array_new_with_free_func ((GFreeFunc) g_object_unref);
priv->locations = g_ptr_array_new_with_free_func (g_free);
priv->settings = g_settings_new ("org.gnome.software");
diff --git a/lib/gs-plugin-loader.h b/lib/gs-plugin-loader.h
index 1d0c10f7..e5083d9e 100644
--- a/lib/gs-plugin-loader.h
+++ b/lib/gs-plugin-loader.h
@@ -11,7 +11,6 @@
#include <glib-object.h>
#include "gs-app.h"
-#include "gs-auth.h"
#include "gs-category.h"
#include "gs-plugin-event.h"
#include "gs-plugin-private.h"
@@ -64,9 +63,6 @@ gboolean gs_plugin_loader_get_enabled (GsPluginLoader *plugin_loader,
const gchar *plugin_name);
void gs_plugin_loader_add_location (GsPluginLoader *plugin_loader,
const gchar *location);
-GsAuth *gs_plugin_loader_get_auth_by_id (GsPluginLoader *plugin_loader,
- const gchar *auth_id);
-GPtrArray *gs_plugin_loader_get_auths (GsPluginLoader *plugin_loader);
guint gs_plugin_loader_get_scale (GsPluginLoader *plugin_loader);
void gs_plugin_loader_set_scale (GsPluginLoader *plugin_loader,
guint scale);
diff --git a/lib/gs-plugin.c b/lib/gs-plugin.c
index aea94128..b33c8cc2 100644
--- a/lib/gs-plugin.c
+++ b/lib/gs-plugin.c
@@ -47,7 +47,6 @@
typedef struct
{
- GPtrArray *auth_array;
GHashTable *cache;
GMutex cache_mutex;
GModule *module;
@@ -209,8 +208,6 @@ gs_plugin_finalize (GObject *object)
g_free (priv->data);
g_free (priv->locale);
g_free (priv->language);
- if (priv->auth_array != NULL)
- g_ptr_array_unref (priv->auth_array);
if (priv->soup_session != NULL)
g_object_unref (priv->soup_session);
if (priv->network_monitor != NULL)
@@ -598,64 +595,6 @@ gs_plugin_set_language (GsPlugin *plugin, const gchar *language)
priv->language = g_strdup (language);
}
-/**
- * gs_plugin_set_auth_array:
- * @plugin: a #GsPlugin
- * @auth_array: (element-type GsAuth): an array
- *
- * Sets the authentication objects that can be added by the plugin.
- *
- * Since: 3.22
- **/
-void
-gs_plugin_set_auth_array (GsPlugin *plugin, GPtrArray *auth_array)
-{
- GsPluginPrivate *priv = gs_plugin_get_instance_private (plugin);
- priv->auth_array = g_ptr_array_ref (auth_array);
-}
-
-/**
- * gs_plugin_add_auth:
- * @plugin: a #GsPlugin
- * @auth: a #GsAuth
- *
- * Adds an authentication object that can be used for all the plugins.
- *
- * Since: 3.22
- **/
-void
-gs_plugin_add_auth (GsPlugin *plugin, GsAuth *auth)
-{
- GsPluginPrivate *priv = gs_plugin_get_instance_private (plugin);
- g_ptr_array_add (priv->auth_array, g_object_ref (auth));
-}
-
-/**
- * gs_plugin_get_auth_by_id:
- * @plugin: a #GsPlugin
- * @auth_id: an ID, e.g. "dummy-sso"
- *
- * Gets a specific authentication object.
- *
- * Returns: the #GsAuth, or %NULL if not found
- *
- * Since: 3.22
- **/
-GsAuth *
-gs_plugin_get_auth_by_id (GsPlugin *plugin, const gchar *auth_id)
-{
- GsPluginPrivate *priv = gs_plugin_get_instance_private (plugin);
- guint i;
-
- /* match on ID */
- for (i = 0; i < priv->auth_array->len; i++) {
- GsAuth *auth = g_ptr_array_index (priv->auth_array, i);
- if (g_strcmp0 (gs_auth_get_auth_id (auth), auth_id) == 0)
- return auth;
- }
- return NULL;
-}
-
/**
* gs_plugin_get_soup_session:
* @plugin: a #GsPlugin
diff --git a/lib/gs-plugin.h b/lib/gs-plugin.h
index d4595186..7dd2d864 100644
--- a/lib/gs-plugin.h
+++ b/lib/gs-plugin.h
@@ -15,7 +15,6 @@
#include "gs-app.h"
#include "gs-app-list.h"
-#include "gs-auth.h"
#include "gs-category.h"
#include "gs-plugin-event.h"
#include "gs-plugin-types.h"
@@ -71,10 +70,6 @@ const gchar *gs_plugin_get_language (GsPlugin *plugin);
SoupSession *gs_plugin_get_soup_session (GsPlugin *plugin);
void gs_plugin_set_soup_session (GsPlugin *plugin,
SoupSession *soup_session);
-void gs_plugin_add_auth (GsPlugin *plugin,
- GsAuth *auth);
-GsAuth *gs_plugin_get_auth_by_id (GsPlugin *plugin,
- const gchar *auth_id);
void gs_plugin_add_rule (GsPlugin *plugin,
GsPluginRule rule,
const gchar *name);
diff --git a/lib/meson.build b/lib/meson.build
index 2126ce1a..86c7d378 100644
--- a/lib/meson.build
+++ b/lib/meson.build
@@ -39,7 +39,6 @@ install_headers([
'gnome-software.h',
'gs-app.h',
'gs-app-list.h',
- 'gs-auth.h',
'gs-category.h',
'gs-os-release.h',
'gs-plugin.h',
@@ -72,7 +71,6 @@ libgnomesoftware = static_library(
sources : [
'gs-app.c',
'gs-app-list.c',
- 'gs-auth.c',
'gs-category.c',
'gs-debug.c',
'gs-ioprio.c',
diff --git a/plugins/dummy/gs-plugin-dummy.c b/plugins/dummy/gs-plugin-dummy.c
index ee041500..0d8d53cb 100644
--- a/plugins/dummy/gs-plugin-dummy.c
+++ b/plugins/dummy/gs-plugin-dummy.c
@@ -19,8 +19,6 @@ struct GsPluginData {
guint quirk_id;
guint allow_updates_id;
gboolean allow_updates_inhibit;
- guint has_auth;
- GsAuth *auth;
GsApp *cached_origin;
GHashTable *installed_apps; /* id:1 */
GHashTable *available_apps; /* id:1 */
@@ -54,13 +52,6 @@ gs_plugin_initialize (GsPlugin *plugin)
gs_plugin_dummy_allow_updates_cb, plugin);
}
- /* set up a dummy authentication provider */
- priv->auth = gs_auth_new (gs_plugin_get_name (plugin), "google", NULL);
- if (priv->auth != NULL) {
- gs_auth_set_provider_name (priv->auth, "GNOME SSO");
- gs_plugin_add_auth (plugin, priv->auth);
- }
-
/* add source */
priv->cached_origin = gs_app_new (gs_plugin_get_name (plugin));
gs_app_set_kind (priv->cached_origin, AS_APP_KIND_SOURCE);
@@ -102,8 +93,6 @@ gs_plugin_destroy (GsPlugin *plugin)
g_hash_table_unref (priv->available_apps);
if (priv->quirk_id > 0)
g_source_remove (priv->quirk_id);
- if (priv->auth != NULL)
- g_object_unref (priv->auth);
if (priv->cached_origin != NULL)
g_object_unref (priv->cached_origin);
}
@@ -925,18 +914,6 @@ gs_plugin_review_remove (GsPlugin *plugin,
GCancellable *cancellable,
GError **error)
{
- GsPluginData *priv = gs_plugin_get_data (plugin);
-
- /* simulate an auth check */
- if (!priv->has_auth) {
- g_set_error (error,
- GS_PLUGIN_ERROR,
- GS_PLUGIN_ERROR_AUTH_REQUIRED,
- "authentication is required using @%s",
- gs_plugin_get_name (plugin));
- return FALSE;
- }
-
/* all okay */
g_debug ("Removing dummy self-review");
return TRUE;
diff --git a/plugins/snap/gs-plugin-snap.c b/plugins/snap/gs-plugin-snap.c
index 18146f60..9e84f0b0 100644
--- a/plugins/snap/gs-plugin-snap.c
+++ b/plugins/snap/gs-plugin-snap.c
@@ -16,7 +16,6 @@ struct GsPluginData {
SnapdAuthData *auth_data;
gchar *store_name;
SnapdSystemConfinement system_confinement;
- GsAuth *auth;
GMutex store_snaps_lock;
GHashTable *store_snaps;
@@ -40,9 +39,6 @@ get_client (GsPlugin *plugin, GError **error)
return g_steal_pointer (&client);
}
-static void
-load_auth (GsPlugin *plugin);
-
void
gs_plugin_initialize (GsPlugin *plugin)
{
@@ -61,20 +57,6 @@ gs_plugin_initialize (GsPlugin *plugin)
priv->store_snaps = g_hash_table_new_full (g_str_hash, g_str_equal,
g_free, (GDestroyNotify) g_object_unref);
- priv->auth = gs_auth_new ("snapd", "ubuntusso", &error);
- if (priv->auth) {
- gs_auth_set_provider_name (priv->auth, "Snap Store");
- gs_auth_set_header (priv->auth, _("To continue, you need to use an Ubuntu One account."),
- _("To continue, you need to use your Ubuntu One account."),
- _("To continue, you need to use an Ubuntu One account."));
- gs_plugin_add_auth (plugin, priv->auth);
- g_signal_connect_object (priv->auth, "changed",
- G_CALLBACK (load_auth),
- plugin, G_CONNECT_SWAPPED);
- } else {
- g_warning ("Failed to instantiate the snapd authentication object: %s", error->message);
- }
-
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_AFTER, "desktop-categories");
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_BETTER_THAN, "packagekit");
gs_plugin_add_rule (plugin, GS_PLUGIN_RULE_RUN_BEFORE, "icons");
@@ -167,60 +149,6 @@ snapd_error_convert (GError **perror)
error->domain = GS_PLUGIN_ERROR;
}
-static void
-load_auth (GsPlugin *plugin)
-{
- GsPluginData *priv = gs_plugin_get_data (plugin);
- GsAuth *auth;
- GoaObject *goa_object;
- GoaPasswordBased *password_based;
- g_autofree gchar *macaroon = NULL;
- g_autofree gchar *discharges_str = NULL;
- g_autoptr(GVariant) discharges_var = NULL;
- g_auto(GStrv) discharges = NULL;
- g_autoptr(SnapdAuthData) auth_data = NULL;
- g_autoptr(GError) error = NULL;
-
- auth = gs_plugin_get_auth_by_id (plugin, "snapd");
- if (auth == NULL)
- return;
-
- g_clear_object (&priv->auth_data);
- goa_object = gs_auth_peek_goa_object (auth);
- if (goa_object == NULL)
- return;
-
- password_based = goa_object_peek_password_based (goa_object);
- g_return_if_fail (password_based != NULL);
-
- goa_password_based_call_get_password_sync (password_based,
- "macaroon",
- &macaroon,
- NULL, &error);
- if (error != NULL) {
- g_warning ("Failed to get macaroon: %s", error->message);
- return;
- }
-
- goa_password_based_call_get_password_sync (password_based,
- "discharges",
- &discharges_str,
- NULL, &error);
- if (error != NULL) {
- g_warning ("Failed to get discharges %s", error->message);
- return;
- }
-
- if (discharges_str)
- discharges_var = g_variant_parse (G_VARIANT_TYPE ("as"),
- discharges_str,
- NULL, NULL, NULL);
- if (discharges_var)
- discharges = g_variant_dup_strv (discharges_var, NULL);
-
- priv->auth_data = snapd_auth_data_new (macaroon, discharges);
-}
-
gboolean
gs_plugin_setup (GsPlugin *plugin, GCancellable *cancellable, GError **error)
{
@@ -387,7 +315,6 @@ gs_plugin_destroy (GsPlugin *plugin)
{
GsPluginData *priv = gs_plugin_get_data (plugin);
g_free (priv->store_name);
- g_clear_object (&priv->auth);
g_clear_pointer (&priv->store_snaps, g_hash_table_unref);
g_mutex_clear (&priv->store_snaps_lock);
}
diff --git a/po/POTFILES.in b/po/POTFILES.in
index 5c5a4256..b2b76fac 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -12,8 +12,6 @@ src/gs-app-row.c
src/gs-app-row.ui
src/gs-app-tile.c
src/gs-app-tile.ui
-src/gs-auth-dialog.c
-src/gs-auth-dialog.ui
lib/gs-category.c
src/gs-category-page.c
src/gs-category-page.ui
diff --git a/src/gnome-software.gresource.xml b/src/gnome-software.gresource.xml
index a8efa6a9..2a523021 100644
--- a/src/gnome-software.gresource.xml
+++ b/src/gnome-software.gresource.xml
@@ -5,7 +5,6 @@
<file preprocess="xml-stripblanks">gs-app-addon-row.ui</file>
<file preprocess="xml-stripblanks">gs-app-folder-dialog.ui</file>
<file preprocess="xml-stripblanks">gs-app-row.ui</file>
- <file preprocess="xml-stripblanks">gs-auth-dialog.ui</file>
<file preprocess="xml-stripblanks">gs-category-page.ui</file>
<file preprocess="xml-stripblanks">gs-category-tile.ui</file>
<file preprocess="xml-stripblanks">gs-details-page.ui</file>
diff --git a/src/gs-details-page.c b/src/gs-details-page.c
index 5f11b728..2a59f8f0 100644
--- a/src/gs-details-page.c
+++ b/src/gs-details-page.c
@@ -18,7 +18,6 @@
#include "gs-details-page.h"
#include "gs-app-addon-row.h"
-#include "gs-auth-dialog.h"
#include "gs-history-dialog.h"
#include "gs-origin-popover-row.h"
#include "gs-screenshot-image.h"
@@ -1418,33 +1417,6 @@ gs_details_page_review_helper_free (GsDetailsPageReviewHelper *helper)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GsDetailsPageReviewHelper, gs_details_page_review_helper_free);
-static void
-gs_details_page_app_set_review_cb (GObject *source,
- GAsyncResult *res,
- gpointer user_data);
-
-static void
-gs_details_page_authenticate_cb (GsPage *page,
- gboolean authenticated,
- gpointer user_data)
-{
- g_autoptr(GsDetailsPageReviewHelper) helper = (GsDetailsPageReviewHelper *) user_data;
- g_autoptr(GsPluginJob) plugin_job = NULL;
-
- if (!authenticated)
- return;
-
- plugin_job = gs_plugin_job_newv (helper->action,
- "app", helper->app,
- "review", helper->review,
- NULL);
- gs_plugin_loader_job_process_async (helper->self->plugin_loader, plugin_job,
- helper->self->cancellable,
- gs_details_page_app_set_review_cb,
- helper);
- g_steal_pointer (&helper);
-}
-
static void
gs_details_page_app_set_review_cb (GObject *source,
GAsyncResult *res,
@@ -1455,19 +1427,6 @@ gs_details_page_app_set_review_cb (GObject *source,
g_autoptr(GError) error = NULL;
if (!gs_plugin_loader_job_action_finish (plugin_loader, res, &error)) {
- /* try to authenticate then retry */
- if (g_error_matches (error,
- GS_PLUGIN_ERROR,
- GS_PLUGIN_ERROR_AUTH_REQUIRED)) {
- gs_page_authenticate (GS_PAGE (helper->self),
- helper->app,
- gs_utils_get_error_value (error),
- helper->self->cancellable,
- gs_details_page_authenticate_cb,
- helper);
- g_steal_pointer (&helper);
- return;
- }
g_warning ("failed to set review on %s: %s",
gs_app_get_id (helper->app), error->message);
return;
diff --git a/src/gs-page.c b/src/gs-page.c
index b2bef0ee..98665dcb 100644
--- a/src/gs-page.c
+++ b/src/gs-page.c
@@ -13,7 +13,6 @@
#include "gs-page.h"
#include "gs-common.h"
-#include "gs-auth-dialog.h"
#include "gs-screenshot-image.h"
typedef struct
@@ -42,8 +41,6 @@ typedef struct {
GtkWidget *button_install;
GsPluginAction action;
GsShellInteraction interaction;
- GsPageAuthCallback callback;
- gpointer callback_data;
} GsPageHelper;
static void
@@ -62,110 +59,6 @@ gs_page_helper_free (GsPageHelper *helper)
G_DEFINE_AUTOPTR_CLEANUP_FUNC(GsPageHelper, gs_page_helper_free);
-static void
-gs_page_authenticate_cb (GtkDialog *dialog,
- GtkResponseType response_type,
- gpointer user_data)
-{
- g_autoptr(GsPageHelper) helper = user_data;
-
- /* unmap the dialog */
- gtk_widget_destroy (GTK_WIDGET (dialog));
-
- if (helper->callback != NULL)
- helper->callback (helper->page, response_type == GTK_RESPONSE_OK, helper->callback_data);
-}
-
-void
-gs_page_authenticate (GsPage *page,
- GsApp *app,
- const gchar *auth_id,
- GCancellable *cancellable,
- GsPageAuthCallback callback,
- gpointer user_data)
-{
- GsPagePrivate *priv = gs_page_get_instance_private (page);
- g_autoptr(GsPageHelper) helper = NULL;
- GtkWidget *dialog;
- g_autoptr(GError) error = NULL;
-
- helper = g_slice_new0 (GsPageHelper);
- helper->app = app != NULL ? g_object_ref (app) : NULL;
- helper->page = g_object_ref (page);
- helper->callback = callback;
- helper->callback_data = user_data;
-
- dialog = gs_auth_dialog_new (priv->plugin_loader,
- app,
- auth_id,
- &error);
- if (dialog == NULL) {
- g_warning ("%s", error->message);
- return;
- }
- gs_shell_modal_dialog_present (priv->shell, GTK_DIALOG (dialog));
- g_signal_connect (dialog, "response",
- G_CALLBACK (gs_page_authenticate_cb),
- helper);
- g_steal_pointer (&helper);
-}
-
-static void
-gs_page_app_installed_cb (GObject *source,
- GAsyncResult *res,
- gpointer user_data);
-
-static void
-gs_page_install_authenticate_cb (GsPage *page,
- gboolean authenticated,
- gpointer user_data)
-{
- g_autoptr(GsPageHelper) helper = (GsPageHelper *) user_data;
- GsPagePrivate *priv = gs_page_get_instance_private (page);
- g_autoptr(GsPluginJob) plugin_job = NULL;
-
- if (!authenticated)
- return;
-
- plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_INSTALL,
- "interactive", TRUE,
- "app", helper->app,
- NULL);
- gs_plugin_loader_job_process_async (priv->plugin_loader, plugin_job,
- helper->cancellable,
- gs_page_app_installed_cb,
- helper);
- g_steal_pointer (&helper);
-}
-
-static void
-gs_page_app_removed_cb (GObject *source,
- GAsyncResult *res,
- gpointer user_data);
-
-static void
-gs_page_remove_authenticate_cb (GsPage *page,
- gboolean authenticated,
- gpointer user_data)
-{
- g_autoptr(GsPageHelper) helper = (GsPageHelper *) user_data;
- GsPagePrivate *priv = gs_page_get_instance_private (page);
- g_autoptr(GsPluginJob) plugin_job = NULL;
-
- if (!authenticated)
- return;
-
- plugin_job = gs_plugin_job_newv (GS_PLUGIN_ACTION_REMOVE,
- "interactive", TRUE,
- "app", helper->app,
- NULL);
- gs_plugin_loader_job_process_async (priv->plugin_loader, plugin_job,
- helper->cancellable,
- gs_page_app_removed_cb,
- helper);
- g_steal_pointer (&helper);
-}
-
static void
gs_page_app_installed_cb (GObject *source,
GAsyncResult *res,
@@ -188,20 +81,6 @@ gs_page_app_installed_cb (GObject *source,
return;
}
if (!ret) {
- /* try to authenticate then retry */
- if (g_error_matches (error,
- GS_PLUGIN_ERROR,
- GS_PLUGIN_ERROR_AUTH_REQUIRED)) {
- gs_page_authenticate (page,
- helper->app,
- gs_utils_get_error_value (error),
- helper->cancellable,
- gs_page_install_authenticate_cb,
- helper);
- g_steal_pointer (&helper);
- return;
- }
-
g_warning ("failed to install %s: %s",
gs_app_get_id (helper->app),
error->message);
@@ -249,20 +128,6 @@ gs_page_app_removed_cb (GObject *source,
return;
}
if (!ret) {
- /* try to authenticate then retry */
- if (g_error_matches (error,
- GS_PLUGIN_ERROR,
- GS_PLUGIN_ERROR_AUTH_REQUIRED)) {
- gs_page_authenticate (page,
- helper->app,
- gs_utils_get_error_value (error),
- helper->cancellable,
- gs_page_remove_authenticate_cb,
- helper);
- g_steal_pointer (&helper);
- return;
- }
-
g_warning ("failed to remove: %s", error->message);
return;
}
diff --git a/src/gs-page.h b/src/gs-page.h
index ccea9b7b..b45dbc38 100644
--- a/src/gs-page.h
+++ b/src/gs-page.h
@@ -46,12 +46,6 @@ void gs_page_set_header_start_widget (GsPage *page,
GtkWidget *gs_page_get_header_end_widget (GsPage *page);
void gs_page_set_header_end_widget (GsPage *page,
GtkWidget *widget);
-void gs_page_authenticate (GsPage *page,
- GsApp *app,
- const gchar *auth_id,
- GCancellable *cancellable,
- GsPageAuthCallback callback,
- gpointer user_data);
void gs_page_install_app (GsPage *page,
GsApp *app,
GsShellInteraction interaction,
diff --git a/src/gs-shell.c b/src/gs-shell.c
index df12aa69..475a8181 100644
--- a/src/gs-shell.c
+++ b/src/gs-shell.c
@@ -66,7 +66,6 @@ typedef struct
gchar *events_info_uri;
gboolean in_mode_change;
GsPage *page;
- GSimpleActionGroup *auth_actions;
} GsShellPrivate;
G_DEFINE_TYPE_WITH_PRIVATE (GsShell, gs_shell, G_TYPE_OBJECT)
@@ -648,110 +647,6 @@ search_mode_enabled_cb (GtkSearchBar *search_bar, GParamSpec *pspec, GsShell *sh
gtk_search_bar_get_search_mode (search_bar));
}
-static void
-signin_activated_cb (GSimpleAction *action, GVariant *parameter, GsShell *shell)
-{
- GsShellPrivate *priv = gs_shell_get_instance_private (shell);
- const gchar *action_name, *auth_id;
- GsAuth *auth;
-
- action_name = g_action_get_name (G_ACTION (action));
- g_return_if_fail (g_str_has_prefix (action_name, "signin-"));
- auth_id = action_name + strlen ("signin-");
-
- auth = gs_plugin_loader_get_auth_by_id (priv->plugin_loader, auth_id);
- g_return_if_fail (auth != NULL);
-
- gs_page_authenticate (priv->page, NULL,
- gs_auth_get_auth_id (auth),
- priv->cancellable,
- NULL, NULL);
-}
-
-static void
-signout_activated_cb (GSimpleAction *action, GVariant *parameter, GsShell *shell)
-{
- GsShellPrivate *priv = gs_shell_get_instance_private (shell);
- const gchar *action_name, *auth_id;
- GsAuth *auth;
-
- action_name = g_action_get_name (G_ACTION (action));
- g_return_if_fail (g_str_has_prefix (action_name, "signout-"));
- auth_id = action_name + strlen ("signout-");
-
- auth = gs_plugin_loader_get_auth_by_id (priv->plugin_loader, auth_id);
- g_return_if_fail (auth != NULL);
-
- gs_auth_set_goa_object (auth, NULL);
-}
-
-static void
-gs_shell_reload_auth_menus (GsShell *shell)
-{
- GsShellPrivate *priv = gs_shell_get_instance_private (shell);
- GMenu *accounts_menu;
- GPtrArray *auth_array;
-
- accounts_menu = G_MENU (gtk_builder_get_object (priv->builder, "accounts_menu"));
- g_menu_remove_all (accounts_menu);
-
- auth_array = gs_plugin_loader_get_auths (priv->plugin_loader);
- for (guint i = 0; i < auth_array->len; i++) {
- GsAuth *auth = g_ptr_array_index (auth_array, i);
- gboolean logged_in;
- g_autofree gchar *signin_action_name = NULL;
- GSimpleAction *signin_action;
- g_autofree gchar *signin_target = NULL;
- g_autofree gchar *signout_action_name = NULL;
- GSimpleAction *signout_action;
- g_autofree gchar *signout_target = NULL;
- GoaObject *goa_object;
- g_autofree gchar *signin_label = NULL;
- g_autofree gchar *signout_label = NULL;
- g_autoptr(GMenu) auth_menu = NULL;
- g_autoptr(GMenuItem) signin_item = NULL;
- g_autoptr(GMenuItem) signout_item = NULL;
-
-
- goa_object = gs_auth_peek_goa_object (auth);
- logged_in = goa_object != NULL;
-
- auth_menu = g_menu_new ();
- accounts_menu = G_MENU (gtk_builder_get_object (priv->builder, "accounts_menu"));
- g_menu_append_section (accounts_menu, gs_auth_get_provider_name (auth), G_MENU_MODEL
(auth_menu));
-
- signin_action_name = g_strdup_printf ("signin-%s", gs_auth_get_auth_id (auth));
- signin_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP
(priv->auth_actions), signin_action_name));
- g_simple_action_set_enabled (signin_action, !logged_in);
-
- signout_action_name = g_strdup_printf ("signout-%s", gs_auth_get_auth_id (auth));
- signout_action = G_SIMPLE_ACTION (g_action_map_lookup_action (G_ACTION_MAP
(priv->auth_actions), signout_action_name));
- g_simple_action_set_enabled (signout_action, logged_in);
-
-
- if (logged_in) {
- GoaAccount *goa_account = goa_object_peek_account (goa_object);
-
- /* TRANSLATORS: menu item that signs into the named account with a particular
username */
- signin_label = g_strdup_printf (_("Signed in as %s"),
- goa_account_get_presentation_identity (goa_account));
- } else {
- /* TRANSLATORS: menu item that signs into the named account */
- signin_label = g_strdup_printf (_("Sign in…"));
- }
-
- signin_target = g_strdup_printf ("auth.%s", signin_action_name);
- signin_item = g_menu_item_new (signin_label, signin_target);
- g_menu_append_item (auth_menu, signin_item);
-
- /* TRANSLATORS: menu item for signing out from the named account */
- signout_label = g_strdup_printf (_("Sign out"));
- signout_target = g_strdup_printf ("auth.%s", signout_action_name);
- signout_item = g_menu_item_new (signout_label, signout_target);
- g_menu_append_item (auth_menu, signout_item);
- }
-}
-
static gboolean
window_key_press_event (GtkWidget *win, GdkEventKey *event, GsShell *shell)
{
@@ -1951,7 +1846,6 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
GtkWidget *widget;
GtkStyleContext *style_context;
GsPage *page;
- GPtrArray *auth_array;
g_return_if_fail (GS_IS_SHELL (shell));
@@ -2096,33 +1990,6 @@ gs_shell_setup (GsShell *shell, GsPluginLoader *plugin_loader, GCancellable *can
/* primary menu */
gs_shell_add_about_menu_item (shell);
- /* auth menu */
- priv->auth_actions = g_simple_action_group_new ();
- gtk_widget_insert_action_group (GTK_WIDGET (priv->main_window), "auth", G_ACTION_GROUP
(priv->auth_actions));
- auth_array = gs_plugin_loader_get_auths (priv->plugin_loader);
- for (guint i = 0; i < auth_array->len; i++) {
- GsAuth *auth = g_ptr_array_index (auth_array, i);
- g_autoptr(GSimpleAction) signin_action = NULL;
- g_autofree gchar *signin_action_name = NULL;
- g_autoptr(GSimpleAction) signout_action = NULL;
- g_autofree gchar *signout_action_name = NULL;
-
- signin_action_name = g_strdup_printf ("signin-%s", gs_auth_get_auth_id (auth));
- signin_action = g_simple_action_new (signin_action_name, NULL);
- g_signal_connect (signin_action, "activate", G_CALLBACK (signin_activated_cb), shell);
- g_action_map_add_action (G_ACTION_MAP (priv->auth_actions), G_ACTION (signin_action));
-
- signout_action_name = g_strdup_printf ("signout-%s", gs_auth_get_auth_id (auth));
- signout_action = g_simple_action_new (signout_action_name, NULL);
- g_signal_connect (signout_action, "activate", G_CALLBACK (signout_activated_cb), shell);
- g_action_map_add_action (G_ACTION_MAP (priv->auth_actions), G_ACTION (signout_action));
-
- g_signal_connect_object (auth, "changed",
- G_CALLBACK (gs_shell_reload_auth_menus),
- shell, G_CONNECT_SWAPPED);
- gs_shell_reload_auth_menus (shell);
- }
-
/* show loading page, which triggers the initial refresh */
gs_shell_change_mode (shell, GS_SHELL_MODE_LOADING, NULL, TRUE);
}
@@ -2312,7 +2179,6 @@ gs_shell_dispose (GObject *object)
g_clear_pointer (&priv->pages, g_hash_table_unref);
g_clear_pointer (&priv->events_info_uri, g_free);
g_clear_pointer (&priv->modal_dialogs, g_ptr_array_unref);
- g_clear_object (&priv->auth_actions);
G_OBJECT_CLASS (gs_shell_parent_class)->dispose (object);
}
diff --git a/src/meson.build b/src/meson.build
index 9c118ecc..fde9ebd6 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -21,7 +21,6 @@ gnome_software_sources = [
'gs-application.c',
'gs-app-row.c',
'gs-app-tile.c',
- 'gs-auth-dialog.c',
'gs-category-page.c',
'gs-category-tile.c',
'gs-common.c',
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]