[gtk+] filechooserentry: Split out function
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] filechooserentry: Split out function
- Date: Fri, 16 Dec 2011 19:13:09 +0000 (UTC)
commit 5c42972735d4819f32ee78141fed249e8366f154
Author: Benjamin Otte <otte redhat com>
Date: Sat Nov 5 03:28:02 2011 +0100
filechooserentry: Split out function
I want to use that function elsewhere, so split it out.
gtk/gtkfilechooserentry.c | 19 +++++++++++++++----
1 files changed, 15 insertions(+), 4 deletions(-)
---
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index 94e01d5..11d1838 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -426,6 +426,20 @@ has_uri_scheme (const char *str)
return (strncmp (p, "://", 3) == 0);
}
+static GFile *
+gtk_file_chooser_get_file_for_text (GtkFileChooserEntry *chooser_entry,
+ const gchar *str)
+{
+ GFile *file;
+
+ if (str[0] == '~' || g_path_is_absolute (str) || has_uri_scheme (str))
+ file = g_file_parse_name (str);
+ else
+ file = g_file_resolve_relative_path (chooser_entry->base_folder, str);
+
+ return file;
+}
+
static gboolean
gtk_file_chooser_entry_parse (GtkFileChooserEntry *chooser_entry,
const gchar *str,
@@ -443,10 +457,7 @@ gtk_file_chooser_entry_parse (GtkFileChooserEntry *chooser_entry,
last_slash = strrchr (str, G_DIR_SEPARATOR);
- if (str[0] == '~' || g_path_is_absolute (str) || has_uri_scheme (str))
- file = g_file_parse_name (str);
- else
- file = g_file_resolve_relative_path (chooser_entry->base_folder, str);
+ file = gtk_file_chooser_get_file_for_text (chooser_entry, str);
if (g_file_equal (chooser_entry->base_folder, file))
{
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]