diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-09-26 02:06:29 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-09-26 02:06:29 +0800 |
commit | 6a5efeb0f98a88afbbe18af740df7a209bb1c71b (patch) | |
tree | 0b7cc11115a6fa4ff45f634545fad0c842c1e7d0 /shell | |
parent | 541c29f0d9914395cf5a2b840edc5e88c5f809bd (diff) | |
download | gsoc2013-evolution-6a5efeb0f98a88afbbe18af740df7a209bb1c71b.tar gsoc2013-evolution-6a5efeb0f98a88afbbe18af740df7a209bb1c71b.tar.gz gsoc2013-evolution-6a5efeb0f98a88afbbe18af740df7a209bb1c71b.tar.bz2 gsoc2013-evolution-6a5efeb0f98a88afbbe18af740df7a209bb1c71b.tar.lz gsoc2013-evolution-6a5efeb0f98a88afbbe18af740df7a209bb1c71b.tar.xz gsoc2013-evolution-6a5efeb0f98a88afbbe18af740df7a209bb1c71b.tar.zst gsoc2013-evolution-6a5efeb0f98a88afbbe18af740df7a209bb1c71b.zip |
[Finish fixing #11645.]
* e-shell-folder-commands.c (xfer_result_callback): Don't update
the shortcuts here anymore since now the shell takes care of it.
* e-shell.c (storage_set_moved_folder_callback): New callback for
EStorageSetView::folder_moved; update the shortcuts.
(e_shell_construct): Connect.
* e-storage-set.c: Renamed StorageConverterCallbackData to
StorageCallbackData. New members destination_folder,
source_folder, operation in it.
(class_init): Install "moved_folder" signal.
(storage_callback_data_new): Renamed from
storage_converter_callback_data_new.
(storage_callback_data_free): New.
(storage_callback): Renamed from storage_callback_converter. Use
storage_callback_data_free().
(e_storage_set_async_create_folder): Updated to use the
storage_callback and storage_callback_data_new().
(e_storage_set_async_remove_folder): Likewise.
(e_storage_set_async_xfer_folder): Likewise.
* e-storage-set.h: New signal "moved_folder".
svn path=/trunk/; revision=18216
Diffstat (limited to 'shell')
-rw-r--r-- | shell/ChangeLog | 27 | ||||
-rw-r--r-- | shell/e-shell-folder-commands.c | 15 | ||||
-rw-r--r-- | shell/e-shell.c | 31 | ||||
-rw-r--r-- | shell/e-storage-set.c | 105 | ||||
-rw-r--r-- | shell/e-storage-set.h | 1 | ||||
-rw-r--r-- | shell/e-storage.h | 9 |
6 files changed, 142 insertions, 46 deletions
diff --git a/shell/ChangeLog b/shell/ChangeLog index d2941c494d..a73e173a70 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,30 @@ +2002-09-25 Ettore Perazzoli <ettore@ximian.com> + + [Finish fixing #11645.] + + * e-shell-folder-commands.c (xfer_result_callback): Don't update + the shortcuts here anymore since now the shell takes care of it. + + * e-shell.c (storage_set_moved_folder_callback): New callback for + EStorageSetView::folder_moved; update the shortcuts. + (e_shell_construct): Connect. + + * e-storage-set.c: Renamed StorageConverterCallbackData to + StorageCallbackData. New members destination_folder, + source_folder, operation in it. + (class_init): Install "moved_folder" signal. + (storage_callback_data_new): Renamed from + storage_converter_callback_data_new. + (storage_callback_data_free): New. + (storage_callback): Renamed from storage_callback_converter. Use + storage_callback_data_free(). + (e_storage_set_async_create_folder): Updated to use the + storage_callback and storage_callback_data_new(). + (e_storage_set_async_remove_folder): Likewise. + (e_storage_set_async_xfer_folder): Likewise. + + * e-storage-set.h: New signal "moved_folder". + 2002-09-24 Ettore Perazzoli <ettore@ximian.com> [Fix #11645 for menu-based folder move operations. Still requires diff --git a/shell/e-shell-folder-commands.c b/shell/e-shell-folder-commands.c index 3fe90163b8..884fa97c05 100644 --- a/shell/e-shell-folder-commands.c +++ b/shell/e-shell-folder-commands.c @@ -149,21 +149,6 @@ xfer_result_callback (EStorageSet *storage_set, g_free (msg); } - if (folder_command_data->command == FOLDER_COMMAND_MOVE) { - char *source_uri; - char *destination_uri; - - source_uri = g_strconcat (E_SHELL_URI_PREFIX, folder_command_data->source_path, NULL); - destination_uri = g_strconcat (E_SHELL_URI_PREFIX, folder_command_data->destination_path, NULL); - - e_shortcuts_update_shortcuts_for_changed_uri - (e_shell_get_shortcuts (folder_command_data->shell), - source_uri, destination_uri); - - g_free (source_uri); - g_free (destination_uri); - } - folder_command_data_free (folder_command_data); } diff --git a/shell/e-shell.c b/shell/e-shell.c index 3fedf7dd56..33cdf23751 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -914,6 +914,32 @@ set_owner_on_components (EShell *shell, } +/* EStorageSet callbacks. */ + +static void +storage_set_moved_folder_callback (EStorageSet *storage_set, + const char *source_path, + const char *destination_path, + void *data) +{ + EShell *shell; + char *source_uri; + char *destination_uri; + + shell = E_SHELL (data); + + source_uri = g_strconcat (E_SHELL_URI_PREFIX, source_path, NULL); + destination_uri = g_strconcat (E_SHELL_URI_PREFIX, destination_path, NULL); + + e_shortcuts_update_shortcuts_for_changed_uri (e_shell_get_shortcuts (shell), + source_uri, + destination_uri); + + g_free (source_uri); + g_free (destination_uri); +} + + /* EShellView handling and bookkeeping. */ static int @@ -1208,6 +1234,11 @@ e_shell_construct (EShell *shell, priv->folder_type_registry = e_folder_type_registry_new (); priv->uri_schema_registry = e_uri_schema_registry_new (); priv->storage_set = e_storage_set_new (priv->folder_type_registry); + + gtk_signal_connect_while_alive (GTK_OBJECT (priv->storage_set), "moved_folder", + GTK_SIGNAL_FUNC (storage_set_moved_folder_callback), + shell, + GTK_OBJECT (shell)); e_folder_type_registry_register_type (priv->folder_type_registry, "noselect", "empty.gif", diff --git a/shell/e-storage-set.c b/shell/e-storage-set.c index 17c66ce672..6303ef9320 100644 --- a/shell/e-storage-set.c +++ b/shell/e-storage-set.c @@ -63,6 +63,7 @@ enum { NEW_FOLDER, UPDATED_FOLDER, REMOVED_FOLDER, + MOVED_FOLDER, CLOSE_FOLDER, LAST_SIGNAL }; @@ -106,42 +107,74 @@ name_to_named_storage_foreach_destroy (void *key, /* "Callback converter", from `EStorageResultCallback' to `EStorageSetResultCallback'. */ -struct _StorageCallbackConverterData { +enum _StorageOperation { + OPERATION_COPY, + OPERATION_MOVE, + OPERATION_REMOVE, + OPERATION_CREATE +}; +typedef enum _StorageOperation StorageOperation; + +struct _StorageCallbackData { EStorageSet *storage_set; EStorageSetResultCallback storage_set_result_callback; + char *source_path; + char *destination_path; + StorageOperation operation; void *data; }; -typedef struct _StorageCallbackConverterData StorageCallbackConverterData; - -static StorageCallbackConverterData * -storage_callback_converter_data_new (EStorageSet *storage_set, - EStorageSetResultCallback callback, - void *data) +typedef struct _StorageCallbackData StorageCallbackData; + +static StorageCallbackData * +storage_callback_data_new (EStorageSet *storage_set, + EStorageSetResultCallback callback, + const char *source_path, + const char *destination_path, + StorageOperation operation, + void *data) { - StorageCallbackConverterData *new; + StorageCallbackData *new; - new = g_new (StorageCallbackConverterData, 1); + new = g_new (StorageCallbackData, 1); new->storage_set = storage_set; new->storage_set_result_callback = callback; + new->source_path = g_strdup (source_path); + new->destination_path = g_strdup (destination_path); + new->operation = operation; new->data = data; return new; } static void -storage_callback_converter (EStorage *storage, - EStorageResult result, - void *data) +storage_callback_data_free (StorageCallbackData *data) { - StorageCallbackConverterData *converter_data; + g_free (data->source_path); + g_free (data->destination_path); - converter_data = (StorageCallbackConverterData *) data; + g_free (data); +} - (* converter_data->storage_set_result_callback) (converter_data->storage_set, - result, - converter_data->data); +static void +storage_callback (EStorage *storage, + EStorageResult result, + void *data) +{ + StorageCallbackData *storage_callback_data; - g_free (converter_data); + storage_callback_data = (StorageCallbackData *) data; + + (* storage_callback_data->storage_set_result_callback) (storage_callback_data->storage_set, + result, + storage_callback_data->data); + + if (storage_callback_data->operation == OPERATION_MOVE) + gtk_signal_emit (GTK_OBJECT (storage_callback_data->storage_set), + signals[MOVED_FOLDER], + storage_callback_data->source_path, + storage_callback_data->destination_path); + + storage_callback_data_free (storage_callback_data); } @@ -376,6 +409,15 @@ class_init (EStorageSetClass *klass) gtk_marshal_NONE__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + signals[MOVED_FOLDER] = + gtk_signal_new ("moved_folder", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EStorageSetClass, moved_folder), + gtk_marshal_NONE__POINTER_POINTER, + GTK_TYPE_NONE, 2, + GTK_TYPE_STRING, + GTK_TYPE_STRING); signals[CLOSE_FOLDER] = gtk_signal_new ("close_folder", GTK_RUN_FIRST, @@ -642,7 +684,7 @@ e_storage_set_async_create_folder (EStorageSet *storage_set, { EStorage *storage; const char *subpath; - StorageCallbackConverterData *converter_data; + StorageCallbackData *storage_callback_data; g_return_if_fail (storage_set != NULL); g_return_if_fail (E_IS_STORAGE_SET (storage_set)); @@ -654,10 +696,12 @@ e_storage_set_async_create_folder (EStorageSet *storage_set, storage = get_storage_for_path (storage_set, path, &subpath); - converter_data = storage_callback_converter_data_new (storage_set, callback, data); + storage_callback_data = storage_callback_data_new (storage_set, callback, + path, NULL, OPERATION_CREATE, + data); e_storage_async_create_folder (storage, subpath, type, description, - storage_callback_converter, converter_data); + storage_callback, storage_callback_data); } void @@ -668,7 +712,7 @@ e_storage_set_async_remove_folder (EStorageSet *storage_set, { EStorage *storage; const char *subpath; - StorageCallbackConverterData *converter_data; + StorageCallbackData *storage_callback_data; g_return_if_fail (storage_set != NULL); g_return_if_fail (E_IS_STORAGE_SET (storage_set)); @@ -678,10 +722,12 @@ e_storage_set_async_remove_folder (EStorageSet *storage_set, storage = get_storage_for_path (storage_set, path, &subpath); - converter_data = storage_callback_converter_data_new (storage_set, callback, data); + storage_callback_data = storage_callback_data_new (storage_set, callback, + path, NULL, OPERATION_REMOVE, + data); e_storage_async_remove_folder (storage, subpath, - storage_callback_converter, converter_data); + storage_callback, storage_callback_data); } void @@ -696,7 +742,7 @@ e_storage_set_async_xfer_folder (EStorageSet *storage_set, EStorage *destination_storage; const char *source_subpath; const char *destination_subpath; - StorageCallbackConverterData *converter_data; + StorageCallbackData *storage_callback_data; g_return_if_fail (storage_set != NULL); g_return_if_fail (E_IS_STORAGE_SET (storage_set)); @@ -716,11 +762,16 @@ e_storage_set_async_xfer_folder (EStorageSet *storage_set, return; } - converter_data = storage_callback_converter_data_new (storage_set, callback, data); + storage_callback_data = storage_callback_data_new (storage_set, + callback, + source_path, + destination_path, + remove_source ? OPERATION_MOVE : OPERATION_COPY, + data); e_storage_async_xfer_folder (source_storage, source_subpath, destination_subpath, remove_source, - storage_callback_converter, converter_data); + storage_callback, storage_callback_data); } diff --git a/shell/e-storage-set.h b/shell/e-storage-set.h index a8cc285fc7..f614e70ffc 100644 --- a/shell/e-storage-set.h +++ b/shell/e-storage-set.h @@ -65,6 +65,7 @@ struct _EStorageSetClass { void (* new_folder) (EStorageSet *storage_set, const char *path); void (* updated_folder) (EStorageSet *storage_set, const char *path); void (* removed_folder) (EStorageSet *storage_set, const char *path); + void (* moved_folder) (EStorageSet *storage_set, const char *source_path, const char *destination_path); void (* close_folder) (EStorageSet *storage_set, const char *path); }; diff --git a/shell/e-storage.h b/shell/e-storage.h index 22d87de8f9..43ad6f442b 100644 --- a/shell/e-storage.h +++ b/shell/e-storage.h @@ -78,10 +78,10 @@ struct _EStorageClass { /* Signals. */ - void * (* new_folder) (EStorage *storage, const char *path); - void * (* updated_folder) (EStorage *storage, const char *path); - void * (* removed_folder) (EStorage *storage, const char *path); - void * (* close_folder) (EStorage *storage, const char *path); + void (* new_folder) (EStorage *storage, const char *path); + void (* updated_folder) (EStorage *storage, const char *path); + void (* removed_folder) (EStorage *storage, const char *path); + void (* close_folder) (EStorage *storage, const char *path); /* Virtual methods. */ @@ -110,6 +110,7 @@ struct _EStorageClass { void (* async_open_folder) (EStorage *storage, const char *path); + }; |