aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Claessens <xclaesse@src.gnome.org>2008-01-19 08:24:39 +0800
committerXavier Claessens <xclaesse@src.gnome.org>2008-01-19 08:24:39 +0800
commitd0e8b67fe27465caf63f783e727ae176e8a4166a (patch)
treec0807f72b8a3fbbb351e741d20a053c16a7874fe
parentb06aa6d69e7bdfec0b755812f1b7e1386e7cfc57 (diff)
downloadgsoc2013-empathy-d0e8b67fe27465caf63f783e727ae176e8a4166a.tar
gsoc2013-empathy-d0e8b67fe27465caf63f783e727ae176e8a4166a.tar.gz
gsoc2013-empathy-d0e8b67fe27465caf63f783e727ae176e8a4166a.tar.bz2
gsoc2013-empathy-d0e8b67fe27465caf63f783e727ae176e8a4166a.tar.lz
gsoc2013-empathy-d0e8b67fe27465caf63f783e727ae176e8a4166a.tar.xz
gsoc2013-empathy-d0e8b67fe27465caf63f783e727ae176e8a4166a.tar.zst
gsoc2013-empathy-d0e8b67fe27465caf63f783e727ae176e8a4166a.zip
Unset account parameter if user gives an empthy value.
svn path=/trunk/; revision=579
-rw-r--r--libempathy-gtk/empathy-account-widget-msn.c37
-rw-r--r--libempathy-gtk/empathy-account-widget-salut.c7
2 files changed, 36 insertions, 8 deletions
diff --git a/libempathy-gtk/empathy-account-widget-msn.c b/libempathy-gtk/empathy-account-widget-msn.c
index e0107fb09..edcd185ad 100644
--- a/libempathy-gtk/empathy-account-widget-msn.c
+++ b/libempathy-gtk/empathy-account-widget-msn.c
@@ -33,10 +33,13 @@
#include <libmissioncontrol/mc-profile.h>
#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-debug.h>
#include "empathy-account-widget-msn.h"
#include "empathy-ui-utils.h"
+#define DEBUG_DOMAIN "AccountWidgetMSN"
+
typedef struct {
McAccount *account;
@@ -69,14 +72,16 @@ account_widget_msn_entry_focus_cb (GtkWidget *widget,
}
str = gtk_entry_get_text (GTK_ENTRY (widget));
-
if (G_STR_EMPTY (str)) {
gchar *value = NULL;
+ mc_account_unset_param (settings->account, param);
mc_account_get_param_string (settings->account, param, &value);
+ empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %s", param, value);
gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
g_free (value);
} else {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %s", param, str);
mc_account_set_param_string (settings->account, param, str);
}
@@ -99,11 +104,28 @@ static void
account_widget_msn_value_changed_cb (GtkWidget *spinbutton,
EmpathyAccountWidgetMSN *settings)
{
+ gdouble value;
+ const gchar *param;
+
+ value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinbutton));
+
if (spinbutton == settings->spinbutton_port) {
- gdouble value;
+ param = "port";
+ } else {
+ return;
+ }
- value = gtk_spin_button_get_value (GTK_SPIN_BUTTON (spinbutton));
- mc_account_set_param_int (settings->account, "port", (gint) value);
+ if (value != 0) {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %d", param, (gint) value);
+ mc_account_set_param_int (settings->account, param, (gint) value);
+ } else {
+ gint val;
+
+ mc_account_unset_param (settings->account, param);
+ mc_account_get_param_int (settings->account, param, &val);
+ empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %d", param, val);
+
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (spinbutton), val);
}
}
@@ -111,7 +133,8 @@ static void
account_widget_msn_button_forget_clicked_cb (GtkWidget *button,
EmpathyAccountWidgetMSN *settings)
{
- mc_account_set_param_string (settings->account, "password", "");
+ empathy_debug (DEBUG_DOMAIN, "Unset password");
+ mc_account_unset_param (settings->account, "password");
gtk_entry_set_text (GTK_ENTRY (settings->entry_password), "");
}
@@ -136,10 +159,10 @@ account_widget_msn_setup (EmpathyAccountWidgetMSN *settings)
mc_account_get_param_string (settings->account, "server", &server);
mc_account_get_param_string (settings->account, "password", &password);
+ gtk_spin_button_set_value (GTK_SPIN_BUTTON (settings->spinbutton_port), port);
gtk_entry_set_text (GTK_ENTRY (settings->entry_id), id ? id : "");
- gtk_entry_set_text (GTK_ENTRY (settings->entry_password), password ? password : "");
gtk_entry_set_text (GTK_ENTRY (settings->entry_server), server ? server : "");
- gtk_spin_button_set_value (GTK_SPIN_BUTTON (settings->spinbutton_port), port);
+ gtk_entry_set_text (GTK_ENTRY (settings->entry_password), password ? password : "");
gtk_widget_set_sensitive (settings->button_forget, !G_STR_EMPTY (password));
diff --git a/libempathy-gtk/empathy-account-widget-salut.c b/libempathy-gtk/empathy-account-widget-salut.c
index 5d9bba9ff..78dce2312 100644
--- a/libempathy-gtk/empathy-account-widget-salut.c
+++ b/libempathy-gtk/empathy-account-widget-salut.c
@@ -31,10 +31,13 @@
#include <libmissioncontrol/mc-profile.h>
#include <libempathy/empathy-utils.h>
+#include <libempathy/empathy-debug.h>
#include "empathy-account-widget-salut.h"
#include "empathy-ui-utils.h"
+#define DEBUG_DOMAIN "AccountWidgetMSN"
+
typedef struct {
McAccount *account;
@@ -78,14 +81,16 @@ account_widget_salut_entry_focus_cb (GtkWidget *widget,
}
str = gtk_entry_get_text (GTK_ENTRY (widget));
-
if (G_STR_EMPTY (str)) {
gchar *value = NULL;
+ mc_account_unset_param (settings->account, param);
mc_account_get_param_string (settings->account, param, &value);
+ empathy_debug (DEBUG_DOMAIN, "Unset %s and restore to %s", param, value);
gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
g_free (value);
} else {
+ empathy_debug (DEBUG_DOMAIN, "Setting %s to %s", param, str);
mc_account_set_param_string (settings->account, param, str);
}