aboutsummaryrefslogtreecommitdiffstats
path: root/libempathy-gtk
diff options
context:
space:
mode:
authorDanielle Madeley <danielle.madeley@collabora.co.uk>2011-03-11 15:58:29 +0800
committerEmilio Pozuelo Monfort <emilio.pozuelo@collabora.co.uk>2011-04-08 18:41:29 +0800
commit1b2cc0df045f09e7de63b65d3da0f4f6d3c63186 (patch)
treee06645e4d98f313525a7dbcb9ccc515318492628 /libempathy-gtk
parent5174e41f934d8c6d7326fdaf00d32c62955f8ab3 (diff)
downloadgsoc2013-empathy-1b2cc0df045f09e7de63b65d3da0f4f6d3c63186.tar
gsoc2013-empathy-1b2cc0df045f09e7de63b65d3da0f4f6d3c63186.tar.gz
gsoc2013-empathy-1b2cc0df045f09e7de63b65d3da0f4f6d3c63186.tar.bz2
gsoc2013-empathy-1b2cc0df045f09e7de63b65d3da0f4f6d3c63186.tar.lz
gsoc2013-empathy-1b2cc0df045f09e7de63b65d3da0f4f6d3c63186.tar.xz
gsoc2013-empathy-1b2cc0df045f09e7de63b65d3da0f4f6d3c63186.tar.zst
gsoc2013-empathy-1b2cc0df045f09e7de63b65d3da0f4f6d3c63186.zip
Add a Remember Password toggle which remembers the password
This feels a bit awkwardly implemented, for example, if you enter a password but uncheck the toggle, then the password will be removed from the dialog when the account connects (maybe this is the correct behaviour?). No one has really specced out the flow of this, maybe it can be sorted out properly when this code is made more generic.
Diffstat (limited to 'libempathy-gtk')
-rw-r--r--libempathy-gtk/empathy-account-widget-skype.c44
-rw-r--r--libempathy-gtk/empathy-account-widget-skype.ui64
2 files changed, 69 insertions, 39 deletions
diff --git a/libempathy-gtk/empathy-account-widget-skype.c b/libempathy-gtk/empathy-account-widget-skype.c
index 32ee9c9e5..c263c9e2e 100644
--- a/libempathy-gtk/empathy-account-widget-skype.c
+++ b/libempathy-gtk/empathy-account-widget-skype.c
@@ -45,18 +45,21 @@ typedef struct
TpAccount *account;
TpChannel *channel;
char *password;
+ gboolean remember;
} ObserveChannelsData;
static ObserveChannelsData *
observe_channels_data_new (TpAccount *account,
TpChannel *channel,
- const char *password)
+ const char *password,
+ gboolean remember)
{
ObserveChannelsData *data = g_slice_new0 (ObserveChannelsData);
data->account = g_object_ref (account);
data->channel = g_object_ref (channel);
data->password = g_strdup (password);
+ data->remember = remember;
return data;
}
@@ -100,12 +103,12 @@ auth_observer_new_sasl_handler_cb (GObject *obj,
goto finally;
}
- DEBUG ("providing password");
+ DEBUG ("providing password, remember = %s", data->remember ? "yes" : "no");
g_signal_connect (sasl_handler, "invalidated",
G_CALLBACK (auth_observer_sasl_handler_invalidated), NULL);
empathy_server_sasl_handler_provide_password (sasl_handler,
- data->password, TRUE);
+ data->password, data->remember);
finally:
observe_channels_data_free (data);
@@ -148,6 +151,7 @@ auth_observer_observe_channels (TpSimpleObserver *auth_observer,
GStrv available_mechanisms;
GtkWidget *password_entry = user_data;
const char *password = NULL;
+ gboolean remember;
/* we only do this for Psyke */
if (tp_strdiff (
@@ -177,14 +181,15 @@ auth_observer_observe_channels (TpSimpleObserver *auth_observer,
if (tp_str_empty (password))
goto except;
+ /* do we want to remember it */
+ remember = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (
+ g_object_get_data (G_OBJECT (password_entry), "remember-password")));
+
DEBUG ("claiming auth channel");
tp_channel_dispatch_operation_claim_async (dispatch_operation,
auth_observer_claim_cb,
- observe_channels_data_new (account, channel, password));
-
- tp_observe_channels_context_accept (context);
- return;
+ observe_channels_data_new (account, channel, password, remember));
except:
tp_observe_channels_context_accept (context);
@@ -443,6 +448,23 @@ account_widget_skype_forget_password (GtkEntry *entry,
}
static void
+account_widget_skype_remember_password_toggled (GtkToggleButton *button,
+ EmpathyAccountWidget *self)
+{
+ EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
+ TpAccount *account = empathy_account_settings_get_account (priv->settings);
+
+ /* we only forget the password if the toggle goes inactive */
+ if (gtk_toggle_button_get_active (button))
+ return;
+
+ DEBUG ("forgetting password");
+
+ emp_cli_account_interface_external_password_storage_call_forget_password (
+ TP_PROXY (account), -1, NULL, NULL, NULL, NULL);
+}
+
+static void
account_widget_build_skype_get_privacy_settings_cb (TpProxy *cm,
GHashTable *props,
const GError *in_error,
@@ -713,7 +735,7 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self,
{
EmpathyAccountWidgetPriv *priv = GET_PRIV (self);
TpAccount *account = empathy_account_settings_get_account (priv->settings);
- GtkWidget *password_entry;
+ GtkWidget *password_entry, *remember_password;
if (priv->simple || priv->creating_account)
{
@@ -725,6 +747,7 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self,
"vbox_skype_settings_setup", &self->ui_details->widget,
"skype-info-vbox", &skype_info,
"entry_password_setup", &password_entry,
+ "remember-password-setup", &remember_password,
NULL);
account_widget_build_skype_set_pixmap (self->ui_details->gui,
@@ -751,6 +774,7 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self,
"skype-info-vbox", &skype_info,
"edit-privacy-settings-button", &edit_privacy_settings_button,
"entry_password", &password_entry,
+ "remember-password", &remember_password,
NULL);
empathy_builder_connect (self->ui_details->gui, self,
@@ -758,6 +782,8 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self,
account_widget_skype_privacy_settings,
"entry_password", "icon-press",
account_widget_skype_forget_password,
+ "remember-password", "toggled",
+ account_widget_skype_remember_password_toggled,
NULL);
if (account != NULL)
@@ -785,6 +811,8 @@ empathy_account_widget_build_skype (EmpathyAccountWidget *self,
* tie the lifetime of the observer to the lifetime of the widget */
g_object_set_data_full (G_OBJECT (self->ui_details->widget), "auth-observer",
auth_observer_new (password_entry), g_object_unref);
+ g_object_set_data (G_OBJECT (password_entry), "remember-password",
+ remember_password);
/* find out if we know the password */
if (account != NULL && tp_proxy_has_interface_by_id (account,
diff --git a/libempathy-gtk/empathy-account-widget-skype.ui b/libempathy-gtk/empathy-account-widget-skype.ui
index 67fb50f5d..1a131d29a 100644
--- a/libempathy-gtk/empathy-account-widget-skype.ui
+++ b/libempathy-gtk/empathy-account-widget-skype.ui
@@ -11,27 +11,13 @@
<property name="visible">True</property>
<property name="n_rows">4</property>
<property name="n_columns">2</property>
- <property name="column_spacing">12</property>
+ <property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label_password">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Pass_word:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="top_attach">2</property>
- <property name="bottom_attach">3</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="label_id">
<property name="visible">True</property>
<property name="xalign">0</property>
- <property name="label" translatable="yes">Skype name:</property>
+ <property name="label" translatable="yes">_Skype name:</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">entry_id_setup</property>
</object>
@@ -93,6 +79,21 @@ Get one at &lt;a href="http://www.skype.com/go/register"&gt;Skype.com&lt;/a&gt;<
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="remember-password-setup">
+ <property name="label" translatable="yes">Remember pass_word:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">2</property>
+ <property name="bottom_attach">3</property>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
<child>
@@ -402,23 +403,9 @@ Get one at &lt;a href="http://www.skype.com/go/register"&gt;Skype.com&lt;/a&gt;<
<property name="visible">True</property>
<property name="n_rows">3</property>
<property name="n_columns">2</property>
- <property name="column_spacing">12</property>
+ <property name="column_spacing">6</property>
<property name="row_spacing">6</property>
<child>
- <object class="GtkLabel" id="label_password1">
- <property name="visible">True</property>
- <property name="xalign">0</property>
- <property name="label" translatable="yes">Pass_word:</property>
- <property name="use_underline">True</property>
- </object>
- <packing>
- <property name="top_attach">1</property>
- <property name="bottom_attach">2</property>
- <property name="x_options">GTK_FILL</property>
- <property name="y_options"></property>
- </packing>
- </child>
- <child>
<object class="GtkLabel" id="label_id1">
<property name="visible">True</property>
<property name="xalign">0</property>
@@ -480,6 +467,21 @@ Get one at &lt;a href="http://www.skype.com/go/register"&gt;Skype.com&lt;/a&gt;<
</packing>
</child>
<child>
+ <object class="GtkCheckButton" id="remember-password">
+ <property name="label" translatable="yes">Remember pass_word:</property>
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">False</property>
+ <property name="use_underline">True</property>
+ <property name="active">True</property>
+ <property name="draw_indicator">True</property>
+ </object>
+ <packing>
+ <property name="top_attach">1</property>
+ <property name="bottom_attach">2</property>
+ </packing>
+ </child>
+ <child>
<placeholder/>
</child>
</object>