aboutsummaryrefslogtreecommitdiffstats
path: root/shell
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2001-10-24 08:24:21 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2001-10-24 08:24:21 +0800
commitabb1c1895aa73a58d46ada8fea6325e5bc55fb30 (patch)
tree96abbb1e5934bb671c9a4bcc894383853f767d06 /shell
parent65c33efb1b50b4ca08adf3dbc56c300a20b55608 (diff)
downloadgsoc2013-evolution-abb1c1895aa73a58d46ada8fea6325e5bc55fb30.tar
gsoc2013-evolution-abb1c1895aa73a58d46ada8fea6325e5bc55fb30.tar.gz
gsoc2013-evolution-abb1c1895aa73a58d46ada8fea6325e5bc55fb30.tar.bz2
gsoc2013-evolution-abb1c1895aa73a58d46ada8fea6325e5bc55fb30.tar.lz
gsoc2013-evolution-abb1c1895aa73a58d46ada8fea6325e5bc55fb30.tar.xz
gsoc2013-evolution-abb1c1895aa73a58d46ada8fea6325e5bc55fb30.tar.zst
gsoc2013-evolution-abb1c1895aa73a58d46ada8fea6325e5bc55fb30.zip
Get the path and the shell view instead. (rename_callback_data_free):
* e-shell-folder-commands.c (rename_callback_data_new): Get the path and the shell view instead. (rename_callback_data_free): Updated accordingly. (rename_cb): Set the name on the folder based on the path, not the actual object [as the old object gets unreffed -- of course]. svn path=/trunk/; revision=13969
Diffstat (limited to 'shell')
-rw-r--r--shell/ChangeLog8
-rw-r--r--shell/e-shell-folder-commands.c31
2 files changed, 25 insertions, 14 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog
index 38e1f2d8b1..4a33cb5530 100644
--- a/shell/ChangeLog
+++ b/shell/ChangeLog
@@ -1,5 +1,13 @@
2001-10-23 Ettore Perazzoli <ettore@ximian.com>
+ * e-shell-folder-commands.c (rename_callback_data_new): Get the
+ path and the shell view instead.
+ (rename_callback_data_free): Updated accordingly.
+ (rename_cb): Set the name on the folder based on the path, not the
+ actual object [as the old object gets unreffed -- of course].
+
+2001-10-23 Ettore Perazzoli <ettore@ximian.com>
+
* e-shell-folder-commands.c (rename_callback_data_new): New.
(rename_callback_data_free): New.
(rename_cb): Rename the folder here.
diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c
index b65941f760..38b934057e 100644
--- a/shell/e-shell-folder-commands.c
+++ b/shell/e-shell-folder-commands.c
@@ -447,15 +447,13 @@ e_shell_command_delete_folder (EShell *shell,
struct _RenameCallbackData {
EShellView *shell_view;
- EFolder *folder;
- char *new_name;
+ char *new_path;
};
typedef struct _RenameCallbackData RenameCallbackData;
static RenameCallbackData *
rename_callback_data_new (EShellView *shell_view,
- EFolder *folder,
- const char *new_name)
+ const char *new_path)
{
RenameCallbackData *callback_data;
@@ -464,10 +462,7 @@ rename_callback_data_new (EShellView *shell_view,
gtk_object_ref (GTK_OBJECT (shell_view));
callback_data->shell_view = shell_view;
- gtk_object_ref (GTK_OBJECT (folder));
- callback_data->folder = folder;
-
- callback_data->new_name = g_strdup (new_name);
+ callback_data->new_path = g_strdup (new_path);
return callback_data;
}
@@ -476,8 +471,7 @@ static void
rename_callback_data_free (RenameCallbackData *callback_data)
{
gtk_object_unref (GTK_OBJECT (callback_data->shell_view));
- gtk_object_unref (GTK_OBJECT (callback_data->folder));
- g_free (callback_data->new_name);
+ g_free (callback_data->new_path);
g_free (callback_data);
}
@@ -489,11 +483,20 @@ rename_cb (EStorageSet *storage_set, EStorageResult result, void *data)
callback_data = (RenameCallbackData *) data;
- if (result == E_STORAGE_OK) {
- e_folder_set_name (callback_data->folder, callback_data->new_name);
- } else {
+ if (result != E_STORAGE_OK) {
e_notice (GTK_WINDOW (callback_data->shell_view), GNOME_MESSAGE_BOX_ERROR,
_("Cannot rename folder:\n%s"), e_storage_result_to_string (result));
+ } else {
+ EFolder *folder;
+ EShell *shell;
+ EStorageSet *storage_set;
+
+ shell = e_shell_view_get_shell (callback_data->shell_view);
+ storage_set = e_shell_get_storage_set (shell);
+ folder = e_storage_set_get_folder (storage_set, callback_data->new_path);
+
+ if (folder != NULL)
+ e_folder_set_name (folder, g_basename (callback_data->new_path));
}
rename_callback_data_free (callback_data);
@@ -548,7 +551,7 @@ e_shell_command_rename_folder (EShell *shell,
old_base_path = g_strndup (folder_path, old_name - folder_path);
new_path = g_strconcat (old_base_path, new_name, NULL);
- callback_data = rename_callback_data_new (shell_view, folder, new_name);
+ callback_data = rename_callback_data_new (shell_view, new_path);
e_storage_set_async_xfer_folder (storage_set, folder_path, new_path, TRUE, rename_cb, callback_data);
g_free (old_base_path);