[gnome-online-accounts] oauth[2]provider: Restrict the spinner's size and show a heading text
- From: Debarshi Ray <debarshir src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-online-accounts] oauth[2]provider: Restrict the spinner's size and show a heading text
- Date: Tue, 15 May 2012 20:41:05 +0000 (UTC)
commit ed64fe752b49731a10cc8c18b8f37ff59020d768
Author: Debarshi Ray <debarshir gnome org>
Date: Tue May 15 16:41:31 2012 +0200
oauth[2]provider: Restrict the spinner's size and show a heading text
Fixes: https://bugzilla.gnome.org/671980
src/goabackend/goaoauth2provider.c | 9 +++++++++
src/goabackend/goaoauthprovider.c | 12 +++++++++++-
src/goabackend/goautils.c | 23 +++++++++++++++++++++++
src/goabackend/goautils.h | 3 +++
4 files changed, 46 insertions(+), 1 deletions(-)
---
diff --git a/src/goabackend/goaoauth2provider.c b/src/goabackend/goaoauth2provider.c
index 459c758..039ef40 100644
--- a/src/goabackend/goaoauth2provider.c
+++ b/src/goabackend/goaoauth2provider.c
@@ -737,6 +737,7 @@ on_entry_changed (GtkEditable *editable,
static gboolean
get_tokens_and_identity (GoaOAuth2Provider *provider,
+ gboolean add_account,
GtkDialog *dialog,
GtkBox *vbox,
gchar **out_authorization_code,
@@ -750,6 +751,7 @@ get_tokens_and_identity (GoaOAuth2Provider *provider,
gboolean ret;
gchar *url;
IdentifyData data;
+ GtkWidget *label;
gchar *escaped_redirect_uri;
gchar *escaped_client_id;
gchar *escaped_scope;
@@ -781,6 +783,11 @@ get_tokens_and_identity (GoaOAuth2Provider *provider,
escaped_client_id,
escaped_scope);
+ label = goa_utils_create_add_refresh_label (GOA_PROVIDER (provider), add_account);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
if (goa_oauth2_provider_get_use_external_browser (provider))
{
GtkWidget *label;
@@ -1016,6 +1023,7 @@ goa_oauth2_provider_add_account (GoaProvider *_provider,
data.loop = g_main_loop_new (NULL, FALSE);
if (!get_tokens_and_identity (provider,
+ TRUE,
dialog,
vbox,
&authorization_code,
@@ -1136,6 +1144,7 @@ goa_oauth2_provider_refresh_account (GoaProvider *_provider,
gtk_widget_show_all (dialog);
if (!get_tokens_and_identity (provider,
+ FALSE,
GTK_DIALOG (dialog),
GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
&authorization_code,
diff --git a/src/goabackend/goaoauthprovider.c b/src/goabackend/goaoauthprovider.c
index 67c924c..aba5b41 100644
--- a/src/goabackend/goaoauthprovider.c
+++ b/src/goabackend/goaoauthprovider.c
@@ -665,6 +665,7 @@ rest_proxy_call_cb (RestProxyCall *call, const GError *error, GObject *weak_obje
static gboolean
get_tokens_and_identity (GoaOAuthProvider *provider,
+ gboolean add_account,
GtkDialog *dialog,
GtkBox *vbox,
gchar **out_access_token,
@@ -683,6 +684,7 @@ get_tokens_and_identity (GoaOAuthProvider *provider,
RestProxy *proxy;
RestProxyCall *call;
GHashTable *f;
+ GtkWidget *label;
GtkWidget *spinner;
gboolean use_external_browser;
gchar **request_params;
@@ -732,9 +734,15 @@ get_tokens_and_identity (GoaOAuthProvider *provider,
goto out;
}
+ label = goa_utils_create_add_refresh_label (GOA_PROVIDER (provider), add_account);
+ gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
+ gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
+ gtk_widget_show (label);
+
spinner = gtk_spinner_new ();
+ gtk_widget_set_size_request (GTK_WIDGET (spinner), 24, 24);
gtk_spinner_start (GTK_SPINNER (spinner));
- gtk_box_pack_start (vbox, spinner, TRUE, TRUE, 0);
+ gtk_box_pack_start (vbox, spinner, TRUE, FALSE, 0);
gtk_widget_show (spinner);
g_main_loop_run (data.loop);
@@ -1017,6 +1025,7 @@ goa_oauth_provider_add_account (GoaProvider *_provider,
data.loop = g_main_loop_new (NULL, FALSE);
if (!get_tokens_and_identity (provider,
+ TRUE,
dialog,
vbox,
&access_token,
@@ -1141,6 +1150,7 @@ goa_oauth_provider_refresh_account (GoaProvider *_provider,
gtk_widget_show_all (dialog);
if (!get_tokens_and_identity (provider,
+ FALSE,
GTK_DIALOG (dialog),
GTK_BOX (gtk_dialog_get_content_area (GTK_DIALOG (dialog))),
&access_token,
diff --git a/src/goabackend/goautils.c b/src/goabackend/goautils.c
index 77da74c..0be7fba 100644
--- a/src/goabackend/goautils.c
+++ b/src/goabackend/goautils.c
@@ -24,6 +24,7 @@
#include <glib/gi18n-lib.h>
+#include "goaprovider.h"
#include "goautils.h"
gboolean
@@ -81,3 +82,25 @@ goa_utils_check_duplicate (GoaClient *client,
g_list_free_full (accounts, g_object_unref);
return ret;
}
+
+GtkWidget *
+goa_utils_create_add_refresh_label (GoaProvider *provider, gboolean add_account)
+{
+ GtkWidget *label;
+ gchar *markup;
+ gchar *provider_name;
+ gchar *template;
+
+ label = gtk_label_new (NULL);
+
+ /* Translators: the %s is the name of the provider. eg., Google. */
+ template = g_strconcat ("<b>", (add_account) ? _("Add %s") : _("Refresh %s"), "</b>", NULL);
+ provider_name = goa_provider_get_provider_name (provider, NULL);
+ markup = g_strdup_printf (template, provider_name);
+ gtk_label_set_markup (GTK_LABEL (label), markup);
+ g_free (markup);
+ g_free (provider_name);
+ g_free (template);
+
+ return label;
+}
diff --git a/src/goabackend/goautils.h b/src/goabackend/goautils.h
index 6e5dc8d..b306ecd 100644
--- a/src/goabackend/goautils.h
+++ b/src/goabackend/goautils.h
@@ -28,6 +28,7 @@
#define __GOA_UTILS_H__
#include <glib.h>
+#include <gtk/gtk.h>
#include <goabackend/goabackendtypes.h>
G_BEGIN_DECLS
@@ -40,6 +41,8 @@ gboolean goa_utils_check_duplicate (GoaClient *client,
GoaPeekInterfaceFunc func,
GError **error);
+GtkWidget *goa_utils_create_add_refresh_label (GoaProvider *provider, gboolean add_account);
+
G_END_DECLS
#endif /* __GOA_UTILS_H__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]