aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-04-10 08:24:31 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2008-04-10 08:24:31 +0000
commit8ad18e775be48cb52a6b182b88a831255793f465 (patch)
treee57a405ae675a07d9811fa6d7cfe686320efcf27
parent62406eb470f36addb2ccdca581d9a58ef6c3cbb8 (diff)
spaces in address and server entries are automatically removed at applying account configuration.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@1974 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog6
-rw-r--r--ChangeLog.ja6
-rw-r--r--src/gtkutils.c16
-rw-r--r--src/gtkutils.h4
-rw-r--r--src/prefs_account_dialog.c5
5 files changed, 35 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1d16cde2..c8cfbb8c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-04-10
+
+ * src/gtkutils.[ch]
+ src/prefs_account_dialog.c: spaces in address and server
+ entries are automatically removed at applying configuration.
+
2008-04-09
* libsylph/session.c
diff --git a/ChangeLog.ja b/ChangeLog.ja
index 9a4678b0..d4bef510 100644
--- a/ChangeLog.ja
+++ b/ChangeLog.ja
@@ -1,3 +1,9 @@
+2008-04-10
+
+ * src/gtkutils.[ch]
+ src/prefs_account_dialog.c: 設定適用時にアドレス、サーバのエントリ
+ の前後の空白を除去するようにした。
+
2008-04-09
* libsylph/session.c
diff --git a/src/gtkutils.c b/src/gtkutils.c
index 9294587b..367a5919 100644
--- a/src/gtkutils.c
+++ b/src/gtkutils.c
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -40,6 +40,7 @@
#include <gtk/gtktreestore.h>
#include <gtk/gtkversion.h>
#include <stdlib.h>
+#include <string.h>
#include <stdarg.h>
#ifdef G_OS_WIN32
@@ -750,6 +751,19 @@ void gtkut_editable_disable_im(GtkEditable *editable)
#endif
}
+void gtkut_entry_strip_text(GtkEntry *entry)
+{
+ gchar *text;
+ gint len;
+
+ text = gtk_editable_get_chars(GTK_EDITABLE(entry), 0, -1);
+ len = strlen(text);
+ g_strstrip(text);
+ if (len > strlen(text))
+ gtk_entry_set_text(entry, text);
+ g_free(text);
+}
+
void gtkut_container_remove(GtkContainer *container, GtkWidget *widget)
{
gtk_container_remove(container, widget);
diff --git a/src/gtkutils.h b/src/gtkutils.h
index ea5ff429..4690c067 100644
--- a/src/gtkutils.h
+++ b/src/gtkutils.h
@@ -1,6 +1,6 @@
/*
* Sylpheed -- a GTK+ based, lightweight, and fast e-mail client
- * Copyright (C) 1999-2007 Hiroyuki Yamamoto
+ * Copyright (C) 1999-2008 Hiroyuki Yamamoto
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -180,6 +180,8 @@ void gtkut_combo_set_items (GtkCombo *combo,
gchar *gtkut_editable_get_selection (GtkEditable *editable);
void gtkut_editable_disable_im (GtkEditable *editable);
+void gtkut_entry_strip_text (GtkEntry *entry);
+
void gtkut_container_remove (GtkContainer *container,
GtkWidget *widget);
diff --git a/src/prefs_account_dialog.c b/src/prefs_account_dialog.c
index 4c285bcd..6df3b1ed 100644
--- a/src/prefs_account_dialog.c
+++ b/src/prefs_account_dialog.c
@@ -1942,6 +1942,11 @@ static gint prefs_account_apply(void)
protocol = GPOINTER_TO_INT
(g_object_get_data(G_OBJECT(menuitem), MENU_VAL_ID));
+ gtkut_entry_strip_text(GTK_ENTRY(basic.addr_entry));
+ gtkut_entry_strip_text(GTK_ENTRY(basic.smtpserv_entry));
+ gtkut_entry_strip_text(GTK_ENTRY(basic.recvserv_entry));
+ gtkut_entry_strip_text(GTK_ENTRY(basic.nntpserv_entry));
+
if (*gtk_entry_get_text(GTK_ENTRY(basic.acname_entry)) == '\0') {
alertpanel_error(_("Account name is not entered."));
return -1;