[easytag] Check if the full commandline path is hidden
- From: David King <davidk src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [easytag] Check if the full commandline path is hidden
- Date: Mon, 20 May 2013 21:56:58 +0000 (UTC)
commit c726854e1a7baad9356a0022378d63629f3b8866
Author: David King <amigadave amigadave com>
Date: Mon May 20 22:37:50 2013 +0100
Check if the full commandline path is hidden
The last element of the commandline path was skipped when checking for
hidden paths, so rearrange the check so that all elements of the path
are tested.
src/easytag.c | 19 ++++++++++++++-----
1 files changed, 14 insertions(+), 5 deletions(-)
---
diff --git a/src/easytag.c b/src/easytag.c
index b5fac84..2cf00f5 100644
--- a/src/easytag.c
+++ b/src/easytag.c
@@ -189,16 +189,17 @@ command_line (GApplication *application,
if (argc > 1)
{
GFile *arg;
- GFile *file;
+ GFile *file = NULL;
GFile *parent;
GFileInfo *info;
GError *err = NULL;
GFileType type;
arg = g_file_new_for_commandline_arg (argv[1]);
- file = g_file_dup (arg);
+ /* Not really the parent of arg. */
+ parent = g_file_dup (arg);
- while ((parent = g_file_get_parent (file)) != NULL)
+ do
{
info = g_file_query_info (parent,
G_FILE_ATTRIBUTE_STANDARD_IS_HIDDEN,
@@ -209,7 +210,10 @@ command_line (GApplication *application,
g_warning ("Error querying file information (%s)",
err->message);
g_error_free (err);
- g_object_unref (file);
+ if (file)
+ {
+ g_clear_object (&file);
+ }
g_object_unref (parent);
break;
}
@@ -219,14 +223,19 @@ command_line (GApplication *application,
{
/* If the user saves the configuration for this session,
* this value will be saved. */
+ /* FIXME: Avoid this being overridden in activate(). */
BROWSE_HIDDEN_DIR = 1;
}
}
g_object_unref (info);
- g_object_unref (file);
+ if (file)
+ {
+ g_clear_object (&file);
+ }
file = parent;
}
+ while ((parent = g_file_get_parent (file)) != NULL);
info = g_file_query_info (arg, G_FILE_ATTRIBUTE_STANDARD_TYPE,
G_FILE_QUERY_INFO_NONE, NULL, &err);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]