mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-09-22 23:04:07 +00:00
filechooserentry: Split out function
I want to use that function elsewhere, so split it out.
This commit is contained in:
parent
2186c28263
commit
5c42972735
@ -426,6 +426,20 @@ has_uri_scheme (const char *str)
|
|||||||
return (strncmp (p, "://", 3) == 0);
|
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
|
static gboolean
|
||||||
gtk_file_chooser_entry_parse (GtkFileChooserEntry *chooser_entry,
|
gtk_file_chooser_entry_parse (GtkFileChooserEntry *chooser_entry,
|
||||||
const gchar *str,
|
const gchar *str,
|
||||||
@ -443,10 +457,7 @@ gtk_file_chooser_entry_parse (GtkFileChooserEntry *chooser_entry,
|
|||||||
|
|
||||||
last_slash = strrchr (str, G_DIR_SEPARATOR);
|
last_slash = strrchr (str, G_DIR_SEPARATOR);
|
||||||
|
|
||||||
if (str[0] == '~' || g_path_is_absolute (str) || has_uri_scheme (str))
|
file = gtk_file_chooser_get_file_for_text (chooser_entry, str);
|
||||||
file = g_file_parse_name (str);
|
|
||||||
else
|
|
||||||
file = g_file_resolve_relative_path (chooser_entry->base_folder, str);
|
|
||||||
|
|
||||||
if (g_file_equal (chooser_entry->base_folder, file))
|
if (g_file_equal (chooser_entry->base_folder, file))
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user