Skip to content

Commit 5242266

Browse files
tarcerimtwebster
authored andcommitted
Remove .hidden file code now that gio does if for us
Gio now parses .hidden files itself and sets the hidden flags in the GFileInfo, so no need to do it again. We already rely on the glib version that has this support added.
1 parent b47f79b commit 5242266

4 files changed

Lines changed: 2 additions & 126 deletions

File tree

libnemo-private/nemo-directory-async.c

Lines changed: 1 addition & 107 deletions
Original file line numberDiff line numberDiff line change
@@ -176,9 +176,6 @@ static GHashTable *waiting_directories;
176176
static GHashTable *async_jobs;
177177
#endif
178178

179-
/* Hide kde trashcan directory */
180-
static char *kde_trash_dir_name = NULL;
181-
182179
/* Forward declarations for functions that need them. */
183180
static void deep_count_load (DeepCountState *state,
184181
GFile *location);
@@ -202,13 +199,6 @@ static void move_file_to_extension_queue (NemoDirectory
202199
static void nemo_directory_invalidate_file_attributes (NemoDirectory *directory,
203200
NemoFileAttributes file_attributes);
204201

205-
void
206-
nemo_set_kde_trash_name (const char *trash_dir)
207-
{
208-
g_free (kde_trash_dir_name);
209-
kde_trash_dir_name = g_strdup (trash_dir);
210-
}
211-
212202
/* Some helpers for case-insensitive strings.
213203
* Move to nemo-glib-extensions?
214204
*/
@@ -846,10 +836,7 @@ should_skip_file (NemoDirectory *directory, GFileInfo *info)
846836

847837
if (!show_hidden_files &&
848838
(g_file_info_get_is_hidden (info) ||
849-
g_file_info_get_is_backup (info) ||
850-
(directory != NULL && directory->details->hidden_file_hash != NULL &&
851-
g_hash_table_lookup (directory->details->hidden_file_hash,
852-
g_file_info_get_name (info)) != NULL))) {
839+
g_file_info_get_is_backup (info))) {
853840
return TRUE;
854841
}
855842

@@ -1092,10 +1079,6 @@ file_list_cancel (NemoDirectory *directory)
10921079
g_list_free_full (directory->details->pending_file_info, g_object_unref);
10931080
directory->details->pending_file_info = NULL;
10941081
}
1095-
1096-
if (directory->details->hidden_file_hash) {
1097-
g_hash_table_remove_all (directory->details->hidden_file_hash);
1098-
}
10991082
}
11001083

11011084
static void
@@ -1966,78 +1949,6 @@ mark_all_files_unconfirmed (NemoDirectory *directory)
19661949
}
19671950
}
19681951

