select folder after moving it
authorColin Leroy <colin@colino.net>
Thu, 7 Nov 2002 01:00:26 +0000 (01:00 +0000)
committerColin Leroy <colin@colino.net>
Thu, 7 Nov 2002 01:00:26 +0000 (01:00 +0000)
ChangeLog.claws
configure.in
src/folder.c
src/folder.h
src/folderview.c

index bf0be469c9bd4392da0074edd306eda757d15eff..4234e0e5f1bea613acef3baf40e9c1b8b6cfed09 100644 (file)
@@ -1,3 +1,11 @@
+2002-11-07 [colin]     0.8.5claws84
+
+       * src/folder.[ch]
+               Change folder_item_move_to to return the newly 
+               created folderitem.
+       * src/folderview.c
+               Select the new folderitem after moving.
+
 2002-11-07 [colin]     0.8.5claws83
 
        * src/prefs_filtering.c
index 26ffbbd3e188611eabd8015fc6e18804c1e04163..f3076bfeda96684fffda4233e106598c167e2f9a 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=8
 MICRO_VERSION=5
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=claws83
+EXTRA_VERSION=claws84
 VERSION=$MAJOR_VERSION.$MINOR_VERSION.$MICRO_VERSION$EXTRA_VERSION
 
 dnl set $target
index 081cb80a11773b41de5c05124ef2afca9f1de415..1ed264a78280671ed4bf036bdfbf7f9477a61dd0 100644 (file)
@@ -1475,7 +1475,7 @@ gint folder_item_move_recursive (FolderItem *src, FolderItem *dest)
        return 0;
 }
 
-gint folder_item_move_to(FolderItem *src, FolderItem *dest)
+FolderItem *folder_item_move_to(FolderItem *src, FolderItem *dest)
 {
        FolderItem *tmp = dest->parent;
        char * srcpath, * dstpath;
@@ -1483,7 +1483,7 @@ gint 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."));
-                       return -1;
+                       return NULL;
                }
                tmp = tmp->parent;
        }
@@ -1495,7 +1495,7 @@ gint folder_item_move_to(FolderItem *src, FolderItem *dest)
        
        if (srcpath == NULL || dstpath == NULL) {
                printf("Can't get identifiers\n");
-               return -1;
+               return NULL;
        }
 
        phys_srcpath = folder_item_get_path(src);
@@ -1507,17 +1507,20 @@ gint folder_item_move_to(FolderItem *src, FolderItem *dest)
                g_free(dstpath);
                g_free(phys_srcpath);
                g_free(phys_dstpath);
-               return -1;
+               return NULL;
        }
        debug_print("moving \"%s\" to \"%s\"\n", phys_srcpath, phys_dstpath);
        if (folder_item_move_recursive(src, dest) != 0) {
                alertpanel_error(_("Move failed !"));
-               return -1;
+               return NULL;
        }
        
        /* update rules */
        debug_print("updating rules ....\n");
-       prefs_filtering_rename_path(srcpath, g_strconcat(dstpath, G_DIR_SEPARATOR_S, g_basename(srcpath), NULL));
+       prefs_filtering_rename_path(srcpath, g_strconcat(dstpath, 
+                                               G_DIR_SEPARATOR_S, 
+                                               g_basename(srcpath), 
+                                               NULL));
 
        src->folder->remove_folder(src->folder, src);
        /* not to much worry if remove fails, move has been done */
@@ -1532,7 +1535,10 @@ gint folder_item_move_to(FolderItem *src, FolderItem *dest)
        g_free(dstpath);
        g_free(phys_srcpath);
        g_free(phys_dstpath);
-       return 0;
+       return folder_find_item_from_identifier(g_strconcat(dstpath, 
+                                                       G_DIR_SEPARATOR_S, 
+                                                       g_basename(srcpath), 
+                                                       NULL));
 }
 
 gint folder_item_move_msg(FolderItem *dest, MsgInfo *msginfo)
index fdd87679ecf908345f1adaf3a2458cf4cf0b5f21..23c98eb1bdcc4c77e9da1087228c32ac12c14260 100644 (file)
@@ -352,7 +352,7 @@ gchar *folder_item_fetch_msg                (FolderItem     *item,
 gint   folder_item_add_msg             (FolderItem     *dest,
                                         const gchar    *file,
                                         gboolean        remove_source);
-gint   folder_item_move_to             (FolderItem     *src,
+FolderItem   *folder_item_move_to      (FolderItem     *src,
                                         FolderItem     *dest);
 gint   folder_item_move_msg            (FolderItem     *dest,
                                         MsgInfo        *msginfo);
index 7b388d8305a60aa7e89ee511997082a9a2d9e2f0..7ff620e35ea6bdfbd23d7de86b890d14b45ef107 100644 (file)
@@ -2639,6 +2639,7 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                /* comes from folderview */
                char *source;
                char *buf;
+               FolderItem *new_item;
                source = data->data + 17;
                if (*source == 0)
                        return;
@@ -2655,12 +2656,14 @@ static void folderview_drag_received_cb(GtkWidget        *widget,
                buf = g_strdup_printf(_("Moving %s to %s..."), src_item->name, item->name);
                STATUSBAR_PUSH(folderview->mainwin, buf);
                main_window_cursor_wait(folderview->mainwin);
-               if (!folder_item_move_to(src_item, item))
+               if ((new_item = folder_item_move_to(src_item, item)) != NULL)
                        gtk_drag_finish(drag_context, TRUE, TRUE, time);
                else
                        gtk_drag_finish(drag_context, FALSE, FALSE, time);
                STATUSBAR_PUSH(folderview->mainwin, _("Done."));
                main_window_cursor_normal(folderview->mainwin);
+               summary_clear_all(folderview->summaryview);
+               folderview_select(folderview, new_item);
        }
 }