2010-01-22 [pawel] 3.7.4cvs8
[claws.git] / src / prefs_filtering.c
index 39436315891913da8a478efdc46188b18c012e92..1063606020dab80c8d9e9444a0acaa4c3181ade6 100644 (file)
@@ -220,6 +220,7 @@ void prefs_filtering_open(GSList ** p_processing,
        }
 
        gtk_widget_show(filtering.window);
+       gtk_window_set_modal(GTK_WINDOW(filtering.window), TRUE);
 
        start_address_completion(NULL);
 }
@@ -227,7 +228,7 @@ void prefs_filtering_open(GSList ** p_processing,
 static void prefs_filtering_size_allocate_cb(GtkWidget *widget,
                                         GtkAllocation *allocation)
 {
-       g_return_if_fail(allocation != NULL);
+       cm_return_if_fail(allocation != NULL);
 
        prefs_common.filteringwin_width = allocation->width;
        prefs_common.filteringwin_height = allocation->height;
@@ -244,6 +245,7 @@ static void prefs_filtering_close(void)
                                (filtering.cond_list_view)));
        gtk_list_store_clear(store);
        gtk_widget_hide(filtering.window);
+       gtk_window_set_modal(GTK_WINDOW(filtering.window), FALSE);
        inc_unlock();
 }
 
@@ -254,9 +256,10 @@ static void prefs_filtering_account_option_menu_populate(void)
 
        accounts = account_get_list();
 
-       g_return_if_fail(accounts != NULL);
+       cm_return_if_fail(accounts != NULL);
 
        COMBOBOX_ADD(filtering.account_combobox_list, Q_("Filtering Account Menu|All"), 0);
+       COMBOBOX_ADD(filtering.account_combobox_list, NULL, 0);
        for (; accounts != NULL; accounts = accounts->next) {
                PrefsAccount *ac = (PrefsAccount *)accounts->data;
 
@@ -334,7 +337,6 @@ static void prefs_filtering_create(void)
        window = gtkut_window_new(GTK_WINDOW_TOPLEVEL, "prefs_filtering");
        gtk_container_set_border_width (GTK_CONTAINER (window), 8);
        gtk_window_set_position (GTK_WINDOW (window), GTK_WIN_POS_CENTER);
-       gtk_window_set_modal (GTK_WINDOW (window), TRUE);
        gtk_window_set_resizable(GTK_WINDOW (window), TRUE);
 
        vbox = gtk_vbox_new (FALSE, 6);
@@ -653,9 +655,13 @@ static void rename_path(GSList * filters,
        gint oldpathlen;
         GSList * action_cur;
         GSList * cur;
-
+       const gchar *separator=G_DIR_SEPARATOR_S;
+       gboolean matched = FALSE;
+#ifdef G_OS_WIN32
+again:
+#endif
        oldpathlen = strlen(old_path);
-       old_path_with_sep = g_strconcat(old_path,G_DIR_SEPARATOR_S,NULL);
+       old_path_with_sep = g_strconcat(old_path,separator,NULL);
 
        for (cur = filters; cur != NULL; cur = cur->next) {
                FilteringProp   *filtering = (FilteringProp *)cur->data;
@@ -685,28 +691,30 @@ static void rename_path(GSList * filters,
                                         while (*base == G_DIR_SEPARATOR) base++;
                                         if (*base == '\0')
                                                 dest_path = g_strconcat(prefix,
-                                                    G_DIR_SEPARATOR_S,
+                                                    separator,
                                                     new_path, NULL);
                                         else
                                                 dest_path = g_strconcat(prefix,
-                                                    G_DIR_SEPARATOR_S,
+                                                    separator,
                                                     new_path,
-                                                    G_DIR_SEPARATOR_S,
+                                                    separator,
                                                     base, NULL);
                                         
                                         g_free(prefix);
                                         g_free(action->destination);
                                         action->destination = dest_path;
+                                       matched = TRUE;
                                 } else { /* for non-leaf folders */
                                         /* compare with trailing slash */
                                         if (!strncmp(old_path_with_sep, action->destination, oldpathlen+1)) {
                                                 
                                                 suffix = action->destination + oldpathlen + 1;
                                                 dest_path = g_strconcat(new_path,
-                                                    G_DIR_SEPARATOR_S,
+                                                    separator,
                                                     suffix, NULL);
                                                 g_free(action->destination);
                                                 action->destination = dest_path;
+                                               matched = TRUE;
                                         }
                                 }
                         } else {
@@ -715,10 +723,19 @@ static void rename_path(GSList * filters,
                                         dest_path = g_strdup(new_path);
                                         g_free(action->destination);
                                         action->destination = dest_path;
+                                       matched = TRUE;
                                 }
                         }
                 }
         }
+       
+       g_free(old_path_with_sep);
+#ifdef G_OS_WIN32
+       if (!strcmp(separator, G_DIR_SEPARATOR_S) && !matched) {
+               separator = "/";
+               goto again;
+       }
+#endif
 }
 
 static gboolean prefs_filtering_rename_path_func(GNode *node, gpointer data)
@@ -733,9 +750,9 @@ static gboolean prefs_filtering_rename_path_func(GNode *node, gpointer data)
        old_path = paths[0];
        new_path = paths[1];
 
-       g_return_val_if_fail(old_path != NULL, FALSE);
-       g_return_val_if_fail(new_path != NULL, FALSE);
-       g_return_val_if_fail(node != NULL, FALSE);
+       cm_return_val_if_fail(old_path != NULL, FALSE);
+       cm_return_val_if_fail(new_path != NULL, FALSE);
+       cm_return_val_if_fail(node != NULL, FALSE);
 
         item = node->data;
         if (!item || !item->prefs)
@@ -786,9 +803,9 @@ static gboolean prefs_filtering_rename_tag_func(GNode *node, gpointer data)
        old_tag = tags[0];
        new_tag = tags[1];
 
-       g_return_val_if_fail(old_tag != NULL, FALSE);
-       g_return_val_if_fail(new_tag != NULL, FALSE);
-       g_return_val_if_fail(node != NULL, FALSE);
+       cm_return_val_if_fail(old_tag != NULL, FALSE);
+       cm_return_val_if_fail(new_tag != NULL, FALSE);
+       cm_return_val_if_fail(node != NULL, FALSE);
 
         item = node->data;
         if (!item || !item->prefs)
@@ -873,8 +890,8 @@ static gboolean prefs_filtering_delete_path_func(GNode *node, gpointer data)
        FolderItem *item;
         GSList ** p_filters;
        
-       g_return_val_if_fail(path != NULL, FALSE);
-       g_return_val_if_fail(node != NULL, FALSE);
+       cm_return_val_if_fail(path != NULL, FALSE);
+       cm_return_val_if_fail(node != NULL, FALSE);
 
         item = node->data;
         if (!item || !item->prefs)