1969-
static void
1970-
read_dot_hidden_file (NemoDirectory *directory)
1971-
{
1972-
gsize file_size;
1973-
char *file_contents;
1974-
GFile *child;
1975-
GFileInfo *info;
1976-
GFileType type;
1977-
guint i;
1978-
1979-
1980-
/* FIXME: We only support .hidden on file: uri's for the moment.
1981-
* Need to figure out if we should do this async or sync to extend
1982-
* it to all types of uris.
1983-
*/
1984-
if (directory->details->location == NULL ||
1985-
!g_file_is_native (directory->details->location)) {
1986-
return;
1987-
}
1988-
1989-
child = g_file_get_child (directory->details->location, ".hidden");
1990-
1991-
type = G_FILE_TYPE_UNKNOWN;
1992-
1993-
info = g_file_query_info (child, G_FILE_ATTRIBUTE_STANDARD_TYPE, 0, NULL, NULL);
1994-
if (info != NULL) {
1995-
type = g_file_info_get_file_type (info);
1996-
g_object_unref (info);
1997-
}
1998-
1999-
if (type != G_FILE_TYPE_REGULAR) {
2000-
g_object_unref (child);
2001-
return;
2002-
}
2003-
2004-
if (!g_file_load_contents (child, NULL, &file_contents, &file_size, NULL, NULL)) {
2005-
g_object_unref (child);
2006-
return;
2007-
}
2008-
2009-
g_object_unref (child);
2010-
2011-
if (directory->details->hidden_file_hash == NULL) {
2012-
directory->details->hidden_file_hash =
2013-
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
2014-
}
2015-
2016-
/* Now parse the data */
2017-
i = 0;
2018-
while (i < file_size) {
2019-
guint start;
2020-
2021-
start = i;
2022-
while (i < file_size && file_contents[i] != '\n') {
2023-
i++;
2024-
}
2025-
2026-
if (i > start) {
2027-
char *hidden_filename;
2028-
2029-
hidden_filename = g_strndup (file_contents + start, i - start);
2030-
g_hash_table_insert (directory->details->hidden_file_hash,
2031-
hidden_filename, hidden_filename);
2032-
}
2033-
2034-
i++;
2035-
2036-
}
2037-
2038-
g_free (file_contents);
2039-
}
2040-
20411952
static void
20421953
directory_load_state_free (DirectoryLoadState *state)
20431954
{
@@ -2183,23 +2094,6 @@ start_monitoring_file_list (NemoDirectory *directory)
21832094
state->load_directory_file =
21842095
nemo_directory_get_corresponding_file (directory);
21852096
state->load_directory_file->details->loading_directory = TRUE;
2186-
2187-
read_dot_hidden_file (directory);
2188-
2189-
/* Hack to work around kde trash dir */
2190-
if (kde_trash_dir_name != NULL && nemo_directory_is_desktop_directory (directory)) {
2191-
char *fn;
2192-
2193-
if (directory->details->hidden_file_hash == NULL) {
2194-
directory->details->hidden_file_hash =
2195-
g_hash_table_new_full (g_str_hash, g_str_equal, g_free, NULL);
2196-
}
2197-
2198-
fn = g_strdup (kde_trash_dir_name);
2199-
g_hash_table_insert (directory->details->hidden_file_hash,
2200-
fn, fn);
2201-
}
2202-
22032097

22042098
#ifdef DEBUG_LOAD_DIRECTORY
22052099
g_message ("load_directory called to monitor file list of %p", directory->details->location);

libnemo-private/nemo-directory-private.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ struct NemoDirectoryDetails
140140
LinkInfoReadState *link_info_read_state;
141141

142142
GList *file_operations_in_progress; /* list of FileOperation * */
143-
144-
GHashTable *hidden_file_hash;
145143
};
146144

147145
NemoDirectory *nemo_directory_get_existing (GFile *location);
@@ -239,9 +237,6 @@ void nemo_directory_add_file_to_work_queue (NemoDirectory
239237
void nemo_directory_remove_file_from_work_queue (NemoDirectory *directory,
240238
NemoFile *file);
241239

242-
/* KDE compatibility hacks */
243-
244-
void nemo_set_kde_trash_name (const char *trash_dir);
245240

246241
/* debugging functions */
247242
int nemo_directory_number_outstanding (void);

libnemo-private/nemo-directory.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -179,10 +179,6 @@ nemo_directory_finalize (GObject *object)
179179
g_assert (directory->details->file_list == NULL);
180180
g_hash_table_destroy (directory->details->file_hash);
181181

182-
if (directory->details->hidden_file_hash) {
183-
g_hash_table_destroy (directory->details->hidden_file_hash);
184-
}
185-
186182
nemo_file_queue_destroy (directory->details->high_priority_queue);
187183
nemo_file_queue_destroy (directory->details->low_priority_queue);
188184
nemo_file_queue_destroy (directory->details->extension_queue);

libnemo-private/nemo-file.c

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3491,15 +3491,6 @@ nemo_file_is_hidden_file (NemoFile *file)
34913491
return file->details->is_hidden;
34923492
}
34933493

3494-
static gboolean
3495-
is_file_hidden (NemoFile *file)
3496-
{
3497-
return file->details->directory->details->hidden_file_hash != NULL &&
3498-
g_hash_table_lookup (file->details->directory->details->hidden_file_hash,
3499-
eel_ref_str_peek (file->details->name)) != NULL;
3500-
3501-
}
3502-
35033494
/**
35043495
* nemo_file_should_show:
35053496
* @file: the file to check.
@@ -3519,7 +3510,7 @@ nemo_file_should_show (NemoFile *file,
35193510
if (nemo_file_is_in_trash (file)) {
35203511
return TRUE;
35213512
} else {
3522-
return (show_hidden || (!nemo_file_is_hidden_file (file) && !is_file_hidden (file))) &&
3513+
return (show_hidden || !nemo_file_is_hidden_file (file)) &&
35233514
(show_foreign || !(nemo_file_is_in_desktop (file) && nemo_file_is_foreign_link (file)));
35243515
}
35253516
}

0 commit comments

Comments
 (0)