+ /* Hide the location widgets temporarily */
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ {
+ gtk_widget_hide (impl->location_button);
+ gtk_widget_hide (impl->location_entry_box);
+ }
+
+ recent_start_loading (impl);
+}
+
+/* Sometimes we need to frob the selection in the shortcuts list manually */
+static void
+shortcuts_select_item_without_activating (GtkFileChooserDefault *impl, int pos)
+{
+ GtkTreeSelection *selection;
+ GtkTreePath *path;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
+
+ g_signal_handlers_block_by_func (selection, G_CALLBACK (shortcuts_selection_changed_cb), impl);
+
+ path = gtk_tree_path_new_from_indices (pos, -1);
+ gtk_tree_selection_select_path (selection, path);
+ gtk_tree_path_free (path);
+
+ g_signal_handlers_unblock_by_func (selection, G_CALLBACK (shortcuts_selection_changed_cb), impl);
+}
+
+static void
+operation_mode_set (GtkFileChooserDefault *impl, OperationMode mode)
+{
+ ShortcutsIndex shortcut_to_select;
+
+ operation_mode_stop (impl, impl->operation_mode);
+
+ impl->operation_mode = mode;
+
+ switch (impl->operation_mode)
+ {
+ case OPERATION_MODE_BROWSE:
+ operation_mode_set_browse (impl);
+ shortcut_to_select = SHORTCUTS_CURRENT_FOLDER;
+ break;
+
+ case OPERATION_MODE_SEARCH:
+ operation_mode_set_search (impl);
+ shortcut_to_select = SHORTCUTS_SEARCH;
+ break;
+
+ case OPERATION_MODE_RECENT:
+ operation_mode_set_recent (impl);
+ shortcut_to_select = SHORTCUTS_RECENT;
+ break;
+
+ default:
+ g_assert_not_reached ();
+ return;
+ }
+
+ if (shortcut_to_select != SHORTCUTS_CURRENT_FOLDER)
+ shortcuts_select_item_without_activating (impl, shortcuts_get_index (impl, shortcut_to_select));
+}
+
+/* This function is basically a do_all function.
+ *
+ * It sets the visibility on all the widgets based on the current state, and
+ * moves the custom_widget if needed.
+ */
+static void
+update_appearance (GtkFileChooserDefault *impl)
+{
+ save_path_bar (impl);
+
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ {
+ const char *text;
+
+ gtk_widget_hide (impl->location_button);
+ save_widgets_create (impl);
+
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ text = _("Save in _folder:");
+ else
+ text = _("Create in _folder:");
+
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (impl->save_folder_label), text);
+
+ if (impl->select_multiple)
+ {
+ g_warning ("Save mode cannot be set in conjunction with multiple selection mode. "
+ "Re-setting to single selection mode.");
+ set_select_multiple (impl, FALSE, TRUE);
+ }
+ }
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ {
+ gtk_widget_show (impl->location_button);
+ save_widgets_destroy (impl);
+ location_mode_set (impl, impl->location_mode, TRUE);
+ }
+
+ if (impl->location_entry)
+ _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
+
+ restore_path_bar (impl);
+ path_bar_update (impl);
+
+ /* This *is* needed; we need to redraw the file list because the "sensitivity"
+ * of files may change depending whether we are in a file or folder-only mode.
+ */
+ gtk_widget_queue_draw (impl->browse_files_tree_view);
+
+ emit_default_size_changed (impl);
+}
+
+static void
+gtk_file_chooser_default_set_property (GObject *object,
+ guint prop_id,
+ const GValue *value,
+ GParamSpec *pspec)
+
+{
+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object);
+
+ switch (prop_id)
+ {