aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-01-25 04:29:14 +0000
committerhiro <hiro@ee746299-78ed-0310-b773-934348b2243d>2013-01-25 04:29:14 +0000
commit8da6ea27d310eecb9cdbc1ccb9283bc6fbdd86bf (patch)
tree8bd6efee245f7918dacf9b437b77ebef92061107
parent217a66f247b55a47d4a5077092846e34d7b4f4c2 (diff)
check the existence of destination folder when editing filter rule.
git-svn-id: svn://sylpheed.sraoss.jp/sylpheed/trunk@3196 ee746299-78ed-0310-b773-934348b2243d
-rw-r--r--ChangeLog5
-rw-r--r--src/prefs_filter_edit.c29
2 files changed, 26 insertions, 8 deletions
diff --git a/ChangeLog b/ChangeLog
index e827ce87..3aa354e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2013-01-25
+
+ * src/prefs_filter_edit.c: prefs_filter_edit_action_hbox_to_action():
+ check the existence of destination folder.
+
2013-01-24
* libsylph/pop.c
diff --git a/src/prefs_filter_edit.c b/src/prefs_filter_edit.c
index 1af4557e..64ca3b75 100644
--- a/src/prefs_filter_edit.c
+++ b/src/prefs_filter_edit.c
@@ -1850,6 +1850,24 @@ FilterCond *prefs_filter_edit_cond_hbox_to_cond(CondHBox *hbox,
return cond;
}
+static gboolean check_dest_folder(const gchar *dest, gchar **error_msg)
+{
+ FolderItem *item;
+
+ if (!dest || *dest == '\0') {
+ *error_msg = _("Destination folder is not specified.");
+ return FALSE;
+ }
+
+ item = folder_find_item_from_identifier(dest);
+ if (!item || !item->path || !item->parent) {
+ *error_msg = _("The specified destination folder does not exist.");
+ return FALSE;
+ }
+
+ return TRUE;
+}
+
FilterAction *prefs_filter_edit_action_hbox_to_action(ActionHBox *hbox,
gchar **error_msg)
{
@@ -1864,18 +1882,13 @@ FilterAction *prefs_filter_edit_action_hbox_to_action(ActionHBox *hbox,
switch (action_menu_type) {
case PF_ACTION_MOVE:
str = gtk_entry_get_text(GTK_ENTRY(hbox->folder_entry));
- if (str && *str)
- action = filter_action_new(FLT_ACTION_MOVE,
- str);
- else
- error_msg_ = _("Destination folder is not specified.");
+ if (check_dest_folder(str, &error_msg_))
+ action = filter_action_new(FLT_ACTION_MOVE, str);
break;
case PF_ACTION_COPY:
str = gtk_entry_get_text(GTK_ENTRY(hbox->folder_entry));
- if (str && *str)
+ if (check_dest_folder(str, &error_msg_))
action = filter_action_new(FLT_ACTION_COPY, str);
- else
- error_msg_ = _("Destination folder is not specified.");
break;
case PF_ACTION_NOT_RECEIVE:
action = filter_action_new(FLT_ACTION_NOT_RECEIVE, NULL);