diff options
author | Benjamin Otte <otte@redhat.com> | 2011-11-07 03:40:16 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2011-12-16 20:09:13 +0100 |
commit | af9e38561609c058e4499211b5061ce6f9647847 (patch) | |
tree | 8f852797c364f49bf74aa65c30643dafdf436790 /gtk/gtkfilechooserentry.c | |
parent | 357ae09b544971236bc8cd3562f7e07d51ba71c4 (diff) | |
download | gtk+-af9e38561609c058e4499211b5061ce6f9647847.tar.gz |
filechooserentry: Simplify refresh_current_folder_and_file_part()
The function can get the text it's refreshing from itself, as there is
only one possible value. And it doesn't need to return a value anymore.
Diffstat (limited to 'gtk/gtkfilechooserentry.c')
-rw-r--r-- | gtk/gtkfilechooserentry.c | 28 |
1 files changed, 9 insertions, 19 deletions
diff --git a/gtk/gtkfilechooserentry.c b/gtk/gtkfilechooserentry.c index 3f4757440f..ecd51077d9 100644 --- a/gtk/gtkfilechooserentry.c +++ b/gtk/gtkfilechooserentry.c @@ -118,8 +118,7 @@ static gboolean completion_match_func (GtkEntryCompletion *comp, GtkTreeIter *iter, gpointer data); -static RefreshStatus refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry, - const char *text); +static void refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry); static void finished_loading_cb (GtkFileSystemModel *model, GError *error, GtkFileChooserEntry *chooser_entry); @@ -155,13 +154,9 @@ gtk_file_chooser_entry_dispatch_properties_changed (GObject *object, pspecs[i]->name == I_("selection-bound") || pspecs[i]->name == I_("text")) { - char *text; - chooser_entry->load_complete_action = LOAD_COMPLETE_NOTHING; - text = gtk_file_chooser_entry_get_completion_text (chooser_entry); - refresh_current_folder_and_file_part (chooser_entry, text); - g_free (text); + refresh_current_folder_and_file_part (chooser_entry); break; } @@ -766,9 +761,8 @@ reload_current_folder (GtkFileChooserEntry *chooser_entry, return REFRESH_OK; } -static RefreshStatus -refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry, - const gchar * text) +static void +refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry) { GFile *folder_file; gchar *file_part; @@ -776,6 +770,9 @@ refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry, gint file_part_pos; GError *error; RefreshStatus result; + char *text; + + text = gtk_file_chooser_entry_get_completion_text (chooser_entry); error = NULL; if (!gtk_file_chooser_entry_parse (chooser_entry, @@ -817,7 +814,7 @@ refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry, if (result == REFRESH_OK) { - result = reload_current_folder (chooser_entry, folder_file); + reload_current_folder (chooser_entry, folder_file); } else { @@ -827,14 +824,7 @@ refresh_current_folder_and_file_part (GtkFileChooserEntry *chooser_entry, if (folder_file) g_object_unref (folder_file); - g_assert (/* we are OK and we have a current folder file and (loading process or folder handle)... */ - ((result == REFRESH_OK) - && (chooser_entry->current_folder_file != NULL)) - /* ... OR we have an error, and we don't have a current folder file nor a loading process nor a folder handle */ - || ((result != REFRESH_OK) - && (chooser_entry->current_folder_file == NULL))); - - return result; + g_free (text); } #ifdef G_OS_WIN32 |