diff options
author | Mike Engber <engber@src.gnome.org> | 2000-10-24 00:14:24 +0000 |
---|---|---|
committer | Mike Engber <engber@src.gnome.org> | 2000-10-24 00:14:24 +0000 |
commit | 85d6bd45c8098940f06695de466ed925b0ddcea9 (patch) | |
tree | 18c2e75f5ab41a2fe51b741f015ee1ca6a476618 /libnautilus-extensions/nautilus-glib-extensions.c | |
parent | 7b72c48c8cae8552887ae33dc37873c520f7c2b4 (diff) | |
download | nautilus-85d6bd45c8098940f06695de466ed925b0ddcea9.tar.gz |
Added callback for copy_move operation - to support selecting icons
* libnautilus-extensions/nautilus-file-operations.c:
(handle_xfer_ok), (sync_xfer_callback),
(nautilus_file_operations_copy_move),
(nautilus_file_operations_move_to_trash),
(nautilus_file_operations_delete), (do_empty_trash):
* libnautilus-extensions/nautilus-file-operations.h:
Added callback for copy_move operation - to support
selecting icons afterward.
* libnautilus-extensions/nautilus-glib-extensions.c:
(nautilus_g_hash_table_remove_deep_custom),
(nautilus_g_hash_table_remove_deep),
(nautilus_g_hash_table_free_deep_helper),
(nautilus_g_hash_table_free_deep_custom),
(nautilus_g_hash_table_free_deep):
* libnautilus-extensions/nautilus-glib-extensions.h:
Added misc hash table utilities
* src/file-manager/fm-directory-view.c: (debuting_uri_data_free),
(debuting_uri_add_file_callback), (copy_move_done_data_free),
(pre_copy_move_add_file_callback), (pre_copy_move),
(copy_move_done_partition_func), (copy_move_done_callback),
(fm_directory_view_create_links_for_files),
(fm_directory_view_duplicate_selection), (new_folder_done),
(fm_directory_view_new_folder),
(fm_directory_view_move_copy_items):
Hooked up to new copy_move callback. There are still problems,
the icons get unselected by someone after they're selected.
Diffstat (limited to 'libnautilus-extensions/nautilus-glib-extensions.c')
-rw-r--r-- | libnautilus-extensions/nautilus-glib-extensions.c | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/libnautilus-extensions/nautilus-glib-extensions.c b/libnautilus-extensions/nautilus-glib-extensions.c index 759eaae05..6a2eaa720 100644 --- a/libnautilus-extensions/nautilus-glib-extensions.c +++ b/libnautilus-extensions/nautilus-glib-extensions.c @@ -877,6 +877,74 @@ nautilus_g_hash_table_safe_for_each (GHashTable *hash_table, g_list_free (flattened.values); } + +gboolean +nautilus_g_hash_table_remove_deep_custom (GHashTable *hash_table, gconstpointer key, GFreeFunc key_free, GFreeFunc data_free) +{ + gpointer key_in_table; + gpointer value; + + /* It would sure be nice if we could do this with a single lookup. + */ + if (g_hash_table_lookup_extended (hash_table, key, &key_in_table, &value)) { + g_hash_table_remove (hash_table, key); + if (key_free) { + key_free (key_in_table); + } + if (data_free) { + data_free (value); + } + return TRUE; + } else { + return FALSE; + } +} + +gboolean +nautilus_g_hash_table_remove_deep (GHashTable *hash_table, gconstpointer key) +{ + return nautilus_g_hash_table_remove_deep_custom (hash_table, key, g_free, g_free); +} + +typedef struct { + GFreeFunc key_free; + GFreeFunc data_free; +} HashTableFreeFuncs; + +static gboolean +nautilus_g_hash_table_free_deep_helper (gpointer key, gpointer value, gpointer data) +{ + HashTableFreeFuncs *free_funcs; + free_funcs = (HashTableFreeFuncs *) data; + + if (free_funcs->key_free) { + free_funcs->key_free (key); + } + if (free_funcs->data_free) { + free_funcs->data_free (data); + } + return TRUE; +} + +void +nautilus_g_hash_table_free_deep_custom (GHashTable *hash_table, GFreeFunc key_free, GFreeFunc data_free) +{ + HashTableFreeFuncs free_funcs; + + if (hash_table != NULL) { + free_funcs.key_free = key_free; + free_funcs.data_free = data_free; + + g_hash_table_foreach_remove (hash_table, nautilus_g_hash_table_free_deep_helper, &free_funcs); + } +} + +void +nautilus_g_hash_table_free_deep (GHashTable *hash_table) +{ + nautilus_g_hash_table_free_deep_custom (hash_table, g_free, g_free); +} + /* This is something like the new g_string_append_len function from * GLib 2.0, without the ability to deal with NUL character that the * GLib 2.0 function has. It's limited in other ways too, so it's |