remove gui stuff from folder.c
authorColin Leroy <colin@colino.net>
Fri, 15 Nov 2002 15:36:30 +0000 (15:36 +0000)
committerColin Leroy <colin@colino.net>
Fri, 15 Nov 2002 15:36:30 +0000 (15:36 +0000)
ChangeLog.claws
configure.in
src/folder.c
src/folder.h
src/folderview.c

index c5a6760..bb1b205 100644 (file)
@@ -1,3 +1,10 @@
+2002-11-14 [colin]     0.8.5claws154
+
+       * src/folder.[ch]
+         src/folderview.c
+               folder_item_move_to() sets an error message instead
+               of having GUI stuff in folder.c
+
 2002-11-14 [colin]     0.8.5claws153
 
        * src/procmsg.[ch]
index b81f1d0..dc54ccd 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws153
+EXTRA_VERSION=claws154
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 1136b92..4f09911 100644 (file)
@@ -1559,7 +1559,7 @@ FolderItem *folder_item_move_recursive (FolderItem *src, FolderItem *dest)
        return new_item;
 }
 
-FolderItem *folder_item_move_to(FolderItem *src, FolderItem *dest)
+FolderItem *folder_item_move_to(FolderItem *src, FolderItem *dest, char *error)
 {
        FolderItem *tmp = dest->parent;
        char * src_identifier, * dst_identifier, * new_identifier;
@@ -1568,7 +1568,7 @@ FolderItem *folder_item_move_to(FolderItem *src, FolderItem *dest)
        
        while (tmp) {
                if (tmp == src) {
-                       alertpanel_error(_("Can't move a folder to one of its children."));
+                       error = g_strdup(_("Can't move a folder to one of its children."));
                        return NULL;
                }
                tmp = tmp->parent;
@@ -1592,7 +1592,7 @@ FolderItem *folder_item_move_to(FolderItem *src, FolderItem *dest)
        phys_dstpath = g_strconcat(folder_item_get_path(dest),G_DIR_SEPARATOR_S,g_basename(phys_srcpath),NULL);
 
        if (src->parent == dest) {
-               alertpanel_error(_("Source and destination are the same."));
+               error = g_strdup(_("Source and destination are the same."));
                g_free(src_identifier);
                g_free(dst_identifier);
                g_free(phys_srcpath);
@@ -1601,7 +1601,7 @@ FolderItem *folder_item_move_to(FolderItem *src, FolderItem *dest)
        }
        debug_print("moving \"%s\" to \"%s\"\n", phys_srcpath, phys_dstpath);
        if ((tmp = folder_item_move_recursive(src, dest)) == NULL) {
-               alertpanel_error(_("Move failed!"));
+               error = g_strdup(_("Move failed!"));
                return NULL;
        }
        
index a7aa8b9..67961ea 100644 (file)
@@ -358,7 +358,8 @@ gint   folder_item_add_msg          (FolderItem     *dest,
                                         const gchar    *file,
                                         gboolean        remove_source);
 FolderItem   *folder_item_move_to      (FolderItem     *src,
-                                        FolderItem     *dest);
+                                        FolderItem     *dest,
+                                        char           *error);
 gint   folder_item_move_msg            (FolderItem     *dest,
                                         MsgInfo        *msginfo);
 gint   folder_item_move_msgs_with_dest (FolderItem     *dest,
index 2a1a6f3..0170858 100644 (file)
@@ -2620,6 +2620,7 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                /* comes from folderview */
                char *source;
                char *buf;
+               char *error_msg = NULL;
                GtkCTreeNode *src_node;
                FolderItem *new_item, *src_parent;
                
@@ -2650,7 +2651,7 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                gtk_widget_set_sensitive(folderview->ctree, FALSE);
                inc_lock();
                main_window_cursor_wait(folderview->mainwin);
-               if ((new_item = folder_item_move_to(src_item, item)) != NULL) {
+               if ((new_item = folder_item_move_to(src_item, item, &error_msg)) != NULL) {
                        main_window_cursor_normal(folderview->mainwin);
                        gtk_drag_finish(drag_context, TRUE, TRUE, time);
                
@@ -2671,6 +2672,10 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                        main_window_cursor_normal(folderview->mainwin);
                        gtk_drag_finish(drag_context, FALSE, FALSE, time);
                        STATUSBAR_POP(folderview->mainwin);
+                       if (error_msg != NULL) {
+                               alertpanel_error(error_msg);
+                               g_free(error_msg);
+                       }
                }       
                inc_unlock();           
                gtk_widget_set_sensitive(folderview->ctree, TRUE);