#include <string.h>
#include <gtk/gtk.h>
-#include <glib/gi18n.h>
+#include <glib/gi18n-lib.h>
#include <libmissioncontrol/mc-account.h>
#include <libmissioncontrol/mc-protocol.h>
str = gtk_entry_get_text (GTK_ENTRY (widget));
param_name = g_object_get_data (G_OBJECT (widget), "param_name");
- if (G_STR_EMPTY (str)) {
+ if (EMP_STR_EMPTY (str)) {
gchar *value = NULL;
mc_account_unset_param (account, param_name);
gtk_entry_set_text (GTK_ENTRY (widget), value ? value : "");
g_free (value);
} else {
- McProfile *profile;
- const gchar *default_account_domain = NULL;
- gchar *value = NULL;
+ McProfile *profile;
+ const gchar *domain = NULL;
+ gchar *dup_str = NULL;
profile = mc_account_get_profile (account);
if (mc_profile_get_capabilities (profile) &
- MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT) {
-
- default_account_domain = mc_profile_get_default_account_domain (profile);
+ MC_PROFILE_CAPABILITY_SPLIT_ACCOUNT) {
+ domain = mc_profile_get_default_account_domain (profile);
}
- if ((strcmp (param_name, "account") == 0) && default_account_domain &&
- !strstr (str, "@")) {
-
- DEBUG ("Adding @%s suffix to account",
- default_account_domain);
- value = g_strconcat (str, "@", default_account_domain, NULL);
- gtk_entry_set_text (GTK_ENTRY (widget), value);
- } else {
- value = g_strdup (str);
+ if (domain && !strstr (str, "@") &&
+ strcmp (param_name, "account") == 0) {
+ DEBUG ("Adding @%s suffix to account", domain);
+ str = dup_str = g_strconcat (str, "@", domain, NULL);
+ gtk_entry_set_text (GTK_ENTRY (widget), str);
}
DEBUG ("Setting %s to %s", param_name,
- strstr (param_name, "password") ? "***" : value);
- mc_account_set_param_string (account, param_name, value);
- g_free (value);
+ strstr (param_name, "password") ? "***" : str);
+ mc_account_set_param_string (account, param_name, str);
+ g_free (dup_str);
+ g_object_unref (profile);
}
return FALSE;
const gchar *str;
str = gtk_entry_get_text (GTK_ENTRY (entry));
- gtk_widget_set_sensitive (button, !G_STR_EMPTY (str));
+ gtk_widget_set_sensitive (button, !EMP_STR_EMPTY (str));
}
static void
entry_password = glade_xml_get_widget (glade, entry);
mc_account_get_param_string (account, "password", &password);
- gtk_widget_set_sensitive (button_forget, !G_STR_EMPTY (password));
+ gtk_widget_set_sensitive (button_forget, !EMP_STR_EMPTY (password));
g_free (password);
g_signal_connect (button_forget, "clicked",
"entry_id", "account",
"entry_password", "password",
"entry_server", "server",
- "entry_serverjp", "serverjp",
"entry_locale", "room-list-locale",
"entry_charset", "charset",
"spinbutton_port", "port",