diff options
author | monsta <[email protected]> | 2017-04-18 11:50:02 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2017-04-18 11:50:02 +0300 |
commit | 21668de5806ce71ceecd7470b717412bfa3bd01c (patch) | |
tree | b575285b32d2db44b4182a902c9fe67998d48639 /libcaja-private/caja-directory-async.c | |
parent | ed842baac4f438a90bd6214020d2363241171545 (diff) | |
download | caja-21668de5806ce71ceecd7470b717412bfa3bd01c.tar.bz2 caja-21668de5806ce71ceecd7470b717412bfa3bd01c.tar.xz |
don't parse .hidden files manually - GIO does it since 2.36
taken from:
https://git.gnome.org/browse/nautilus/commit/?id=ace6d2c2170028148785f3fa87eedf883f20f1dd
GIO commit for reference:
https://git.gnome.org/browse/glib/commit/?id=510ba9b4efe1813e24c6dfa7405c3547bf9efdd7
Diffstat (limited to 'libcaja-private/caja-directory-async.c')
-rw-r--r-- | libcaja-private/caja-directory-async.c | 119 |
1 files changed, 1 insertions, 118 deletions
diff --git a/libcaja-private/caja-directory-async.c b/libcaja-private/caja-directory-async.c index 5bab5858..d90d3e76 100644 --- a/libcaja-private/caja-directory-async.c +++ b/libcaja-private/caja-directory-async.c @@ -194,9 +194,6 @@ static GHashTable *waiting_directories; static GHashTable *async_jobs; #endif -/* Hide kde trashcan directory */ -static char *kde_trash_dir_name = NULL; - /* Forward declarations for functions that need them. */ static void deep_count_load (DeepCountState *state, GFile *location); @@ -220,13 +217,6 @@ static void move_file_to_extension_queue (CajaDirectory static void caja_directory_invalidate_file_attributes (CajaDirectory *directory, CajaFileAttributes file_attributes); -void -caja_set_kde_trash_name (const char *trash_dir) -{ - g_free (kde_trash_dir_name); - kde_trash_dir_name = g_strdup (trash_dir); -} - /* Some helpers for case-insensitive strings. * Move to caja-glib-extensions? */ @@ -930,10 +920,7 @@ should_skip_file (CajaDirectory *directory, GFileInfo *info) if (!show_hidden_files && (g_file_info_get_is_hidden (info) || - g_file_info_get_is_backup (info) || - (directory != NULL && directory->details->hidden_file_hash != NULL && - g_hash_table_lookup (directory->details->hidden_file_hash, - g_file_info_get_name (info)) != NULL))) + g_file_info_get_is_backup (info))) { return TRUE; } @@ -1178,11 +1165,6 @@ file_list_cancel (CajaDirectory *directory) g_list_free_full (directory->details->pending_file_info, g_object_unref); directory->details->pending_file_info = NULL; } - - if (directory->details->hidden_file_hash) - { - g_hash_table_remove_all (directory->details->hidden_file_hash); - } } static void @@ -2181,86 +2163,6 @@ mark_all_files_unconfirmed (CajaDirectory *directory) } static void -read_dot_hidden_file (CajaDirectory *directory) -{ - gsize file_size; - char *file_contents; - GFile *child; - GFileInfo *info; - GFileType type; - int i; - - - /* FIXME: We only support .hidden on file: uri's for the moment. - * Need to figure out if we should do this async or sync to extend - * it to all types of uris. - */ - if (directory->details->location == NULL || - !g_file_is_native (directory->details->location)) - { - return; - } - - child = g_file_get_child (directory->details->location, ".hidden"); - - type = G_FILE_TYPE_UNKNOWN; - - info = g_file_query_info (child, G_FILE_ATTRIBUTE_STANDARD_TYPE, 0, NULL, NULL); - if (info != NULL) - { - type = g_file_info_get_file_type (info); - g_object_unref (info); - } - - if (type != G_FILE_TYPE_REGULAR) - { - g_object_unref (child); - return; - } - - if (!g_file_load_contents (child, NULL, &file_contents, &file_size, NULL, NULL)) - { - g_object_unref (child); - return; - } - - g_object_unref (child); - - if (directory->details->hidden_file_hash == NULL) - { - directory->details->hidden_file_hash = - g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - } - - /* Now parse the data */ - i = 0; - while (i < file_size) - { - int start; - - start = i; - while (i < file_size && file_contents[i] != '\n') - { - i++; - } - - if (i > start) - { - char *hidden_filename; - - hidden_filename = g_strndup (file_contents + start, i - start); - g_hash_table_insert (directory->details->hidden_file_hash, - hidden_filename, hidden_filename); - } - - i++; - - } - - g_free (file_contents); -} - -static void directory_load_state_free (DirectoryLoadState *state) { if (state->enumerator) @@ -2422,25 +2324,6 @@ start_monitoring_file_list (CajaDirectory *directory) caja_directory_get_corresponding_file (directory); state->load_directory_file->details->loading_directory = TRUE; - read_dot_hidden_file (directory); - - /* Hack to work around kde trash dir */ - if (kde_trash_dir_name != NULL && caja_directory_is_desktop_directory (directory)) - { - char *fn; - - if (directory->details->hidden_file_hash == NULL) - { - directory->details->hidden_file_hash = - g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL); - } - - fn = g_strdup (kde_trash_dir_name); - g_hash_table_insert (directory->details->hidden_file_hash, - fn, fn); - } - - #ifdef DEBUG_LOAD_DIRECTORY g_message ("load_directory called to monitor file list of %p", directory->details->location); #endif |