Revision 3196 src/prefs_filter_edit.c

View differences:

prefs_filter_edit.c
1850 1850
	return cond;
1851 1851
}
1852 1852

  
1853
static gboolean check_dest_folder(const gchar *dest, gchar **error_msg)
1854
{
1855
	FolderItem *item;
1856

  
1857
	if (!dest || *dest == '\0') {
1858
		*error_msg = _("Destination folder is not specified.");
1859
		return FALSE;
1860
	}
1861

  
1862
	item = folder_find_item_from_identifier(dest);
1863
	if (!item || !item->path || !item->parent) {
1864
		*error_msg = _("The specified destination folder does not exist.");
1865
		return FALSE;
1866
	}
1867

  
1868
	return TRUE;
1869
}
1870

  
1853 1871
FilterAction *prefs_filter_edit_action_hbox_to_action(ActionHBox *hbox,
1854 1872
						      gchar **error_msg)
1855 1873
{
......
1864 1882
	switch (action_menu_type) {
1865 1883
	case PF_ACTION_MOVE:
1866 1884
		str = gtk_entry_get_text(GTK_ENTRY(hbox->folder_entry));
1867
		if (str && *str)
1868
			action = filter_action_new(FLT_ACTION_MOVE,
1869
						   str);
1870
		else
1871
			error_msg_ = _("Destination folder is not specified.");
1885
		if (check_dest_folder(str, &error_msg_))
1886
			action = filter_action_new(FLT_ACTION_MOVE, str);
1872 1887
		break;
1873 1888
	case PF_ACTION_COPY:
1874 1889
		str = gtk_entry_get_text(GTK_ENTRY(hbox->folder_entry));
1875
		if (str && *str)
1890
		if (check_dest_folder(str, &error_msg_))
1876 1891
			action = filter_action_new(FLT_ACTION_COPY, str);
1877
		else
1878
			error_msg_ = _("Destination folder is not specified.");
1879 1892
		break;
1880 1893
	case PF_ACTION_NOT_RECEIVE:
1881 1894
		action = filter_action_new(FLT_ACTION_NOT_RECEIVE, NULL);

Also available in: Unified diff