[evince] [shell] Fix opening files with '#' in its name
- From: Carlos Garcia Campos <carlosgc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince] [shell] Fix opening files with '#' in its name
- Date: Tue, 11 May 2010 12:32:04 +0000 (UTC)
commit 182e12aed96d302f78f52c16b52b8f3c2784d415
Author: Carlos Garcia Campos <carlosgc gnome org>
Date: Tue May 11 14:29:56 2010 +0200
[shell] Fix opening files with '#' in its name
See bug #616515.
shell/main.c | 24 +++++++++++++++++++++++-
1 files changed, 23 insertions(+), 1 deletions(-)
---
diff --git a/shell/main.c b/shell/main.c
index d7d6e15..187a794 100644
--- a/shell/main.c
+++ b/shell/main.c
@@ -146,6 +146,28 @@ launch_previewer (void)
return retval;
}
+static gchar *
+get_label_from_filename (const gchar *filename)
+{
+ GFile *file;
+ gchar *label;
+ gboolean exists;
+
+ label = g_strrstr (filename, "#");
+ if (!label)
+ return NULL;
+
+ /* Filename contains a #, check
+ * whether it's part of the path
+ * or a label
+ */
+ file = g_file_new_for_commandline_arg (filename);
+ exists = g_file_query_exists (file, NULL);
+ g_object_unref (file);
+
+ return exists ? NULL : label;
+}
+
static void
load_files (const char **files)
{
@@ -179,7 +201,7 @@ load_files (const char **files)
const gchar *app_uri;
filename = files[i];
- label = strchr (filename, '#');
+ label = get_label_from_filename (filename);
if (label) {
*label = 0;
label++;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]