summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authormonsta <[email protected]>2017-04-18 12:17:35 +0300
committermonsta <[email protected]>2017-04-18 12:17:35 +0300
commit19da912288063fdc021d2acc4070cb2d36a3a8a0 (patch)
tree44f3ac2808cce208285002a406fe030be8abead5 /plugins
parent2f26e319e067cc1baa0f85cbb1763e7359565ae0 (diff)
downloadpluma-19da912288063fdc021d2acc4070cb2d36a3a8a0.tar.bz2
pluma-19da912288063fdc021d2acc4070cb2d36a3a8a0.tar.xz
filebrowser: don't parse .hidden files - GIO does it since 2.36
taken from: https://git.gnome.org/browse/gedit/commit/?id=f0454abbec92f34431bd59fd1e3da6ad346a000e GIO commit for reference: https://git.gnome.org/browse/glib/commit/?id=510ba9b4efe1813e24c6dfa7405c3547bf9efdd7
Diffstat (limited to 'plugins')
-rw-r--r--plugins/filebrowser/pluma-file-browser-store.c86
1 files changed, 0 insertions, 86 deletions
diff --git a/plugins/filebrowser/pluma-file-browser-store.c b/plugins/filebrowser/pluma-file-browser-store.c
index 1615729a..5bf092e1 100644
--- a/plugins/filebrowser/pluma-file-browser-store.c
+++ b/plugins/filebrowser/pluma-file-browser-store.c
@@ -104,7 +104,6 @@ struct _FileBrowserNodeDir
{
FileBrowserNode node;
GSList *children;
- GHashTable *hidden_file_hash;
GCancellable *cancellable;
GFileMonitor *monitor;
@@ -1372,9 +1371,6 @@ file_browser_node_free (PlumaFileBrowserStore * model,
g_file_monitor_cancel (dir->monitor);
g_object_unref (dir->monitor);
}
-
- if (dir->hidden_file_hash)
- g_hash_table_destroy (dir->hidden_file_hash);
}
if (node->file)
@@ -1913,9 +1909,7 @@ file_browser_node_set_from_info (PlumaFileBrowserStore * model,
GFileInfo * info,
gboolean isadded)
{
- FileBrowserNodeDir * dir;
gchar const * content;
- gchar const * name;
gboolean free_info = FALSE;
GtkTreePath * path;
gchar * uri;
@@ -1942,14 +1936,8 @@ file_browser_node_set_from_info (PlumaFileBrowserStore * model,
free_info = TRUE;
}
- dir = FILE_BROWSER_NODE_DIR (node->parent);
- name = g_file_info_get_name (info);
-
if (g_file_info_get_is_hidden (info) || g_file_info_get_is_backup (info))
node->flags |= PLUMA_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
- else if (dir != NULL && dir->hidden_file_hash != NULL &&
- g_hash_table_lookup (dir->hidden_file_hash, name) != NULL)
- node->flags |= PLUMA_FILE_BROWSER_STORE_FLAG_IS_HIDDEN;
if (g_file_info_get_file_type (info) == G_FILE_TYPE_DIRECTORY)
node->flags |= PLUMA_FILE_BROWSER_STORE_FLAG_IS_DIRECTORY;
@@ -2126,77 +2114,6 @@ model_add_node_from_dir (PlumaFileBrowserStore * model,
return node;
}
-/* Read is sync, but we only do it for local files */
-static void
-parse_dot_hidden_file (FileBrowserNode *directory)
-{
- gsize file_size;
- char *file_contents;
- GFile *child;
- GFileInfo *info;
- GFileType type;
- int i;
- FileBrowserNodeDir * dir = FILE_BROWSER_NODE_DIR (directory);
-
- /* 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->file == NULL || !g_file_is_native (directory->file)) {
- return;
- }
-
- child = g_file_get_child (directory->file, ".hidden");
- info = g_file_query_info (child, G_FILE_ATTRIBUTE_STANDARD_TYPE, G_FILE_QUERY_INFO_NONE, NULL, NULL);
-
- type = info ? g_file_info_get_file_type (info) : G_FILE_TYPE_UNKNOWN;
-
- if (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 (dir->hidden_file_hash == NULL) {
- dir->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 (dir->hidden_file_hash,
- hidden_filename, hidden_filename);
- }
-
- i++;
-
- }
-
- g_free (file_contents);
-}
-
static void
on_directory_monitor_event (GFileMonitor * monitor,
GFile * file,
@@ -2369,9 +2286,6 @@ model_load_directory (PlumaFileBrowserStore * model,
node->flags |= PLUMA_FILE_BROWSER_STORE_FLAG_LOADED;
model_begin_loading (model, node);
- /* Read the '.hidden' file first (if any) */
- parse_dot_hidden_file (node);
-
dir->cancellable = g_cancellable_new ();
async = g_new (AsyncNode, 1);