summaryrefslogtreecommitdiff
path: root/gtk/gtkfilechooserentry.c
diff options
context:
space:
mode:
authorBenjamin Otte <otte@redhat.com>2011-11-05 02:51:59 +0100
committerBenjamin Otte <otte@redhat.com>2011-12-16 20:09:12 +0100
commit2186c282634e9ebe6791c5e3dd2e88049b427502 (patch)
tree3318f51b1ada78b600df3e2d7fc6fd5846451c20 /gtk/gtkfilechooserentry.c
parent35198e142da35e016e2f2782b328a87689ba7292 (diff)
downloadgtk+-2186c282634e9ebe6791c5e3dd2e88049b427502.tar.gz
filechooserentry: Simplify code
Now that the base folder is always != NULL, we can remove the parts of the code that check for NULL.
Diffstat (limited to 'gtk/gtkfilechooserentry.c')
-rw-r--r--gtk/gtkfilechooserentry.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c
index d603569a9b..94e01d5f8e 100644
--- a/gtk/gtkfilechooserentry.c
+++ b/gtk/gtkfilechooserentry.c
@@ -237,8 +237,7 @@ gtk_file_chooser_entry_finalize (GObject *object)
{
GtkFileChooserEntry *chooser_entry = GTK_FILE_CHOOSER_ENTRY (object);
- if (chooser_entry->base_folder)
- g_object_unref (chooser_entry->base_folder);
+ g_object_unref (chooser_entry->base_folder);
if (chooser_entry->current_folder_file)
g_object_unref (chooser_entry->current_folder_file);
@@ -447,22 +446,9 @@ gtk_file_chooser_entry_parse (GtkFileChooserEntry *chooser_entry,
if (str[0] == '~' || g_path_is_absolute (str) || has_uri_scheme (str))
file = g_file_parse_name (str);
else
- {
- if (chooser_entry->base_folder)
- file = g_file_resolve_relative_path (chooser_entry->base_folder, str);
- else
- {
- *folder = NULL;
- *file_part = NULL;
- g_set_error (error,
- GTK_FILE_CHOOSER_ERROR,
- GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
- _("Invalid path"));
- return FALSE;
- }
- }
+ file = g_file_resolve_relative_path (chooser_entry->base_folder, str);
- if (chooser_entry->base_folder && g_file_equal (chooser_entry->base_folder, file))
+ if (g_file_equal (chooser_entry->base_folder, file))
{
/* this is when user types '.', could be the
* beginning of a hidden file, ./ or ../
@@ -1452,7 +1438,7 @@ refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry,
if (!gtk_file_chooser_entry_parse (chooser_entry,
text, &folder_file, &file_part, &error))
{
- folder_file = (chooser_entry->base_folder) ? g_object_ref (chooser_entry->base_folder) : NULL;
+ folder_file = g_object_ref (chooser_entry->base_folder);
if (g_error_matches (error, GTK_FILE_CHOOSER_ERROR, GTK_FILE_CHOOSER_ERROR_NONEXISTENT))
result = REFRESH_NONEXISTENT;