[gtk+/composite-templates-new: 20/33] GtkFileChooserDefault: Define children with a GtkBuilder template
- From: Tristan Van Berkom <tvb src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/composite-templates-new: 20/33] GtkFileChooserDefault: Define children with a GtkBuilder template
- Date: Mon, 8 Apr 2013 12:21:41 +0000 (UTC)
commit bf909f56157311174d5d9089bdec954e7def8873
Author: Tristan Van Berkom <tristanvb openismus com>
Date: Mon Mar 25 01:40:08 2013 +0900
GtkFileChooserDefault: Define children with a GtkBuilder template
gtk/Makefile.am | 1 +
gtk/gtk.gresource.xml | 1 +
gtk/gtkfilechooserdefault.c | 3829 ++++++++++++++++++++----------------------
gtk/gtkfilechooserdefault.ui | 555 ++++++
gtk/gtkfilechooserprivate.h | 154 +--
gtk/tests/templates.c | 57 +
6 files changed, 2399 insertions(+), 2198 deletions(-)
---
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index 7fd005d..5d163d0 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -1102,6 +1102,7 @@ COMPOSITE_TEMPLATES = \
gtkassistant.ui \
gtkcolorchooserdialog.ui \
gtkdialog.ui \
+ gtkfilechooserdefault.ui \
gtkinfobar.ui \
gtklockbutton.ui \
gtkmessagedialog.ui \
diff --git a/gtk/gtk.gresource.xml b/gtk/gtk.gresource.xml
index 2a83c2a..baa57a5 100644
--- a/gtk/gtk.gresource.xml
+++ b/gtk/gtk.gresource.xml
@@ -17,6 +17,7 @@
<file compressed="true">gtkassistant.ui</file>
<file compressed="true">gtkcolorchooserdialog.ui</file>
<file compressed="true">gtkdialog.ui</file>
+ <file compressed="true">gtkfilechooserdefault.ui</file>
<file compressed="true">gtkinfobar.ui</file>
<file compressed="true">gtklockbutton.ui</file>
<file compressed="true">gtkmessagedialog.ui</file>
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index 99c4200..75dcfde 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -141,6 +141,164 @@ _gtk_file_chooser_profile_log (const char *func, int indent, const char *msg1, c
+struct _GtkFileChooserDefaultPrivate
+{
+ GtkFileChooserAction action;
+
+ GtkFileSystem *file_system;
+
+ /* Save mode widgets */
+ GtkWidget *save_widgets;
+ GtkWidget *save_widgets_table;
+
+ GtkWidget *save_folder_label;
+
+ /* The file browsing widgets */
+ GtkWidget *browse_widgets_box;
+ GtkWidget *browse_widgets_hpaned;
+ GtkWidget *browse_header_box;
+ GtkWidget *browse_shortcuts_swin;
+ GtkWidget *browse_shortcuts_toolbar;
+ GtkWidget *browse_shortcuts_tree_view;
+ GtkWidget *browse_shortcuts_add_button;
+ GtkWidget *browse_shortcuts_remove_button;
+ GtkWidget *browse_shortcuts_popup_menu;
+ GtkWidget *browse_shortcuts_popup_menu_remove_item;
+ GtkWidget *browse_shortcuts_popup_menu_rename_item;
+ GtkWidget *browse_files_tree_view;
+ GtkWidget *browse_files_popup_menu;
+ GtkWidget *browse_files_popup_menu_add_shortcut_item;
+ GtkWidget *browse_files_popup_menu_hidden_files_item;
+ GtkWidget *browse_files_popup_menu_size_column_item;
+ GtkWidget *browse_files_popup_menu_copy_file_location_item;
+ GtkWidget *browse_files_popup_menu_visit_file_item;
+ GtkWidget *browse_new_folder_button;
+ GtkWidget *browse_path_bar_hbox;
+ GtkSizeGroup *browse_path_bar_size_group;
+ GtkWidget *browse_path_bar;
+ GtkWidget *browse_special_mode_icon;
+ GtkWidget *browse_special_mode_label;
+ GtkWidget *browse_select_a_folder_info_bar;
+ GtkWidget *browse_select_a_folder_label;
+ GtkWidget *browse_select_a_folder_icon;
+
+ GtkFileSystemModel *browse_files_model;
+ char *browse_files_last_selected_name;
+
+ /* OPERATION_MODE_SEARCH */
+ GtkWidget *search_hbox;
+ GtkWidget *search_entry;
+ GtkSearchEngine *search_engine;
+ GtkQuery *search_query;
+ GtkFileSystemModel *search_model;
+
+ /* OPERATION_MODE_RECENT */
+ GtkRecentManager *recent_manager;
+ GtkFileSystemModel *recent_model;
+ guint load_recent_id;
+
+ GtkWidget *filter_combo_hbox;
+ GtkWidget *filter_combo;
+ GtkWidget *preview_box;
+ GtkWidget *preview_label;
+ GtkWidget *preview_widget;
+ GtkWidget *extra_align;
+ GtkWidget *extra_widget;
+
+ GtkWidget *location_button;
+ GtkWidget *location_entry_box;
+ GtkWidget *location_label;
+ GtkWidget *location_entry;
+ LocationMode location_mode;
+
+ GtkListStore *shortcuts_model;
+
+ /* Filter for the shortcuts pane. We filter out the "current folder" row and
+ * the separator that we use for the "Save in folder" combo.
+ */
+ GtkTreeModel *shortcuts_pane_filter_model;
+
+ /* Handles */
+ GSList *loading_shortcuts;
+ GSList *reload_icon_cancellables;
+ GCancellable *file_list_drag_data_received_cancellable;
+ GCancellable *update_current_folder_cancellable;
+ GCancellable *should_respond_get_info_cancellable;
+ GCancellable *file_exists_get_info_cancellable;
+ GCancellable *update_from_entry_cancellable;
+ GCancellable *shortcuts_activate_iter_cancellable;
+
+ LoadState load_state;
+ ReloadState reload_state;
+ guint load_timeout_id;
+
+ OperationMode operation_mode;
+
+ GSList *pending_select_files;
+
+ GtkFileFilter *current_filter;
+ GSList *filters;
+
+ int num_volumes;
+ int num_shortcuts;
+ int num_bookmarks;
+
+ gulong volumes_changed_id;
+ gulong bookmarks_changed_id;
+
+ GFile *current_volume_file;
+ GFile *current_folder;
+ GFile *preview_file;
+ char *preview_display_name;
+
+ GtkTreeViewColumn *list_name_column;
+ GtkCellRenderer *list_pixbuf_renderer;
+ GtkCellRenderer *list_name_renderer;
+ GtkTreeViewColumn *list_mtime_column;
+ GtkTreeViewColumn *list_size_column;
+
+ GSource *edited_idle;
+ char *edited_new_text;
+
+ gulong settings_signal_id;
+ int icon_size;
+
+ GSource *focus_entry_idle;
+
+ gulong toplevel_set_focus_id;
+ GtkWidget *toplevel_last_focus_widget;
+
+ gint sort_column;
+ GtkSortType sort_order;
+
+#if 0
+ GdkDragContext *shortcuts_drag_context;
+ GSource *shortcuts_drag_outside_idle;
+#endif
+
+ /* Flags */
+
+ guint local_only : 1;
+ guint preview_widget_active : 1;
+ guint use_preview_label : 1;
+ guint select_multiple : 1;
+ guint show_hidden : 1;
+ guint do_overwrite_confirmation : 1;
+ guint list_sort_ascending : 1;
+ guint changing_folder : 1;
+ guint shortcuts_current_folder_active : 1;
+ guint has_home : 1;
+ guint has_desktop : 1;
+ guint has_search : 1;
+ guint has_recent: 1;
+ guint show_size_column : 1;
+ guint create_folders : 1;
+
+#if 0
+ guint shortcuts_drag_outside : 1;
+#endif
+};
+
typedef struct _GtkFileChooserDefaultClass GtkFileChooserDefaultClass;
#define GTK_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass),
GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass))
@@ -423,7 +581,6 @@ static void set_file_system_backend (GtkFileChooserDefault *impl);
static void unset_file_system_backend (GtkFileChooserDefault *impl);
-
/* Drag and drop interface declarations */
@@ -451,10 +608,6 @@ G_DEFINE_TYPE_WITH_CODE (ShortcutsPaneModelFilter,
G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
shortcuts_pane_model_filter_drag_source_iface_init))
-static GtkTreeModel *shortcuts_pane_model_filter_new (GtkFileChooserDefault *impl,
- GtkTreeModel *child_model,
- GtkTreePath *root);
-
G_DEFINE_TYPE_WITH_CODE (GtkFileChooserDefault, _gtk_file_chooser_default, GTK_TYPE_BOX,
@@ -479,384 +632,112 @@ add_normal_and_shifted_binding (GtkBindingSet *binding_set,
signal_name, 0);
}
+/* Frees the data columns for the specified iter in the shortcuts model*/
static void
-_gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
+shortcuts_free_row_data (GtkFileChooserDefault *impl,
+ GtkTreeIter *iter)
{
- static const guint quick_bookmark_keyvals[10] = {
- GDK_KEY_1, GDK_KEY_2, GDK_KEY_3, GDK_KEY_4, GDK_KEY_5, GDK_KEY_6, GDK_KEY_7, GDK_KEY_8, GDK_KEY_9,
GDK_KEY_0
- };
- GObjectClass *gobject_class = G_OBJECT_CLASS (class);
- GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
- GtkBindingSet *binding_set;
- int i;
+ gpointer col_data;
+ ShortcutType shortcut_type;
+ GCancellable *cancellable;
- gobject_class->finalize = gtk_file_chooser_default_finalize;
- gobject_class->constructor = gtk_file_chooser_default_constructor;
- gobject_class->set_property = gtk_file_chooser_default_set_property;
- gobject_class->get_property = gtk_file_chooser_default_get_property;
- gobject_class->dispose = gtk_file_chooser_default_dispose;
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), iter,
+ SHORTCUTS_COL_DATA, &col_data,
+ SHORTCUTS_COL_TYPE, &shortcut_type,
+ SHORTCUTS_COL_CANCELLABLE, &cancellable,
+ -1);
- widget_class->show_all = gtk_file_chooser_default_show_all;
- widget_class->realize = gtk_file_chooser_default_realize;
- widget_class->map = gtk_file_chooser_default_map;
- widget_class->unmap = gtk_file_chooser_default_unmap;
- widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed;
- widget_class->style_updated = gtk_file_chooser_default_style_updated;
- widget_class->screen_changed = gtk_file_chooser_default_screen_changed;
+ if (cancellable)
+ {
+ g_cancellable_cancel (cancellable);
+ g_object_unref (cancellable);
+ }
- signals[LOCATION_POPUP] =
- g_signal_new_class_handler (I_("location-popup"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (location_popup_handler),
- NULL, NULL,
- _gtk_marshal_VOID__STRING,
- G_TYPE_NONE, 1, G_TYPE_STRING);
+ if (!(shortcut_type == SHORTCUT_TYPE_FILE ||
+ shortcut_type == SHORTCUT_TYPE_VOLUME) ||
+ !col_data)
+ return;
- signals[LOCATION_POPUP_ON_PASTE] =
- g_signal_new_class_handler (I_("location-popup-on-paste"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (location_popup_on_paste_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ if (shortcut_type == SHORTCUT_TYPE_VOLUME)
+ {
+ GtkFileSystemVolume *volume;
- signals[LOCATION_TOGGLE_POPUP] =
- g_signal_new_class_handler (I_("location-toggle-popup"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (location_toggle_popup_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ volume = col_data;
+ _gtk_file_system_volume_unref (volume);
+ }
+ if (shortcut_type == SHORTCUT_TYPE_FILE)
+ {
+ GFile *file;
- signals[UP_FOLDER] =
- g_signal_new_class_handler (I_("up-folder"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (up_folder_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ file = col_data;
+ g_object_unref (file);
+ }
+}
- signals[DOWN_FOLDER] =
- g_signal_new_class_handler (I_("down-folder"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (down_folder_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+/* Frees all the data columns in the shortcuts model */
+static void
+shortcuts_free (GtkFileChooserDefault *impl)
+{
+ GtkTreeIter iter;
- signals[HOME_FOLDER] =
- g_signal_new_class_handler (I_("home-folder"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (home_folder_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ if (!impl->priv->shortcuts_model)
+ return;
- signals[DESKTOP_FOLDER] =
- g_signal_new_class_handler (I_("desktop-folder"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (desktop_folder_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+ if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter))
+ do
+ {
+ shortcuts_free_row_data (impl, &iter);
+ }
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter));
- signals[QUICK_BOOKMARK] =
- g_signal_new_class_handler (I_("quick-bookmark"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (quick_bookmark_handler),
- NULL, NULL,
- _gtk_marshal_VOID__INT,
- G_TYPE_NONE, 1, G_TYPE_INT);
+ impl->priv->shortcuts_model = NULL;
+}
- signals[SHOW_HIDDEN] =
- g_signal_new_class_handler (I_("show-hidden"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (show_hidden_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+static void
+pending_select_files_free (GtkFileChooserDefault *impl)
+{
+ g_slist_free_full (impl->priv->pending_select_files, g_object_unref);
+ impl->priv->pending_select_files = NULL;
+}
- signals[SEARCH_SHORTCUT] =
- g_signal_new_class_handler (I_("search-shortcut"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (search_shortcut_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+static void
+pending_select_files_add (GtkFileChooserDefault *impl,
+ GFile *file)
+{
+ impl->priv->pending_select_files =
+ g_slist_prepend (impl->priv->pending_select_files, g_object_ref (file));
+}
- signals[RECENT_SHORTCUT] =
- g_signal_new_class_handler (I_("recent-shortcut"),
- G_OBJECT_CLASS_TYPE (class),
- G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
- G_CALLBACK (recent_shortcut_handler),
- NULL, NULL,
- _gtk_marshal_VOID__VOID,
- G_TYPE_NONE, 0);
+static void
+gtk_file_chooser_default_finalize (GObject *object)
+{
+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object);
+ GSList *l;
- binding_set = gtk_binding_set_by_class (class);
+ unset_file_system_backend (impl);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_l, GDK_CONTROL_MASK,
- "location-toggle-popup",
- 0);
+ g_free (impl->priv->browse_files_last_selected_name);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_slash, 0,
- "location-popup",
- 1, G_TYPE_STRING, "/");
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_KP_Divide, 0,
- "location-popup",
- 1, G_TYPE_STRING, "/");
+ for (l = impl->priv->filters; l; l = l->next)
+ {
+ GtkFileFilter *filter;
-#ifdef G_OS_UNIX
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_asciitilde, 0,
- "location-popup",
- 1, G_TYPE_STRING, "~");
-#endif
+ filter = GTK_FILE_FILTER (l->data);
+ g_object_unref (filter);
+ }
+ g_slist_free (impl->priv->filters);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_v, GDK_CONTROL_MASK,
- "location-popup-on-paste",
- 0);
+ if (impl->priv->current_filter)
+ g_object_unref (impl->priv->current_filter);
- add_normal_and_shifted_binding (binding_set,
- GDK_KEY_Up, GDK_MOD1_MASK,
- "up-folder");
+ if (impl->priv->current_volume_file)
+ g_object_unref (impl->priv->current_volume_file);
- add_normal_and_shifted_binding (binding_set,
- GDK_KEY_KP_Up, GDK_MOD1_MASK,
- "up-folder");
+ if (impl->priv->current_folder)
+ g_object_unref (impl->priv->current_folder);
- add_normal_and_shifted_binding (binding_set,
- GDK_KEY_Down, GDK_MOD1_MASK,
- "down-folder");
- add_normal_and_shifted_binding (binding_set,
- GDK_KEY_KP_Down, GDK_MOD1_MASK,
- "down-folder");
-
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_Home, GDK_MOD1_MASK,
- "home-folder",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_KP_Home, GDK_MOD1_MASK,
- "home-folder",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_d, GDK_MOD1_MASK,
- "desktop-folder",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_h, GDK_CONTROL_MASK,
- "show-hidden",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_s, GDK_MOD1_MASK,
- "search-shortcut",
- 0);
- gtk_binding_entry_add_signal (binding_set,
- GDK_KEY_r, GDK_MOD1_MASK,
- "recent-shortcut",
- 0);
-
- for (i = 0; i < 10; i++)
- gtk_binding_entry_add_signal (binding_set,
- quick_bookmark_keyvals[i], GDK_MOD1_MASK,
- "quick-bookmark",
- 1, G_TYPE_INT, i);
-
- _gtk_file_chooser_install_properties (gobject_class);
-}
-
-static void
-gtk_file_chooser_default_iface_init (GtkFileChooserIface *iface)
-{
- iface->select_file = gtk_file_chooser_default_select_file;
- iface->unselect_file = gtk_file_chooser_default_unselect_file;
- iface->select_all = gtk_file_chooser_default_select_all;
- iface->unselect_all = gtk_file_chooser_default_unselect_all;
- iface->get_files = gtk_file_chooser_default_get_files;
- iface->get_preview_file = gtk_file_chooser_default_get_preview_file;
- iface->get_file_system = gtk_file_chooser_default_get_file_system;
- iface->set_current_folder = gtk_file_chooser_default_set_current_folder;
- iface->get_current_folder = gtk_file_chooser_default_get_current_folder;
- iface->set_current_name = gtk_file_chooser_default_set_current_name;
- iface->add_filter = gtk_file_chooser_default_add_filter;
- iface->remove_filter = gtk_file_chooser_default_remove_filter;
- iface->list_filters = gtk_file_chooser_default_list_filters;
- iface->add_shortcut_folder = gtk_file_chooser_default_add_shortcut_folder;
- iface->remove_shortcut_folder = gtk_file_chooser_default_remove_shortcut_folder;
- iface->list_shortcut_folders = gtk_file_chooser_default_list_shortcut_folders;
-}
-
-static void
-gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface)
-{
- iface->get_default_size = gtk_file_chooser_default_get_default_size;
- iface->should_respond = gtk_file_chooser_default_should_respond;
- iface->initial_focus = gtk_file_chooser_default_initial_focus;
-}
-
-static void
-_gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
-{
- profile_start ("start", NULL);
-#ifdef PROFILE_FILE_CHOOSER
- access ("MARK: *** CREATE FILE CHOOSER", F_OK);
-#endif
- impl->local_only = TRUE;
- impl->preview_widget_active = TRUE;
- impl->use_preview_label = TRUE;
- impl->select_multiple = FALSE;
- impl->show_hidden = FALSE;
- impl->show_size_column = TRUE;
- impl->icon_size = FALLBACK_ICON_SIZE;
- impl->load_state = LOAD_EMPTY;
- impl->reload_state = RELOAD_EMPTY;
- impl->pending_select_files = NULL;
- impl->location_mode = LOCATION_MODE_PATH_BAR;
- impl->operation_mode = OPERATION_MODE_BROWSE;
- impl->sort_column = MODEL_COL_NAME;
- impl->sort_order = GTK_SORT_ASCENDING;
- impl->recent_manager = gtk_recent_manager_get_default ();
- impl->create_folders = TRUE;
-
- gtk_orientable_set_orientation (GTK_ORIENTABLE (impl),
- GTK_ORIENTATION_VERTICAL);
- gtk_box_set_spacing (GTK_BOX (impl), 12);
-
- set_file_system_backend (impl);
-
- profile_end ("end", NULL);
-}
-
-/* Frees the data columns for the specified iter in the shortcuts model*/
-static void
-shortcuts_free_row_data (GtkFileChooserDefault *impl,
- GtkTreeIter *iter)
-{
- gpointer col_data;
- ShortcutType shortcut_type;
- GCancellable *cancellable;
-
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter,
- SHORTCUTS_COL_DATA, &col_data,
- SHORTCUTS_COL_TYPE, &shortcut_type,
- SHORTCUTS_COL_CANCELLABLE, &cancellable,
- -1);
-
- if (cancellable)
- {
- g_cancellable_cancel (cancellable);
- g_object_unref (cancellable);
- }
-
- if (!(shortcut_type == SHORTCUT_TYPE_FILE ||
- shortcut_type == SHORTCUT_TYPE_VOLUME) ||
- !col_data)
- return;
-
- if (shortcut_type == SHORTCUT_TYPE_VOLUME)
- {
- GtkFileSystemVolume *volume;
-
- volume = col_data;
- _gtk_file_system_volume_unref (volume);
- }
- if (shortcut_type == SHORTCUT_TYPE_FILE)
- {
- GFile *file;
-
- file = col_data;
- g_object_unref (file);
- }
-}
-
-/* Frees all the data columns in the shortcuts model */
-static void
-shortcuts_free (GtkFileChooserDefault *impl)
-{
- GtkTreeIter iter;
-
- if (!impl->shortcuts_model)
- return;
-
- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
- do
- {
- shortcuts_free_row_data (impl, &iter);
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter));
-
- g_object_unref (impl->shortcuts_model);
- impl->shortcuts_model = NULL;
-}
-
-static void
-pending_select_files_free (GtkFileChooserDefault *impl)
-{
- g_slist_free_full (impl->pending_select_files, g_object_unref);
- impl->pending_select_files = NULL;
-}
-
-static void
-pending_select_files_add (GtkFileChooserDefault *impl,
- GFile *file)
-{
- impl->pending_select_files =
- g_slist_prepend (impl->pending_select_files, g_object_ref (file));
-}
-
-static void
-gtk_file_chooser_default_finalize (GObject *object)
-{
- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object);
- GSList *l;
-
- unset_file_system_backend (impl);
-
- if (impl->shortcuts_pane_filter_model)
- g_object_unref (impl->shortcuts_pane_filter_model);
-
- shortcuts_free (impl);
-
- g_free (impl->browse_files_last_selected_name);
-
- for (l = impl->filters; l; l = l->next)
- {
- GtkFileFilter *filter;
-
- filter = GTK_FILE_FILTER (l->data);
- g_object_unref (filter);
- }
- g_slist_free (impl->filters);
-
- if (impl->current_filter)
- g_object_unref (impl->current_filter);
-
- if (impl->current_volume_file)
- g_object_unref (impl->current_volume_file);
-
- if (impl->current_folder)
- g_object_unref (impl->current_folder);
-
- if (impl->preview_file)
- g_object_unref (impl->preview_file);
-
- if (impl->browse_path_bar_size_group)
- g_object_unref (impl->browse_path_bar_size_group);
+ if (impl->priv->preview_file)
+ g_object_unref (impl->priv->preview_file);
/* Free all the Models we have */
stop_loading_and_clear_list_model (impl, FALSE);
@@ -864,11 +745,11 @@ gtk_file_chooser_default_finalize (GObject *object)
recent_clear_model (impl, FALSE);
/* stopping the load above should have cleared this */
- g_assert (impl->load_timeout_id == 0);
+ g_assert (impl->priv->load_timeout_id == 0);
- g_free (impl->preview_display_name);
+ g_free (impl->priv->preview_display_name);
- g_free (impl->edited_new_text);
+ g_free (impl->priv->edited_new_text);
G_OBJECT_CLASS (_gtk_file_chooser_default_parent_class)->finalize (object);
}
@@ -1090,30 +971,30 @@ emit_default_size_changed (GtkFileChooserDefault *impl)
static void
update_preview_widget_visibility (GtkFileChooserDefault *impl)
{
- if (impl->use_preview_label)
+ if (impl->priv->use_preview_label)
{
- if (!impl->preview_label)
+ if (!impl->priv->preview_label)
{
- impl->preview_label = gtk_label_new (impl->preview_display_name);
- gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_label, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (impl->preview_box), impl->preview_label, 0);
- gtk_label_set_ellipsize (GTK_LABEL (impl->preview_label), PANGO_ELLIPSIZE_MIDDLE);
- gtk_widget_show (impl->preview_label);
+ impl->priv->preview_label = gtk_label_new (impl->priv->preview_display_name);
+ gtk_box_pack_start (GTK_BOX (impl->priv->preview_box), impl->priv->preview_label, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (impl->priv->preview_box), impl->priv->preview_label, 0);
+ gtk_label_set_ellipsize (GTK_LABEL (impl->priv->preview_label), PANGO_ELLIPSIZE_MIDDLE);
+ gtk_widget_show (impl->priv->preview_label);
}
}
else
{
- if (impl->preview_label)
+ if (impl->priv->preview_label)
{
- gtk_widget_destroy (impl->preview_label);
- impl->preview_label = NULL;
+ gtk_widget_destroy (impl->priv->preview_label);
+ impl->priv->preview_label = NULL;
}
}
- if (impl->preview_widget_active && impl->preview_widget)
- gtk_widget_show (impl->preview_box);
+ if (impl->priv->preview_widget_active && impl->priv->preview_widget)
+ gtk_widget_show (impl->priv->preview_box);
else
- gtk_widget_hide (impl->preview_box);
+ gtk_widget_hide (impl->priv->preview_box);
if (!gtk_widget_get_mapped (GTK_WIDGET (impl)))
emit_default_size_changed (impl);
@@ -1123,21 +1004,21 @@ static void
set_preview_widget (GtkFileChooserDefault *impl,
GtkWidget *preview_widget)
{
- if (preview_widget == impl->preview_widget)
+ if (preview_widget == impl->priv->preview_widget)
return;
- if (impl->preview_widget)
- gtk_container_remove (GTK_CONTAINER (impl->preview_box),
- impl->preview_widget);
+ if (impl->priv->preview_widget)
+ gtk_container_remove (GTK_CONTAINER (impl->priv->preview_box),
+ impl->priv->preview_widget);
- impl->preview_widget = preview_widget;
- if (impl->preview_widget)
+ impl->priv->preview_widget = preview_widget;
+ if (impl->priv->preview_widget)
{
- gtk_widget_show (impl->preview_widget);
- gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_widget, TRUE, TRUE, 0);
- gtk_box_reorder_child (GTK_BOX (impl->preview_box),
- impl->preview_widget,
- (impl->use_preview_label && impl->preview_label) ? 1 : 0);
+ gtk_widget_show (impl->priv->preview_widget);
+ gtk_box_pack_start (GTK_BOX (impl->priv->preview_box), impl->priv->preview_widget, TRUE, TRUE, 0);
+ gtk_box_reorder_child (GTK_BOX (impl->priv->preview_box),
+ impl->priv->preview_widget,
+ (impl->priv->use_preview_label && impl->priv->preview_label) ? 1 : 0);
}
update_preview_widget_visibility (impl);
@@ -1162,7 +1043,7 @@ render_recent_icon (GtkFileChooserDefault *impl)
theme = gtk_icon_theme_get_default ();
retval = gtk_icon_theme_load_icon (theme, "document-open-recent",
- impl->icon_size, 0,
+ impl->priv->icon_size, 0,
NULL);
/* fallback */
@@ -1192,21 +1073,21 @@ shortcuts_reload_icons_get_info_cb (GCancellable *cancellable,
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
struct ReloadIconsData *data = user_data;
- if (!g_slist_find (data->impl->reload_icon_cancellables, cancellable))
+ if (!g_slist_find (data->impl->priv->reload_icon_cancellables, cancellable))
goto out;
- data->impl->reload_icon_cancellables = g_slist_remove (data->impl->reload_icon_cancellables, cancellable);
+ data->impl->priv->reload_icon_cancellables = g_slist_remove (data->impl->priv->reload_icon_cancellables,
cancellable);
if (cancelled || error)
goto out;
- pixbuf = _gtk_file_info_render_icon (info, GTK_WIDGET (data->impl), data->impl->icon_size);
+ pixbuf = _gtk_file_info_render_icon (info, GTK_WIDGET (data->impl), data->impl->priv->icon_size);
path = gtk_tree_row_reference_get_path (data->row_ref);
if (path)
{
- gtk_tree_model_get_iter (GTK_TREE_MODEL (data->impl->shortcuts_model), &iter, path);
- gtk_list_store_set (data->impl->shortcuts_model, &iter,
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (data->impl->priv->shortcuts_model), &iter, path);
+ gtk_list_store_set (data->impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_PIXBUF, pixbuf,
-1);
gtk_tree_path_free (path);
@@ -1231,16 +1112,16 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl)
profile_start ("start", NULL);
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter))
goto out;
- for (l = impl->reload_icon_cancellables; l; l = l->next)
+ for (l = impl->priv->reload_icon_cancellables; l; l = l->next)
{
GCancellable *cancellable = G_CANCELLABLE (l->data);
g_cancellable_cancel (cancellable);
}
- g_slist_free (impl->reload_icon_cancellables);
- impl->reload_icon_cancellables = NULL;
+ g_slist_free (impl->priv->reload_icon_cancellables);
+ impl->priv->reload_icon_cancellables = NULL;
do
{
@@ -1249,7 +1130,7 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl)
gboolean pixbuf_visible;
GdkPixbuf *pixbuf;
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_DATA, &data,
SHORTCUTS_COL_TYPE, &shortcut_type,
SHORTCUTS_COL_PIXBUF_VISIBLE, &pixbuf_visible,
@@ -1264,7 +1145,7 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl)
volume = data;
pixbuf = _gtk_file_system_volume_render_icon (volume, GTK_WIDGET (impl),
- impl->icon_size, NULL);
+ impl->priv->icon_size, NULL);
}
else if (shortcut_type == SHORTCUT_TYPE_FILE)
{
@@ -1279,15 +1160,15 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl)
info = g_new0 (struct ReloadIconsData, 1);
info->impl = g_object_ref (impl);
- tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
- info->row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (impl->shortcuts_model),
tree_path);
+ tree_path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter);
+ info->row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (impl->priv->shortcuts_model),
tree_path);
gtk_tree_path_free (tree_path);
- cancellable = _gtk_file_system_get_info (impl->file_system, file,
+ cancellable = _gtk_file_system_get_info (impl->priv->file_system, file,
"standard::icon",
shortcuts_reload_icons_get_info_cb,
info);
- impl->reload_icon_cancellables = g_slist_append (impl->reload_icon_cancellables,
cancellable);
+ impl->priv->reload_icon_cancellables = g_slist_append
(impl->priv->reload_icon_cancellables, cancellable);
}
else
{
@@ -1300,7 +1181,7 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl)
*/
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
pixbuf = gtk_icon_theme_load_icon (icon_theme, "folder-remote",
- impl->icon_size, 0, NULL);
+ impl->priv->icon_size, 0, NULL);
}
}
else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
@@ -1312,7 +1193,7 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl)
pixbuf = render_recent_icon (impl);
}
- gtk_list_store_set (impl->shortcuts_model, &iter,
+ gtk_list_store_set (impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_PIXBUF, pixbuf,
-1);
@@ -1321,7 +1202,7 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl)
}
}
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter));
+ while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->priv->shortcuts_model),&iter));
out:
@@ -1336,7 +1217,7 @@ shortcuts_find_folder (GtkFileChooserDefault *impl,
int pos;
GtkTreePath *path;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view));
g_assert (folder != NULL);
pos = shortcut_find_position (impl, folder);
@@ -1355,7 +1236,7 @@ shortcuts_find_folder (GtkFileChooserDefault *impl,
static void
shortcuts_find_current_folder (GtkFileChooserDefault *impl)
{
- shortcuts_find_folder (impl, impl->current_folder);
+ shortcuts_find_folder (impl, impl->priv->current_folder);
}
/* Removes the specified number of rows from the shortcuts list */
@@ -1372,11 +1253,11 @@ shortcuts_remove_rows (GtkFileChooserDefault *impl,
{
GtkTreeIter iter;
- if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path))
+ if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter, path))
g_assert_not_reached ();
shortcuts_free_row_data (impl, &iter);
- gtk_list_store_remove (impl->shortcuts_model, &iter);
+ gtk_list_store_remove (impl->priv->shortcuts_model, &iter);
}
gtk_tree_path_free (path);
@@ -1391,35 +1272,35 @@ shortcuts_update_count (GtkFileChooserDefault *impl,
{
case SHORTCUTS_HOME:
if (value < 0)
- impl->has_home = FALSE;
+ impl->priv->has_home = FALSE;
else
- impl->has_home = TRUE;
+ impl->priv->has_home = TRUE;
break;
case SHORTCUTS_DESKTOP:
if (value < 0)
- impl->has_desktop = FALSE;
+ impl->priv->has_desktop = FALSE;
else
- impl->has_desktop = TRUE;
+ impl->priv->has_desktop = TRUE;
break;
case SHORTCUTS_VOLUMES:
- impl->num_volumes += value;
+ impl->priv->num_volumes += value;
break;
case SHORTCUTS_SHORTCUTS:
- impl->num_shortcuts += value;
+ impl->priv->num_shortcuts += value;
break;
case SHORTCUTS_BOOKMARKS:
- impl->num_bookmarks += value;
+ impl->priv->num_bookmarks += value;
break;
case SHORTCUTS_CURRENT_FOLDER:
if (value < 0)
- impl->shortcuts_current_folder_active = FALSE;
+ impl->priv->shortcuts_current_folder_active = FALSE;
else
- impl->shortcuts_current_folder_active = TRUE;
+ impl->priv->shortcuts_current_folder_active = TRUE;
break;
default:
@@ -1458,19 +1339,19 @@ get_file_info_finished (GCancellable *cancellable,
/* Handle doesn't exist anymore in the model */
goto out;
- gtk_tree_model_get_iter (GTK_TREE_MODEL (request->impl->shortcuts_model),
+ gtk_tree_model_get_iter (GTK_TREE_MODEL (request->impl->priv->shortcuts_model),
&iter, path);
gtk_tree_path_free (path);
/* validate cancellable, else goto out */
- gtk_tree_model_get (GTK_TREE_MODEL (request->impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (request->impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_CANCELLABLE, &model_cancellable,
-1);
if (cancellable != model_cancellable)
goto out;
/* set the cancellable to NULL in the model (we unref later on) */
- gtk_list_store_set (request->impl->shortcuts_model, &iter,
+ gtk_list_store_set (request->impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_CANCELLABLE, NULL,
-1);
@@ -1479,7 +1360,7 @@ get_file_info_finished (GCancellable *cancellable,
if (!info)
{
- gtk_list_store_remove (request->impl->shortcuts_model, &iter);
+ gtk_list_store_remove (request->impl->priv->shortcuts_model, &iter);
shortcuts_update_count (request->impl, request->type, -1);
if (request->type == SHORTCUTS_HOME)
@@ -1503,9 +1384,9 @@ get_file_info_finished (GCancellable *cancellable,
if (!request->label_copy)
request->label_copy = g_strdup (g_file_info_get_display_name (info));
pixbuf = _gtk_file_info_render_icon (info, GTK_WIDGET (request->impl),
- request->impl->icon_size);
+ request->impl->priv->icon_size);
- gtk_list_store_set (request->impl->shortcuts_model, &iter,
+ gtk_list_store_set (request->impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_PIXBUF, pixbuf,
SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
SHORTCUTS_COL_NAME, request->label_copy,
@@ -1513,8 +1394,8 @@ get_file_info_finished (GCancellable *cancellable,
SHORTCUTS_COL_REMOVABLE, request->removable,
-1);
- if (request->impl->shortcuts_pane_filter_model)
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (request->impl->shortcuts_pane_filter_model));
+ if (request->impl->priv->shortcuts_pane_filter_model)
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER
(request->impl->priv->shortcuts_pane_filter_model));
if (pixbuf)
g_object_unref (pixbuf);
@@ -1612,7 +1493,7 @@ shortcuts_insert_file (GtkFileChooserDefault *impl,
data = volume;
label_copy = _gtk_file_system_volume_get_display_name (volume);
pixbuf = _gtk_file_system_volume_render_icon (volume, GTK_WIDGET (impl),
- impl->icon_size, NULL);
+ impl->priv->icon_size, NULL);
}
else if (shortcut_type == SHORTCUT_TYPE_FILE)
{
@@ -1633,19 +1514,19 @@ shortcuts_insert_file (GtkFileChooserDefault *impl,
request->label_copy = g_strdup (label);
if (pos == -1)
- gtk_list_store_append (impl->shortcuts_model, &iter);
+ gtk_list_store_append (impl->priv->shortcuts_model, &iter);
else
- gtk_list_store_insert (impl->shortcuts_model, &iter, pos);
+ gtk_list_store_insert (impl->priv->shortcuts_model, &iter, pos);
- p = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
- request->row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (impl->shortcuts_model), p);
+ p = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter);
+ request->row_ref = gtk_tree_row_reference_new (GTK_TREE_MODEL (impl->priv->shortcuts_model), p);
gtk_tree_path_free (p);
- cancellable = _gtk_file_system_get_info (request->impl->file_system, request->file,
+ cancellable = _gtk_file_system_get_info (request->impl->priv->file_system, request->file,
"standard::is-hidden,standard::is-backup,standard::display-name,standard::icon",
get_file_info_finished, request);
- gtk_list_store_set (impl->shortcuts_model, &iter,
+ gtk_list_store_set (impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_DATA, g_object_ref (file),
SHORTCUTS_COL_TYPE, SHORTCUT_TYPE_FILE,
SHORTCUTS_COL_CANCELLABLE, cancellable,
@@ -1671,7 +1552,7 @@ shortcuts_insert_file (GtkFileChooserDefault *impl,
*/
icon_theme = gtk_icon_theme_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
pixbuf = gtk_icon_theme_load_icon (icon_theme, "folder-remote",
- impl->icon_size, 0, NULL);
+ impl->priv->icon_size, 0, NULL);
}
}
else
@@ -1682,13 +1563,13 @@ shortcuts_insert_file (GtkFileChooserDefault *impl,
}
if (pos == -1)
- gtk_list_store_append (impl->shortcuts_model, &iter);
+ gtk_list_store_append (impl->priv->shortcuts_model, &iter);
else
- gtk_list_store_insert (impl->shortcuts_model, &iter, pos);
+ gtk_list_store_insert (impl->priv->shortcuts_model, &iter, pos);
shortcuts_update_count (impl, type, 1);
- gtk_list_store_set (impl->shortcuts_model, &iter,
+ gtk_list_store_set (impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_PIXBUF, pixbuf,
SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
SHORTCUTS_COL_NAME, label_copy,
@@ -1698,8 +1579,8 @@ shortcuts_insert_file (GtkFileChooserDefault *impl,
SHORTCUTS_COL_CANCELLABLE, NULL,
-1);
- if (impl->shortcuts_pane_filter_model)
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model));
+ if (impl->priv->shortcuts_pane_filter_model)
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->priv->shortcuts_pane_filter_model));
g_free (label_copy);
@@ -1717,8 +1598,8 @@ shortcuts_append_search (GtkFileChooserDefault *impl)
pixbuf = render_search_icon (impl);
- gtk_list_store_append (impl->shortcuts_model, &iter);
- gtk_list_store_set (impl->shortcuts_model, &iter,
+ gtk_list_store_append (impl->priv->shortcuts_model, &iter);
+ gtk_list_store_set (impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_PIXBUF, pixbuf,
SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
SHORTCUTS_COL_NAME, _("Search"),
@@ -1730,7 +1611,7 @@ shortcuts_append_search (GtkFileChooserDefault *impl)
if (pixbuf)
g_object_unref (pixbuf);
- impl->has_search = TRUE;
+ impl->priv->has_search = TRUE;
}
static gboolean
@@ -1761,8 +1642,8 @@ shortcuts_append_recent (GtkFileChooserDefault *impl)
pixbuf = render_recent_icon (impl);
- gtk_list_store_append (impl->shortcuts_model, &iter);
- gtk_list_store_set (impl->shortcuts_model, &iter,
+ gtk_list_store_append (impl->priv->shortcuts_model, &iter);
+ gtk_list_store_set (impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_PIXBUF, pixbuf,
SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
SHORTCUTS_COL_NAME, _("Recently Used"),
@@ -1774,7 +1655,7 @@ shortcuts_append_recent (GtkFileChooserDefault *impl)
if (pixbuf)
g_object_unref (pixbuf);
- impl->has_recent = TRUE;
+ impl->priv->has_recent = TRUE;
}
/* Appends an item for the user's home directory to the shortcuts model */
@@ -1795,7 +1676,7 @@ shortcuts_append_home (GtkFileChooserDefault *impl)
home = g_file_new_for_path (home_path);
shortcuts_insert_file (impl, -1, SHORTCUT_TYPE_FILE, NULL, home, NULL, FALSE, SHORTCUTS_HOME);
- impl->has_home = TRUE;
+ impl->priv->has_home = TRUE;
g_object_unref (home);
@@ -1823,7 +1704,7 @@ shortcuts_append_desktop (GtkFileChooserDefault *impl)
file = g_file_new_for_path (name);
shortcuts_insert_file (impl, -1, SHORTCUT_TYPE_FILE, NULL, file, _("Desktop"), FALSE, SHORTCUTS_DESKTOP);
- impl->has_desktop = TRUE;
+ impl->priv->has_desktop = TRUE;
/* We do not actually pop up an error dialog if there is no desktop directory
* because some people may really not want to have one.
@@ -1854,13 +1735,13 @@ shortcuts_append_bookmarks (GtkFileChooserDefault *impl,
file = bookmarks->data;
- if (impl->local_only && !_gtk_file_has_native_path (file))
+ if (impl->priv->local_only && !_gtk_file_has_native_path (file))
continue;
if (shortcut_find_position (impl, file) != -1)
continue;
- label = _gtk_file_system_get_bookmark_label (impl->file_system, file);
+ label = _gtk_file_system_get_bookmark_label (impl->priv->file_system, file);
shortcuts_insert_file (impl, start_row + num_inserted, SHORTCUT_TYPE_FILE, NULL, file, label, TRUE,
SHORTCUTS_BOOKMARKS);
g_free (label);
@@ -1885,12 +1766,12 @@ shortcuts_get_index (GtkFileChooserDefault *impl,
if (where == SHORTCUTS_SEARCH)
goto out;
- n += impl->has_search ? 1 : 0;
+ n += impl->priv->has_search ? 1 : 0;
if (where == SHORTCUTS_RECENT)
goto out;
- n += impl->has_recent ? 1 : 0;
+ n += impl->priv->has_recent ? 1 : 0;
if (where == SHORTCUTS_RECENT_SEPARATOR)
goto out;
@@ -1900,33 +1781,33 @@ shortcuts_get_index (GtkFileChooserDefault *impl,
if (where == SHORTCUTS_HOME)
goto out;
- n += impl->has_home ? 1 : 0;
+ n += impl->priv->has_home ? 1 : 0;
if (where == SHORTCUTS_DESKTOP)
goto out;
- n += impl->has_desktop ? 1 : 0;
+ n += impl->priv->has_desktop ? 1 : 0;
if (where == SHORTCUTS_VOLUMES)
goto out;
- n += impl->num_volumes;
+ n += impl->priv->num_volumes;
if (where == SHORTCUTS_SHORTCUTS)
goto out;
- n += impl->num_shortcuts;
+ n += impl->priv->num_shortcuts;
if (where == SHORTCUTS_BOOKMARKS_SEPARATOR)
goto out;
/* If there are no bookmarks there won't be a separator */
- n += (impl->num_bookmarks > 0) ? 1 : 0;
+ n += (impl->priv->num_bookmarks > 0) ? 1 : 0;
if (where == SHORTCUTS_BOOKMARKS)
goto out;
- n += impl->num_bookmarks;
+ n += impl->priv->num_bookmarks;
if (where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR)
goto out;
@@ -1954,14 +1835,14 @@ shortcuts_add_volumes (GtkFileChooserDefault *impl)
profile_start ("start", NULL);
- old_changing_folders = impl->changing_folder;
- impl->changing_folder = TRUE;
+ old_changing_folders = impl->priv->changing_folder;
+ impl->priv->changing_folder = TRUE;
start_row = shortcuts_get_index (impl, SHORTCUTS_VOLUMES);
- shortcuts_remove_rows (impl, start_row, impl->num_volumes);
- impl->num_volumes = 0;
+ shortcuts_remove_rows (impl, start_row, impl->priv->num_volumes);
+ impl->priv->num_volumes = 0;
- list = _gtk_file_system_list_volumes (impl->file_system);
+ list = _gtk_file_system_list_volumes (impl->priv->file_system);
n = 0;
@@ -1971,7 +1852,7 @@ shortcuts_add_volumes (GtkFileChooserDefault *impl)
volume = l->data;
- if (impl->local_only)
+ if (impl->priv->local_only)
{
if (_gtk_file_system_volume_is_mounted (volume))
{
@@ -2001,13 +1882,13 @@ shortcuts_add_volumes (GtkFileChooserDefault *impl)
n++;
}
- impl->num_volumes = n;
+ impl->priv->num_volumes = n;
g_slist_free (list);
- if (impl->shortcuts_pane_filter_model)
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model));
+ if (impl->priv->shortcuts_pane_filter_model)
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->priv->shortcuts_pane_filter_model));
- impl->changing_folder = old_changing_folders;
+ impl->priv->changing_folder = old_changing_folders;
profile_end ("end", NULL);
}
@@ -2023,9 +1904,9 @@ shortcuts_insert_separator (GtkFileChooserDefault *impl,
where == SHORTCUTS_BOOKMARKS_SEPARATOR ||
where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
- gtk_list_store_insert (impl->shortcuts_model, &iter,
+ gtk_list_store_insert (impl->priv->shortcuts_model, &iter,
shortcuts_get_index (impl, where));
- gtk_list_store_set (impl->shortcuts_model, &iter,
+ gtk_list_store_set (impl->priv->shortcuts_model, &iter,
SHORTCUTS_COL_PIXBUF, NULL,
SHORTCUTS_COL_PIXBUF_VISIBLE, FALSE,
SHORTCUTS_COL_NAME, NULL,
@@ -2047,12 +1928,12 @@ shortcuts_add_bookmarks (GtkFileChooserDefault *impl)
profile_start ("start", NULL);
- old_changing_folders = impl->changing_folder;
- impl->changing_folder = TRUE;
+ old_changing_folders = impl->priv->changing_folder;
+ impl->priv->changing_folder = TRUE;
if (shortcuts_get_selected (impl, &iter))
{
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model),
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model),
&iter,
SHORTCUTS_COL_DATA, &col_data,
SHORTCUTS_COL_TYPE, &shortcut_type,
@@ -2062,24 +1943,24 @@ shortcuts_add_bookmarks (GtkFileChooserDefault *impl)
list_selected = g_object_ref (col_data);
}
- if (impl->num_bookmarks > 0)
+ if (impl->priv->num_bookmarks > 0)
shortcuts_remove_rows (impl,
shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR),
- impl->num_bookmarks + 1);
+ impl->priv->num_bookmarks + 1);
- impl->num_bookmarks = 0;
+ impl->priv->num_bookmarks = 0;
shortcuts_insert_separator (impl, SHORTCUTS_BOOKMARKS_SEPARATOR);
- bookmarks = _gtk_file_system_list_bookmarks (impl->file_system);
+ bookmarks = _gtk_file_system_list_bookmarks (impl->priv->file_system);
shortcuts_append_bookmarks (impl, bookmarks);
g_slist_foreach (bookmarks, (GFunc) g_object_unref, NULL);
g_slist_free (bookmarks);
- if (impl->num_bookmarks == 0)
+ if (impl->priv->num_bookmarks == 0)
shortcuts_remove_rows (impl, shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR), 1);
- if (impl->shortcuts_pane_filter_model)
- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model));
+ if (impl->priv->shortcuts_pane_filter_model)
+ gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->priv->shortcuts_pane_filter_model));
if (list_selected)
{
@@ -2087,7 +1968,7 @@ shortcuts_add_bookmarks (GtkFileChooserDefault *impl)
g_object_unref (list_selected);
}
- impl->changing_folder = old_changing_folders;
+ impl->priv->changing_folder = old_changing_folders;
profile_end ("end", NULL);
}
@@ -2098,11 +1979,11 @@ shortcuts_add_current_folder (GtkFileChooserDefault *impl)
{
int pos;
- g_assert (!impl->shortcuts_current_folder_active);
+ g_assert (!impl->priv->shortcuts_current_folder_active);
- g_assert (impl->current_folder != NULL);
+ g_assert (impl->priv->current_folder != NULL);
- pos = shortcut_find_position (impl, impl->current_folder);
+ pos = shortcut_find_position (impl, impl->priv->current_folder);
if (pos == -1)
{
GtkFileSystemVolume *volume;
@@ -2114,16 +1995,16 @@ shortcuts_add_current_folder (GtkFileChooserDefault *impl)
/* Item */
pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER);
- volume = _gtk_file_system_get_volume_for_file (impl->file_system, impl->current_folder);
+ volume = _gtk_file_system_get_volume_for_file (impl->priv->file_system, impl->priv->current_folder);
if (volume)
base_file = _gtk_file_system_volume_get_root (volume);
else
base_file = NULL;
- if (base_file && g_file_equal (base_file, impl->current_folder))
+ if (base_file && g_file_equal (base_file, impl->priv->current_folder))
shortcuts_insert_file (impl, pos, SHORTCUT_TYPE_VOLUME, volume, NULL, NULL, FALSE,
SHORTCUTS_CURRENT_FOLDER);
else
- shortcuts_insert_file (impl, pos, SHORTCUT_TYPE_FILE, NULL, impl->current_folder, NULL, FALSE,
SHORTCUTS_CURRENT_FOLDER);
+ shortcuts_insert_file (impl, pos, SHORTCUT_TYPE_FILE, NULL, impl->priv->current_folder, NULL, FALSE,
SHORTCUTS_CURRENT_FOLDER);
if (base_file)
g_object_unref (base_file);
@@ -2138,10 +2019,10 @@ shortcuts_update_current_folder (GtkFileChooserDefault *impl)
pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
- if (impl->shortcuts_current_folder_active)
+ if (impl->priv->shortcuts_current_folder_active)
{
shortcuts_remove_rows (impl, pos, 2);
- impl->shortcuts_current_folder_active = FALSE;
+ impl->priv->shortcuts_current_folder_active = FALSE;
}
shortcuts_add_current_folder (impl);
@@ -2171,38 +2052,24 @@ shortcuts_pane_filter_cb (GtkTreeModel *model,
/* Creates the list model for shortcuts */
static void
-shortcuts_model_create (GtkFileChooserDefault *impl)
+shortcuts_model_populate (GtkFileChooserDefault *impl)
{
- /* Keep this order in sync with the SHORCUTS_COL_* enum values */
- impl->shortcuts_model = gtk_list_store_new (SHORTCUTS_COL_NUM_COLUMNS,
- GDK_TYPE_PIXBUF, /* pixbuf */
- G_TYPE_STRING, /* name */
- G_TYPE_POINTER, /* path or volume */
- G_TYPE_INT, /* ShortcutType */
- G_TYPE_BOOLEAN, /* removable */
- G_TYPE_BOOLEAN, /* pixbuf cell visibility */
- G_TYPE_POINTER); /* GCancellable */
-
shortcuts_append_search (impl);
- if (impl->recent_manager)
+ if (impl->priv->recent_manager)
{
shortcuts_append_recent (impl);
shortcuts_insert_separator (impl, SHORTCUTS_RECENT_SEPARATOR);
}
- if (impl->file_system)
+ if (impl->priv->file_system)
{
shortcuts_append_home (impl);
shortcuts_append_desktop (impl);
shortcuts_add_volumes (impl);
}
- impl->shortcuts_pane_filter_model = shortcuts_pane_model_filter_new (impl,
- GTK_TREE_MODEL (impl->shortcuts_model),
- NULL);
-
- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (impl->shortcuts_pane_filter_model),
+ gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (impl->priv->shortcuts_pane_filter_model),
shortcuts_pane_filter_cb,
impl,
NULL);
@@ -2216,23 +2083,23 @@ new_folder_button_clicked (GtkButton *button,
GtkTreeIter iter;
GtkTreePath *path;
- if (!impl->browse_files_model)
+ if (!impl->priv->browse_files_model)
return; /* FIXME: this sucks. Disable the New Folder button or something. */
/* Prevent button from being clicked twice */
- gtk_widget_set_sensitive (impl->browse_new_folder_button, FALSE);
+ gtk_widget_set_sensitive (impl->priv->browse_new_folder_button, FALSE);
- _gtk_file_system_model_add_editable (impl->browse_files_model, &iter);
+ _gtk_file_system_model_add_editable (impl->priv->browse_files_model, &iter);
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->browse_files_model), &iter);
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->browse_files_tree_view),
- path, impl->list_name_column,
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->priv->browse_files_model), &iter);
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
+ path, impl->priv->list_name_column,
FALSE, 0.0, 0.0);
- g_object_set (impl->list_name_renderer, "editable", TRUE, NULL);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ g_object_set (impl->priv->list_name_renderer, "editable", TRUE, NULL);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
path,
- impl->list_name_column,
+ impl->priv->list_name_column,
TRUE);
gtk_tree_path_free (path);
@@ -2259,23 +2126,23 @@ edited_idle_cb (GtkFileChooserDefault *impl)
{
gdk_threads_enter ();
- g_source_destroy (impl->edited_idle);
- impl->edited_idle = NULL;
+ g_source_destroy (impl->priv->edited_idle);
+ impl->priv->edited_idle = NULL;
- _gtk_file_system_model_remove_editable (impl->browse_files_model);
- g_object_set (impl->list_name_renderer, "editable", FALSE, NULL);
+ _gtk_file_system_model_remove_editable (impl->priv->browse_files_model);
+ g_object_set (impl->priv->list_name_renderer, "editable", FALSE, NULL);
- gtk_widget_set_sensitive (impl->browse_new_folder_button, TRUE);
+ gtk_widget_set_sensitive (impl->priv->browse_new_folder_button, TRUE);
- if (impl->edited_new_text /* not cancelled? */
- && (strlen (impl->edited_new_text) != 0)
- && (strcmp (impl->edited_new_text, DEFAULT_NEW_FOLDER_NAME) != 0)) /* Don't create folder if name is
empty or has not been edited */
+ if (impl->priv->edited_new_text /* not cancelled? */
+ && (strlen (impl->priv->edited_new_text) != 0)
+ && (strcmp (impl->priv->edited_new_text, DEFAULT_NEW_FOLDER_NAME) != 0)) /* Don't create folder if
name is empty or has not been edited */
{
GError *error = NULL;
GFile *file;
- file = g_file_get_child_for_display_name (impl->current_folder,
- impl->edited_new_text,
+ file = g_file_get_child_for_display_name (impl->priv->current_folder,
+ impl->priv->edited_new_text,
&error);
if (file)
{
@@ -2291,8 +2158,8 @@ edited_idle_cb (GtkFileChooserDefault *impl)
else
error_creating_folder_dialog (impl, file, error);
- g_free (impl->edited_new_text);
- impl->edited_new_text = NULL;
+ g_free (impl->priv->edited_new_text);
+ impl->priv->edited_new_text = NULL;
}
gdk_threads_leave ();
@@ -2308,11 +2175,11 @@ queue_edited_idle (GtkFileChooserDefault *impl,
* just now.
*/
- if (!impl->edited_idle)
- impl->edited_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (edited_idle_cb));
+ if (!impl->priv->edited_idle)
+ impl->priv->edited_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (edited_idle_cb));
- g_free (impl->edited_new_text);
- impl->edited_new_text = g_strdup (new_text);
+ g_free (impl->priv->edited_new_text);
+ impl->priv->edited_new_text = g_strdup (new_text);
}
/* Callback used from the text cell renderer when the new folder is named */
@@ -2341,60 +2208,6 @@ renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
queue_edited_idle (impl, NULL);
}
-/* Creates the widgets for the filter combo box */
-static GtkWidget *
-filter_create (GtkFileChooserDefault *impl)
-{
- GtkCellRenderer *cell;
- GList *cells;
-
- impl->filter_combo = gtk_combo_box_text_new ();
- gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE);
-
- /* Get the combo's text renderer and set ellipsize parameters */
- cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (impl->filter_combo));
- g_assert (cells);
- cell = cells->data;
-
- g_object_set (G_OBJECT (cell),
- "ellipsize", PANGO_ELLIPSIZE_END,
- NULL);
-
- g_list_free (cells);
-
- g_signal_connect (impl->filter_combo, "changed",
- G_CALLBACK (filter_combo_changed), impl);
-
- gtk_widget_set_tooltip_text (impl->filter_combo,
- _("Select which types of files are shown"));
-
- return impl->filter_combo;
-}
-
-static GtkWidget *
-toolbutton_new (GtkFileChooserDefault *impl,
- GIcon *icon,
- gboolean sensitive,
- gboolean show,
- GCallback callback)
-{
- GtkToolItem *item;
- GtkWidget *image;
-
- item = gtk_tool_button_new (NULL, NULL);
- image = gtk_image_new_from_gicon (icon, GTK_ICON_SIZE_SMALL_TOOLBAR);
- gtk_widget_show (image);
- gtk_tool_button_set_icon_widget (GTK_TOOL_BUTTON (item), image);
-
- gtk_widget_set_sensitive (GTK_WIDGET (item), sensitive);
- g_signal_connect (item, "clicked", callback, impl);
-
- if (show)
- gtk_widget_show (GTK_WIDGET (item));
-
- return GTK_WIDGET (item);
-}
-
/* Looks for a path among the shortcuts; returns its index or -1 if it doesn't exist */
static int
shortcut_find_position (GtkFileChooserDefault *impl,
@@ -2404,14 +2217,14 @@ shortcut_find_position (GtkFileChooserDefault *impl,
int i;
int current_folder_separator_idx;
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
+ if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter))
return -1;
current_folder_separator_idx = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
#if 0
/* FIXME: is this still needed? */
- if (current_folder_separator_idx >= impl->shortcuts_model->length)
+ if (current_folder_separator_idx >= impl->priv->shortcuts_model->length)
return -1;
#endif
@@ -2420,7 +2233,7 @@ shortcut_find_position (GtkFileChooserDefault *impl,
gpointer col_data;
ShortcutType shortcut_type;
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_DATA, &col_data,
SHORTCUTS_COL_TYPE, &shortcut_type,
-1);
@@ -2457,7 +2270,7 @@ shortcut_find_position (GtkFileChooserDefault *impl,
if (i < current_folder_separator_idx - 1)
{
- if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
+ if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter))
g_assert_not_reached ();
}
}
@@ -2479,7 +2292,7 @@ shortcuts_add_bookmark_from_file (GtkFileChooserDefault *impl,
return FALSE;
error = NULL;
- if (!_gtk_file_system_insert_bookmark (impl->file_system, file, pos, &error))
+ if (!_gtk_file_system_insert_bookmark (impl->priv->file_system, file, pos, &error))
{
error_adding_bookmark_dialog (impl, file, error);
return FALSE;
@@ -2514,10 +2327,10 @@ bookmarks_add_selected_folder (GtkFileChooserDefault *impl)
{
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
if (gtk_tree_selection_count_selected_rows (selection) == 0)
- shortcuts_add_bookmark_from_file (impl, impl->current_folder, -1);
+ shortcuts_add_bookmark_from_file (impl, impl->priv->current_folder, -1);
else
gtk_tree_selection_selected_foreach (selection,
add_bookmark_foreach_cb,
@@ -2542,15 +2355,15 @@ shortcuts_get_selected (GtkFileChooserDefault *impl,
GtkTreeSelection *selection;
GtkTreeIter parent_iter;
- if (!impl->browse_shortcuts_tree_view)
+ if (!impl->priv->browse_shortcuts_tree_view)
return FALSE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view));
if (!gtk_tree_selection_get_selected (selection, NULL, &parent_iter))
return FALSE;
- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER
(impl->shortcuts_pane_filter_model),
+ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER
(impl->priv->shortcuts_pane_filter_model),
iter,
&parent_iter);
return TRUE;
@@ -2569,7 +2382,7 @@ remove_selected_bookmarks (GtkFileChooserDefault *impl)
if (!shortcuts_get_selected (impl, &iter))
return;
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_DATA, &col_data,
SHORTCUTS_COL_REMOVABLE, &removable,
-1);
@@ -2582,7 +2395,7 @@ remove_selected_bookmarks (GtkFileChooserDefault *impl)
file = col_data;
error = NULL;
- if (!_gtk_file_system_remove_bookmark (impl->file_system, file, &error))
+ if (!_gtk_file_system_remove_bookmark (impl->priv->file_system, file, &error))
error_removing_bookmark_dialog (impl, file, error);
}
@@ -2644,7 +2457,7 @@ selection_check (GtkFileChooserDefault *impl,
closure.all_files = TRUE;
closure.all_folders = TRUE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection,
selection_check_foreach_cb,
&closure);
@@ -2696,7 +2509,7 @@ get_selected_file (GtkFileChooserDefault *impl)
closure.impl = impl;
closure.file = NULL;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection,
get_selected_file_foreach_cb,
&closure);
@@ -2747,7 +2560,7 @@ bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl)
selection_check (impl, &num_selected, NULL, &all_folders);
if (num_selected == 0)
- active = (impl->current_folder != NULL) && (shortcut_find_position (impl, impl->current_folder) == -1);
+ active = (impl->priv->current_folder != NULL) && (shortcut_find_position (impl,
impl->priv->current_folder) == -1);
else if (num_selected == 1)
{
GFile *file;
@@ -2760,10 +2573,10 @@ bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl)
else
active = all_folders;
- gtk_widget_set_sensitive (impl->browse_shortcuts_add_button, active);
+ gtk_widget_set_sensitive (impl->priv->browse_shortcuts_add_button, active);
- if (impl->browse_files_popup_menu_add_shortcut_item)
- gtk_widget_set_sensitive (impl->browse_files_popup_menu_add_shortcut_item,
+ if (impl->priv->browse_files_popup_menu_add_shortcut_item)
+ gtk_widget_set_sensitive (impl->priv->browse_files_popup_menu_add_shortcut_item,
(num_selected == 0) ? FALSE : active);
if (active)
@@ -2777,14 +2590,14 @@ bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl)
GtkTreeSelection *selection;
UpdateTooltipData data;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
data.impl = impl;
data.tip = NULL;
gtk_tree_selection_selected_foreach (selection, update_tooltip, &data);
tip = data.tip;
}
- gtk_widget_set_tooltip_text (impl->browse_shortcuts_add_button, tip);
+ gtk_widget_set_tooltip_text (impl->priv->browse_shortcuts_add_button, tip);
g_free (tip);
}
}
@@ -2802,22 +2615,22 @@ bookmarks_check_remove_sensitivity (GtkFileChooserDefault *impl)
if (shortcuts_get_selected (impl, &iter))
{
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_REMOVABLE, &removable,
SHORTCUTS_COL_NAME, &name,
-1);
- gtk_widget_set_sensitive (impl->browse_shortcuts_remove_button, removable);
+ gtk_widget_set_sensitive (impl->priv->browse_shortcuts_remove_button, removable);
if (removable)
tip = g_strdup_printf (_("Remove the bookmark '%s'"), name);
else
tip = g_strdup_printf (_("Bookmark '%s' cannot be removed"), name);
- gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button, tip);
+ gtk_widget_set_tooltip_text (impl->priv->browse_shortcuts_remove_button, tip);
g_free (tip);
}
else
- gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button,
+ gtk_widget_set_tooltip_text (impl->priv->browse_shortcuts_remove_button,
_("Remove the selected bookmark"));
g_free (name);
}
@@ -2828,16 +2641,16 @@ shortcuts_check_popup_sensitivity (GtkFileChooserDefault *impl)
GtkTreeIter iter;
gboolean removable = FALSE;
- if (impl->browse_shortcuts_popup_menu == NULL)
+ if (impl->priv->browse_shortcuts_popup_menu == NULL)
return;
if (shortcuts_get_selected (impl, &iter))
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_REMOVABLE, &removable,
-1);
- gtk_widget_set_sensitive (impl->browse_shortcuts_popup_menu_remove_item, removable);
- gtk_widget_set_sensitive (impl->browse_shortcuts_popup_menu_rename_item, removable);
+ gtk_widget_set_sensitive (impl->priv->browse_shortcuts_popup_menu_remove_item, removable);
+ gtk_widget_set_sensitive (impl->priv->browse_shortcuts_popup_menu_rename_item, removable);
}
/* GtkWidget::drag-begin handler for the shortcuts list. */
@@ -2847,7 +2660,7 @@ shortcuts_drag_begin_cb (GtkWidget *widget,
GtkFileChooserDefault *impl)
{
#if 0
- impl->shortcuts_drag_context = g_object_ref (context);
+ impl->priv->shortcuts_drag_context = g_object_ref (context);
#endif
}
@@ -2856,11 +2669,11 @@ shortcuts_drag_begin_cb (GtkWidget *widget,
static void
shortcuts_cancel_drag_outside_idle (GtkFileChooserDefault *impl)
{
- if (!impl->shortcuts_drag_outside_idle)
+ if (!impl->priv->shortcuts_drag_outside_idle)
return;
- g_source_destroy (impl->shortcuts_drag_outside_idle);
- impl->shortcuts_drag_outside_idle = NULL;
+ g_source_destroy (impl->priv->shortcuts_drag_outside_idle);
+ impl->priv->shortcuts_drag_outside_idle = NULL;
}
#endif
@@ -2871,16 +2684,16 @@ shortcuts_drag_end_cb (GtkWidget *widget,
GtkFileChooserDefault *impl)
{
#if 0
- g_object_unref (impl->shortcuts_drag_context);
+ g_object_unref (impl->priv->shortcuts_drag_context);
shortcuts_cancel_drag_outside_idle (impl);
- if (!impl->shortcuts_drag_outside)
+ if (!impl->priv->shortcuts_drag_outside)
return;
- gtk_button_clicked (GTK_BUTTON (impl->browse_shortcuts_remove_button));
+ gtk_button_clicked (GTK_BUTTON (impl->priv->browse_shortcuts_remove_button));
- impl->shortcuts_drag_outside = FALSE;
+ impl->priv->shortcuts_drag_outside = FALSE;
#endif
}
@@ -2903,13 +2716,13 @@ shortcuts_drag_leave_cb (GtkWidget *widget,
GtkFileChooserDefault *impl)
{
#if 0
- if (gtk_drag_get_source_widget (context) == widget && !impl->shortcuts_drag_outside_idle)
+ if (gtk_drag_get_source_widget (context) == widget && !impl->priv->shortcuts_drag_outside_idle)
{
- impl->shortcuts_drag_outside_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK
(shortcuts_drag_outside_idle_cb));
+ impl->priv->shortcuts_drag_outside_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK
(shortcuts_drag_outside_idle_cb));
}
#endif
- gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
+ gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view),
NULL,
GTK_TREE_VIEW_DROP_BEFORE);
@@ -2932,7 +2745,7 @@ shortcuts_compute_drop_position (GtkFileChooserDefault *impl,
int bookmarks_index;
int header_height = 0;
- tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view);
+ tree_view = GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view);
if (gtk_tree_view_get_headers_visible (tree_view))
header_height = _gtk_tree_view_get_header_height (tree_view);
@@ -2947,7 +2760,7 @@ shortcuts_compute_drop_position (GtkFileChooserDefault *impl,
NULL,
&cell_y))
{
- row = bookmarks_index + impl->num_bookmarks - 1;
+ row = bookmarks_index + impl->priv->num_bookmarks - 1;
*path = gtk_tree_path_new_from_indices (row, -1);
*pos = GTK_TREE_VIEW_DROP_AFTER;
return;
@@ -2962,9 +2775,9 @@ shortcuts_compute_drop_position (GtkFileChooserDefault *impl,
row = bookmarks_index;
*pos = GTK_TREE_VIEW_DROP_BEFORE;
}
- else if (row > bookmarks_index + impl->num_bookmarks - 1)
+ else if (row > bookmarks_index + impl->priv->num_bookmarks - 1)
{
- row = bookmarks_index + impl->num_bookmarks - 1;
+ row = bookmarks_index + impl->priv->num_bookmarks - 1;
*pos = GTK_TREE_VIEW_DROP_AFTER;
}
else
@@ -2999,10 +2812,10 @@ shortcuts_drag_motion_cb (GtkWidget *widget,
{
shortcuts_cancel_drag_outside_idle (impl);
- if (impl->shortcuts_drag_outside)
+ if (impl->priv->shortcuts_drag_outside)
{
shortcuts_drag_set_delete_cursor (impl, FALSE);
- impl->shortcuts_drag_outside = FALSE;
+ impl->priv->shortcuts_drag_outside = FALSE;
}
}
#endif
@@ -3020,7 +2833,7 @@ shortcuts_drag_motion_cb (GtkWidget *widget,
}
shortcuts_compute_drop_position (impl, x, y, &path, &pos);
- gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), path, pos);
+ gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view), path, pos);
gtk_tree_path_free (path);
out:
@@ -3103,15 +2916,15 @@ shortcuts_reorder (GtkFileChooserDefault *impl,
if (!shortcuts_get_selected (impl, &iter))
g_assert_not_reached ();
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter);
old_position = *gtk_tree_path_get_indices (path);
gtk_tree_path_free (path);
bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS);
old_position -= bookmarks_index;
- g_assert (old_position >= 0 && old_position < impl->num_bookmarks);
+ g_assert (old_position >= 0 && old_position < impl->priv->num_bookmarks);
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_NAME, &name,
SHORTCUTS_COL_DATA, &col_data,
SHORTCUTS_COL_TYPE, &shortcut_type,
@@ -3131,10 +2944,10 @@ shortcuts_reorder (GtkFileChooserDefault *impl,
goto out;
error = NULL;
- if (_gtk_file_system_remove_bookmark (impl->file_system, file, &error))
+ if (_gtk_file_system_remove_bookmark (impl->priv->file_system, file, &error))
{
shortcuts_add_bookmark_from_file (impl, file, new_position);
- _gtk_file_system_set_bookmark_label (impl->file_system, file, name);
+ _gtk_file_system_set_bookmark_label (impl->priv->file_system, file, name);
}
else
error_adding_bookmark_dialog (impl, file, error);
@@ -3261,12 +3074,12 @@ shortcuts_selection_changed_cb (GtkTreeSelection *selection,
bookmarks_check_remove_sensitivity (impl);
shortcuts_check_popup_sensitivity (impl);
- if (impl->changing_folder)
+ if (impl->priv->changing_folder)
return;
if (gtk_tree_selection_get_selected(selection, NULL, &iter))
{
- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER
(impl->shortcuts_pane_filter_model),
+ gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER
(impl->priv->shortcuts_pane_filter_model),
&child_iter,
&iter);
shortcuts_activate_iter (impl, &child_iter);
@@ -3292,6 +3105,21 @@ shortcuts_key_press_event_after_cb (GtkWidget *tree_view,
{
GtkWidget *entry;
+ /* Connect "after" to key-press-event on the shortcuts pane. We want this action to be possible:
+ *
+ * 1. user brings up a SAVE dialog
+ * 2. user clicks on a shortcut in the shortcuts pane
+ * 3. user starts typing a filename
+ *
+ * Normally, the user's typing would be ignored, as the shortcuts treeview doesn't
+ * support interactive search. However, we'd rather focus the location entry
+ * so that the user can type *there*.
+ *
+ * To preserve keyboard navigation in the shortcuts pane, we don't focus the
+ * filename entry if one clicks on a shortcut; rather, we focus the entry only
+ * if the user starts typing while the focus is in the shortcuts pane.
+ */
+
/* don't screw up focus switching with Tab */
if (event->keyval == GDK_KEY_Tab
|| event->keyval == GDK_KEY_KP_Tab
@@ -3299,10 +3127,10 @@ shortcuts_key_press_event_after_cb (GtkWidget *tree_view,
|| event->length < 1)
return FALSE;
- if (impl->location_entry)
- entry = impl->location_entry;
- else if (impl->search_entry)
- entry = impl->search_entry;
+ if (impl->priv->location_entry)
+ entry = impl->priv->location_entry;
+ else if (impl->priv->search_entry)
+ entry = impl->priv->search_entry;
else
entry = NULL;
@@ -3325,9 +3153,9 @@ shortcuts_popup_menu_detach_cb (GtkWidget *attach_widget,
impl = g_object_get_data (G_OBJECT (attach_widget), "GtkFileChooserDefault");
g_assert (GTK_IS_FILE_CHOOSER_DEFAULT (impl));
- impl->browse_shortcuts_popup_menu = NULL;
- impl->browse_shortcuts_popup_menu_remove_item = NULL;
- impl->browse_shortcuts_popup_menu_rename_item = NULL;
+ impl->priv->browse_shortcuts_popup_menu = NULL;
+ impl->priv->browse_shortcuts_popup_menu_remove_item = NULL;
+ impl->priv->browse_shortcuts_popup_menu_rename_item = NULL;
}
static void
@@ -3349,13 +3177,13 @@ rename_selected_bookmark (GtkFileChooserDefault *impl)
if (shortcuts_get_selected (impl, &iter))
{
- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), 0);
+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view), 0);
renderers = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
cell = g_list_nth_data (renderers, 1);
g_list_free (renderers);
g_object_set (cell, "editable", TRUE, NULL);
- gtk_tree_view_set_cursor_on_cell (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
+ gtk_tree_view_set_cursor_on_cell (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view),
path, column, cell, TRUE);
gtk_tree_path_free (path);
}
@@ -3374,29 +3202,29 @@ shortcuts_build_popup_menu (GtkFileChooserDefault *impl)
{
GtkWidget *item;
- if (impl->browse_shortcuts_popup_menu)
+ if (impl->priv->browse_shortcuts_popup_menu)
return;
- impl->browse_shortcuts_popup_menu = gtk_menu_new ();
- gtk_menu_attach_to_widget (GTK_MENU (impl->browse_shortcuts_popup_menu),
- impl->browse_shortcuts_tree_view,
+ impl->priv->browse_shortcuts_popup_menu = gtk_menu_new ();
+ gtk_menu_attach_to_widget (GTK_MENU (impl->priv->browse_shortcuts_popup_menu),
+ impl->priv->browse_shortcuts_tree_view,
shortcuts_popup_menu_detach_cb);
item = gtk_image_menu_item_new_with_label (_("Remove"));
- impl->browse_shortcuts_popup_menu_remove_item = item;
+ impl->priv->browse_shortcuts_popup_menu_remove_item = item;
gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
gtk_image_new_from_stock (GTK_STOCK_REMOVE, GTK_ICON_SIZE_MENU));
g_signal_connect (item, "activate",
G_CALLBACK (remove_shortcut_cb), impl);
gtk_widget_show (item);
- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_shortcuts_popup_menu), item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (impl->priv->browse_shortcuts_popup_menu), item);
item = gtk_menu_item_new_with_label (_("Rename…"));
- impl->browse_shortcuts_popup_menu_rename_item = item;
+ impl->priv->browse_shortcuts_popup_menu_rename_item = item;
g_signal_connect (item, "activate",
G_CALLBACK (rename_shortcut_cb), impl);
gtk_widget_show (item);
- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_shortcuts_popup_menu), item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (impl->priv->browse_shortcuts_popup_menu), item);
}
static void
@@ -3419,16 +3247,16 @@ shortcuts_popup_menu (GtkFileChooserDefault *impl,
{
shortcuts_update_popup_menu (impl);
if (event)
- gtk_menu_popup (GTK_MENU (impl->browse_shortcuts_popup_menu),
+ gtk_menu_popup (GTK_MENU (impl->priv->browse_shortcuts_popup_menu),
NULL, NULL, NULL, NULL,
event->button, event->time);
else
{
- gtk_menu_popup (GTK_MENU (impl->browse_shortcuts_popup_menu),
+ gtk_menu_popup (GTK_MENU (impl->priv->browse_shortcuts_popup_menu),
NULL, NULL,
- popup_position_func, impl->browse_shortcuts_tree_view,
+ popup_position_func, impl->priv->browse_shortcuts_tree_view,
0, GDK_CURRENT_TIME);
- gtk_menu_shell_select_first (GTK_MENU_SHELL (impl->browse_shortcuts_popup_menu),
+ gtk_menu_shell_select_first (GTK_MENU_SHELL (impl->priv->browse_shortcuts_popup_menu),
FALSE);
}
}
@@ -3460,7 +3288,7 @@ shortcuts_button_press_event_cb (GtkWidget *widget,
return FALSE;
in_press = TRUE;
- handled = gtk_widget_event (impl->browse_shortcuts_tree_view, (GdkEvent *) event);
+ handled = gtk_widget_event (impl->priv->browse_shortcuts_tree_view, (GdkEvent *) event);
in_press = FALSE;
if (!handled)
@@ -3483,15 +3311,15 @@ shortcuts_edited (GtkCellRenderer *cell,
g_object_set (cell, "editable", FALSE, NULL);
path = gtk_tree_path_new_from_string (path_string);
- if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path))
+ if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter, path))
g_assert_not_reached ();
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_DATA, &shortcut,
-1);
gtk_tree_path_free (path);
- _gtk_file_system_set_bookmark_label (impl->file_system, shortcut, new_text);
+ _gtk_file_system_set_bookmark_label (impl->priv->file_system, shortcut, new_text);
}
static void
@@ -3501,261 +3329,53 @@ shortcuts_editing_canceled (GtkCellRenderer *cell,
g_object_set (cell, "editable", FALSE, NULL);
}
-/* Creates the widgets for the shortcuts and bookmarks tree */
-static GtkWidget *
-shortcuts_list_create (GtkFileChooserDefault *impl)
+static gboolean
+key_is_left_or_right (GdkEventKey *event)
{
- GtkWidget *swin;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
+ guint modifiers;
- /* Target types for dragging a row to/from the shortcuts list */
- const GtkTargetEntry tree_model_row_targets[] = {
- { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, GTK_TREE_MODEL_ROW }
- };
+ modifiers = gtk_accelerator_get_default_mod_mask ();
- /* Scrolled window */
+ return ((event->keyval == GDK_KEY_Right
+ || event->keyval == GDK_KEY_KP_Right
+ || event->keyval == GDK_KEY_Left
+ || event->keyval == GDK_KEY_KP_Left)
+ && (event->state & modifiers) == 0);
+}
- swin = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
- GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin),
- GTK_SHADOW_IN);
- gtk_widget_show (swin);
+/* Handles key press events on the file list, so that we can trap Enter to
+ * activate the default button on our own. Also, checks to see if '/' has been
+ * pressed.
+ */
+static gboolean
+browse_files_key_press_event_cb (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer data)
+{
+ GtkFileChooserDefault *impl;
+ GdkModifierType no_text_input_mask;
- /* Tree */
- impl->browse_shortcuts_tree_view = gtk_tree_view_new ();
- gtk_style_context_add_class (gtk_widget_get_style_context (impl->browse_shortcuts_tree_view),
- GTK_STYLE_CLASS_SIDEBAR);
- gtk_tree_view_set_enable_search (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), FALSE);
-#ifdef PROFILE_FILE_CHOOSER
- g_object_set_data (G_OBJECT (impl->browse_shortcuts_tree_view), "fmq-name", "shortcuts");
-#endif
+ impl = (GtkFileChooserDefault *) data;
- /* Connect "after" to key-press-event on the shortcuts pane. We want this action to be possible:
- *
- * 1. user brings up a SAVE dialog
- * 2. user clicks on a shortcut in the shortcuts pane
- * 3. user starts typing a filename
- *
- * Normally, the user's typing would be ignored, as the shortcuts treeview doesn't
- * support interactive search. However, we'd rather focus the location entry
- * so that the user can type *there*.
- *
- * To preserve keyboard navigation in the shortcuts pane, we don't focus the
- * filename entry if one clicks on a shortcut; rather, we focus the entry only
- * if the user starts typing while the focus is in the shortcuts pane.
- */
- g_signal_connect_after (impl->browse_shortcuts_tree_view, "key-press-event",
- G_CALLBACK (shortcuts_key_press_event_after_cb), impl);
+ no_text_input_mask =
+ gtk_widget_get_modifier_mask (widget, GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
- g_signal_connect (impl->browse_shortcuts_tree_view, "popup-menu",
- G_CALLBACK (shortcuts_popup_menu_cb), impl);
- g_signal_connect (impl->browse_shortcuts_tree_view, "button-press-event",
- G_CALLBACK (shortcuts_button_press_event_cb), impl);
- /* Accessible object name for the file chooser's shortcuts pane */
- atk_object_set_name (gtk_widget_get_accessible (impl->browse_shortcuts_tree_view), _("Places"));
+ if ((event->keyval == GDK_KEY_slash
+ || event->keyval == GDK_KEY_KP_Divide
+#ifdef G_OS_UNIX
+ || event->keyval == GDK_KEY_asciitilde
+#endif
+ ) && !(event->state & no_text_input_mask))
+ {
+ location_popup_handler (impl, event->string);
+ return TRUE;
+ }
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
impl->shortcuts_pane_filter_model);
-
- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
- GDK_BUTTON1_MASK,
- tree_model_row_targets,
- G_N_ELEMENTS (tree_model_row_targets),
- GDK_ACTION_MOVE);
-
- gtk_drag_dest_set (impl->browse_shortcuts_tree_view,
- GTK_DEST_DEFAULT_ALL,
- tree_model_row_targets,
- G_N_ELEMENTS (tree_model_row_targets),
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
- gtk_drag_dest_add_uri_targets (impl->browse_shortcuts_tree_view);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE);
- gtk_tree_selection_set_select_function (selection,
- shortcuts_select_func,
- impl, NULL);
-
- g_signal_connect (selection, "changed",
- G_CALLBACK (shortcuts_selection_changed_cb), impl);
-
- g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event",
- G_CALLBACK (shortcuts_key_press_event_cb), impl);
-
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-begin",
- G_CALLBACK (shortcuts_drag_begin_cb), impl);
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-end",
- G_CALLBACK (shortcuts_drag_end_cb), impl);
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-delete",
- G_CALLBACK (shortcuts_drag_data_delete_cb), impl);
-
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-leave",
- G_CALLBACK (shortcuts_drag_leave_cb), impl);
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-motion",
- G_CALLBACK (shortcuts_drag_motion_cb), impl);
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-drop",
- G_CALLBACK (shortcuts_drag_drop_cb), impl);
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-received",
- G_CALLBACK (shortcuts_drag_data_received_cb), impl);
-
- /* Support tooltips */
- gtk_widget_set_has_tooltip (impl->browse_shortcuts_tree_view, TRUE);
- g_signal_connect (impl->browse_shortcuts_tree_view, "query-tooltip",
- G_CALLBACK (shortcuts_query_tooltip_cb), impl);
-
- gtk_container_add (GTK_CONTAINER (swin), impl->browse_shortcuts_tree_view);
- gtk_widget_show (impl->browse_shortcuts_tree_view);
-
- /* Column */
-
- column = gtk_tree_view_column_new ();
- /* Column header for the file chooser's shortcuts pane */
- gtk_tree_view_column_set_title (column, _("_Places"));
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_column_set_attributes (column, renderer,
- "pixbuf", SHORTCUTS_COL_PIXBUF,
- "visible", SHORTCUTS_COL_PIXBUF_VISIBLE,
- NULL);
-
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "width-chars", 12,
- "ellipsize", PANGO_ELLIPSIZE_END,
- NULL);
- g_signal_connect (renderer, "edited",
- G_CALLBACK (shortcuts_edited), impl);
- g_signal_connect (renderer, "editing-canceled",
- G_CALLBACK (shortcuts_editing_canceled), impl);
- gtk_tree_view_column_pack_start (column, renderer, TRUE);
- gtk_tree_view_column_set_attributes (column, renderer,
- "text", SHORTCUTS_COL_NAME,
- NULL);
-
- gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
- shortcuts_row_separator_func,
- NULL, NULL);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), column);
-
- return swin;
-}
-
-/* Creates the widgets for the shortcuts/bookmarks pane */
-static GtkWidget *
-shortcuts_pane_create (GtkFileChooserDefault *impl,
- GtkSizeGroup *size_group)
-{
- GtkWidget *vbox;
- GtkWidget *toolbar;
- GtkWidget *widget;
- GtkStyleContext *context;
- GIcon *icon;
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0);
- gtk_widget_show (vbox);
-
- /* Shortcuts tree */
-
- widget = shortcuts_list_create (impl);
-
- gtk_size_group_add_widget (size_group, widget);
- context = gtk_widget_get_style_context (widget);
- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
-
- gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
-
- /* Box for buttons */
-
- toolbar = gtk_toolbar_new ();
- gtk_toolbar_set_style (GTK_TOOLBAR (toolbar), GTK_TOOLBAR_ICONS);
- gtk_toolbar_set_icon_size (GTK_TOOLBAR (toolbar), GTK_ICON_SIZE_MENU);
-
- context = gtk_widget_get_style_context (toolbar);
- gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
- gtk_style_context_add_class (context, GTK_STYLE_CLASS_INLINE_TOOLBAR);
-
- gtk_box_pack_start (GTK_BOX (vbox), toolbar, FALSE, FALSE, 0);
- gtk_widget_show (toolbar);
-
- /* Add bookmark button */
- icon = g_themed_icon_new_with_default_fallbacks ("list-add-symbolic");
- impl->browse_shortcuts_add_button = toolbutton_new (impl,
- icon,
- FALSE,
- TRUE,
- G_CALLBACK (add_bookmark_button_clicked_cb));
- g_object_unref (icon);
-
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (impl->browse_shortcuts_add_button), 0);
- gtk_widget_set_tooltip_text (impl->browse_shortcuts_add_button,
- _("Add the selected folder to the Bookmarks"));
-
- /* Remove bookmark button */
- icon = g_themed_icon_new_with_default_fallbacks ("list-remove-symbolic");
- impl->browse_shortcuts_remove_button = toolbutton_new (impl,
- icon,
- FALSE,
- TRUE,
- G_CALLBACK (remove_bookmark_button_clicked_cb));
- g_object_unref (icon);
- gtk_toolbar_insert (GTK_TOOLBAR (toolbar), GTK_TOOL_ITEM (impl->browse_shortcuts_remove_button), 1);
- gtk_widget_set_tooltip_text (impl->browse_shortcuts_remove_button,
- _("Remove the selected bookmark"));
-
- return vbox;
-}
-
-static gboolean
-key_is_left_or_right (GdkEventKey *event)
-{
- guint modifiers;
-
- modifiers = gtk_accelerator_get_default_mod_mask ();
-
- return ((event->keyval == GDK_KEY_Right
- || event->keyval == GDK_KEY_KP_Right
- || event->keyval == GDK_KEY_Left
- || event->keyval == GDK_KEY_KP_Left)
- && (event->state & modifiers) == 0);
-}
-
-/* Handles key press events on the file list, so that we can trap Enter to
- * activate the default button on our own. Also, checks to see if '/' has been
- * pressed.
- */
-static gboolean
-browse_files_key_press_event_cb (GtkWidget *widget,
- GdkEventKey *event,
- gpointer data)
-{
- GtkFileChooserDefault *impl;
- GdkModifierType no_text_input_mask;
-
- impl = (GtkFileChooserDefault *) data;
-
- no_text_input_mask =
- gtk_widget_get_modifier_mask (widget, GDK_MODIFIER_INTENT_NO_TEXT_INPUT);
-
- if ((event->keyval == GDK_KEY_slash
- || event->keyval == GDK_KEY_KP_Divide
-#ifdef G_OS_UNIX
- || event->keyval == GDK_KEY_asciitilde
-#endif
- ) && !(event->state & no_text_input_mask))
- {
- location_popup_handler (impl, event->string);
- return TRUE;
- }
-
- if (key_is_left_or_right (event))
- {
- gtk_widget_grab_focus (impl->browse_shortcuts_tree_view);
- return TRUE;
- }
+ if (key_is_left_or_right (event))
+ {
+ gtk_widget_grab_focus (impl->priv->browse_shortcuts_tree_view);
+ return TRUE;
+ }
if ((event->keyval == GDK_KEY_Return
|| event->keyval == GDK_KEY_ISO_Enter
@@ -3763,8 +3383,8 @@ browse_files_key_press_event_cb (GtkWidget *widget,
|| event->keyval == GDK_KEY_space
|| event->keyval == GDK_KEY_KP_Space)
&& !(event->state & gtk_accelerator_get_default_mod_mask ())
- && !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
+ && !(impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
{
GtkWindow *window;
@@ -3799,10 +3419,10 @@ popup_menu_detach_cb (GtkWidget *attach_widget,
impl = g_object_get_data (G_OBJECT (attach_widget), "GtkFileChooserDefault");
g_assert (GTK_IS_FILE_CHOOSER_DEFAULT (impl));
- impl->browse_files_popup_menu = NULL;
- impl->browse_files_popup_menu_add_shortcut_item = NULL;
- impl->browse_files_popup_menu_hidden_files_item = NULL;
- impl->browse_files_popup_menu_copy_file_location_item = NULL;
+ impl->priv->browse_files_popup_menu = NULL;
+ impl->priv->browse_files_popup_menu_add_shortcut_item = NULL;
+ impl->priv->browse_files_popup_menu_hidden_files_item = NULL;
+ impl->priv->browse_files_popup_menu_copy_file_location_item = NULL;
}
/* Callback used when the "Add to Bookmarks" menu item is activated */
@@ -3940,10 +3560,10 @@ static void
show_size_column_toggled_cb (GtkCheckMenuItem *item,
GtkFileChooserDefault *impl)
{
- impl->show_size_column = gtk_check_menu_item_get_active (item);
+ impl->priv->show_size_column = gtk_check_menu_item_get_active (item);
- gtk_tree_view_column_set_visible (impl->list_size_column,
- impl->show_size_column);
+ gtk_tree_view_column_set_visible (impl->priv->list_size_column,
+ impl->priv->show_size_column);
}
/* Shows an error dialog about not being able to select a dragged file */
@@ -3998,16 +3618,16 @@ file_list_drag_data_received_get_info_cb (GCancellable *cancellable,
struct FileListDragData *data = user_data;
GtkFileChooser *chooser = GTK_FILE_CHOOSER (data->impl);
- if (cancellable != data->impl->file_list_drag_data_received_cancellable)
+ if (cancellable != data->impl->priv->file_list_drag_data_received_cancellable)
goto out;
- data->impl->file_list_drag_data_received_cancellable = NULL;
+ data->impl->priv->file_list_drag_data_received_cancellable = NULL;
if (cancelled || error)
goto out;
- if ((data->impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- data->impl->action == GTK_FILE_CHOOSER_ACTION_SAVE) &&
+ if ((data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE) &&
data->uris[1] == 0 && !error && _gtk_file_info_consider_as_directory (info))
change_folder_and_display_error (data->impl, data->file, FALSE);
else
@@ -4022,7 +3642,7 @@ file_list_drag_data_received_get_info_cb (GCancellable *cancellable,
browse_files_center_selected_row (data->impl);
}
- if (data->impl->select_multiple)
+ if (data->impl->priv->select_multiple)
file_list_drag_data_select_uris (data->impl, data->uris);
out:
@@ -4072,11 +3692,11 @@ file_list_drag_data_received_cb (GtkWidget *widget,
data->uris = uris;
data->file = file;
- if (impl->file_list_drag_data_received_cancellable)
- g_cancellable_cancel (impl->file_list_drag_data_received_cancellable);
+ if (impl->priv->file_list_drag_data_received_cancellable)
+ g_cancellable_cancel (impl->priv->file_list_drag_data_received_cancellable);
- impl->file_list_drag_data_received_cancellable =
- _gtk_file_system_get_info (impl->file_system, file,
+ impl->priv->file_list_drag_data_received_cancellable =
+ _gtk_file_system_get_info (impl->priv->file_system, file,
"standard::type",
file_list_drag_data_received_get_info_cb,
data);
@@ -4121,14 +3741,14 @@ check_copy_file_location_sensitivity (GtkFileChooserDefault *impl)
GtkTreeSelection *selection;
gboolean active;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
if (gtk_tree_selection_count_selected_rows (selection) == 0)
active = FALSE;
else
active = TRUE;
- if (impl->browse_files_popup_menu_copy_file_location_item)
- gtk_widget_set_sensitive (impl->browse_files_popup_menu_copy_file_location_item, active);
+ if (impl->priv->browse_files_popup_menu_copy_file_location_item)
+ gtk_widget_set_sensitive (impl->priv->browse_files_popup_menu_copy_file_location_item, active);
}
static GtkWidget *
@@ -4144,7 +3764,7 @@ file_list_add_image_menu_item (GtkFileChooserDefault *impl,
gtk_image_new_from_stock (stock_name, GTK_ICON_SIZE_MENU));
g_signal_connect (item, "activate", callback, impl);
gtk_widget_show (item);
- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (impl->priv->browse_files_popup_menu), item);
return item;
}
@@ -4159,7 +3779,7 @@ file_list_add_check_menu_item (GtkFileChooserDefault *impl,
item = gtk_check_menu_item_new_with_mnemonic (mnemonic_label);
g_signal_connect (item, "toggled", callback, impl);
gtk_widget_show (item);
- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (impl->priv->browse_files_popup_menu), item);
return item;
}
@@ -4170,31 +3790,31 @@ file_list_build_popup_menu (GtkFileChooserDefault *impl)
{
GtkWidget *item;
- if (impl->browse_files_popup_menu)
+ if (impl->priv->browse_files_popup_menu)
return;
- impl->browse_files_popup_menu = gtk_menu_new ();
- gtk_menu_attach_to_widget (GTK_MENU (impl->browse_files_popup_menu),
- impl->browse_files_tree_view,
+ impl->priv->browse_files_popup_menu = gtk_menu_new ();
+ gtk_menu_attach_to_widget (GTK_MENU (impl->priv->browse_files_popup_menu),
+ impl->priv->browse_files_tree_view,
popup_menu_detach_cb);
- impl->browse_files_popup_menu_visit_file_item = file_list_add_image_menu_item (impl,
GTK_STOCK_DIRECTORY, _("_Visit this file"),
+ impl->priv->browse_files_popup_menu_visit_file_item = file_list_add_image_menu_item (impl,
GTK_STOCK_DIRECTORY, _("_Visit this file"),
G_CALLBACK
(visit_file_cb));
- impl->browse_files_popup_menu_copy_file_location_item = file_list_add_image_menu_item (impl,
GTK_STOCK_COPY, _("_Copy file’s location"),
+ impl->priv->browse_files_popup_menu_copy_file_location_item = file_list_add_image_menu_item (impl,
GTK_STOCK_COPY, _("_Copy file’s location"),
G_CALLBACK
(copy_file_location_cb));
- impl->browse_files_popup_menu_add_shortcut_item = file_list_add_image_menu_item (impl, GTK_STOCK_ADD,
_("_Add to Bookmarks"),
+ impl->priv->browse_files_popup_menu_add_shortcut_item = file_list_add_image_menu_item (impl,
GTK_STOCK_ADD, _("_Add to Bookmarks"),
G_CALLBACK
(add_to_shortcuts_cb));
item = gtk_separator_menu_item_new ();
gtk_widget_show (item);
- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
+ gtk_menu_shell_append (GTK_MENU_SHELL (impl->priv->browse_files_popup_menu), item);
- impl->browse_files_popup_menu_hidden_files_item = file_list_add_check_menu_item (impl, _("Show
_Hidden Files"),
+ impl->priv->browse_files_popup_menu_hidden_files_item = file_list_add_check_menu_item (impl,
_("Show _Hidden Files"),
G_CALLBACK
(show_hidden_toggled_cb));
- impl->browse_files_popup_menu_size_column_item = file_list_add_check_menu_item (impl, _("Show _Size
Column"),
+ impl->priv->browse_files_popup_menu_size_column_item = file_list_add_check_menu_item (impl, _("Show _Size
Column"),
G_CALLBACK
(show_size_column_toggled_cb));
bookmarks_check_add_sensitivity (impl);
@@ -4212,22 +3832,22 @@ file_list_update_popup_menu (GtkFileChooserDefault *impl)
*/
/* 'Visit this file' */
- gtk_widget_set_visible (impl->browse_files_popup_menu_visit_file_item, (impl->operation_mode !=
OPERATION_MODE_BROWSE));
+ gtk_widget_set_visible (impl->priv->browse_files_popup_menu_visit_file_item, (impl->priv->operation_mode
!= OPERATION_MODE_BROWSE));
/* 'Show Hidden Files' */
- g_signal_handlers_block_by_func (impl->browse_files_popup_menu_hidden_files_item,
+ g_signal_handlers_block_by_func (impl->priv->browse_files_popup_menu_hidden_files_item,
G_CALLBACK (show_hidden_toggled_cb), impl);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (impl->browse_files_popup_menu_hidden_files_item),
- impl->show_hidden);
- g_signal_handlers_unblock_by_func (impl->browse_files_popup_menu_hidden_files_item,
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM
(impl->priv->browse_files_popup_menu_hidden_files_item),
+ impl->priv->show_hidden);
+ g_signal_handlers_unblock_by_func (impl->priv->browse_files_popup_menu_hidden_files_item,
G_CALLBACK (show_hidden_toggled_cb), impl);
/* 'Show Size Column' */
- g_signal_handlers_block_by_func (impl->browse_files_popup_menu_size_column_item,
+ g_signal_handlers_block_by_func (impl->priv->browse_files_popup_menu_size_column_item,
G_CALLBACK (show_size_column_toggled_cb), impl);
- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (impl->browse_files_popup_menu_size_column_item),
- impl->show_size_column);
- g_signal_handlers_unblock_by_func (impl->browse_files_popup_menu_size_column_item,
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (impl->priv->browse_files_popup_menu_size_column_item),
+ impl->priv->show_size_column);
+ g_signal_handlers_unblock_by_func (impl->priv->browse_files_popup_menu_size_column_item,
G_CALLBACK (show_size_column_toggled_cb), impl);
}
@@ -4272,16 +3892,16 @@ file_list_popup_menu (GtkFileChooserDefault *impl,
{
file_list_update_popup_menu (impl);
if (event)
- gtk_menu_popup (GTK_MENU (impl->browse_files_popup_menu),
+ gtk_menu_popup (GTK_MENU (impl->priv->browse_files_popup_menu),
NULL, NULL, NULL, NULL,
event->button, event->time);
else
{
- gtk_menu_popup (GTK_MENU (impl->browse_files_popup_menu),
+ gtk_menu_popup (GTK_MENU (impl->priv->browse_files_popup_menu),
NULL, NULL,
- popup_position_func, impl->browse_files_tree_view,
+ popup_position_func, impl->priv->browse_files_tree_view,
0, GDK_CURRENT_TIME);
- gtk_menu_shell_select_first (GTK_MENU_SHELL (impl->browse_files_popup_menu),
+ gtk_menu_shell_select_first (GTK_MENU_SHELL (impl->priv->browse_files_popup_menu),
FALSE);
}
@@ -4313,7 +3933,7 @@ list_button_press_event_cb (GtkWidget *widget,
return FALSE;
in_press = TRUE;
- gtk_widget_event (impl->browse_files_tree_view, (GdkEvent *) event);
+ gtk_widget_event (impl->priv->browse_files_tree_view, (GdkEvent *) event);
in_press = FALSE;
file_list_popup_menu (impl, event);
@@ -4332,9 +3952,9 @@ typedef struct {
static void
file_list_set_sort_column_ids (GtkFileChooserDefault *impl)
{
- gtk_tree_view_column_set_sort_column_id (impl->list_name_column, MODEL_COL_NAME);
- gtk_tree_view_column_set_sort_column_id (impl->list_mtime_column, MODEL_COL_MTIME);
- gtk_tree_view_column_set_sort_column_id (impl->list_size_column, MODEL_COL_SIZE);
+ gtk_tree_view_column_set_sort_column_id (impl->priv->list_name_column, MODEL_COL_NAME);
+ gtk_tree_view_column_set_sort_column_id (impl->priv->list_mtime_column, MODEL_COL_MTIME);
+ gtk_tree_view_column_set_sort_column_id (impl->priv->list_size_column, MODEL_COL_SIZE);
}
static gboolean
@@ -4352,11 +3972,11 @@ file_list_query_tooltip_cb (GtkWidget *widget,
GFile *file;
gchar *filename;
- if (impl->operation_mode == OPERATION_MODE_BROWSE)
+ if (impl->priv->operation_mode == OPERATION_MODE_BROWSE)
return FALSE;
- if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ if (!gtk_tree_view_get_tooltip_context (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
&x, &y,
keyboard_tip,
&model, &path, &iter))
@@ -4374,7 +3994,7 @@ file_list_query_tooltip_cb (GtkWidget *widget,
filename = g_file_get_path (file);
gtk_tooltip_set_text (tooltip, filename);
- gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ gtk_tree_view_set_tooltip_row (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
tooltip,
path);
@@ -4386,196 +4006,26 @@ file_list_query_tooltip_cb (GtkWidget *widget,
}
static void
-set_icon_cell_renderer_fixed_size (GtkFileChooserDefault *impl, GtkCellRenderer *renderer)
+set_icon_cell_renderer_fixed_size (GtkFileChooserDefault *impl)
{
gint xpad, ypad;
- gtk_cell_renderer_get_padding (renderer, &xpad, &ypad);
- gtk_cell_renderer_set_fixed_size (renderer,
- xpad * 2 + impl->icon_size,
- ypad * 2 + impl->icon_size);
-}
-
-/* Creates the widgets for the file list */
-static GtkWidget *
-create_file_list (GtkFileChooserDefault *impl)
-{
- GtkWidget *swin;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
- GtkCellRenderer *renderer;
-
- /* Scrolled window */
- swin = gtk_scrolled_window_new (NULL, NULL);
- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
- GTK_POLICY_AUTOMATIC, GTK_POLICY_ALWAYS);
- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin),
- GTK_SHADOW_IN);
-
- /* Tree/list view */
-
- impl->browse_files_tree_view = gtk_tree_view_new ();
-#ifdef PROFILE_FILE_CHOOSER
- g_object_set_data (G_OBJECT (impl->browse_files_tree_view), "fmq-name", "file_list");
-#endif
- g_object_set_data (G_OBJECT (impl->browse_files_tree_view), I_("GtkFileChooserDefault"), impl);
- atk_object_set_name (gtk_widget_get_accessible (impl->browse_files_tree_view), _("Files"));
-
- gtk_tree_view_set_rules_hint (GTK_TREE_VIEW (impl->browse_files_tree_view), TRUE);
- gtk_container_add (GTK_CONTAINER (swin), impl->browse_files_tree_view);
-
- gtk_drag_dest_set (impl->browse_files_tree_view,
- GTK_DEST_DEFAULT_ALL,
- NULL, 0,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
- gtk_drag_dest_add_uri_targets (impl->browse_files_tree_view);
-
- g_signal_connect (impl->browse_files_tree_view, "row-activated",
- G_CALLBACK (list_row_activated), impl);
- g_signal_connect (impl->browse_files_tree_view, "key-press-event",
- G_CALLBACK (browse_files_key_press_event_cb), impl);
- g_signal_connect (impl->browse_files_tree_view, "popup-menu",
- G_CALLBACK (list_popup_menu_cb), impl);
- g_signal_connect (impl->browse_files_tree_view, "button-press-event",
- G_CALLBACK (list_button_press_event_cb), impl);
-
- g_signal_connect (impl->browse_files_tree_view, "drag-data-received",
- G_CALLBACK (file_list_drag_data_received_cb), impl);
- g_signal_connect (impl->browse_files_tree_view, "drag-drop",
- G_CALLBACK (file_list_drag_drop_cb), impl);
- g_signal_connect (impl->browse_files_tree_view, "drag-motion",
- G_CALLBACK (file_list_drag_motion_cb), impl);
-
- g_object_set (impl->browse_files_tree_view, "has-tooltip", TRUE, NULL);
- g_signal_connect (impl->browse_files_tree_view, "query-tooltip",
- G_CALLBACK (file_list_query_tooltip_cb), impl);
-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
- gtk_tree_selection_set_select_function (selection,
- list_select_func,
- impl, NULL);
- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_files_tree_view),
- GDK_BUTTON1_MASK,
- NULL, 0,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
- gtk_drag_source_add_uri_targets (impl->browse_files_tree_view);
-
- g_signal_connect (selection, "changed",
- G_CALLBACK (list_selection_changed), impl);
-
- /* Keep the column order in sync with update_cell_renderer_attributes() */
-
- /* Filename column */
-
- impl->list_name_column = gtk_tree_view_column_new ();
- gtk_tree_view_column_set_expand (impl->list_name_column, TRUE);
- gtk_tree_view_column_set_resizable (impl->list_name_column, TRUE);
- gtk_tree_view_column_set_title (impl->list_name_column, _("Name"));
-
- renderer = gtk_cell_renderer_pixbuf_new ();
- /* We set a fixed size so that we get an empty slot even if no icons are loaded yet */
- set_icon_cell_renderer_fixed_size (impl, renderer);
- gtk_tree_view_column_pack_start (impl->list_name_column, renderer, FALSE);
-
- impl->list_name_renderer = gtk_cell_renderer_text_new ();
- g_object_set (impl->list_name_renderer,
- "ellipsize", PANGO_ELLIPSIZE_END,
- NULL);
- g_signal_connect (impl->list_name_renderer, "edited",
- G_CALLBACK (renderer_edited_cb), impl);
- g_signal_connect (impl->list_name_renderer, "editing-canceled",
- G_CALLBACK (renderer_editing_canceled_cb), impl);
- gtk_tree_view_column_pack_start (impl->list_name_column, impl->list_name_renderer, TRUE);
-
- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_files_tree_view), impl->list_name_column);
-
- /* Size column */
-
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_set_resizable (column, TRUE);
- gtk_tree_view_column_set_title (column, _("Size"));
-
- renderer = gtk_cell_renderer_text_new ();
- g_object_set (renderer,
- "alignment", PANGO_ALIGN_RIGHT,
- NULL);
- gtk_tree_view_column_pack_start (column, renderer, TRUE); /* bug: it doesn't expand */
- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_files_tree_view), column);
- impl->list_size_column = column;
-
- /* Modification time column */
-
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_set_resizable (column, TRUE);
- gtk_tree_view_column_set_title (column, _("Modified"));
-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start (column, renderer, TRUE);
- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_files_tree_view), column);
- impl->list_mtime_column = column;
-
- file_list_set_sort_column_ids (impl);
- update_cell_renderer_attributes (impl);
-
- gtk_widget_show_all (swin);
-
- return swin;
-}
-
-/* Creates the widgets for the files/folders pane */
-static GtkWidget *
-file_pane_create (GtkFileChooserDefault *impl,
- GtkSizeGroup *size_group)
-{
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *widget;
-
- vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
- gtk_widget_show (vbox);
-
- /* Box for lists and preview */
-
- hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, PREVIEW_HBOX_SPACING);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
- gtk_widget_show (hbox);
-
- /* File list */
-
- widget = create_file_list (impl);
- gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
- gtk_size_group_add_widget (size_group, widget);
-
- /* Preview */
-
- impl->preview_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
- gtk_box_pack_start (GTK_BOX (hbox), impl->preview_box, FALSE, FALSE, 0);
- /* Don't show preview box initially */
-
- /* Filter combo */
-
- impl->filter_combo_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
-
- widget = filter_create (impl);
-
- gtk_widget_show (widget);
- gtk_box_pack_end (GTK_BOX (impl->filter_combo_hbox), widget, FALSE, FALSE, 0);
-
- gtk_box_pack_end (GTK_BOX (vbox), impl->filter_combo_hbox, FALSE, FALSE, 0);
-
- return vbox;
+ gtk_cell_renderer_get_padding (impl->priv->list_pixbuf_renderer, &xpad, &ypad);
+ gtk_cell_renderer_set_fixed_size (impl->priv->list_pixbuf_renderer,
+ xpad * 2 + impl->priv->icon_size,
+ ypad * 2 + impl->priv->icon_size);
}
static void
location_entry_create (GtkFileChooserDefault *impl)
{
- if (!impl->location_entry)
- impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
+ if (!impl->priv->location_entry)
+ impl->priv->location_entry = _gtk_file_chooser_entry_new (TRUE);
- _gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->local_only);
- _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
- gtk_entry_set_width_chars (GTK_ENTRY (impl->location_entry), 45);
- gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
+ _gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry),
impl->priv->local_only);
+ _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry),
impl->priv->action);
+ gtk_entry_set_width_chars (GTK_ENTRY (impl->priv->location_entry), 45);
+ gtk_entry_set_activates_default (GTK_ENTRY (impl->priv->location_entry), TRUE);
}
/* Creates the widgets specific to Save mode */
@@ -4585,60 +4035,60 @@ save_widgets_create (GtkFileChooserDefault *impl)
GtkWidget *vbox;
GtkWidget *widget;
- if (impl->save_widgets != NULL)
+ if (impl->priv->save_widgets != NULL)
return;
location_switch_to_path_bar (impl);
vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
- impl->save_widgets_table = gtk_grid_new ();
- gtk_box_pack_start (GTK_BOX (vbox), impl->save_widgets_table, FALSE, FALSE, 0);
- gtk_widget_show (impl->save_widgets_table);
- gtk_grid_set_row_spacing (GTK_GRID (impl->save_widgets_table), 12);
- gtk_grid_set_column_spacing (GTK_GRID (impl->save_widgets_table), 12);
+ impl->priv->save_widgets_table = gtk_grid_new ();
+ gtk_box_pack_start (GTK_BOX (vbox), impl->priv->save_widgets_table, FALSE, FALSE, 0);
+ gtk_widget_show (impl->priv->save_widgets_table);
+ gtk_grid_set_row_spacing (GTK_GRID (impl->priv->save_widgets_table), 12);
+ gtk_grid_set_column_spacing (GTK_GRID (impl->priv->save_widgets_table), 12);
/* Label */
widget = gtk_label_new_with_mnemonic (_("_Name:"));
gtk_widget_set_halign (widget, GTK_ALIGN_START);
gtk_widget_set_valign (widget, GTK_ALIGN_CENTER);
- gtk_grid_attach (GTK_GRID (impl->save_widgets_table), widget, 0, 0, 1, 1);
+ gtk_grid_attach (GTK_GRID (impl->priv->save_widgets_table), widget, 0, 0, 1, 1);
gtk_widget_show (widget);
/* Location entry */
location_entry_create (impl);
- gtk_widget_set_hexpand (impl->location_entry, TRUE);
- gtk_grid_attach (GTK_GRID (impl->save_widgets_table), impl->location_entry, 1, 0, 1, 1);
- gtk_widget_show (impl->location_entry);
- gtk_label_set_mnemonic_widget (GTK_LABEL (widget), impl->location_entry);
+ gtk_widget_set_hexpand (impl->priv->location_entry, TRUE);
+ gtk_grid_attach (GTK_GRID (impl->priv->save_widgets_table), impl->priv->location_entry, 1, 0, 1, 1);
+ gtk_widget_show (impl->priv->location_entry);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (widget), impl->priv->location_entry);
/* Folder combo */
- impl->save_folder_label = gtk_label_new (NULL);
- gtk_widget_set_halign (impl->save_folder_label, GTK_ALIGN_START);
- gtk_widget_set_valign (impl->save_folder_label, GTK_ALIGN_CENTER);
- gtk_grid_attach (GTK_GRID (impl->save_widgets_table), impl->save_folder_label, 0, 1, 1, 1);
- gtk_widget_show (impl->save_folder_label);
+ impl->priv->save_folder_label = gtk_label_new (NULL);
+ gtk_widget_set_halign (impl->priv->save_folder_label, GTK_ALIGN_START);
+ gtk_widget_set_valign (impl->priv->save_folder_label, GTK_ALIGN_CENTER);
+ gtk_grid_attach (GTK_GRID (impl->priv->save_widgets_table), impl->priv->save_folder_label, 0, 1, 1, 1);
+ gtk_widget_show (impl->priv->save_folder_label);
- impl->save_widgets = vbox;
- gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (impl), impl->save_widgets, 0);
- gtk_widget_show (impl->save_widgets);
+ impl->priv->save_widgets = vbox;
+ gtk_box_pack_start (GTK_BOX (impl), impl->priv->save_widgets, FALSE, FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (impl), impl->priv->save_widgets, 0);
+ gtk_widget_show (impl->priv->save_widgets);
}
/* Destroys the widgets specific to Save mode */
static void
save_widgets_destroy (GtkFileChooserDefault *impl)
{
- if (impl->save_widgets == NULL)
+ if (impl->priv->save_widgets == NULL)
return;
- gtk_widget_destroy (impl->save_widgets);
- impl->save_widgets = NULL;
- impl->save_widgets_table = NULL;
- impl->location_entry = NULL;
- impl->save_folder_label = NULL;
+ gtk_widget_destroy (impl->priv->save_widgets);
+ impl->priv->save_widgets = NULL;
+ impl->priv->save_widgets_table = NULL;
+ impl->priv->location_entry = NULL;
+ impl->priv->save_folder_label = NULL;
}
/* Turns on the path bar widget. Can be called even if we are already in that
@@ -4647,13 +4097,13 @@ save_widgets_destroy (GtkFileChooserDefault *impl)
static void
location_switch_to_path_bar (GtkFileChooserDefault *impl)
{
- if (impl->location_entry)
+ if (impl->priv->location_entry)
{
- gtk_widget_destroy (impl->location_entry);
- impl->location_entry = NULL;
+ gtk_widget_destroy (impl->priv->location_entry);
+ impl->priv->location_entry = NULL;
}
- gtk_widget_hide (impl->location_entry_box);
+ gtk_widget_hide (impl->priv->location_entry_box);
}
/* Turns on the location entry. Can be called even if we are already in that
@@ -4666,31 +4116,31 @@ location_switch_to_filename_entry (GtkFileChooserDefault *impl)
* location_entry_box container, so there's no point in switching
* to it.
*/
- if (impl->operation_mode == OPERATION_MODE_SEARCH ||
- impl->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->priv->operation_mode == OPERATION_MODE_SEARCH ||
+ impl->priv->operation_mode == OPERATION_MODE_RECENT)
return;
/* Box */
- gtk_widget_show (impl->location_entry_box);
+ gtk_widget_show (impl->priv->location_entry_box);
/* Entry */
- if (!impl->location_entry)
+ if (!impl->priv->location_entry)
{
location_entry_create (impl);
- gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_entry, TRUE, TRUE, 0);
- gtk_label_set_mnemonic_widget (GTK_LABEL (impl->location_label), impl->location_entry);
+ gtk_box_pack_start (GTK_BOX (impl->priv->location_entry_box), impl->priv->location_entry, TRUE, TRUE,
0);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (impl->priv->location_label), impl->priv->location_entry);
}
/* Configure the entry */
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
impl->current_folder);
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry),
impl->priv->current_folder);
/* Done */
- gtk_widget_show (impl->location_entry);
- gtk_widget_grab_focus (impl->location_entry);
+ gtk_widget_show (impl->priv->location_entry);
+ gtk_widget_grab_focus (impl->priv->location_entry);
}
/* Sets a new location mode. set_buttons determines whether the toggle button
@@ -4701,8 +4151,8 @@ location_mode_set (GtkFileChooserDefault *impl,
LocationMode new_mode,
gboolean set_button)
{
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
GtkWindow *toplevel;
GtkWidget *current_focus;
@@ -4723,14 +4173,14 @@ location_mode_set (GtkFileChooserDefault *impl,
if (toplevel)
{
current_focus = gtk_window_get_focus (toplevel);
- if (!current_focus || current_focus == impl->location_entry)
+ if (!current_focus || current_focus == impl->priv->location_entry)
switch_to_file_list = TRUE;
}
location_switch_to_path_bar (impl);
if (switch_to_file_list)
- gtk_widget_grab_focus (impl->browse_files_tree_view);
+ gtk_widget_grab_focus (impl->priv->browse_files_tree_view);
break;
@@ -4746,17 +4196,17 @@ location_mode_set (GtkFileChooserDefault *impl,
if (set_button)
{
- g_signal_handlers_block_by_func (impl->location_button,
+ g_signal_handlers_block_by_func (impl->priv->location_button,
G_CALLBACK (location_button_toggled_cb), impl);
- gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->location_button), button_active);
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (impl->priv->location_button), button_active);
- g_signal_handlers_unblock_by_func (impl->location_button,
+ g_signal_handlers_unblock_by_func (impl->priv->location_button,
G_CALLBACK (location_button_toggled_cb), impl);
}
}
- impl->location_mode = new_mode;
+ impl->priv->location_mode = new_mode;
}
static void
@@ -4766,26 +4216,26 @@ location_toggle_popup_handler (GtkFileChooserDefault *impl)
* location_entry_box container, so there's no point in switching
* to it.
*/
- if (impl->operation_mode == OPERATION_MODE_SEARCH ||
- impl->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->priv->operation_mode == OPERATION_MODE_SEARCH ||
+ impl->priv->operation_mode == OPERATION_MODE_RECENT)
return;
/* If the file entry is not visible, show it.
* If it is visible, turn it off only if it is focused. Otherwise, switch to the entry.
*/
- if (impl->location_mode == LOCATION_MODE_PATH_BAR)
+ if (impl->priv->location_mode == LOCATION_MODE_PATH_BAR)
{
location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY, TRUE);
}
- else if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+ else if (impl->priv->location_mode == LOCATION_MODE_FILENAME_ENTRY)
{
- if (gtk_widget_has_focus (impl->location_entry))
+ if (gtk_widget_has_focus (impl->priv->location_entry))
{
location_mode_set (impl, LOCATION_MODE_PATH_BAR, TRUE);
}
else
{
- gtk_widget_grab_focus (impl->location_entry);
+ gtk_widget_grab_focus (impl->priv->location_entry);
}
}
}
@@ -4802,41 +4252,18 @@ location_button_toggled_cb (GtkToggleButton *toggle,
if (is_active)
{
- g_assert (impl->location_mode == LOCATION_MODE_PATH_BAR);
+ g_assert (impl->priv->location_mode == LOCATION_MODE_PATH_BAR);
new_mode = LOCATION_MODE_FILENAME_ENTRY;
}
else
{
- g_assert (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY);
+ g_assert (impl->priv->location_mode == LOCATION_MODE_FILENAME_ENTRY);
new_mode = LOCATION_MODE_PATH_BAR;
}
location_mode_set (impl, new_mode, FALSE);
}
-/* Creates a toggle button for the location entry. */
-static void
-location_button_create (GtkFileChooserDefault *impl)
-{
- GtkWidget *image;
- const char *str;
-
- image = gtk_image_new_from_stock (GTK_STOCK_EDIT, GTK_ICON_SIZE_BUTTON);
- gtk_widget_show (image);
-
- impl->location_button = g_object_new (GTK_TYPE_TOGGLE_BUTTON,
- "image", image,
- NULL);
-
- g_signal_connect (impl->location_button, "toggled",
- G_CALLBACK (location_button_toggled_cb), impl);
-
- str = _("Type a file name");
-
- gtk_widget_set_tooltip_text (impl->location_button, str);
- atk_object_set_name (gtk_widget_get_accessible (impl->location_button), str);
-}
-
typedef enum {
PATH_BAR_FOLDER_PATH,
PATH_BAR_SELECT_A_FOLDER,
@@ -4846,25 +4273,6 @@ typedef enum {
PATH_BAR_SEARCH
} PathBarMode;
-/* Creates the info bar for informational messages or warnings, with its icon and label */
-static void
-info_bar_create (GtkFileChooserDefault *impl)
-{
- GtkWidget *content_area;
-
- impl->browse_select_a_folder_info_bar = gtk_info_bar_new ();
- impl->browse_select_a_folder_icon = gtk_image_new_from_stock (GTK_STOCK_DIRECTORY, GTK_ICON_SIZE_MENU);
- impl->browse_select_a_folder_label = gtk_label_new (NULL);
-
- content_area = gtk_info_bar_get_content_area (GTK_INFO_BAR (impl->browse_select_a_folder_info_bar));
-
- gtk_box_pack_start (GTK_BOX (content_area), impl->browse_select_a_folder_icon, FALSE, FALSE, 0);
- gtk_box_pack_start (GTK_BOX (content_area), impl->browse_select_a_folder_label, FALSE, FALSE, 0);
-
- gtk_widget_show (impl->browse_select_a_folder_icon);
- gtk_widget_show (impl->browse_select_a_folder_label);
-}
-
/* Sets the info bar to show the appropriate informational or warning message */
static void
info_bar_set (GtkFileChooserDefault *impl, PathBarMode mode)
@@ -4898,70 +4306,16 @@ info_bar_set (GtkFileChooserDefault *impl, PathBarMode mode)
return;
}
- gtk_info_bar_set_message_type (GTK_INFO_BAR (impl->browse_select_a_folder_info_bar), message_type);
- gtk_image_set_from_stock (GTK_IMAGE (impl->browse_select_a_folder_icon),
+ gtk_info_bar_set_message_type (GTK_INFO_BAR (impl->priv->browse_select_a_folder_info_bar), message_type);
+ gtk_image_set_from_stock (GTK_IMAGE (impl->priv->browse_select_a_folder_icon),
(message_type == GTK_MESSAGE_WARNING) ? GTK_STOCK_DIALOG_WARNING :
GTK_STOCK_DIRECTORY,
GTK_ICON_SIZE_MENU);
- gtk_label_set_markup (GTK_LABEL (impl->browse_select_a_folder_label), str);
+ gtk_label_set_markup (GTK_LABEL (impl->priv->browse_select_a_folder_label), str);
if (free_str)
g_free (str);
}
-/* Creates the icon and label used to show that the file chooser is in Search or Recently-used mode */
-static void
-special_mode_widgets_create (GtkFileChooserDefault *impl)
-{
- impl->browse_special_mode_icon = gtk_image_new ();
- gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_special_mode_icon);
- gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_special_mode_icon, FALSE, FALSE, 0);
-
- impl->browse_special_mode_label = gtk_label_new (NULL);
- gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_special_mode_label);
- gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_special_mode_label, FALSE, FALSE,
0);
-}
-
-/* Creates the path bar's container and eveyrthing that goes in it: location button, pathbar, info bar, and
Create Folder button */
-static void
-path_bar_widgets_create (GtkFileChooserDefault *impl)
-{
- /* Location widgets - note browse_path_bar_hbox is packed in the right place until switch_path_bar() */
- impl->browse_path_bar_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_widget_show (impl->browse_path_bar_hbox);
-
- /* Size group that allows the path bar to be the same size between modes */
- impl->browse_path_bar_size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
- gtk_size_group_set_ignore_hidden (impl->browse_path_bar_size_group, FALSE);
-
- /* Location button */
- location_button_create (impl);
- gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->location_button);
- gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->location_button, FALSE, FALSE, 0);
-
- /* Path bar */
- impl->browse_path_bar = g_object_new (GTK_TYPE_PATH_BAR, NULL);
- _gtk_path_bar_set_file_system (GTK_PATH_BAR (impl->browse_path_bar), impl->file_system);
- g_signal_connect (impl->browse_path_bar, "path-clicked", G_CALLBACK (path_bar_clicked), impl);
-
- gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_path_bar);
- gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_path_bar, TRUE, TRUE, 0);
-
- /* Info bar */
- info_bar_create (impl);
- gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_select_a_folder_info_bar);
- gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_select_a_folder_info_bar, TRUE,
TRUE, 0);
-
- /* Widgets for special modes (recently-used in Open mode, Search mode) */
- special_mode_widgets_create (impl);
-
- /* Create Folder */
- impl->browse_new_folder_button = gtk_button_new_with_mnemonic (_("Create Fo_lder"));
- g_signal_connect (impl->browse_new_folder_button, "clicked",
- G_CALLBACK (new_folder_button_clicked), impl);
- gtk_size_group_add_widget (impl->browse_path_bar_size_group, impl->browse_new_folder_button);
- gtk_box_pack_end (GTK_BOX (impl->browse_path_bar_hbox), impl->browse_new_folder_button, FALSE, FALSE, 0);
-}
-
/* Sets the path bar's mode to show a label, the actual folder path, or a
* warning message. You may call this function with PATH_BAR_ERROR_* directly
* if the pathbar is already showing the widgets you expect; otherwise, call
@@ -4991,20 +4345,20 @@ path_bar_set_mode (GtkFileChooserDefault *impl, PathBarMode mode)
break;
case PATH_BAR_RECENTLY_USED:
- gtk_image_set_from_icon_name (GTK_IMAGE (impl->browse_special_mode_icon), "document-open-recent",
GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_icon_name (GTK_IMAGE (impl->priv->browse_special_mode_icon),
"document-open-recent", GTK_ICON_SIZE_BUTTON);
tmp = g_strdup_printf ("<b>%s</b>", _("Recently Used"));
- gtk_label_set_markup (GTK_LABEL (impl->browse_special_mode_label), tmp);
+ gtk_label_set_markup (GTK_LABEL (impl->priv->browse_special_mode_label), tmp);
g_free (tmp);
special_mode_widgets_visible = TRUE;
break;
case PATH_BAR_SEARCH:
- gtk_image_set_from_stock (GTK_IMAGE (impl->browse_special_mode_icon), GTK_STOCK_FIND,
GTK_ICON_SIZE_BUTTON);
+ gtk_image_set_from_stock (GTK_IMAGE (impl->priv->browse_special_mode_icon), GTK_STOCK_FIND,
GTK_ICON_SIZE_BUTTON);
tmp = g_strdup_printf ("<b>%s</b>", _("Search:"));
- gtk_label_set_markup (GTK_LABEL (impl->browse_special_mode_label), tmp);
+ gtk_label_set_markup (GTK_LABEL (impl->priv->browse_special_mode_label), tmp);
g_free (tmp);
special_mode_widgets_visible = TRUE;
@@ -5014,64 +4368,20 @@ path_bar_set_mode (GtkFileChooserDefault *impl, PathBarMode mode)
g_assert_not_reached ();
}
- gtk_widget_set_visible (impl->browse_path_bar, path_bar_visible);
- gtk_widget_set_visible (impl->browse_special_mode_icon, special_mode_widgets_visible);
- gtk_widget_set_visible (impl->browse_special_mode_label, special_mode_widgets_visible);
- gtk_widget_set_visible (impl->browse_select_a_folder_info_bar, info_bar_visible);
+ gtk_widget_set_visible (impl->priv->browse_path_bar, path_bar_visible);
+ gtk_widget_set_visible (impl->priv->browse_special_mode_icon, special_mode_widgets_visible);
+ gtk_widget_set_visible (impl->priv->browse_special_mode_label, special_mode_widgets_visible);
+ gtk_widget_set_visible (impl->priv->browse_select_a_folder_info_bar, info_bar_visible);
if (path_bar_visible)
{
- if (impl->create_folders
- && impl->action != GTK_FILE_CHOOSER_ACTION_OPEN
- && impl->operation_mode != OPERATION_MODE_RECENT)
+ if (impl->priv->create_folders
+ && impl->priv->action != GTK_FILE_CHOOSER_ACTION_OPEN
+ && impl->priv->operation_mode != OPERATION_MODE_RECENT)
create_folder_visible = TRUE;
}
- gtk_widget_set_visible (impl->browse_new_folder_button, create_folder_visible);
-}
-
-/* Creates the main hpaned with the widgets shared by Open and Save mode */
-static void
-browse_widgets_create (GtkFileChooserDefault *impl)
-{
- GtkWidget *hpaned;
- GtkWidget *widget;
- GtkSizeGroup *size_group;
-
- impl->browse_widgets_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
- gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets_box, TRUE, TRUE, 0);
- gtk_widget_show (impl->browse_widgets_box);
-
- impl->browse_header_box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 12);
- gtk_box_pack_start (GTK_BOX (impl->browse_widgets_box), impl->browse_header_box, FALSE, FALSE, 0);
- gtk_widget_show (impl->browse_header_box);
-
- /* Path bar, info bar, and their respective machinery - the browse_path_bar_hbox will get packed elsewhere
*/
- path_bar_widgets_create (impl);
-
- /* Box for the location label and entry */
-
- impl->location_entry_box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
- gtk_box_pack_start (GTK_BOX (impl->browse_header_box), impl->location_entry_box, FALSE, FALSE, 0);
-
- impl->location_label = gtk_label_new_with_mnemonic (_("_Location:"));
- gtk_widget_show (impl->location_label);
- gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_label, FALSE, FALSE, 0);
-
- /* size group is used by the scrolled windows of the panes */
- size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
-
- /* Paned widget */
-
- hpaned = impl->browse_widgets_hpaned = gtk_paned_new (GTK_ORIENTATION_HORIZONTAL);
- gtk_widget_show (hpaned);
- gtk_box_pack_start (GTK_BOX (impl->browse_widgets_box), hpaned, TRUE, TRUE, 0);
-
- widget = shortcuts_pane_create (impl, size_group);
- gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE);
- widget = file_pane_create (impl, size_group);
- gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE);
- g_object_unref (size_group);
+ gtk_widget_set_visible (impl->priv->browse_new_folder_button, create_folder_visible);
}
static GObject*
@@ -5089,23 +4399,9 @@ gtk_file_chooser_default_constructor (GType type,
construct_params);
impl = GTK_FILE_CHOOSER_DEFAULT (object);
- g_assert (impl->file_system);
-
- gtk_widget_push_composite_child ();
-
- /* Shortcuts model */
- shortcuts_model_create (impl);
- /* The browse widgets */
- browse_widgets_create (impl);
+ g_assert (impl->priv->file_system);
- /* Alignment to hold extra widget */
- impl->extra_align = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
- gtk_widget_set_halign (impl->extra_align, GTK_ALIGN_START);
- gtk_widget_set_valign (impl->extra_align, GTK_ALIGN_CENTER);
- gtk_box_pack_start (GTK_BOX (impl), impl->extra_align, FALSE, FALSE, 0);
-
- gtk_widget_pop_composite_child ();
update_appearance (impl);
profile_end ("end", NULL);
@@ -5125,41 +4421,41 @@ set_extra_widget (GtkFileChooserDefault *impl,
gtk_widget_show (extra_widget);
}
- if (impl->extra_widget)
+ if (impl->priv->extra_widget)
{
- gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
- g_object_unref (impl->extra_widget);
+ gtk_container_remove (GTK_CONTAINER (impl->priv->extra_align), impl->priv->extra_widget);
+ g_object_unref (impl->priv->extra_widget);
}
- impl->extra_widget = extra_widget;
- if (impl->extra_widget)
+ impl->priv->extra_widget = extra_widget;
+ if (impl->priv->extra_widget)
{
- gtk_container_add (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
- gtk_widget_show (impl->extra_align);
+ gtk_container_add (GTK_CONTAINER (impl->priv->extra_align), impl->priv->extra_widget);
+ gtk_widget_show (impl->priv->extra_align);
}
else
- gtk_widget_hide (impl->extra_align);
+ gtk_widget_hide (impl->priv->extra_align);
}
static void
set_local_only (GtkFileChooserDefault *impl,
gboolean local_only)
{
- if (local_only != impl->local_only)
+ if (local_only != impl->priv->local_only)
{
- impl->local_only = local_only;
+ impl->priv->local_only = local_only;
- if (impl->location_entry)
- _gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), local_only);
+ if (impl->priv->location_entry)
+ _gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry),
local_only);
- if (impl->shortcuts_model && impl->file_system)
+ if (impl->priv->shortcuts_model && impl->priv->file_system)
{
shortcuts_add_volumes (impl);
shortcuts_add_bookmarks (impl);
}
- if (local_only && impl->current_folder &&
- !_gtk_file_has_native_path (impl->current_folder))
+ if (local_only && impl->priv->current_folder &&
+ !_gtk_file_has_native_path (impl->priv->current_folder))
{
/* If we are pointing to a non-local folder, make an effort to change
* back to a local folder, but it's really up to the app to not cause
@@ -5201,17 +4497,17 @@ set_select_multiple (GtkFileChooserDefault *impl,
GtkTreeSelection *selection;
GtkSelectionMode mode;
- if (select_multiple == impl->select_multiple)
+ if (select_multiple == impl->priv->select_multiple)
return;
mode = select_multiple ? GTK_SELECTION_MULTIPLE : GTK_SELECTION_SINGLE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_set_mode (selection, mode);
- gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (impl->browse_files_tree_view), select_multiple);
+ gtk_tree_view_set_rubber_banding (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), select_multiple);
- impl->select_multiple = select_multiple;
+ impl->priv->select_multiple = select_multiple;
g_object_notify (G_OBJECT (impl), "select-multiple");
check_preview_change (impl);
@@ -5222,11 +4518,11 @@ set_file_system_backend (GtkFileChooserDefault *impl)
{
profile_start ("start for backend", "default");
- impl->file_system = _gtk_file_system_new ();
+ impl->priv->file_system = _gtk_file_system_new ();
- g_signal_connect (impl->file_system, "volumes-changed",
+ g_signal_connect (impl->priv->file_system, "volumes-changed",
G_CALLBACK (volumes_bookmarks_changed_cb), impl);
- g_signal_connect (impl->file_system, "bookmarks-changed",
+ g_signal_connect (impl->priv->file_system, "bookmarks-changed",
G_CALLBACK (volumes_bookmarks_changed_cb), impl);
profile_end ("end", NULL);
@@ -5235,12 +4531,12 @@ set_file_system_backend (GtkFileChooserDefault *impl)
static void
unset_file_system_backend (GtkFileChooserDefault *impl)
{
- g_signal_handlers_disconnect_by_func (impl->file_system,
+ g_signal_handlers_disconnect_by_func (impl->priv->file_system,
G_CALLBACK (volumes_bookmarks_changed_cb), impl);
- g_object_unref (impl->file_system);
+ g_object_unref (impl->priv->file_system);
- impl->file_system = NULL;
+ impl->priv->file_system = NULL;
}
/* Saves the widgets around the pathbar so they can be reparented later
@@ -5252,11 +4548,11 @@ save_path_bar (GtkFileChooserDefault *impl)
{
GtkWidget *parent;
- g_object_ref (impl->browse_path_bar_hbox);
+ g_object_ref (impl->priv->browse_path_bar_hbox);
- parent = gtk_widget_get_parent (impl->browse_path_bar_hbox);
+ parent = gtk_widget_get_parent (impl->priv->browse_path_bar_hbox);
if (parent)
- gtk_container_remove (GTK_CONTAINER (parent), impl->browse_path_bar_hbox);
+ gtk_container_remove (GTK_CONTAINER (parent), impl->priv->browse_path_bar_hbox);
}
/* Reparents the path bar and the "Create folder" button to the right place:
@@ -5267,23 +4563,23 @@ save_path_bar (GtkFileChooserDefault *impl)
static void
restore_path_bar (GtkFileChooserDefault *impl)
{
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
- || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- gtk_box_pack_start (GTK_BOX (impl->browse_header_box), impl->browse_path_bar_hbox, FALSE, FALSE, 0);
- gtk_box_reorder_child (GTK_BOX (impl->browse_header_box), impl->browse_path_bar_hbox, 0);
+ gtk_box_pack_start (GTK_BOX (impl->priv->browse_header_box), impl->priv->browse_path_bar_hbox, FALSE,
FALSE, 0);
+ gtk_box_reorder_child (GTK_BOX (impl->priv->browse_header_box), impl->priv->browse_path_bar_hbox, 0);
}
- else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ else if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
- gtk_widget_set_hexpand (impl->browse_path_bar_hbox, TRUE);
- gtk_grid_attach (GTK_GRID (impl->save_widgets_table), impl->browse_path_bar_hbox, 1, 1, 1, 1);
- gtk_label_set_mnemonic_widget (GTK_LABEL (impl->save_folder_label), impl->browse_path_bar);
+ gtk_widget_set_hexpand (impl->priv->browse_path_bar_hbox, TRUE);
+ gtk_grid_attach (GTK_GRID (impl->priv->save_widgets_table), impl->priv->browse_path_bar_hbox, 1, 1, 1,
1);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (impl->priv->save_folder_label), impl->priv->browse_path_bar);
}
else
g_assert_not_reached ();
- g_object_unref (impl->browse_path_bar_hbox);
+ g_object_unref (impl->priv->browse_path_bar_hbox);
}
/* Takes the folder stored in a row in the recent_model, and puts it in the pathbar */
@@ -5292,15 +4588,15 @@ put_recent_folder_in_pathbar (GtkFileChooserDefault *impl, GtkTreeIter *iter)
{
GFile *file;
- gtk_tree_model_get (GTK_TREE_MODEL (impl->recent_model), iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->recent_model), iter,
MODEL_COL_FILE, &file,
-1);
- _gtk_path_bar_set_file (GTK_PATH_BAR (impl->browse_path_bar), file, FALSE);
+ _gtk_path_bar_set_file (GTK_PATH_BAR (impl->priv->browse_path_bar), file, FALSE);
g_object_unref (file);
}
/* Sets the pathbar in the appropriate mode according to the current operation mode and action. This is the
central function for
- * dealing with the pathbar's widgets; as long as impl->action and impl->operation_mode are set correctly,
then calling this
+ * dealing with the pathbar's widgets; as long as impl->priv->action and impl->priv->operation_mode are set
correctly, then calling this
* function will update all the pathbar's widgets.
*/
static void
@@ -5308,20 +4604,20 @@ path_bar_update (GtkFileChooserDefault *impl)
{
PathBarMode mode;
- switch (impl->operation_mode)
+ switch (impl->priv->operation_mode)
{
case OPERATION_MODE_BROWSE:
mode = PATH_BAR_FOLDER_PATH;
break;
case OPERATION_MODE_RECENT:
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
GtkTreeSelection *selection;
gboolean have_selected;
GtkTreeIter iter;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
/* Save mode means single-selection mode, so the following is valid */
have_selected = gtk_tree_selection_get_selected (selection, NULL, &iter);
@@ -5354,12 +4650,12 @@ path_bar_update (GtkFileChooserDefault *impl)
static void
operation_mode_discard_search_widgets (GtkFileChooserDefault *impl)
{
- if (impl->search_hbox)
+ if (impl->priv->search_hbox)
{
- gtk_widget_destroy (impl->search_hbox);
+ gtk_widget_destroy (impl->priv->search_hbox);
- impl->search_hbox = NULL;
- impl->search_entry = NULL;
+ impl->priv->search_hbox = NULL;
+ impl->priv->search_entry = NULL;
}
}
@@ -5395,23 +4691,23 @@ operation_mode_set_browse (GtkFileChooserDefault *impl)
{
path_bar_update (impl);
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- gtk_widget_show (impl->location_button);
- location_mode_set (impl, impl->location_mode, TRUE);
+ gtk_widget_show (impl->priv->location_button);
+ location_mode_set (impl, impl->priv->location_mode, TRUE);
- if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
- gtk_widget_show (impl->location_entry_box);
+ if (impl->priv->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+ gtk_widget_show (impl->priv->location_entry_box);
}
}
static void
operation_mode_set_search (GtkFileChooserDefault *impl)
{
- g_assert (impl->search_hbox == NULL);
- g_assert (impl->search_entry == NULL);
- g_assert (impl->search_model == NULL);
+ g_assert (impl->priv->search_hbox == NULL);
+ g_assert (impl->priv->search_entry == NULL);
+ g_assert (impl->priv->search_model == NULL);
search_setup_widgets (impl);
}
@@ -5422,11 +4718,11 @@ operation_mode_set_recent (GtkFileChooserDefault *impl)
path_bar_update (impl);
/* Hide the location widgets temporarily */
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- gtk_widget_hide (impl->location_button);
- gtk_widget_hide (impl->location_entry_box);
+ gtk_widget_hide (impl->priv->location_button);
+ gtk_widget_hide (impl->priv->location_entry_box);
}
recent_start_loading (impl);
@@ -5439,7 +4735,7 @@ 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));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view));
g_signal_handlers_block_by_func (selection, G_CALLBACK (shortcuts_selection_changed_cb), impl);
@@ -5455,11 +4751,11 @@ operation_mode_set (GtkFileChooserDefault *impl, OperationMode mode)
{
ShortcutsIndex shortcut_to_select;
- operation_mode_stop (impl, impl->operation_mode);
+ operation_mode_stop (impl, impl->priv->operation_mode);
- impl->operation_mode = mode;
+ impl->priv->operation_mode = mode;
- switch (impl->operation_mode)
+ switch (impl->priv->operation_mode)
{
case OPERATION_MODE_BROWSE:
operation_mode_set_browse (impl);
@@ -5495,38 +4791,38 @@ update_appearance (GtkFileChooserDefault *impl)
{
save_path_bar (impl);
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
const char *text;
- gtk_widget_hide (impl->location_button);
+ gtk_widget_hide (impl->priv->location_button);
save_widgets_create (impl);
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->priv->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);
+ gtk_label_set_text_with_mnemonic (GTK_LABEL (impl->priv->save_folder_label), text);
- if (impl->select_multiple)
+ if (impl->priv->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)
+ else if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- gtk_widget_show (impl->location_button);
+ gtk_widget_show (impl->priv->location_button);
save_widgets_destroy (impl);
- location_mode_set (impl, impl->location_mode, TRUE);
+ location_mode_set (impl, impl->priv->location_mode, TRUE);
}
- if (impl->location_entry)
- _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
+ if (impl->priv->location_entry)
+ _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry),
impl->priv->action);
restore_path_bar (impl);
path_bar_update (impl);
@@ -5534,7 +4830,7 @@ update_appearance (GtkFileChooserDefault *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);
+ gtk_widget_queue_draw (impl->priv->browse_files_tree_view);
emit_default_size_changed (impl);
}
@@ -5554,20 +4850,20 @@ gtk_file_chooser_default_set_property (GObject *object,
{
GtkFileChooserAction action = g_value_get_enum (value);
- if (action != impl->action)
+ if (action != impl->priv->action)
{
gtk_file_chooser_default_unselect_all (GTK_FILE_CHOOSER (impl));
if ((action == GTK_FILE_CHOOSER_ACTION_SAVE ||
action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
- && impl->select_multiple)
+ && impl->priv->select_multiple)
{
g_warning ("Tried to change the file chooser action to SAVE or CREATE_FOLDER, but "
"this is not allowed in multiple selection mode. Resetting the file chooser "
"to single selection mode.");
set_select_multiple (impl, FALSE, TRUE);
}
- impl->action = action;
+ impl->priv->action = action;
update_cell_renderer_attributes (impl);
update_appearance (impl);
settings_load (impl);
@@ -5588,12 +4884,12 @@ gtk_file_chooser_default_set_property (GObject *object,
break;
case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
- impl->preview_widget_active = g_value_get_boolean (value);
+ impl->priv->preview_widget_active = g_value_get_boolean (value);
update_preview_widget_visibility (impl);
break;
case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
- impl->use_preview_label = g_value_get_boolean (value);
+ impl->priv->use_preview_label = g_value_get_boolean (value);
update_preview_widget_visibility (impl);
break;
@@ -5604,8 +4900,8 @@ gtk_file_chooser_default_set_property (GObject *object,
case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
{
gboolean select_multiple = g_value_get_boolean (value);
- if ((impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ if ((impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
&& select_multiple)
{
g_warning ("Tried to set the file chooser to multiple selection mode, but this is "
@@ -5621,12 +4917,12 @@ gtk_file_chooser_default_set_property (GObject *object,
case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
{
gboolean show_hidden = g_value_get_boolean (value);
- if (show_hidden != impl->show_hidden)
+ if (show_hidden != impl->priv->show_hidden)
{
- impl->show_hidden = show_hidden;
+ impl->priv->show_hidden = show_hidden;
- if (impl->browse_files_model)
- _gtk_file_system_model_set_show_hidden (impl->browse_files_model, show_hidden);
+ if (impl->priv->browse_files_model)
+ _gtk_file_system_model_set_show_hidden (impl->priv->browse_files_model, show_hidden);
}
}
break;
@@ -5634,14 +4930,14 @@ gtk_file_chooser_default_set_property (GObject *object,
case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION:
{
gboolean do_overwrite_confirmation = g_value_get_boolean (value);
- impl->do_overwrite_confirmation = do_overwrite_confirmation;
+ impl->priv->do_overwrite_confirmation = do_overwrite_confirmation;
}
break;
case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
{
gboolean create_folders = g_value_get_boolean (value);
- impl->create_folders = create_folders;
+ impl->priv->create_folders = create_folders;
update_appearance (impl);
}
break;
@@ -5663,47 +4959,47 @@ gtk_file_chooser_default_get_property (GObject *object,
switch (prop_id)
{
case GTK_FILE_CHOOSER_PROP_ACTION:
- g_value_set_enum (value, impl->action);
+ g_value_set_enum (value, impl->priv->action);
break;
case GTK_FILE_CHOOSER_PROP_FILTER:
- g_value_set_object (value, impl->current_filter);
+ g_value_set_object (value, impl->priv->current_filter);
break;
case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY:
- g_value_set_boolean (value, impl->local_only);
+ g_value_set_boolean (value, impl->priv->local_only);
break;
case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET:
- g_value_set_object (value, impl->preview_widget);
+ g_value_set_object (value, impl->priv->preview_widget);
break;
case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
- g_value_set_boolean (value, impl->preview_widget_active);
+ g_value_set_boolean (value, impl->priv->preview_widget_active);
break;
case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
- g_value_set_boolean (value, impl->use_preview_label);
+ g_value_set_boolean (value, impl->priv->use_preview_label);
break;
case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET:
- g_value_set_object (value, impl->extra_widget);
+ g_value_set_object (value, impl->priv->extra_widget);
break;
case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
- g_value_set_boolean (value, impl->select_multiple);
+ g_value_set_boolean (value, impl->priv->select_multiple);
break;
case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
- g_value_set_boolean (value, impl->show_hidden);
+ g_value_set_boolean (value, impl->priv->show_hidden);
break;
case GTK_FILE_CHOOSER_PROP_DO_OVERWRITE_CONFIRMATION:
- g_value_set_boolean (value, impl->do_overwrite_confirmation);
+ g_value_set_boolean (value, impl->priv->do_overwrite_confirmation);
break;
case GTK_FILE_CHOOSER_PROP_CREATE_FOLDERS:
- g_value_set_boolean (value, impl->create_folders);
+ g_value_set_boolean (value, impl->priv->create_folders);
break;
default:
@@ -5720,62 +5016,62 @@ cancel_all_operations (GtkFileChooserDefault *impl)
pending_select_files_free (impl);
- if (impl->reload_icon_cancellables)
+ if (impl->priv->reload_icon_cancellables)
{
- for (l = impl->reload_icon_cancellables; l; l = l->next)
+ for (l = impl->priv->reload_icon_cancellables; l; l = l->next)
{
GCancellable *cancellable = G_CANCELLABLE (l->data);
g_cancellable_cancel (cancellable);
}
- g_slist_free (impl->reload_icon_cancellables);
- impl->reload_icon_cancellables = NULL;
+ g_slist_free (impl->priv->reload_icon_cancellables);
+ impl->priv->reload_icon_cancellables = NULL;
}
- if (impl->loading_shortcuts)
+ if (impl->priv->loading_shortcuts)
{
- for (l = impl->loading_shortcuts; l; l = l->next)
+ for (l = impl->priv->loading_shortcuts; l; l = l->next)
{
GCancellable *cancellable = G_CANCELLABLE (l->data);
g_cancellable_cancel (cancellable);
}
- g_slist_free (impl->loading_shortcuts);
- impl->loading_shortcuts = NULL;
+ g_slist_free (impl->priv->loading_shortcuts);
+ impl->priv->loading_shortcuts = NULL;
}
- if (impl->file_list_drag_data_received_cancellable)
+ if (impl->priv->file_list_drag_data_received_cancellable)
{
- g_cancellable_cancel (impl->file_list_drag_data_received_cancellable);
- impl->file_list_drag_data_received_cancellable = NULL;
+ g_cancellable_cancel (impl->priv->file_list_drag_data_received_cancellable);
+ impl->priv->file_list_drag_data_received_cancellable = NULL;
}
- if (impl->update_current_folder_cancellable)
+ if (impl->priv->update_current_folder_cancellable)
{
- g_cancellable_cancel (impl->update_current_folder_cancellable);
- impl->update_current_folder_cancellable = NULL;
+ g_cancellable_cancel (impl->priv->update_current_folder_cancellable);
+ impl->priv->update_current_folder_cancellable = NULL;
}
- if (impl->should_respond_get_info_cancellable)
+ if (impl->priv->should_respond_get_info_cancellable)
{
- g_cancellable_cancel (impl->should_respond_get_info_cancellable);
- impl->should_respond_get_info_cancellable = NULL;
+ g_cancellable_cancel (impl->priv->should_respond_get_info_cancellable);
+ impl->priv->should_respond_get_info_cancellable = NULL;
}
- if (impl->file_exists_get_info_cancellable)
+ if (impl->priv->file_exists_get_info_cancellable)
{
- g_cancellable_cancel (impl->file_exists_get_info_cancellable);
- impl->file_exists_get_info_cancellable = NULL;
+ g_cancellable_cancel (impl->priv->file_exists_get_info_cancellable);
+ impl->priv->file_exists_get_info_cancellable = NULL;
}
- if (impl->update_from_entry_cancellable)
+ if (impl->priv->update_from_entry_cancellable)
{
- g_cancellable_cancel (impl->update_from_entry_cancellable);
- impl->update_from_entry_cancellable = NULL;
+ g_cancellable_cancel (impl->priv->update_from_entry_cancellable);
+ impl->priv->update_from_entry_cancellable = NULL;
}
- if (impl->shortcuts_activate_iter_cancellable)
+ if (impl->priv->shortcuts_activate_iter_cancellable)
{
- g_cancellable_cancel (impl->shortcuts_activate_iter_cancellable);
- impl->shortcuts_activate_iter_cancellable = NULL;
+ g_cancellable_cancel (impl->priv->shortcuts_activate_iter_cancellable);
+ impl->priv->shortcuts_activate_iter_cancellable = NULL;
}
search_stop_searching (impl, TRUE);
@@ -5787,14 +5083,14 @@ static void
remove_settings_signal (GtkFileChooserDefault *impl,
GdkScreen *screen)
{
- if (impl->settings_signal_id)
+ if (impl->priv->settings_signal_id)
{
GtkSettings *settings;
settings = gtk_settings_get_for_screen (screen);
g_signal_handler_disconnect (settings,
- impl->settings_signal_id);
- impl->settings_signal_id = 0;
+ impl->priv->settings_signal_id);
+ impl->priv->settings_signal_id = 0;
}
}
@@ -5805,10 +5101,12 @@ gtk_file_chooser_default_dispose (GObject *object)
cancel_all_operations (impl);
- if (impl->extra_widget)
+ shortcuts_free (impl);
+
+ if (impl->priv->extra_widget)
{
- g_object_unref (impl->extra_widget);
- impl->extra_widget = NULL;
+ g_object_unref (impl->priv->extra_widget);
+ impl->priv->extra_widget = NULL;
}
remove_settings_signal (impl, gtk_widget_get_screen (GTK_WIDGET (impl)));
@@ -5827,8 +5125,8 @@ gtk_file_chooser_default_show_all (GtkWidget *widget)
gtk_widget_show (widget);
- if (impl->extra_widget)
- gtk_widget_show_all (impl->extra_widget);
+ if (impl->priv->extra_widget)
+ gtk_widget_show_all (impl->priv->extra_widget);
}
/* Handler for GtkWindow::set-focus; this is where we save the last-focused
@@ -5839,7 +5137,7 @@ toplevel_set_focus_cb (GtkWindow *window,
GtkWidget *focus,
GtkFileChooserDefault *impl)
{
- impl->toplevel_last_focus_widget = gtk_window_get_focus (window);
+ impl->priv->toplevel_last_focus_widget = gtk_window_get_focus (window);
}
/* We monitor the focus widget on our toplevel to be able to know which widget
@@ -5856,20 +5154,20 @@ gtk_file_chooser_default_hierarchy_changed (GtkWidget *widget,
toplevel = gtk_widget_get_toplevel (widget);
if (previous_toplevel &&
- impl->toplevel_set_focus_id != 0)
+ impl->priv->toplevel_set_focus_id != 0)
{
g_signal_handler_disconnect (previous_toplevel,
- impl->toplevel_set_focus_id);
- impl->toplevel_set_focus_id = 0;
- impl->toplevel_last_focus_widget = NULL;
+ impl->priv->toplevel_set_focus_id);
+ impl->priv->toplevel_set_focus_id = 0;
+ impl->priv->toplevel_last_focus_widget = NULL;
}
if (gtk_widget_is_toplevel (toplevel))
{
- g_assert (impl->toplevel_set_focus_id == 0);
- impl->toplevel_set_focus_id = g_signal_connect (toplevel, "set-focus",
+ g_assert (impl->priv->toplevel_set_focus_id == 0);
+ impl->priv->toplevel_set_focus_id = g_signal_connect (toplevel, "set-focus",
G_CALLBACK (toplevel_set_focus_cb), impl);
- impl->toplevel_last_focus_widget = gtk_window_get_focus (GTK_WINDOW (toplevel));
+ impl->priv->toplevel_last_focus_widget = gtk_window_get_focus (GTK_WINDOW (toplevel));
}
}
@@ -5879,28 +5177,26 @@ change_icon_theme (GtkFileChooserDefault *impl)
{
GtkSettings *settings;
gint width, height;
- GtkCellRenderer *renderer;
- GList *cells;
profile_start ("start", NULL);
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
if (gtk_icon_size_lookup_for_settings (settings, GTK_ICON_SIZE_MENU, &width, &height))
- impl->icon_size = MAX (width, height);
+ impl->priv->icon_size = MAX (width, height);
else
- impl->icon_size = FALLBACK_ICON_SIZE;
+ impl->priv->icon_size = FALLBACK_ICON_SIZE;
shortcuts_reload_icons (impl);
- /* the first cell in the first column is the icon column, and we have a fixed size there */
- cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (
- gtk_tree_view_get_column (GTK_TREE_VIEW (impl->browse_files_tree_view), 0)));
- renderer = GTK_CELL_RENDERER (cells->data);
- set_icon_cell_renderer_fixed_size (impl, renderer);
- g_list_free (cells);
- if (impl->browse_files_model)
- _gtk_file_system_model_clear_cache (impl->browse_files_model, MODEL_COL_PIXBUF);
- gtk_widget_queue_resize (impl->browse_files_tree_view);
+
+ /* the first cell in the first column is the icon column,
+ * and we have a fixed size there
+ */
+ set_icon_cell_renderer_fixed_size (impl);
+
+ if (impl->priv->browse_files_model)
+ _gtk_file_system_model_clear_cache (impl->priv->browse_files_model, MODEL_COL_PIXBUF);
+ gtk_widget_queue_resize (impl->priv->browse_files_tree_view);
profile_end ("end", NULL);
}
@@ -5934,7 +5230,7 @@ check_icon_theme (GtkFileChooserDefault *impl)
profile_start ("start", NULL);
- if (impl->settings_signal_id)
+ if (impl->priv->settings_signal_id)
{
profile_end ("end", NULL);
return;
@@ -5943,7 +5239,7 @@ check_icon_theme (GtkFileChooserDefault *impl)
if (gtk_widget_has_screen (GTK_WIDGET (impl)))
{
settings = gtk_settings_get_for_screen (gtk_widget_get_screen (GTK_WIDGET (impl)));
- impl->settings_signal_id = g_signal_connect (settings, "notify",
+ impl->priv->settings_signal_id = g_signal_connect (settings, "notify",
G_CALLBACK (settings_notify_cb), impl);
change_icon_theme (impl);
@@ -5999,15 +5295,15 @@ set_sort_column (GtkFileChooserDefault *impl)
{
GtkTreeSortable *sortable;
- sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)));
+ sortable = GTK_TREE_SORTABLE (gtk_tree_view_get_model (GTK_TREE_VIEW
(impl->priv->browse_files_tree_view)));
/* can happen when we're still populating the model */
if (sortable == NULL)
return;
gtk_tree_sortable_set_sort_column_id (sortable,
- impl->sort_column,
- impl->sort_order);
+ impl->priv->sort_column,
+ impl->priv->sort_order);
}
static void
@@ -6034,17 +5330,17 @@ settings_load (GtkFileChooserDefault *impl)
gtk_file_chooser_set_show_hidden (GTK_FILE_CHOOSER (impl), show_hidden);
- impl->show_size_column = show_size_column;
- gtk_tree_view_column_set_visible (impl->list_size_column, show_size_column);
+ impl->priv->show_size_column = show_size_column;
+ gtk_tree_view_column_set_visible (impl->priv->list_size_column, show_size_column);
- impl->sort_column = sort_column;
- impl->sort_order = sort_order;
+ impl->priv->sort_column = sort_column;
+ impl->priv->sort_order = sort_order;
/* We don't call set_sort_column() here as the models may not have been
* created yet. The individual functions that create and set the models will
* call set_sort_column() themselves.
*/
- gtk_paned_set_position (GTK_PANED (impl->browse_widgets_hpaned), sidebar_width);
+ gtk_paned_set_position (GTK_PANED (impl->priv->browse_widgets_hpaned), sidebar_width);
}
static void
@@ -6056,14 +5352,14 @@ settings_save (GtkFileChooserDefault *impl)
/* All the other state */
- g_settings_set_enum (settings, SETTINGS_KEY_LOCATION_MODE, impl->location_mode);
+ g_settings_set_enum (settings, SETTINGS_KEY_LOCATION_MODE, impl->priv->location_mode);
g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_HIDDEN,
gtk_file_chooser_get_show_hidden (GTK_FILE_CHOOSER (impl)));
- g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_SIZE_COLUMN, impl->show_size_column);
- g_settings_set_enum (settings, SETTINGS_KEY_SORT_COLUMN, impl->sort_column);
- g_settings_set_enum (settings, SETTINGS_KEY_SORT_ORDER, impl->sort_order);
+ g_settings_set_boolean (settings, SETTINGS_KEY_SHOW_SIZE_COLUMN, impl->priv->show_size_column);
+ g_settings_set_enum (settings, SETTINGS_KEY_SORT_COLUMN, impl->priv->sort_column);
+ g_settings_set_enum (settings, SETTINGS_KEY_SORT_ORDER, impl->priv->sort_order);
g_settings_set_int (settings, SETTINGS_KEY_SIDEBAR_WIDTH,
- gtk_paned_get_position (GTK_PANED (impl->browse_widgets_hpaned)));
+ gtk_paned_get_position (GTK_PANED (impl->priv->browse_widgets_hpaned)));
/* Now apply the settings */
g_settings_apply (settings);
@@ -6094,9 +5390,9 @@ gtk_file_chooser_default_map (GtkWidget *widget)
GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->map (widget);
- if (impl->operation_mode == OPERATION_MODE_BROWSE)
+ if (impl->priv->operation_mode == OPERATION_MODE_BROWSE)
{
- switch (impl->reload_state)
+ switch (impl->priv->reload_state)
{
case RELOAD_EMPTY:
recent_shortcut_handler (impl);
@@ -6113,7 +5409,7 @@ gtk_file_chooser_default_map (GtkWidget *widget)
}
}
- volumes_bookmarks_changed_cb (impl->file_system, impl);
+ volumes_bookmarks_changed_cb (impl->priv->file_system, impl);
settings_load (impl);
@@ -6131,7 +5427,7 @@ gtk_file_chooser_default_unmap (GtkWidget *widget)
settings_save (impl);
cancel_all_operations (impl);
- impl->reload_state = RELOAD_EMPTY;
+ impl->priv->reload_state = RELOAD_EMPTY;
GTK_WIDGET_CLASS (_gtk_file_chooser_default_parent_class)->unmap (widget);
}
@@ -6145,7 +5441,7 @@ gtk_file_chooser_default_unmap (GtkWidget *widget)
dir_b = g_value_get_boolean (_gtk_file_system_model_get_value (fs_model, b, MODEL_COL_IS_FOLDER));
\
\
if (dir_a != dir_b)
\
- return impl->list_sort_ascending ? (dir_a ? -1 : 1) : (dir_a ? 1 : -1) /* Directories *always* go first
*/
+ return impl->priv->list_sort_ascending ? (dir_a ? -1 : 1) : (dir_a ? 1 : -1) /* Directories *always* go
first */
/* Sort callback for the filename column */
static gint
@@ -6226,9 +5522,9 @@ list_sort_column_changed_cb (GtkTreeSortable *sortable,
if (gtk_tree_sortable_get_sort_column_id (sortable, &sort_column_id, &sort_type))
{
- impl->list_sort_ascending = (sort_type == GTK_SORT_ASCENDING);
- impl->sort_column = sort_column_id;
- impl->sort_order = sort_type;
+ impl->priv->list_sort_ascending = (sort_type == GTK_SORT_ASCENDING);
+ impl->priv->sort_column = sort_column_id;
+ impl->priv->sort_order = sort_type;
}
}
@@ -6266,18 +5562,18 @@ load_set_model (GtkFileChooserDefault *impl)
{
profile_start ("start", NULL);
- g_assert (impl->browse_files_model != NULL);
+ g_assert (impl->priv->browse_files_model != NULL);
profile_msg (" gtk_tree_view_set_model start", NULL);
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
- GTK_TREE_MODEL (impl->browse_files_model));
- gtk_tree_view_columns_autosize (GTK_TREE_VIEW (impl->browse_files_tree_view));
- gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->priv->browse_files_model));
+ gtk_tree_view_columns_autosize (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
MODEL_COL_NAME);
file_list_set_sort_column_ids (impl);
set_sort_column (impl);
profile_msg (" gtk_tree_view_set_model end", NULL);
- impl->list_sort_ascending = TRUE;
+ impl->priv->list_sort_ascending = TRUE;
profile_end ("end", NULL);
}
@@ -6291,12 +5587,12 @@ load_timeout_cb (gpointer data)
profile_start ("start", NULL);
impl = GTK_FILE_CHOOSER_DEFAULT (data);
- g_assert (impl->load_state == LOAD_PRELOAD);
- g_assert (impl->load_timeout_id != 0);
- g_assert (impl->browse_files_model != NULL);
+ g_assert (impl->priv->load_state == LOAD_PRELOAD);
+ g_assert (impl->priv->load_timeout_id != 0);
+ g_assert (impl->priv->browse_files_model != NULL);
- impl->load_timeout_id = 0;
- impl->load_state = LOAD_LOADING;
+ impl->priv->load_timeout_id = 0;
+ impl->priv->load_state = LOAD_LOADING;
load_set_model (impl);
@@ -6309,33 +5605,33 @@ load_timeout_cb (gpointer data)
static void
load_setup_timer (GtkFileChooserDefault *impl)
{
- g_assert (impl->load_timeout_id == 0);
- g_assert (impl->load_state != LOAD_PRELOAD);
+ g_assert (impl->priv->load_timeout_id == 0);
+ g_assert (impl->priv->load_state != LOAD_PRELOAD);
- impl->load_timeout_id = gdk_threads_add_timeout (MAX_LOADING_TIME, load_timeout_cb, impl);
- impl->load_state = LOAD_PRELOAD;
+ impl->priv->load_timeout_id = gdk_threads_add_timeout (MAX_LOADING_TIME, load_timeout_cb, impl);
+ impl->priv->load_state = LOAD_PRELOAD;
}
-/* Removes the load timeout; changes the impl->load_state to the specified value. */
+/* Removes the load timeout; changes the impl->priv->load_state to the specified value. */
static void
load_remove_timer (GtkFileChooserDefault *impl, LoadState new_load_state)
{
- if (impl->load_timeout_id != 0)
+ if (impl->priv->load_timeout_id != 0)
{
- g_assert (impl->load_state == LOAD_PRELOAD);
+ g_assert (impl->priv->load_state == LOAD_PRELOAD);
- g_source_remove (impl->load_timeout_id);
- impl->load_timeout_id = 0;
+ g_source_remove (impl->priv->load_timeout_id);
+ impl->priv->load_timeout_id = 0;
}
else
- g_assert (impl->load_state == LOAD_EMPTY ||
- impl->load_state == LOAD_LOADING ||
- impl->load_state == LOAD_FINISHED);
+ g_assert (impl->priv->load_state == LOAD_EMPTY ||
+ impl->priv->load_state == LOAD_LOADING ||
+ impl->priv->load_state == LOAD_FINISHED);
g_assert (new_load_state == LOAD_EMPTY ||
new_load_state == LOAD_LOADING ||
new_load_state == LOAD_FINISHED);
- impl->load_state = new_load_state;
+ impl->priv->load_state = new_load_state;
}
/* Selects the first row in the file list */
@@ -6346,7 +5642,7 @@ browse_files_select_first_row (GtkFileChooserDefault *impl)
GtkTreeIter dummy_iter;
GtkTreeModel *tree_model;
- tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
if (!tree_model)
return;
@@ -6355,7 +5651,7 @@ browse_files_select_first_row (GtkFileChooserDefault *impl)
/* If the list is empty, do nothing. */
if (gtk_tree_model_get_iter (tree_model, &dummy_iter, path))
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), path, NULL, FALSE);
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), path, NULL, FALSE);
gtk_tree_path_free (path);
}
@@ -6380,7 +5676,7 @@ center_selected_row_foreach_cb (GtkTreeModel *model,
if (closure->already_centered)
return;
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (closure->impl->browse_files_tree_view), path, NULL, TRUE,
0.5, 0.0);
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (closure->impl->priv->browse_files_tree_view), path, NULL,
TRUE, 0.5, 0.0);
closure->already_centered = TRUE;
}
@@ -6394,7 +5690,7 @@ browse_files_center_selected_row (GtkFileChooserDefault *impl)
closure.impl = impl;
closure.already_centered = FALSE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, center_selected_row_foreach_cb, &closure);
}
@@ -6408,16 +5704,16 @@ show_and_select_files (GtkFileChooserDefault *impl,
gboolean selected_a_file;
GSList *walk;
- g_assert (impl->load_state == LOAD_FINISHED);
- g_assert (impl->browse_files_model != NULL);
+ g_assert (impl->priv->load_state == LOAD_FINISHED);
+ g_assert (impl->priv->browse_files_model != NULL);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
- fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view)));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
+ fsmodel = GTK_FILE_SYSTEM_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW
(impl->priv->browse_files_tree_view)));
- g_assert (fsmodel == impl->browse_files_model);
+ g_assert (fsmodel == impl->priv->browse_files_model);
- enabled_hidden = impl->show_hidden;
- removed_filters = (impl->current_filter == NULL);
+ enabled_hidden = impl->priv->show_hidden;
+ removed_filters = (impl->priv->current_filter == NULL);
selected_a_file = FALSE;
@@ -6471,7 +5767,7 @@ show_and_select_files (GtkFileChooserDefault *impl,
gtk_tree_selection_select_iter (selection, &iter);
path = gtk_tree_model_get_path (GTK_TREE_MODEL (fsmodel), &iter);
- gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
path, NULL, FALSE);
gtk_tree_path_free (path);
@@ -6488,12 +5784,12 @@ show_and_select_files (GtkFileChooserDefault *impl,
static void
pending_select_files_process (GtkFileChooserDefault *impl)
{
- g_assert (impl->load_state == LOAD_FINISHED);
- g_assert (impl->browse_files_model != NULL);
+ g_assert (impl->priv->load_state == LOAD_FINISHED);
+ g_assert (impl->priv->browse_files_model != NULL);
- if (impl->pending_select_files)
+ if (impl->priv->pending_select_files)
{
- show_and_select_files (impl, impl->pending_select_files);
+ show_and_select_files (impl, impl->priv->pending_select_files);
pending_select_files_free (impl);
browse_files_center_selected_row (impl);
}
@@ -6506,12 +5802,12 @@ pending_select_files_process (GtkFileChooserDefault *impl)
* that case, the chooser's selection should be what the caller expects,
* as the user can't see that something else got selected. See bug #165264.
*/
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN &&
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN &&
gtk_widget_get_mapped (GTK_WIDGET (impl)))
browse_files_select_first_row (impl);
}
- g_assert (impl->pending_select_files == NULL);
+ g_assert (impl->priv->pending_select_files == NULL);
}
static void
@@ -6520,7 +5816,7 @@ show_error_on_reading_current_folder (GtkFileChooserDefault *impl, GError *error
GFileInfo *info;
char *msg;
- info = g_file_query_info (impl->current_folder,
+ info = g_file_query_info (impl->priv->current_folder,
G_FILE_ATTRIBUTE_STANDARD_DISPLAY_NAME,
G_FILE_QUERY_INFO_NONE,
NULL,
@@ -6548,12 +5844,12 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
if (error)
show_error_on_reading_current_folder (impl, error);
- if (impl->load_state == LOAD_PRELOAD)
+ if (impl->priv->load_state == LOAD_PRELOAD)
{
load_remove_timer (impl, LOAD_FINISHED);
load_set_model (impl);
}
- else if (impl->load_state == LOAD_LOADING)
+ else if (impl->priv->load_state == LOAD_LOADING)
{
/* Nothing */
}
@@ -6566,9 +5862,9 @@ browse_files_model_finished_loading_cb (GtkFileSystemModel *model,
return;
}
- g_assert (impl->load_timeout_id == 0);
+ g_assert (impl->priv->load_timeout_id == 0);
- impl->load_state = LOAD_FINISHED;
+ impl->priv->load_state = LOAD_FINISHED;
pending_select_files_process (impl);
set_busy_cursor (impl, FALSE);
@@ -6585,14 +5881,14 @@ stop_loading_and_clear_list_model (GtkFileChooserDefault *impl,
{
load_remove_timer (impl, LOAD_EMPTY);
- if (impl->browse_files_model)
+ if (impl->priv->browse_files_model)
{
- g_object_unref (impl->browse_files_model);
- impl->browse_files_model = NULL;
+ g_object_unref (impl->priv->browse_files_model);
+ impl->priv->browse_files_model = NULL;
}
if (remove_from_treeview)
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), NULL);
}
static char *
@@ -6779,8 +6075,8 @@ file_system_model_set (GtkFileSystemModel *model,
{
gboolean sensitive = TRUE;
- if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
+ if (!(impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
{
sensitive = TRUE; /* for file modes... */
}
@@ -6807,7 +6103,7 @@ file_system_model_set (GtkFileSystemModel *model,
{
if (g_file_info_has_attribute (info, G_FILE_ATTRIBUTE_STANDARD_ICON))
{
- g_value_take_object (value, _gtk_file_info_render_icon (info, GTK_WIDGET (impl),
impl->icon_size));
+ g_value_take_object (value, _gtk_file_info_render_icon (info, GTK_WIDGET (impl),
impl->priv->icon_size));
}
else
{
@@ -6815,11 +6111,11 @@ file_system_model_set (GtkFileSystemModel *model,
GtkTreePath *path, *start, *end;
GtkTreeIter iter;
- if (impl->browse_files_tree_view == NULL ||
+ if (impl->priv->browse_files_tree_view == NULL ||
g_file_info_has_attribute (info, "filechooser::queried"))
return FALSE;
- tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ tree_model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
if (tree_model != GTK_TREE_MODEL (model))
return FALSE;
@@ -6827,7 +6123,7 @@ file_system_model_set (GtkFileSystemModel *model,
&iter,
file))
g_assert_not_reached ();
- if (!gtk_tree_view_get_visible_range (GTK_TREE_VIEW (impl->browse_files_tree_view), &start,
&end))
+ if (!gtk_tree_view_get_visible_range (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
&start, &end))
return FALSE;
path = gtk_tree_model_get_path (tree_model, &iter);
if (gtk_tree_path_compare (start, path) != 1 &&
@@ -6893,7 +6189,7 @@ static gboolean
set_list_model (GtkFileChooserDefault *impl,
GError **error)
{
- g_assert (impl->current_folder != NULL);
+ g_assert (impl->priv->current_folder != NULL);
profile_start ("start", NULL);
@@ -6901,31 +6197,31 @@ set_list_model (GtkFileChooserDefault *impl,
set_busy_cursor (impl, TRUE);
- impl->browse_files_model =
- _gtk_file_system_model_new_for_directory (impl->current_folder,
+ impl->priv->browse_files_model =
+ _gtk_file_system_model_new_for_directory (impl->priv->current_folder,
MODEL_ATTRIBUTES,
file_system_model_set,
impl,
MODEL_COLUMN_TYPES);
- _gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden);
+ _gtk_file_system_model_set_show_hidden (impl->priv->browse_files_model, impl->priv->show_hidden);
profile_msg (" set sort function", NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_NAME,
name_sort_func, impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_SIZE,
size_sort_func, impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), MODEL_COL_MTIME,
mtime_sort_func, impl, NULL);
- gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (impl->browse_files_model), NULL, NULL, NULL);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->browse_files_model), MODEL_COL_NAME,
name_sort_func, impl, NULL);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->browse_files_model), MODEL_COL_SIZE,
size_sort_func, impl, NULL);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->browse_files_model), MODEL_COL_MTIME,
mtime_sort_func, impl, NULL);
+ gtk_tree_sortable_set_default_sort_func (GTK_TREE_SORTABLE (impl->priv->browse_files_model), NULL, NULL,
NULL);
set_sort_column (impl);
- impl->list_sort_ascending = TRUE;
- g_signal_connect (impl->browse_files_model, "sort-column-changed",
+ impl->priv->list_sort_ascending = TRUE;
+ g_signal_connect (impl->priv->browse_files_model, "sort-column-changed",
G_CALLBACK (list_sort_column_changed_cb), impl);
load_setup_timer (impl); /* This changes the state to LOAD_PRELOAD */
- g_signal_connect (impl->browse_files_model, "finished-loading",
+ g_signal_connect (impl->priv->browse_files_model, "finished-loading",
G_CALLBACK (browse_files_model_finished_loading_cb), impl);
- _gtk_file_system_model_set_filter (impl->browse_files_model, impl->current_filter);
+ _gtk_file_system_model_set_filter (impl->priv->browse_files_model, impl->priv->current_filter);
profile_end ("end", NULL);
@@ -6977,38 +6273,38 @@ update_chooser_entry (GtkFileChooserDefault *impl)
struct update_chooser_entry_selected_foreach_closure closure;
/* no need to update the file chooser's entry if there's no entry */
- if (impl->operation_mode == OPERATION_MODE_SEARCH ||
- !impl->location_entry)
+ if (impl->priv->operation_mode == OPERATION_MODE_SEARCH ||
+ !impl->priv->location_entry)
return;
- if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
- || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
- || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)))
+ if (!(impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+ || ((impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ && impl->priv->location_mode == LOCATION_MODE_FILENAME_ENTRY)))
return;
- g_assert (impl->location_entry != NULL);
+ g_assert (impl->priv->location_entry != NULL);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
closure.num_selected = 0;
gtk_tree_selection_selected_foreach (selection, update_chooser_entry_selected_foreach, &closure);
if (closure.num_selected == 0)
{
- if (impl->operation_mode == OPERATION_MODE_RECENT)
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), NULL);
+ if (impl->priv->operation_mode == OPERATION_MODE_RECENT)
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry), NULL);
else
goto maybe_clear_entry;
}
else if (closure.num_selected == 1)
{
- if (impl->operation_mode == OPERATION_MODE_BROWSE)
+ if (impl->priv->operation_mode == OPERATION_MODE_BROWSE)
{
GFileInfo *info;
gboolean change_entry;
- info = _gtk_file_system_model_get_info (impl->browse_files_model, &closure.first_selected_iter);
+ info = _gtk_file_system_model_get_info (impl->priv->browse_files_model,
&closure.first_selected_iter);
/* If the cursor moved to the row of the newly created folder,
* retrieving info will return NULL.
@@ -7016,13 +6312,13 @@ update_chooser_entry (GtkFileChooserDefault *impl)
if (!info)
return;
- g_free (impl->browse_files_last_selected_name);
- impl->browse_files_last_selected_name =
+ g_free (impl->priv->browse_files_last_selected_name);
+ impl->priv->browse_files_last_selected_name =
g_strdup (g_file_info_get_display_name (info));
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
/* Don't change the name when clicking on a folder... */
change_entry = (! _gtk_file_info_consider_as_directory (info));
@@ -7032,52 +6328,52 @@ update_chooser_entry (GtkFileChooserDefault *impl)
if (change_entry)
{
- gtk_entry_set_text (GTK_ENTRY (impl->location_entry), impl->browse_files_last_selected_name);
+ gtk_entry_set_text (GTK_ENTRY (impl->priv->location_entry),
impl->priv->browse_files_last_selected_name);
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
- _gtk_file_chooser_entry_select_filename (GTK_FILE_CHOOSER_ENTRY (impl->location_entry));
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ _gtk_file_chooser_entry_select_filename (GTK_FILE_CHOOSER_ENTRY
(impl->priv->location_entry));
}
return;
}
- else if (impl->operation_mode == OPERATION_MODE_RECENT
- && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (impl->priv->operation_mode == OPERATION_MODE_RECENT
+ && impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
GFile *folder;
/* Set the base folder on the name entry, so it will do completion relative to the correct
recent-folder */
- gtk_tree_model_get (GTK_TREE_MODEL (impl->recent_model), &closure.first_selected_iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->recent_model), &closure.first_selected_iter,
MODEL_COL_FILE, &folder,
-1);
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), folder);
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry),
folder);
g_object_unref (folder);
return;
}
}
else
{
- g_assert (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER));
+ g_assert (!(impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER));
/* Multiple selection, so just clear the entry. */
- g_free (impl->browse_files_last_selected_name);
- impl->browse_files_last_selected_name = NULL;
+ g_free (impl->priv->browse_files_last_selected_name);
+ impl->priv->browse_files_last_selected_name = NULL;
- gtk_entry_set_text (GTK_ENTRY (impl->location_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (impl->priv->location_entry), "");
return;
}
maybe_clear_entry:
- if ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- && impl->browse_files_last_selected_name)
+ if ((impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN || impl->priv->action ==
GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ && impl->priv->browse_files_last_selected_name)
{
const char *entry_text;
int len;
gboolean clear_entry;
- entry_text = gtk_entry_get_text (GTK_ENTRY (impl->location_entry));
+ entry_text = gtk_entry_get_text (GTK_ENTRY (impl->priv->location_entry));
len = strlen (entry_text);
if (len != 0)
{
@@ -7089,17 +6385,17 @@ update_chooser_entry (GtkFileChooserDefault *impl)
gchar *tmp;
tmp = g_strndup (entry_text, len - 1);
- clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, tmp) == 0);
+ clear_entry = (compare_utf8_filenames (impl->priv->browse_files_last_selected_name, tmp) == 0);
g_free (tmp);
}
else
- clear_entry = (compare_utf8_filenames (impl->browse_files_last_selected_name, entry_text) == 0);
+ clear_entry = (compare_utf8_filenames (impl->priv->browse_files_last_selected_name, entry_text)
== 0);
}
else
clear_entry = FALSE;
if (clear_entry)
- gtk_entry_set_text (GTK_ENTRY (impl->location_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (impl->priv->location_entry), "");
}
}
@@ -7132,10 +6428,10 @@ update_current_folder_mount_enclosing_volume_cb (GCancellable *cancellabl
struct UpdateCurrentFolderData *data = user_data;
GtkFileChooserDefault *impl = data->impl;
- if (cancellable != impl->update_current_folder_cancellable)
+ if (cancellable != impl->priv->update_current_folder_cancellable)
goto out;
- impl->update_current_folder_cancellable = NULL;
+ impl->priv->update_current_folder_cancellable = NULL;
set_busy_cursor (impl, FALSE);
if (cancelled)
@@ -7144,7 +6440,7 @@ update_current_folder_mount_enclosing_volume_cb (GCancellable *cancellabl
if (error)
{
error_changing_folder_dialog (data->impl, data->file, g_error_copy (error));
- impl->reload_state = RELOAD_EMPTY;
+ impl->priv->reload_state = RELOAD_EMPTY;
goto out;
}
@@ -7167,11 +6463,11 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
struct UpdateCurrentFolderData *data = user_data;
GtkFileChooserDefault *impl = data->impl;
- if (cancellable != impl->update_current_folder_cancellable)
+ if (cancellable != impl->priv->update_current_folder_cancellable)
goto out;
- impl->update_current_folder_cancellable = NULL;
- impl->reload_state = RELOAD_EMPTY;
+ impl->priv->update_current_folder_cancellable = NULL;
+ impl->priv->reload_state = RELOAD_EMPTY;
set_busy_cursor (impl, FALSE);
@@ -7194,8 +6490,8 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
set_busy_cursor (impl, TRUE);
- impl->update_current_folder_cancellable =
- _gtk_file_system_mount_enclosing_volume (impl->file_system, data->file,
+ impl->priv->update_current_folder_cancellable =
+ _gtk_file_system_mount_enclosing_volume (impl->priv->file_system, data->file,
mount_operation,
update_current_folder_mount_enclosing_volume_cb,
data);
@@ -7220,10 +6516,10 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
g_object_unref (cancellable);
/* restart the update current folder operation */
- impl->reload_state = RELOAD_HAS_FOLDER;
+ impl->priv->reload_state = RELOAD_HAS_FOLDER;
- impl->update_current_folder_cancellable =
- _gtk_file_system_get_info (impl->file_system, data->file,
+ impl->priv->update_current_folder_cancellable =
+ _gtk_file_system_get_info (impl->priv->file_system, data->file,
"standard::type",
update_current_folder_get_info_cb,
data);
@@ -7264,38 +6560,38 @@ update_current_folder_get_info_cb (GCancellable *cancellable,
if (! _gtk_file_info_consider_as_directory (info))
goto out;
- _gtk_path_bar_set_file (GTK_PATH_BAR (impl->browse_path_bar), data->file, data->keep_trail);
+ _gtk_path_bar_set_file (GTK_PATH_BAR (impl->priv->browse_path_bar), data->file, data->keep_trail);
- if (impl->current_folder != data->file)
+ if (impl->priv->current_folder != data->file)
{
- if (impl->current_folder)
- g_object_unref (impl->current_folder);
+ if (impl->priv->current_folder)
+ g_object_unref (impl->priv->current_folder);
- impl->current_folder = g_object_ref (data->file);
+ impl->priv->current_folder = g_object_ref (data->file);
}
- impl->reload_state = RELOAD_HAS_FOLDER;
+ impl->priv->reload_state = RELOAD_HAS_FOLDER;
/* Update the widgets that may trigger a folder change themselves. */
- if (!impl->changing_folder)
+ if (!impl->priv->changing_folder)
{
- impl->changing_folder = TRUE;
+ impl->priv->changing_folder = TRUE;
shortcuts_update_current_folder (impl);
- impl->changing_folder = FALSE;
+ impl->priv->changing_folder = FALSE;
}
/* Set the folder on the save entry */
- if (impl->location_entry)
+ if (impl->priv->location_entry)
{
- _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
- impl->current_folder);
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry),
+ impl->priv->current_folder);
if (data->clear_entry)
- gtk_entry_set_text (GTK_ENTRY (impl->location_entry), "");
+ gtk_entry_set_text (GTK_ENTRY (impl->priv->location_entry), "");
}
/* Create a new list model. This is slightly evil; we store the result value
@@ -7338,7 +6634,7 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser *chooser,
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- if (impl->local_only && !_gtk_file_has_native_path (file))
+ if (impl->priv->local_only && !_gtk_file_has_native_path (file))
{
g_set_error_literal (error,
GTK_FILE_CHOOSER_ERROR,
@@ -7350,8 +6646,8 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser *chooser,
return FALSE;
}
- if (impl->update_current_folder_cancellable)
- g_cancellable_cancel (impl->update_current_folder_cancellable);
+ if (impl->priv->update_current_folder_cancellable)
+ g_cancellable_cancel (impl->priv->update_current_folder_cancellable);
/* Test validity of path here. */
data = g_new0 (struct UpdateCurrentFolderData, 1);
@@ -7360,10 +6656,10 @@ gtk_file_chooser_default_update_current_folder (GtkFileChooser *chooser,
data->keep_trail = keep_trail;
data->clear_entry = clear_entry;
- impl->reload_state = RELOAD_HAS_FOLDER;
+ impl->priv->reload_state = RELOAD_HAS_FOLDER;
- impl->update_current_folder_cancellable =
- _gtk_file_system_get_info (impl->file_system, file,
+ impl->priv->update_current_folder_cancellable =
+ _gtk_file_system_get_info (impl->priv->file_system, file,
"standard::type",
update_current_folder_get_info_cb,
data);
@@ -7380,12 +6676,12 @@ gtk_file_chooser_default_get_current_folder (GtkFileChooser *chooser)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- if (impl->operation_mode == OPERATION_MODE_SEARCH ||
- impl->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->priv->operation_mode == OPERATION_MODE_SEARCH ||
+ impl->priv->operation_mode == OPERATION_MODE_RECENT)
return NULL;
- if (impl->current_folder)
- return g_object_ref (impl->current_folder);
+ if (impl->priv->current_folder)
+ return g_object_ref (impl->priv->current_folder);
return NULL;
}
@@ -7396,11 +6692,11 @@ gtk_file_chooser_default_set_current_name (GtkFileChooser *chooser,
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- g_return_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
+ g_return_if_fail (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
pending_select_files_free (impl);
- gtk_entry_set_text (GTK_ENTRY (impl->location_entry), name);
+ gtk_entry_set_text (GTK_ENTRY (impl->priv->location_entry), name);
}
static gboolean
@@ -7417,20 +6713,20 @@ gtk_file_chooser_default_select_file (GtkFileChooser *chooser,
if (!parent_file)
return gtk_file_chooser_set_current_folder_file (chooser, file, error);
- if (impl->operation_mode == OPERATION_MODE_SEARCH ||
- impl->operation_mode == OPERATION_MODE_RECENT ||
- impl->load_state == LOAD_EMPTY)
+ if (impl->priv->operation_mode == OPERATION_MODE_SEARCH ||
+ impl->priv->operation_mode == OPERATION_MODE_RECENT ||
+ impl->priv->load_state == LOAD_EMPTY)
{
same_path = FALSE;
}
else
{
- g_assert (impl->current_folder != NULL);
+ g_assert (impl->priv->current_folder != NULL);
- same_path = g_file_equal (parent_file, impl->current_folder);
+ same_path = g_file_equal (parent_file, impl->priv->current_folder);
}
- if (same_path && impl->load_state == LOAD_FINISHED)
+ if (same_path && impl->priv->load_state == LOAD_FINISHED)
{
gboolean result;
GSList files;
@@ -7463,13 +6759,13 @@ gtk_file_chooser_default_unselect_file (GtkFileChooser *chooser,
GFile *file)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- GtkTreeView *tree_view = GTK_TREE_VIEW (impl->browse_files_tree_view);
+ GtkTreeView *tree_view = GTK_TREE_VIEW (impl->priv->browse_files_tree_view);
GtkTreeIter iter;
- if (!impl->browse_files_model)
+ if (!impl->priv->browse_files_model)
return;
- if (!_gtk_file_system_model_get_iter_for_file (impl->browse_files_model,
+ if (!_gtk_file_system_model_get_iter_for_file (impl->priv->browse_files_model,
&iter,
file))
return;
@@ -7489,7 +6785,7 @@ maybe_select (GtkTreeModel *model,
gboolean is_sensitive;
gboolean is_folder;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_model_get (model, iter,
MODEL_COL_IS_FOLDER, &is_folder,
@@ -7497,8 +6793,8 @@ maybe_select (GtkTreeModel *model,
-1);
if (is_sensitive &&
- ((is_folder && impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) ||
- (!is_folder && impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)))
+ ((is_folder && impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) ||
+ (!is_folder && impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)))
gtk_tree_selection_select_iter (selection, iter);
else
gtk_tree_selection_unselect_iter (selection, iter);
@@ -7511,18 +6807,18 @@ gtk_file_chooser_default_select_all (GtkFileChooser *chooser)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- if (impl->operation_mode == OPERATION_MODE_SEARCH ||
- impl->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->priv->operation_mode == OPERATION_MODE_SEARCH ||
+ impl->priv->operation_mode == OPERATION_MODE_RECENT)
{
GtkTreeSelection *selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_select_all (selection);
return;
}
- if (impl->select_multiple)
- gtk_tree_model_foreach (GTK_TREE_MODEL (impl->browse_files_model),
+ if (impl->priv->select_multiple)
+ gtk_tree_model_foreach (GTK_TREE_MODEL (impl->priv->browse_files_model),
maybe_select, impl);
}
@@ -7530,7 +6826,7 @@ static void
gtk_file_chooser_default_unselect_all (GtkFileChooser *chooser)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW
(impl->priv->browse_files_tree_view));
gtk_tree_selection_unselect_all (selection);
pending_select_files_free (impl);
@@ -7559,13 +6855,13 @@ check_save_entry (GtkFileChooserDefault *impl,
GFile *file;
GError *error;
- g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
- || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
- || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY));
+ g_assert (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+ || ((impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ && impl->priv->location_mode == LOCATION_MODE_FILENAME_ENTRY));
- chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->location_entry);
+ chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry);
if (strlen (gtk_entry_get_text (GTK_ENTRY (chooser_entry))) == 0)
{
@@ -7641,7 +6937,7 @@ get_files_foreach (GtkTreeModel *model,
GtkFileSystemModel *fs_model;
info = data;
- fs_model = info->impl->browse_files_model;
+ fs_model = info->impl->priv->browse_files_model;
file = _gtk_file_system_model_get_file (fs_model, iter);
if (!file)
@@ -7664,12 +6960,12 @@ gtk_file_chooser_default_get_files (GtkFileChooser *chooser)
info.result = NULL;
info.file_from_entry = NULL;
- if (impl->operation_mode == OPERATION_MODE_SEARCH)
+ if (impl->priv->operation_mode == OPERATION_MODE_SEARCH)
return search_get_selected_files (impl);
- if (impl->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->priv->operation_mode == OPERATION_MODE_RECENT)
{
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
file_list_seen = TRUE;
goto file_entry;
@@ -7685,14 +6981,14 @@ gtk_file_chooser_default_get_files (GtkFileChooser *chooser)
current_focus = NULL;
file_list_seen = FALSE;
- if (current_focus == impl->browse_files_tree_view)
+ if (current_focus == impl->priv->browse_files_tree_view)
{
GtkTreeSelection *selection;
file_list:
file_list_seen = TRUE;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, get_files_foreach, &info);
/* If there is no selection in the file list, we probably have this situation:
@@ -7703,10 +6999,10 @@ gtk_file_chooser_default_get_files (GtkFileChooser *chooser)
* So we want the selection to be "bar/foo.txt". Jump to the case for the
* filename entry to see if that is the case.
*/
- if (info.result == NULL && impl->location_entry)
+ if (info.result == NULL && impl->priv->location_entry)
goto file_entry;
}
- else if (impl->location_entry && current_focus == impl->location_entry)
+ else if (impl->priv->location_entry && current_focus == impl->priv->location_entry)
{
gboolean is_well_formed, is_empty, is_file_part_empty, is_folder;
@@ -7720,7 +7016,7 @@ gtk_file_chooser_default_get_files (GtkFileChooser *chooser)
if (!is_well_formed)
return NULL;
- if (is_file_part_empty && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (is_file_part_empty && impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
g_object_unref (info.file_from_entry);
return NULL;
@@ -7733,15 +7029,15 @@ gtk_file_chooser_default_get_files (GtkFileChooser *chooser)
else
return NULL;
}
- else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
+ else if (impl->priv->toplevel_last_focus_widget == impl->priv->browse_files_tree_view)
goto file_list;
- else if (impl->location_entry && impl->toplevel_last_focus_widget == impl->location_entry)
+ else if (impl->priv->location_entry && impl->priv->toplevel_last_focus_widget ==
impl->priv->location_entry)
goto file_entry;
else
{
/* The focus is on a dialog's action area button or something else */
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
goto file_entry;
else
goto file_list;
@@ -7751,7 +7047,7 @@ gtk_file_chooser_default_get_files (GtkFileChooser *chooser)
/* If there's no folder selected, and we're in SELECT_FOLDER mode, then we
* fall back to the current directory */
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER &&
info.result == NULL)
{
GFile *current_folder;
@@ -7770,8 +7066,8 @@ gtk_file_chooser_default_get_preview_file (GtkFileChooser *chooser)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- if (impl->preview_file)
- return g_object_ref (impl->preview_file);
+ if (impl->priv->preview_file)
+ return g_object_ref (impl->priv->preview_file);
else
return NULL;
}
@@ -7781,7 +7077,7 @@ gtk_file_chooser_default_get_file_system (GtkFileChooser *chooser)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- return impl->file_system;
+ return impl->priv->file_system;
}
/* Shows or hides the filter widgets */
@@ -7790,9 +7086,9 @@ show_filters (GtkFileChooserDefault *impl,
gboolean show)
{
if (show)
- gtk_widget_show (impl->filter_combo_hbox);
+ gtk_widget_show (impl->priv->filter_combo_hbox);
else
- gtk_widget_hide (impl->filter_combo_hbox);
+ gtk_widget_hide (impl->priv->filter_combo_hbox);
}
static void
@@ -7802,22 +7098,22 @@ gtk_file_chooser_default_add_filter (GtkFileChooser *chooser,
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
const gchar *name;
- if (g_slist_find (impl->filters, filter))
+ if (g_slist_find (impl->priv->filters, filter))
{
g_warning ("gtk_file_chooser_add_filter() called on filter already in list\n");
return;
}
g_object_ref_sink (filter);
- impl->filters = g_slist_append (impl->filters, filter);
+ impl->priv->filters = g_slist_append (impl->priv->filters, filter);
name = gtk_file_filter_get_name (filter);
if (!name)
name = "Untitled filter"; /* Place-holder, doesn't need to be marked for translation */
- gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (impl->filter_combo), name);
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (impl->priv->filter_combo), name);
- if (!g_slist_find (impl->filters, impl->current_filter))
+ if (!g_slist_find (impl->priv->filters, impl->priv->current_filter))
set_current_filter (impl, filter);
show_filters (impl, TRUE);
@@ -7832,7 +7128,7 @@ gtk_file_chooser_default_remove_filter (GtkFileChooser *chooser,
GtkTreeIter iter;
gint filter_index;
- filter_index = g_slist_index (impl->filters, filter);
+ filter_index = g_slist_index (impl->priv->filters, filter);
if (filter_index < 0)
{
@@ -7840,18 +7136,18 @@ gtk_file_chooser_default_remove_filter (GtkFileChooser *chooser,
return;
}
- impl->filters = g_slist_remove (impl->filters, filter);
+ impl->priv->filters = g_slist_remove (impl->priv->filters, filter);
- if (filter == impl->current_filter)
+ if (filter == impl->priv->current_filter)
{
- if (impl->filters)
- set_current_filter (impl, impl->filters->data);
+ if (impl->priv->filters)
+ set_current_filter (impl, impl->priv->filters->data);
else
set_current_filter (impl, NULL);
}
/* Remove row from the combo box */
- model = gtk_combo_box_get_model (GTK_COMBO_BOX (impl->filter_combo));
+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (impl->priv->filter_combo));
if (!gtk_tree_model_iter_nth_child (model, &iter, NULL, filter_index))
g_assert_not_reached ();
@@ -7859,7 +7155,7 @@ gtk_file_chooser_default_remove_filter (GtkFileChooser *chooser,
g_object_unref (filter);
- if (!impl->filters)
+ if (!impl->priv->filters)
show_filters (impl, FALSE);
}
@@ -7868,7 +7164,7 @@ gtk_file_chooser_default_list_filters (GtkFileChooser *chooser)
{
GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
- return g_slist_copy (impl->filters);
+ return g_slist_copy (impl->priv->filters);
}
/* Returns the position in the shortcuts tree where the nth specified shortcut would appear */
@@ -7895,15 +7191,15 @@ add_shortcut_get_info_cb (GCancellable *cancellable,
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
struct AddShortcutData *data = user_data;
- if (!g_slist_find (data->impl->loading_shortcuts, cancellable))
+ if (!g_slist_find (data->impl->priv->loading_shortcuts, cancellable))
goto out;
- data->impl->loading_shortcuts = g_slist_remove (data->impl->loading_shortcuts, cancellable);
+ data->impl->priv->loading_shortcuts = g_slist_remove (data->impl->priv->loading_shortcuts, cancellable);
if (cancelled || error || (! _gtk_file_info_consider_as_directory (info)))
goto out;
- pos = shortcuts_get_pos_for_shortcut_folder (data->impl, data->impl->num_shortcuts);
+ pos = shortcuts_get_pos_for_shortcut_folder (data->impl, data->impl->priv->num_shortcuts);
shortcuts_insert_file (data->impl, pos, SHORTCUT_TYPE_FILE, NULL, data->file, NULL, FALSE,
SHORTCUTS_SHORTCUTS);
@@ -7947,7 +7243,7 @@ gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
return FALSE;
}
- for (l = impl->loading_shortcuts; l; l = l->next)
+ for (l = impl->priv->loading_shortcuts; l; l = l->next)
{
GCancellable *c = l->data;
GFile *f;
@@ -7973,14 +7269,14 @@ gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
data->impl = g_object_ref (impl);
data->file = g_object_ref (file);
- cancellable = _gtk_file_system_get_info (impl->file_system, file,
+ cancellable = _gtk_file_system_get_info (impl->priv->file_system, file,
"standard::type",
add_shortcut_get_info_cb, data);
if (!cancellable)
return FALSE;
- impl->loading_shortcuts = g_slist_append (impl->loading_shortcuts, cancellable);
+ impl->priv->loading_shortcuts = g_slist_append (impl->priv->loading_shortcuts, cancellable);
g_object_set_data (G_OBJECT (cancellable), "add-shortcut-path-key", data->file);
return TRUE;
@@ -7998,7 +7294,7 @@ gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser,
char *uri;
int i;
- for (l = impl->loading_shortcuts; l; l = l->next)
+ for (l = impl->priv->loading_shortcuts; l; l = l->next)
{
GCancellable *c = l->data;
GFile *f;
@@ -8006,26 +7302,26 @@ gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser,
f = g_object_get_data (G_OBJECT (c), "add-shortcut-path-key");
if (f && g_file_equal (file, f))
{
- impl->loading_shortcuts = g_slist_remove (impl->loading_shortcuts, c);
+ impl->priv->loading_shortcuts = g_slist_remove (impl->priv->loading_shortcuts, c);
g_cancellable_cancel (c);
return TRUE;
}
}
- if (impl->num_shortcuts == 0)
+ if (impl->priv->num_shortcuts == 0)
goto out;
pos = shortcuts_get_pos_for_shortcut_folder (impl, 0);
- if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos))
+ if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter, NULL, pos))
g_assert_not_reached ();
- for (i = 0; i < impl->num_shortcuts; i++)
+ for (i = 0; i < impl->priv->num_shortcuts; i++)
{
gpointer col_data;
ShortcutType shortcut_type;
GFile *shortcut;
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_DATA, &col_data,
SHORTCUTS_COL_TYPE, &shortcut_type,
-1);
@@ -8036,11 +7332,11 @@ gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser,
if (g_file_equal (shortcut, file))
{
shortcuts_remove_rows (impl, pos + i, 1);
- impl->num_shortcuts--;
+ impl->priv->num_shortcuts--;
return TRUE;
}
- if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
+ if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter))
g_assert_not_reached ();
}
@@ -8067,22 +7363,22 @@ gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
int i;
GSList *list;
- if (impl->num_shortcuts == 0)
+ if (impl->priv->num_shortcuts == 0)
return NULL;
pos = shortcuts_get_pos_for_shortcut_folder (impl, 0);
- if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos))
+ if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter, NULL, pos))
g_assert_not_reached ();
list = NULL;
- for (i = 0; i < impl->num_shortcuts; i++)
+ for (i = 0; i < impl->priv->num_shortcuts; i++)
{
gpointer col_data;
ShortcutType shortcut_type;
GFile *shortcut;
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter,
SHORTCUTS_COL_DATA, &col_data,
SHORTCUTS_COL_TYPE, &shortcut_type,
-1);
@@ -8092,9 +7388,9 @@ gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
shortcut = col_data;
list = g_slist_prepend (list, g_object_ref (shortcut));
- if (i != impl->num_shortcuts - 1)
+ if (i != impl->priv->num_shortcuts - 1)
{
- if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
+ if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter))
g_assert_not_reached ();
}
}
@@ -8160,19 +7456,19 @@ gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height);
- if (impl->preview_widget_active &&
- impl->preview_widget &&
- gtk_widget_get_visible (impl->preview_widget))
+ if (impl->priv->preview_widget_active &&
+ impl->priv->preview_widget &&
+ gtk_widget_get_visible (impl->priv->preview_widget))
{
- gtk_widget_get_preferred_size (impl->preview_box,
+ gtk_widget_get_preferred_size (impl->priv->preview_box,
&req, NULL);
*default_width += PREVIEW_HBOX_SPACING + req.width;
}
- if (impl->extra_widget &&
- gtk_widget_get_visible (impl->extra_widget))
+ if (impl->priv->extra_widget &&
+ gtk_widget_get_visible (impl->priv->extra_widget))
{
- gtk_widget_get_preferred_size (impl->extra_align,
+ gtk_widget_get_preferred_size (impl->priv->extra_align,
&req, NULL);
*default_height += gtk_box_get_spacing (GTK_BOX (chooser_embed)) + req.height;
}
@@ -8195,7 +7491,7 @@ switch_folder_foreach_cb (GtkTreeModel *model,
closure = data;
- closure->file = _gtk_file_system_model_get_file (closure->impl->browse_files_model, iter);
+ closure->file = _gtk_file_system_model_get_file (closure->impl->priv->browse_files_model, iter);
closure->num_selected++;
}
@@ -8214,7 +7510,7 @@ switch_to_selected_folder (GtkFileChooserDefault *impl)
closure.file = NULL;
closure.num_selected = 0;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, switch_folder_foreach_cb, &closure);
g_assert (closure.file && closure.num_selected == 1);
@@ -8233,8 +7529,8 @@ get_selected_file_info_from_file_list (GtkFileChooserDefault *impl,
GtkTreeIter iter;
GFileInfo *info;
- g_assert (!impl->select_multiple);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ g_assert (!impl->priv->select_multiple);
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
{
*had_selection = FALSE;
@@ -8243,7 +7539,7 @@ get_selected_file_info_from_file_list (GtkFileChooserDefault *impl,
*had_selection = TRUE;
- info = _gtk_file_system_model_get_info (impl->browse_files_model, &iter);
+ info = _gtk_file_system_model_get_info (impl->priv->browse_files_model, &iter);
return info;
}
@@ -8351,10 +7647,10 @@ confirmation_confirm_get_info_cb (GCancellable *cancellable,
gboolean should_respond = FALSE;
struct GetDisplayNameData *data = user_data;
- if (cancellable != data->impl->should_respond_get_info_cancellable)
+ if (cancellable != data->impl->priv->should_respond_get_info_cancellable)
goto out;
- data->impl->should_respond_get_info_cancellable = NULL;
+ data->impl->priv->should_respond_get_info_cancellable = NULL;
if (cancelled)
goto out;
@@ -8387,7 +7683,7 @@ should_respond_after_confirm_overwrite (GtkFileChooserDefault *impl,
{
GtkFileChooserConfirmation conf;
- if (!impl->do_overwrite_confirmation)
+ if (!impl->priv->do_overwrite_confirmation)
return TRUE;
conf = GTK_FILE_CHOOSER_CONFIRMATION_CONFIRM;
@@ -8406,11 +7702,11 @@ should_respond_after_confirm_overwrite (GtkFileChooserDefault *impl,
data->impl = g_object_ref (impl);
data->file_part = g_strdup (file_part);
- if (impl->should_respond_get_info_cancellable)
- g_cancellable_cancel (impl->should_respond_get_info_cancellable);
+ if (impl->priv->should_respond_get_info_cancellable)
+ g_cancellable_cancel (impl->priv->should_respond_get_info_cancellable);
- impl->should_respond_get_info_cancellable =
- _gtk_file_system_get_info (impl->file_system, parent_file,
+ impl->priv->should_respond_get_info_cancellable =
+ _gtk_file_system_get_info (impl->priv->file_system, parent_file,
"standard::display-name",
confirmation_confirm_get_info_cb,
data);
@@ -8448,10 +7744,10 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
struct FileExistsData *data = user_data;
- if (cancellable != data->impl->should_respond_get_info_cancellable)
+ if (cancellable != data->impl->priv->should_respond_get_info_cancellable)
goto out;
- data->impl->should_respond_get_info_cancellable = NULL;
+ data->impl->priv->should_respond_get_info_cancellable = NULL;
set_busy_cursor (data->impl, FALSE);
@@ -8465,11 +7761,11 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
if (parent_is_folder)
{
- if (data->impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+ if (data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)
{
request_response_and_add_to_recent_list (data->impl); /* even if the file doesn't exist, apps can
make good use of that (e.g. Emacs) */
}
- else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
if (data->file_exists_and_is_not_folder)
{
@@ -8480,7 +7776,7 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
* depending on what clients do in the confirm-overwrite
* signal and this corrupts the pointer
*/
- file_part = g_strdup (_gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY
(data->impl->location_entry)));
+ file_part = g_strdup (_gtk_file_chooser_entry_get_file_part (GTK_FILE_CHOOSER_ENTRY
(data->impl->priv->location_entry)));
retval = should_respond_after_confirm_overwrite (data->impl, file_part, data->parent_file);
g_free (file_part);
@@ -8490,8 +7786,8 @@ name_entry_get_parent_info_cb (GCancellable *cancellable,
else
request_response_and_add_to_recent_list (data->impl);
}
- else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
- || data->impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ else if (data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER
+ || data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
GError *mkdir_error = NULL;
@@ -8551,10 +7847,10 @@ file_exists_get_info_cb (GCancellable *cancellable,
gboolean needs_parent_check = FALSE;
struct FileExistsData *data = user_data;
- if (cancellable != data->impl->file_exists_get_info_cancellable)
+ if (cancellable != data->impl->priv->file_exists_get_info_cancellable)
goto out;
- data->impl->file_exists_get_info_cancellable = NULL;
+ data->impl->priv->file_exists_get_info_cancellable = NULL;
set_busy_cursor (data->impl, FALSE);
@@ -8564,7 +7860,7 @@ file_exists_get_info_cb (GCancellable *cancellable,
file_exists = (info != NULL);
is_folder = (file_exists && _gtk_file_info_consider_as_directory (info));
- if (data->impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+ if (data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)
{
if (is_folder)
change_folder_and_display_error (data->impl, data->file, TRUE);
@@ -8576,7 +7872,7 @@ file_exists_get_info_cb (GCancellable *cancellable,
needs_parent_check = TRUE; /* file doesn't exist; see if its parent exists */
}
}
- else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ else if (data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
if (file_exists && !is_folder)
{
@@ -8591,7 +7887,7 @@ file_exists_get_info_cb (GCancellable *cancellable,
needs_parent_check = TRUE;
}
}
- else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ else if (data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
if (!file_exists)
{
@@ -8608,7 +7904,7 @@ file_exists_get_info_cb (GCancellable *cancellable,
error_selecting_folder_over_existing_file_dialog (data->impl, data->file);
}
}
- else if (data->impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (data->impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
if (is_folder)
change_folder_and_display_error (data->impl, data->file, TRUE);
@@ -8626,11 +7922,11 @@ file_exists_get_info_cb (GCancellable *cancellable,
data->file_exists_and_is_not_folder = file_exists && !is_folder;
data_ownership_taken = TRUE;
- if (data->impl->should_respond_get_info_cancellable)
- g_cancellable_cancel (data->impl->should_respond_get_info_cancellable);
+ if (data->impl->priv->should_respond_get_info_cancellable)
+ g_cancellable_cancel (data->impl->priv->should_respond_get_info_cancellable);
- data->impl->should_respond_get_info_cancellable =
- _gtk_file_system_get_info (data->impl->file_system,
+ data->impl->priv->should_respond_get_info_cancellable =
+ _gtk_file_system_get_info (data->impl->priv->file_system,
data->parent_file,
"standard::type",
name_entry_get_parent_info_cb,
@@ -8696,7 +7992,7 @@ add_selection_to_recent_list (GtkFileChooserDefault *impl)
uri = g_file_get_uri (file);
if (uri)
{
- gtk_recent_manager_add_item (impl->recent_manager, uri);
+ gtk_recent_manager_add_item (impl->priv->recent_manager, uri);
g_free (uri);
}
}
@@ -8722,9 +8018,9 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
current_focus = gtk_window_get_focus (GTK_WINDOW (toplevel));
- if (current_focus == impl->browse_files_tree_view)
+ if (current_focus == impl->priv->browse_files_tree_view)
{
- /* The following array encodes what we do based on the impl->action and the
+ /* The following array encodes what we do based on the impl->priv->action and the
* number of files selected.
*/
typedef enum {
@@ -8751,17 +8047,17 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
file_list:
- g_assert (impl->action >= GTK_FILE_CHOOSER_ACTION_OPEN && impl->action <=
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
+ g_assert (impl->priv->action >= GTK_FILE_CHOOSER_ACTION_OPEN && impl->priv->action <=
GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
- if (impl->operation_mode == OPERATION_MODE_SEARCH)
+ if (impl->priv->operation_mode == OPERATION_MODE_SEARCH)
{
retval = search_should_respond (impl);
goto out;
}
- if (impl->operation_mode == OPERATION_MODE_RECENT)
+ if (impl->priv->operation_mode == OPERATION_MODE_RECENT)
{
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
goto save_entry;
else
{
@@ -8777,7 +8073,7 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
else
k = num_selected;
- action = what_to_do [impl->action] [k];
+ action = what_to_do [impl->priv->action] [k];
switch (action)
{
@@ -8796,11 +8092,11 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
switch_to_selected_folder (impl);
return FALSE;
}
- else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ else if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
retval = should_respond_after_confirm_overwrite (impl,
get_display_name_from_file_list (impl),
- impl->current_folder);
+ impl->priv->current_folder);
goto out;
}
else
@@ -8824,7 +8120,7 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
g_assert_not_reached ();
}
}
- else if ((impl->location_entry != NULL) && (current_focus == impl->location_entry))
+ else if ((impl->priv->location_entry != NULL) && (current_focus == impl->priv->location_entry))
{
GFile *file;
gboolean is_well_formed, is_empty, is_file_part_empty;
@@ -8834,20 +8130,20 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
save_entry:
- g_assert (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
- || ((impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
- || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
- && impl->location_mode == LOCATION_MODE_FILENAME_ENTRY));
+ g_assert (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
+ || ((impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ && impl->priv->location_mode == LOCATION_MODE_FILENAME_ENTRY));
- entry = GTK_FILE_CHOOSER_ENTRY (impl->location_entry);
+ entry = GTK_FILE_CHOOSER_ENTRY (impl->priv->location_entry);
check_save_entry (impl, &file, &is_well_formed, &is_empty, &is_file_part_empty, &is_folder);
if (!is_well_formed)
{
if (!is_empty
- && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- && impl->operation_mode == OPERATION_MODE_RECENT)
+ && impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ && impl->priv->operation_mode == OPERATION_MODE_RECENT)
{
path_bar_set_mode (impl, PATH_BAR_ERROR_NO_FOLDER);
#if 0
@@ -8856,7 +8152,7 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
* a selection causes the error message from path_bar_set_mode() to go away,
* but we want the user to see that message!
*/
- gtk_widget_grab_focus (impl->browse_files_tree_view);
+ gtk_widget_grab_focus (impl->priv->browse_files_tree_view);
#endif
}
/* FIXME: else show an "invalid filename" error as the pathbar mode? */
@@ -8866,11 +8162,11 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
if (is_empty)
{
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
path_bar_set_mode (impl, PATH_BAR_ERROR_NO_FILENAME);
- gtk_widget_grab_focus (impl->location_entry);
+ gtk_widget_grab_focus (impl->priv->location_entry);
return FALSE;
}
@@ -8882,13 +8178,13 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
error = NULL;
if (is_folder)
{
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
change_folder_and_display_error (impl, file, TRUE);
}
- else if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ else if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
/* The folder already exists, so we do not need to create it.
* Just respond to terminate the dialog.
@@ -8915,11 +8211,11 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
data->file = g_object_ref (file);
data->parent_file = _gtk_file_chooser_entry_get_current_folder (entry);
- if (impl->file_exists_get_info_cancellable)
- g_cancellable_cancel (impl->file_exists_get_info_cancellable);
+ if (impl->priv->file_exists_get_info_cancellable)
+ g_cancellable_cancel (impl->priv->file_exists_get_info_cancellable);
- impl->file_exists_get_info_cancellable =
- _gtk_file_system_get_info (impl->file_system, file,
+ impl->priv->file_exists_get_info_cancellable =
+ _gtk_file_system_get_info (impl->priv->file_system, file,
"standard::type",
file_exists_get_info_cb,
data);
@@ -8932,19 +8228,19 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
g_object_unref (file);
}
- else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
+ else if (impl->priv->toplevel_last_focus_widget == impl->priv->browse_files_tree_view)
{
/* The focus is on a dialog's action area button, *and* the widget that
* was focused immediately before it is the file list.
*/
goto file_list;
}
- else if (impl->operation_mode == OPERATION_MODE_SEARCH && impl->toplevel_last_focus_widget ==
impl->search_entry)
+ else if (impl->priv->operation_mode == OPERATION_MODE_SEARCH && impl->priv->toplevel_last_focus_widget ==
impl->priv->search_entry)
{
- search_entry_activate_cb (GTK_ENTRY (impl->search_entry), impl);
+ search_entry_activate_cb (GTK_ENTRY (impl->priv->search_entry), impl);
return FALSE;
}
- else if (impl->location_entry && impl->toplevel_last_focus_widget == impl->location_entry)
+ else if (impl->priv->location_entry && impl->priv->toplevel_last_focus_widget ==
impl->priv->location_entry)
{
/* The focus is on a dialog's action area button, *and* the widget that
* was focused immediately before it is the location entry.
@@ -8953,8 +8249,8 @@ gtk_file_chooser_default_should_respond (GtkFileChooserEmbed *chooser_embed)
}
else
/* The focus is on a dialog's action area button or something else */
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
goto save_entry;
else
goto file_list;
@@ -8976,18 +8272,18 @@ gtk_file_chooser_default_initial_focus (GtkFileChooserEmbed *chooser_embed)
impl = GTK_FILE_CHOOSER_DEFAULT (chooser_embed);
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- if (impl->location_mode == LOCATION_MODE_PATH_BAR
- || impl->operation_mode == OPERATION_MODE_RECENT)
- widget = impl->browse_files_tree_view;
+ if (impl->priv->location_mode == LOCATION_MODE_PATH_BAR
+ || impl->priv->operation_mode == OPERATION_MODE_RECENT)
+ widget = impl->priv->browse_files_tree_view;
else
- widget = impl->location_entry;
+ widget = impl->priv->location_entry;
}
- else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
- widget = impl->location_entry;
+ else if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ widget = impl->priv->location_entry;
else
{
g_assert_not_reached ();
@@ -9023,7 +8319,7 @@ search_get_selected_files (GtkFileChooserDefault *impl)
result = NULL;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, search_selected_foreach_get_file_cb, &result);
result = g_slist_reverse (result);
@@ -9038,9 +8334,9 @@ search_should_respond (GtkFileChooserDefault *impl)
{
GtkTreeSelection *selection;
- g_assert (impl->operation_mode == OPERATION_MODE_SEARCH);
+ g_assert (impl->priv->operation_mode == OPERATION_MODE_SEARCH);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
return (gtk_tree_selection_count_selected_rows (selection) != 0);
}
@@ -9061,7 +8357,7 @@ search_add_hit (GtkFileChooserDefault *impl,
return;
}
- _gtk_file_system_model_add_and_query_file (impl->search_model,
+ _gtk_file_system_model_add_and_query_file (impl->priv->search_model,
file,
MODEL_ATTRIBUTES);
@@ -9096,8 +8392,8 @@ search_engine_finished_cb (GtkSearchEngine *engine,
/* EB: setting the model here will avoid loads of row events,
* but it'll make the search look like blocked.
*/
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
- GTK_TREE_MODEL (impl->search_model));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->priv->search_model));
file_list_set_sort_column_ids (impl);
#endif
@@ -9138,14 +8434,14 @@ static void
search_clear_model (GtkFileChooserDefault *impl,
gboolean remove_from_treeview)
{
- if (!impl->search_model)
+ if (!impl->priv->search_model)
return;
- g_object_unref (impl->search_model);
- impl->search_model = NULL;
+ g_object_unref (impl->priv->search_model);
+ impl->priv->search_model = NULL;
if (remove_from_treeview)
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), NULL);
}
/* Stops any ongoing searches; does not touch the search_model */
@@ -9153,18 +8449,18 @@ static void
search_stop_searching (GtkFileChooserDefault *impl,
gboolean remove_query)
{
- if (remove_query && impl->search_query)
+ if (remove_query && impl->priv->search_query)
{
- g_object_unref (impl->search_query);
- impl->search_query = NULL;
+ g_object_unref (impl->priv->search_query);
+ impl->priv->search_query = NULL;
}
- if (impl->search_engine)
+ if (impl->priv->search_engine)
{
- _gtk_search_engine_stop (impl->search_engine);
+ _gtk_search_engine_stop (impl->priv->search_engine);
- g_object_unref (impl->search_engine);
- impl->search_engine = NULL;
+ g_object_unref (impl->priv->search_engine);
+ impl->priv->search_engine = NULL;
}
}
@@ -9172,21 +8468,21 @@ search_stop_searching (GtkFileChooserDefault *impl,
static void
search_setup_model (GtkFileChooserDefault *impl)
{
- g_assert (impl->search_model == NULL);
+ g_assert (impl->priv->search_model == NULL);
- impl->search_model = _gtk_file_system_model_new (file_system_model_set,
+ impl->priv->search_model = _gtk_file_system_model_new (file_system_model_set,
impl,
MODEL_COLUMN_TYPES);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->search_model),
MODEL_COL_NAME,
name_sort_func,
impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->search_model),
MODEL_COL_MTIME,
mtime_sort_func,
impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->search_model),
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->search_model),
MODEL_COL_SIZE,
size_sort_func,
impl, NULL);
@@ -9196,8 +8492,8 @@ search_setup_model (GtkFileChooserDefault *impl)
* more "alive" than setting the model at the end of the search
* run
*/
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
- GTK_TREE_MODEL (impl->search_model));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->priv->search_model));
file_list_set_sort_column_ids (impl);
}
@@ -9211,32 +8507,32 @@ search_start_query (GtkFileChooserDefault *impl,
search_setup_model (impl);
set_busy_cursor (impl, TRUE);
- if (impl->search_engine == NULL)
- impl->search_engine = _gtk_search_engine_new ();
+ if (impl->priv->search_engine == NULL)
+ impl->priv->search_engine = _gtk_search_engine_new ();
- if (!impl->search_engine)
+ if (!impl->priv->search_engine)
{
set_busy_cursor (impl, FALSE);
search_error_could_not_create_client (impl); /* lame; we don't get an error code or anything */
return;
}
- if (!impl->search_query)
+ if (!impl->priv->search_query)
{
- impl->search_query = _gtk_query_new ();
- _gtk_query_set_text (impl->search_query, query_text);
+ impl->priv->search_query = _gtk_query_new ();
+ _gtk_query_set_text (impl->priv->search_query, query_text);
}
- _gtk_search_engine_set_query (impl->search_engine, impl->search_query);
+ _gtk_search_engine_set_query (impl->priv->search_engine, impl->priv->search_query);
- g_signal_connect (impl->search_engine, "hits-added",
+ g_signal_connect (impl->priv->search_engine, "hits-added",
G_CALLBACK (search_engine_hits_added_cb), impl);
- g_signal_connect (impl->search_engine, "finished",
+ g_signal_connect (impl->priv->search_engine, "finished",
G_CALLBACK (search_engine_finished_cb), impl);
- g_signal_connect (impl->search_engine, "error",
+ g_signal_connect (impl->priv->search_engine, "error",
G_CALLBACK (search_engine_error_cb), impl);
- _gtk_search_engine_start (impl->search_engine);
+ _gtk_search_engine_start (impl->priv->search_engine);
}
/* Callback used when the user presses Enter while typing on the search
@@ -9251,15 +8547,15 @@ search_entry_activate_cb (GtkEntry *entry,
impl = GTK_FILE_CHOOSER_DEFAULT (data);
- text = gtk_entry_get_text (GTK_ENTRY (impl->search_entry));
+ text = gtk_entry_get_text (GTK_ENTRY (impl->priv->search_entry));
if (strlen (text) == 0)
return;
/* reset any existing query object */
- if (impl->search_query)
+ if (impl->priv->search_query)
{
- g_object_unref (impl->search_query);
- impl->search_query = NULL;
+ g_object_unref (impl->priv->search_query);
+ impl->priv->search_query = NULL;
}
search_start_query (impl, text);
@@ -9270,11 +8566,11 @@ focus_entry_idle_cb (GtkFileChooserDefault *impl)
{
gdk_threads_enter ();
- g_source_destroy (impl->focus_entry_idle);
- impl->focus_entry_idle = NULL;
+ g_source_destroy (impl->priv->focus_entry_idle);
+ impl->priv->focus_entry_idle = NULL;
- if (impl->search_entry)
- gtk_widget_grab_focus (impl->search_entry);
+ if (impl->priv->search_entry)
+ gtk_widget_grab_focus (impl->priv->search_entry);
gdk_threads_leave ();
@@ -9292,55 +8588,55 @@ focus_search_entry_in_idle (GtkFileChooserDefault *impl)
* handler.
*/
- if (!impl->focus_entry_idle)
- impl->focus_entry_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (focus_entry_idle_cb));
+ if (!impl->priv->focus_entry_idle)
+ impl->priv->focus_entry_idle = add_idle_while_impl_is_alive (impl, G_CALLBACK (focus_entry_idle_cb));
}
/* Hides the path bar and creates the search entry */
static void
search_setup_widgets (GtkFileChooserDefault *impl)
{
- impl->search_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
+ impl->priv->search_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
path_bar_update (impl);
- impl->search_entry = gtk_entry_new ();
- g_signal_connect (impl->search_entry, "activate",
+ impl->priv->search_entry = gtk_entry_new ();
+ g_signal_connect (impl->priv->search_entry, "activate",
G_CALLBACK (search_entry_activate_cb),
impl);
- gtk_box_pack_start (GTK_BOX (impl->search_hbox), impl->search_entry, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (impl->priv->search_hbox), impl->priv->search_entry, TRUE, TRUE, 0);
/* if there already is a query, restart it */
- if (impl->search_query)
+ if (impl->priv->search_query)
{
- gchar *query = _gtk_query_get_text (impl->search_query);
+ gchar *query = _gtk_query_get_text (impl->priv->search_query);
if (query)
{
- gtk_entry_set_text (GTK_ENTRY (impl->search_entry), query);
+ gtk_entry_set_text (GTK_ENTRY (impl->priv->search_entry), query);
search_start_query (impl, query);
g_free (query);
}
else
{
- g_object_unref (impl->search_query);
- impl->search_query = NULL;
+ g_object_unref (impl->priv->search_query);
+ impl->priv->search_query = NULL;
}
}
/* Box for search widgets */
- gtk_box_pack_start (GTK_BOX (impl->browse_path_bar_hbox), impl->search_hbox, TRUE, TRUE, 0);
- gtk_widget_show_all (impl->search_hbox);
- gtk_size_group_add_widget (GTK_SIZE_GROUP (impl->browse_path_bar_size_group), impl->search_hbox);
+ gtk_box_pack_start (GTK_BOX (impl->priv->browse_path_bar_hbox), impl->priv->search_hbox, TRUE, TRUE, 0);
+ gtk_widget_show_all (impl->priv->search_hbox);
+ gtk_size_group_add_widget (GTK_SIZE_GROUP (impl->priv->browse_path_bar_size_group),
impl->priv->search_hbox);
/* Hide the location widgets temporarily */
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
- gtk_widget_hide (impl->location_button);
- gtk_widget_hide (impl->location_entry_box);
+ gtk_widget_hide (impl->priv->location_button);
+ gtk_widget_hide (impl->priv->location_entry_box);
}
focus_search_entry_in_idle (impl);
@@ -9357,14 +8653,14 @@ static void
recent_clear_model (GtkFileChooserDefault *impl,
gboolean remove_from_treeview)
{
- if (!impl->recent_model)
+ if (!impl->priv->recent_model)
return;
if (remove_from_treeview)
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view), NULL);
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), NULL);
- g_object_unref (impl->recent_model);
- impl->recent_model = NULL;
+ g_object_unref (impl->priv->recent_model);
+ impl->priv->recent_model = NULL;
}
/* Stops any ongoing loading of the recent files list; does
@@ -9373,33 +8669,33 @@ recent_clear_model (GtkFileChooserDefault *impl,
static void
recent_stop_loading (GtkFileChooserDefault *impl)
{
- if (impl->load_recent_id)
+ if (impl->priv->load_recent_id)
{
- g_source_remove (impl->load_recent_id);
- impl->load_recent_id = 0;
+ g_source_remove (impl->priv->load_recent_id);
+ impl->priv->load_recent_id = 0;
}
}
static void
recent_setup_model (GtkFileChooserDefault *impl)
{
- g_assert (impl->recent_model == NULL);
+ g_assert (impl->priv->recent_model == NULL);
- impl->recent_model = _gtk_file_system_model_new (file_system_model_set,
+ impl->priv->recent_model = _gtk_file_system_model_new (file_system_model_set,
impl,
MODEL_COLUMN_TYPES);
- _gtk_file_system_model_set_filter (impl->recent_model,
- impl->current_filter);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->recent_model),
+ _gtk_file_system_model_set_filter (impl->priv->recent_model,
+ impl->priv->current_filter);
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->recent_model),
MODEL_COL_NAME,
name_sort_func,
impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->recent_model),
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->recent_model),
MODEL_COL_SIZE,
size_sort_func,
impl, NULL);
- gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->recent_model),
+ gtk_tree_sortable_set_sort_func (GTK_TREE_SORTABLE (impl->priv->recent_model),
MODEL_COL_MTIME,
mtime_sort_func,
impl, NULL);
@@ -9418,14 +8714,14 @@ recent_idle_cleanup (gpointer data)
RecentLoadData *load_data = data;
GtkFileChooserDefault *impl = load_data->impl;
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
- GTK_TREE_MODEL (impl->recent_model));
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->priv->recent_model));
file_list_set_sort_column_ids (impl);
- gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->recent_model), MODEL_COL_MTIME,
GTK_SORT_DESCENDING);
+ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->priv->recent_model), MODEL_COL_MTIME,
GTK_SORT_DESCENDING);
set_busy_cursor (impl, FALSE);
- impl->load_recent_id = 0;
+ impl->priv->load_recent_id = 0;
g_free (load_data);
}
@@ -9464,7 +8760,7 @@ populate_model_with_recent_items (GtkFileChooserDefault *impl, GList *items)
GFile *file;
file = g_file_new_for_uri (gtk_recent_info_get_uri (info));
- _gtk_file_system_model_add_and_query_file (impl->recent_model,
+ _gtk_file_system_model_add_and_query_file (impl->priv->recent_model,
file,
MODEL_ATTRIBUTES);
g_object_unref (file);
@@ -9487,7 +8783,7 @@ populate_model_with_folders (GtkFileChooserDefault *impl, GList *items)
{
GFile *folder = l->data;
- _gtk_file_system_model_add_and_query_file (impl->recent_model,
+ _gtk_file_system_model_add_and_query_file (impl->priv->recent_model,
folder,
MODEL_ATTRIBUTES);
}
@@ -9502,14 +8798,14 @@ recent_idle_load (gpointer data)
RecentLoadData *load_data = data;
GtkFileChooserDefault *impl = load_data->impl;
- if (!impl->recent_manager)
+ if (!impl->priv->recent_manager)
return FALSE;
- load_data->items = gtk_recent_manager_get_items (impl->recent_manager);
+ load_data->items = gtk_recent_manager_get_items (impl->priv->recent_manager);
if (!load_data->items)
return FALSE;
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN)
populate_model_with_recent_items (impl, load_data->items);
else
populate_model_with_folders (impl, load_data->items);
@@ -9531,14 +8827,14 @@ recent_start_loading (GtkFileChooserDefault *impl)
recent_setup_model (impl);
set_busy_cursor (impl, TRUE);
- g_assert (impl->load_recent_id == 0);
+ g_assert (impl->priv->load_recent_id == 0);
load_data = g_new (RecentLoadData, 1);
load_data->impl = impl;
load_data->items = NULL;
/* begin lazy loading the recent files into the model */
- impl->load_recent_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
+ impl->priv->load_recent_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
recent_idle_load,
load_data,
recent_idle_cleanup);
@@ -9568,7 +8864,7 @@ recent_get_selected_files (GtkFileChooserDefault *impl)
result = NULL;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
gtk_tree_selection_selected_foreach (selection, recent_selected_foreach_get_file_cb, &result);
result = g_slist_reverse (result);
@@ -9583,9 +8879,9 @@ recent_should_respond (GtkFileChooserDefault *impl)
{
GtkTreeSelection *selection;
- g_assert (impl->operation_mode == OPERATION_MODE_RECENT);
+ g_assert (impl->priv->operation_mode == OPERATION_MODE_RECENT);
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
return (gtk_tree_selection_count_selected_rows (selection) != 0);
}
@@ -9593,44 +8889,44 @@ static void
set_current_filter (GtkFileChooserDefault *impl,
GtkFileFilter *filter)
{
- if (impl->current_filter != filter)
+ if (impl->priv->current_filter != filter)
{
int filter_index;
/* NULL filters are allowed to reset to non-filtered status
*/
- filter_index = g_slist_index (impl->filters, filter);
- if (impl->filters && filter && filter_index < 0)
+ filter_index = g_slist_index (impl->priv->filters, filter);
+ if (impl->priv->filters && filter && filter_index < 0)
return;
- if (impl->current_filter)
- g_object_unref (impl->current_filter);
- impl->current_filter = filter;
- if (impl->current_filter)
+ if (impl->priv->current_filter)
+ g_object_unref (impl->priv->current_filter);
+ impl->priv->current_filter = filter;
+ if (impl->priv->current_filter)
{
- g_object_ref_sink (impl->current_filter);
+ g_object_ref_sink (impl->priv->current_filter);
}
- if (impl->filters)
- gtk_combo_box_set_active (GTK_COMBO_BOX (impl->filter_combo),
+ if (impl->priv->filters)
+ gtk_combo_box_set_active (GTK_COMBO_BOX (impl->priv->filter_combo),
filter_index);
- if (impl->browse_files_model)
+ if (impl->priv->browse_files_model)
{
- _gtk_file_system_model_set_filter (impl->browse_files_model, impl->current_filter);
- _gtk_file_system_model_clear_cache (impl->browse_files_model, MODEL_COL_IS_SENSITIVE);
+ _gtk_file_system_model_set_filter (impl->priv->browse_files_model, impl->priv->current_filter);
+ _gtk_file_system_model_clear_cache (impl->priv->browse_files_model, MODEL_COL_IS_SENSITIVE);
}
- if (impl->search_model)
+ if (impl->priv->search_model)
{
- _gtk_file_system_model_set_filter (impl->search_model, filter);
- _gtk_file_system_model_clear_cache (impl->search_model, MODEL_COL_IS_SENSITIVE);
+ _gtk_file_system_model_set_filter (impl->priv->search_model, filter);
+ _gtk_file_system_model_clear_cache (impl->priv->search_model, MODEL_COL_IS_SENSITIVE);
}
- if (impl->recent_model)
+ if (impl->priv->recent_model)
{
- _gtk_file_system_model_set_filter (impl->recent_model, filter);
- _gtk_file_system_model_clear_cache (impl->recent_model, MODEL_COL_IS_SENSITIVE);
+ _gtk_file_system_model_set_filter (impl->priv->recent_model, filter);
+ _gtk_file_system_model_clear_cache (impl->priv->recent_model, MODEL_COL_IS_SENSITIVE);
}
g_object_notify (G_OBJECT (impl), "filter");
@@ -9642,7 +8938,7 @@ filter_combo_changed (GtkComboBox *combo_box,
GtkFileChooserDefault *impl)
{
gint new_index = gtk_combo_box_get_active (combo_box);
- GtkFileFilter *new_filter = g_slist_nth_data (impl->filters, new_index);
+ GtkFileFilter *new_filter = g_slist_nth_data (impl->priv->filters, new_index);
set_current_filter (impl, new_filter);
}
@@ -9655,8 +8951,8 @@ check_preview_change (GtkFileChooserDefault *impl)
char *new_display_name;
GtkTreeModel *model;
- gtk_tree_view_get_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), &cursor_path, NULL);
- model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ gtk_tree_view_get_cursor (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), &cursor_path, NULL);
+ model = gtk_tree_view_get_model (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
if (cursor_path)
{
GtkTreeIter iter;
@@ -9675,30 +8971,30 @@ check_preview_change (GtkFileChooserDefault *impl)
new_display_name = NULL;
}
- if (new_file != impl->preview_file &&
- !(new_file && impl->preview_file &&
- g_file_equal (new_file, impl->preview_file)))
+ if (new_file != impl->priv->preview_file &&
+ !(new_file && impl->priv->preview_file &&
+ g_file_equal (new_file, impl->priv->preview_file)))
{
- if (impl->preview_file)
+ if (impl->priv->preview_file)
{
- g_object_unref (impl->preview_file);
- g_free (impl->preview_display_name);
+ g_object_unref (impl->priv->preview_file);
+ g_free (impl->priv->preview_display_name);
}
if (new_file)
{
- impl->preview_file = new_file;
- impl->preview_display_name = new_display_name;
+ impl->priv->preview_file = new_file;
+ impl->priv->preview_display_name = new_display_name;
}
else
{
- impl->preview_file = NULL;
- impl->preview_display_name = NULL;
+ impl->priv->preview_file = NULL;
+ impl->priv->preview_display_name = NULL;
g_free (new_display_name);
}
- if (impl->use_preview_label && impl->preview_label)
- gtk_label_set_text (GTK_LABEL (impl->preview_label), impl->preview_display_name);
+ if (impl->priv->use_preview_label && impl->priv->preview_label)
+ gtk_label_set_text (GTK_LABEL (impl->priv->preview_label), impl->priv->preview_display_name);
g_signal_emit_by_name (impl, "update-preview");
}
@@ -9721,10 +9017,10 @@ shortcuts_activate_volume_mount_cb (GCancellable *cancellable,
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
GtkFileChooserDefault *impl = data;
- if (cancellable != impl->shortcuts_activate_iter_cancellable)
+ if (cancellable != impl->priv->shortcuts_activate_iter_cancellable)
goto out;
- impl->shortcuts_activate_iter_cancellable = NULL;
+ impl->priv->shortcuts_activate_iter_cancellable = NULL;
set_busy_cursor (impl, FALSE);
@@ -9785,8 +9081,8 @@ shortcuts_activate_volume (GtkFileChooserDefault *impl,
set_busy_cursor (impl, TRUE);
mount_op = gtk_mount_operation_new (get_toplevel (GTK_WIDGET (impl)));
- impl->shortcuts_activate_iter_cancellable =
- _gtk_file_system_mount_volume (impl->file_system, volume, mount_op,
+ impl->priv->shortcuts_activate_iter_cancellable =
+ _gtk_file_system_mount_volume (impl->priv->file_system, volume, mount_op,
shortcuts_activate_volume_mount_cb,
g_object_ref (impl));
g_object_unref (mount_op);
@@ -9820,10 +9116,10 @@ shortcuts_activate_get_info_cb (GCancellable *cancellable,
gboolean cancelled = g_cancellable_is_cancelled (cancellable);
struct ShortcutsActivateData *data = user_data;
- if (cancellable != data->impl->shortcuts_activate_iter_cancellable)
+ if (cancellable != data->impl->priv->shortcuts_activate_iter_cancellable)
goto out;
- data->impl->shortcuts_activate_iter_cancellable = NULL;
+ data->impl->priv->shortcuts_activate_iter_cancellable = NULL;
if (cancelled)
goto out;
@@ -9862,8 +9158,8 @@ shortcuts_activate_mount_enclosing_volume (GCancellable *cancellable,
return;
}
- data->impl->shortcuts_activate_iter_cancellable =
- _gtk_file_system_get_info (data->impl->file_system, data->file,
+ data->impl->priv->shortcuts_activate_iter_cancellable =
+ _gtk_file_system_get_info (data->impl->priv->file_system, data->file,
"standard::type",
shortcuts_activate_get_info_cb, data);
@@ -9881,20 +9177,20 @@ shortcuts_activate_iter (GtkFileChooserDefault *impl,
/* In the Save modes, we want to preserve what the uesr typed in the filename
* entry, so that he may choose another folder without erasing his typed name.
*/
- if (impl->location_entry
- && !(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
- || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
- gtk_entry_set_text (GTK_ENTRY (impl->location_entry), "");
+ if (impl->priv->location_entry
+ && !(impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
+ gtk_entry_set_text (GTK_ENTRY (impl->priv->location_entry), "");
- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter,
+ gtk_tree_model_get (GTK_TREE_MODEL (impl->priv->shortcuts_model), iter,
SHORTCUTS_COL_DATA, &col_data,
SHORTCUTS_COL_TYPE, &shortcut_type,
-1);
- if (impl->shortcuts_activate_iter_cancellable)
+ if (impl->priv->shortcuts_activate_iter_cancellable)
{
- g_cancellable_cancel (impl->shortcuts_activate_iter_cancellable);
- impl->shortcuts_activate_iter_cancellable = NULL;
+ g_cancellable_cancel (impl->priv->shortcuts_activate_iter_cancellable);
+ impl->priv->shortcuts_activate_iter_cancellable = NULL;
}
if (shortcut_type == SHORTCUT_TYPE_SEPARATOR)
@@ -9916,7 +9212,7 @@ shortcuts_activate_iter (GtkFileChooserDefault *impl,
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- volume = _gtk_file_system_get_volume_for_file (impl->file_system, col_data);
+ volume = _gtk_file_system_get_volume_for_file (impl->priv->file_system, col_data);
data = g_new0 (struct ShortcutsActivateData, 1);
data->impl = g_object_ref (impl);
@@ -9931,16 +9227,16 @@ shortcuts_activate_iter (GtkFileChooserDefault *impl,
mount_operation = gtk_mount_operation_new (GTK_WINDOW (toplevel));
- impl->shortcuts_activate_iter_cancellable =
- _gtk_file_system_mount_enclosing_volume (impl->file_system, col_data,
+ impl->priv->shortcuts_activate_iter_cancellable =
+ _gtk_file_system_mount_enclosing_volume (impl->priv->file_system, col_data,
mount_operation,
shortcuts_activate_mount_enclosing_volume,
data);
}
else
{
- impl->shortcuts_activate_iter_cancellable =
- _gtk_file_system_get_info (impl->file_system, data->file,
+ impl->priv->shortcuts_activate_iter_cancellable =
+ _gtk_file_system_get_info (impl->priv->file_system, data->file,
"standard::type",
shortcuts_activate_get_info_cb, data);
}
@@ -9967,7 +9263,7 @@ shortcuts_key_press_event_cb (GtkWidget *widget,
if (key_is_left_or_right (event))
{
- gtk_widget_grab_focus (impl->browse_files_tree_view);
+ gtk_widget_grab_focus (impl->priv->browse_files_tree_view);
return TRUE;
}
@@ -10001,10 +9297,10 @@ shortcuts_select_func (GtkTreeSelection *selection,
GtkTreeIter filter_iter;
ShortcutType shortcut_type;
- if (!gtk_tree_model_get_iter (impl->shortcuts_pane_filter_model, &filter_iter, path))
+ if (!gtk_tree_model_get_iter (impl->priv->shortcuts_pane_filter_model, &filter_iter, path))
g_assert_not_reached ();
- gtk_tree_model_get (impl->shortcuts_pane_filter_model, &filter_iter, SHORTCUTS_COL_TYPE, &shortcut_type,
-1);
+ gtk_tree_model_get (impl->priv->shortcuts_pane_filter_model, &filter_iter, SHORTCUTS_COL_TYPE,
&shortcut_type, -1);
return shortcut_type != SHORTCUT_TYPE_SEPARATOR;
}
@@ -10018,8 +9314,8 @@ list_select_func (GtkTreeSelection *selection,
{
GtkFileChooserDefault *impl = data;
- if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
GtkTreeIter iter;
gboolean is_sensitive;
@@ -10043,8 +9339,8 @@ list_selection_changed (GtkTreeSelection *selection,
GtkFileChooserDefault *impl)
{
/* See if we are in the new folder editable row for Save mode */
- if (impl->operation_mode == OPERATION_MODE_BROWSE &&
- impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->priv->operation_mode == OPERATION_MODE_BROWSE &&
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
{
GFileInfo *info;
gboolean had_selection;
@@ -10059,7 +9355,7 @@ list_selection_changed (GtkTreeSelection *selection,
out:
- if (impl->location_entry)
+ if (impl->priv->location_entry)
update_chooser_entry (impl);
path_bar_update (impl);
@@ -10101,8 +9397,8 @@ list_row_activated (GtkTreeView *tree_view,
goto out;
}
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE)
g_signal_emit_by_name (impl, "file-activated");
out:
@@ -10142,7 +9438,7 @@ update_cell_renderer_attributes (GtkFileChooserDefault *impl)
/* Keep the following column numbers in sync with create_file_list() */
/* name */
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->browse_files_tree_view), 0);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), 0);
list = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
for (walk = list; walk; walk = walk->next)
{
@@ -10166,7 +9462,7 @@ update_cell_renderer_attributes (GtkFileChooserDefault *impl)
g_list_free (list);
/* size */
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->browse_files_tree_view), 1);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), 1);
list = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
renderer = list->data;
gtk_tree_view_column_set_attributes (column, renderer,
@@ -10177,7 +9473,7 @@ update_cell_renderer_attributes (GtkFileChooserDefault *impl)
g_list_free (list);
/* mtime */
- column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->browse_files_tree_view), 2);
+ column = gtk_tree_view_get_column (GTK_TREE_VIEW (impl->priv->browse_files_tree_view), 2);
list = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (column));
renderer = list->data;
gtk_tree_view_column_set_attributes (column, renderer,
@@ -10197,34 +9493,34 @@ static void
location_set_user_text (GtkFileChooserDefault *impl,
const gchar *path)
{
- gtk_entry_set_text (GTK_ENTRY (impl->location_entry), path);
- gtk_editable_set_position (GTK_EDITABLE (impl->location_entry), -1);
+ gtk_entry_set_text (GTK_ENTRY (impl->priv->location_entry), path);
+ gtk_editable_set_position (GTK_EDITABLE (impl->priv->location_entry), -1);
}
static void
location_popup_handler (GtkFileChooserDefault *impl,
const gchar *path)
{
- if (impl->operation_mode != OPERATION_MODE_BROWSE)
+ if (impl->priv->operation_mode != OPERATION_MODE_BROWSE)
{
GtkWidget *widget_to_focus;
operation_mode_set (impl, OPERATION_MODE_BROWSE);
- if (impl->current_folder)
- change_folder_and_display_error (impl, impl->current_folder, FALSE);
+ if (impl->priv->current_folder)
+ change_folder_and_display_error (impl, impl->priv->current_folder, FALSE);
- if (impl->location_mode == LOCATION_MODE_PATH_BAR)
- widget_to_focus = impl->browse_files_tree_view;
+ if (impl->priv->location_mode == LOCATION_MODE_PATH_BAR)
+ widget_to_focus = impl->priv->browse_files_tree_view;
else
- widget_to_focus = impl->location_entry;
+ widget_to_focus = impl->priv->location_entry;
gtk_widget_grab_focus (widget_to_focus);
return;
}
- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
{
if (!path)
return;
@@ -10232,10 +9528,10 @@ location_popup_handler (GtkFileChooserDefault *impl,
location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY, TRUE);
location_set_user_text (impl, path);
}
- else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+ else if (impl->priv->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->priv->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
{
- gtk_widget_grab_focus (impl->location_entry);
+ gtk_widget_grab_focus (impl->priv->location_entry);
if (path != NULL)
location_set_user_text (impl, path);
}
@@ -10247,14 +9543,14 @@ location_popup_handler (GtkFileChooserDefault *impl,
static void
up_folder_handler (GtkFileChooserDefault *impl)
{
- _gtk_path_bar_up (GTK_PATH_BAR (impl->browse_path_bar));
+ _gtk_path_bar_up (GTK_PATH_BAR (impl->priv->browse_path_bar));
}
/* Handler for the "down-folder" keybinding signal */
static void
down_folder_handler (GtkFileChooserDefault *impl)
{
- _gtk_path_bar_down (GTK_PATH_BAR (impl->browse_path_bar));
+ _gtk_path_bar_down (GTK_PATH_BAR (impl->priv->browse_path_bar));
}
/* Switches to the shortcut in the specified index */
@@ -10264,7 +9560,7 @@ switch_to_shortcut (GtkFileChooserDefault *impl,
{
GtkTreeIter iter;
- if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos))
+ if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->priv->shortcuts_model), &iter, NULL, pos))
g_assert_not_reached ();
shortcuts_activate_iter (impl, &iter);
@@ -10274,7 +9570,7 @@ switch_to_shortcut (GtkFileChooserDefault *impl,
static void
home_folder_handler (GtkFileChooserDefault *impl)
{
- if (impl->has_home)
+ if (impl->priv->has_home)
switch_to_shortcut (impl, shortcuts_get_index (impl, SHORTCUTS_HOME));
}
@@ -10282,7 +9578,7 @@ home_folder_handler (GtkFileChooserDefault *impl)
static void
desktop_folder_handler (GtkFileChooserDefault *impl)
{
- if (impl->has_desktop)
+ if (impl->priv->has_desktop)
switch_to_shortcut (impl, shortcuts_get_index (impl, SHORTCUTS_DESKTOP));
}
@@ -10290,15 +9586,15 @@ desktop_folder_handler (GtkFileChooserDefault *impl)
static void
search_shortcut_handler (GtkFileChooserDefault *impl)
{
- if (impl->has_search)
+ if (impl->priv->has_search)
{
switch_to_shortcut (impl, shortcuts_get_index (impl, SHORTCUTS_SEARCH));
/* we want the entry widget to grab the focus the first
* time, not the browse_files_tree_view widget.
*/
- if (impl->search_entry)
- gtk_widget_grab_focus (impl->search_entry);
+ if (impl->priv->search_entry)
+ gtk_widget_grab_focus (impl->priv->search_entry);
}
}
@@ -10316,13 +9612,13 @@ quick_bookmark_handler (GtkFileChooserDefault *impl,
int bookmark_pos;
GtkTreePath *path;
- if (bookmark_index < 0 || bookmark_index >= impl->num_bookmarks)
+ if (bookmark_index < 0 || bookmark_index >= impl->priv->num_bookmarks)
return;
bookmark_pos = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS) + bookmark_index;
path = gtk_tree_path_new_from_indices (bookmark_pos, -1);
- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view),
path, NULL,
FALSE, 0.0, 0.0);
gtk_tree_path_free (path);
@@ -10334,13 +9630,13 @@ static void
show_hidden_handler (GtkFileChooserDefault *impl)
{
g_object_set (impl,
- "show-hidden", !impl->show_hidden,
+ "show-hidden", !impl->priv->show_hidden,
NULL);
}
-
-/* Drag and drop interfaces */
-
+/********************************************************************
+ * ShortcutsPaneModelFilter *
+ ********************************************************************/
static void
_shortcuts_pane_model_filter_class_init (ShortcutsPaneModelFilterClass *class)
{
@@ -10366,7 +9662,7 @@ shortcuts_pane_model_filter_row_draggable (GtkTreeDragSource *drag_source,
pos = *gtk_tree_path_get_indices (path);
bookmarks_pos = shortcuts_get_index (model->impl, SHORTCUTS_BOOKMARKS);
- return (pos >= bookmarks_pos && pos < bookmarks_pos + model->impl->num_bookmarks);
+ return (pos >= bookmarks_pos && pos < bookmarks_pos + model->impl->priv->num_bookmarks);
}
/* GtkTreeDragSource::drag_data_get implementation for the shortcuts
@@ -10400,20 +9696,461 @@ shortcuts_pane_model_filter_drag_dest_iface_init (GtkTreeDragDestIface *iface)
}
#endif
-static GtkTreeModel *
-shortcuts_pane_model_filter_new (GtkFileChooserDefault *impl,
- GtkTreeModel *child_model,
- GtkTreePath *root)
+/********************************************************************
+ * Class/Instance Initializer *
+ ********************************************************************/
+static void
+_gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
{
- ShortcutsPaneModelFilter *model;
+ static const guint quick_bookmark_keyvals[10] = {
+ GDK_KEY_1, GDK_KEY_2, GDK_KEY_3, GDK_KEY_4, GDK_KEY_5, GDK_KEY_6, GDK_KEY_7, GDK_KEY_8, GDK_KEY_9,
GDK_KEY_0
+ };
+ GObjectClass *gobject_class = G_OBJECT_CLASS (class);
+ GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class);
+ GtkBindingSet *binding_set;
+ int i;
+
+ gobject_class->finalize = gtk_file_chooser_default_finalize;
+ gobject_class->constructor = gtk_file_chooser_default_constructor;
+ gobject_class->set_property = gtk_file_chooser_default_set_property;
+ gobject_class->get_property = gtk_file_chooser_default_get_property;
+ gobject_class->dispose = gtk_file_chooser_default_dispose;
+
+ widget_class->show_all = gtk_file_chooser_default_show_all;
+ widget_class->realize = gtk_file_chooser_default_realize;
+ widget_class->map = gtk_file_chooser_default_map;
+ widget_class->unmap = gtk_file_chooser_default_unmap;
+ widget_class->hierarchy_changed = gtk_file_chooser_default_hierarchy_changed;
+ widget_class->style_updated = gtk_file_chooser_default_style_updated;
+ widget_class->screen_changed = gtk_file_chooser_default_screen_changed;
+
+ signals[LOCATION_POPUP] =
+ g_signal_new_class_handler (I_("location-popup"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (location_popup_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__STRING,
+ G_TYPE_NONE, 1, G_TYPE_STRING);
- model = g_object_new (SHORTCUTS_PANE_MODEL_FILTER_TYPE,
- "child-model", child_model,
- "virtual-root", root,
- NULL);
+ signals[LOCATION_POPUP_ON_PASTE] =
+ g_signal_new_class_handler (I_("location-popup-on-paste"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (location_popup_on_paste_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
- model->impl = impl;
+ signals[LOCATION_TOGGLE_POPUP] =
+ g_signal_new_class_handler (I_("location-toggle-popup"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (location_toggle_popup_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
- return GTK_TREE_MODEL (model);
+ signals[UP_FOLDER] =
+ g_signal_new_class_handler (I_("up-folder"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (up_folder_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[DOWN_FOLDER] =
+ g_signal_new_class_handler (I_("down-folder"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (down_folder_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[HOME_FOLDER] =
+ g_signal_new_class_handler (I_("home-folder"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (home_folder_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[DESKTOP_FOLDER] =
+ g_signal_new_class_handler (I_("desktop-folder"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (desktop_folder_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[QUICK_BOOKMARK] =
+ g_signal_new_class_handler (I_("quick-bookmark"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (quick_bookmark_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__INT,
+ G_TYPE_NONE, 1, G_TYPE_INT);
+
+ signals[SHOW_HIDDEN] =
+ g_signal_new_class_handler (I_("show-hidden"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (show_hidden_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[SEARCH_SHORTCUT] =
+ g_signal_new_class_handler (I_("search-shortcut"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (search_shortcut_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ signals[RECENT_SHORTCUT] =
+ g_signal_new_class_handler (I_("recent-shortcut"),
+ G_OBJECT_CLASS_TYPE (class),
+ G_SIGNAL_RUN_FIRST | G_SIGNAL_ACTION,
+ G_CALLBACK (recent_shortcut_handler),
+ NULL, NULL,
+ _gtk_marshal_VOID__VOID,
+ G_TYPE_NONE, 0);
+
+ binding_set = gtk_binding_set_by_class (class);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_l, GDK_CONTROL_MASK,
+ "location-toggle-popup",
+ 0);
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_slash, 0,
+ "location-popup",
+ 1, G_TYPE_STRING, "/");
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_KP_Divide, 0,
+ "location-popup",
+ 1, G_TYPE_STRING, "/");
+
+#ifdef G_OS_UNIX
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_asciitilde, 0,
+ "location-popup",
+ 1, G_TYPE_STRING, "~");
+#endif
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_v, GDK_CONTROL_MASK,
+ "location-popup-on-paste",
+ 0);
+
+ add_normal_and_shifted_binding (binding_set,
+ GDK_KEY_Up, GDK_MOD1_MASK,
+ "up-folder");
+
+ add_normal_and_shifted_binding (binding_set,
+ GDK_KEY_KP_Up, GDK_MOD1_MASK,
+ "up-folder");
+
+ add_normal_and_shifted_binding (binding_set,
+ GDK_KEY_Down, GDK_MOD1_MASK,
+ "down-folder");
+ add_normal_and_shifted_binding (binding_set,
+ GDK_KEY_KP_Down, GDK_MOD1_MASK,
+ "down-folder");
+
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_Home, GDK_MOD1_MASK,
+ "home-folder",
+ 0);
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_KP_Home, GDK_MOD1_MASK,
+ "home-folder",
+ 0);
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_d, GDK_MOD1_MASK,
+ "desktop-folder",
+ 0);
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_h, GDK_CONTROL_MASK,
+ "show-hidden",
+ 0);
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_s, GDK_MOD1_MASK,
+ "search-shortcut",
+ 0);
+ gtk_binding_entry_add_signal (binding_set,
+ GDK_KEY_r, GDK_MOD1_MASK,
+ "recent-shortcut",
+ 0);
+
+ for (i = 0; i < 10; i++)
+ gtk_binding_entry_add_signal (binding_set,
+ quick_bookmark_keyvals[i], GDK_MOD1_MASK,
+ "quick-bookmark",
+ 1, G_TYPE_INT, i);
+
+ _gtk_file_chooser_install_properties (gobject_class);
+
+ g_type_class_add_private (gobject_class, sizeof (GtkFileChooserDefaultPrivate));
+
+ /* Bind class to template
+ */
+ gtk_widget_class_set_template_from_resource (widget_class,
+ "/org/gtk/libgtk/gtkfilechooserdefault.ui");
+
+ /* A *lot* of widgets that we need to handle .... */
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_shortcuts_toolbar);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_shortcuts_swin);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_widgets_box);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_widgets_hpaned);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_header_box);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_shortcuts_tree_view);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_widgets_box);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_shortcuts_add_button);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_shortcuts_remove_button);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_files_tree_view);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_new_folder_button);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_path_bar_hbox);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_path_bar_size_group);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_path_bar);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_special_mode_icon);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_special_mode_label);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_select_a_folder_info_bar);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_select_a_folder_label);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, browse_select_a_folder_icon);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, filter_combo_hbox);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, filter_combo);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, preview_box);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, extra_align);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, location_button);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, location_entry_box);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, location_label);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, shortcuts_model);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, shortcuts_pane_filter_model);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, list_name_column);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, list_pixbuf_renderer);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, list_name_renderer);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, list_mtime_column);
+ gtk_widget_class_bind_child (widget_class, GtkFileChooserDefaultPrivate, list_size_column);
+
+ /* And a *lot* of callbacks to bind ... */
+ gtk_widget_class_bind_callback (widget_class, shortcuts_key_press_event_after_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_key_press_event_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_drag_drop_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_drag_data_received_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_drag_data_delete_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_drag_end_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_popup_menu_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_query_tooltip_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_button_press_event_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_drag_motion_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_drag_leave_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_drag_begin_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_selection_changed_cb);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_editing_canceled);
+ gtk_widget_class_bind_callback (widget_class, shortcuts_edited);
+ gtk_widget_class_bind_callback (widget_class, add_bookmark_button_clicked_cb);
+ gtk_widget_class_bind_callback (widget_class, remove_bookmark_button_clicked_cb);
+ gtk_widget_class_bind_callback (widget_class, browse_files_key_press_event_cb);
+ gtk_widget_class_bind_callback (widget_class, file_list_drag_drop_cb);
+ gtk_widget_class_bind_callback (widget_class, file_list_drag_data_received_cb);
+ gtk_widget_class_bind_callback (widget_class, list_popup_menu_cb);
+ gtk_widget_class_bind_callback (widget_class, file_list_query_tooltip_cb);
+ gtk_widget_class_bind_callback (widget_class, list_button_press_event_cb);
+ gtk_widget_class_bind_callback (widget_class, list_row_activated);
+ gtk_widget_class_bind_callback (widget_class, file_list_drag_motion_cb);
+ gtk_widget_class_bind_callback (widget_class, list_selection_changed);
+ gtk_widget_class_bind_callback (widget_class, renderer_editing_canceled_cb);
+ gtk_widget_class_bind_callback (widget_class, renderer_edited_cb);
+ gtk_widget_class_bind_callback (widget_class, filter_combo_changed);
+ gtk_widget_class_bind_callback (widget_class, location_button_toggled_cb);
+ gtk_widget_class_bind_callback (widget_class, new_folder_button_clicked);
+ gtk_widget_class_bind_callback (widget_class, path_bar_clicked);
+}
+
+static void
+gtk_file_chooser_default_iface_init (GtkFileChooserIface *iface)
+{
+ iface->select_file = gtk_file_chooser_default_select_file;
+ iface->unselect_file = gtk_file_chooser_default_unselect_file;
+ iface->select_all = gtk_file_chooser_default_select_all;
+ iface->unselect_all = gtk_file_chooser_default_unselect_all;
+ iface->get_files = gtk_file_chooser_default_get_files;
+ iface->get_preview_file = gtk_file_chooser_default_get_preview_file;
+ iface->get_file_system = gtk_file_chooser_default_get_file_system;
+ iface->set_current_folder = gtk_file_chooser_default_set_current_folder;
+ iface->get_current_folder = gtk_file_chooser_default_get_current_folder;
+ iface->set_current_name = gtk_file_chooser_default_set_current_name;
+ iface->add_filter = gtk_file_chooser_default_add_filter;
+ iface->remove_filter = gtk_file_chooser_default_remove_filter;
+ iface->list_filters = gtk_file_chooser_default_list_filters;
+ iface->add_shortcut_folder = gtk_file_chooser_default_add_shortcut_folder;
+ iface->remove_shortcut_folder = gtk_file_chooser_default_remove_shortcut_folder;
+ iface->list_shortcut_folders = gtk_file_chooser_default_list_shortcut_folders;
+}
+
+static void
+gtk_file_chooser_embed_default_iface_init (GtkFileChooserEmbedIface *iface)
+{
+ iface->get_default_size = gtk_file_chooser_default_get_default_size;
+ iface->should_respond = gtk_file_chooser_default_should_respond;
+ iface->initial_focus = gtk_file_chooser_default_initial_focus;
}
+static void
+post_process_ui (GtkFileChooserDefault *impl)
+{
+ GtkTreeSelection *selection;
+ GtkStyleContext *context;
+ GtkCellRenderer *cell;
+ GList *cells;
+
+ /* Target types for dragging a row to/from the shortcuts list */
+ const GtkTargetEntry tree_model_row_targets[] = {
+ { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, GTK_TREE_MODEL_ROW }
+ };
+
+ /* Shortcuts model needs a pointer back to the 'impl' */
+ SHORTCUTS_PANE_MODEL_FILTER (impl->priv->shortcuts_pane_filter_model)->impl = impl;
+
+ /* Some qdata, qdata can't be set with GtkBuilder */
+#ifdef PROFILE_FILE_CHOOSER
+ g_object_set_data (G_OBJECT (impl->priv->browse_shortcuts_tree_view), "fmq-name", "shortcuts");
+ g_object_set_data (G_OBJECT (impl->priv->browse_files_tree_view), "fmq-name", "file_list");
+#endif
+ g_object_set_data (G_OBJECT (impl->priv->browse_files_tree_view), I_("GtkFileChooserDefault"), impl);
+
+ /* Setup Places and File List Treeviews
+ */
+ gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view),
+ GDK_BUTTON1_MASK,
+ tree_model_row_targets,
+ G_N_ELEMENTS (tree_model_row_targets),
+ GDK_ACTION_MOVE);
+
+ gtk_drag_dest_set (impl->priv->browse_shortcuts_tree_view,
+ GTK_DEST_DEFAULT_ALL,
+ tree_model_row_targets,
+ G_N_ELEMENTS (tree_model_row_targets),
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+ gtk_drag_dest_add_uri_targets (impl->priv->browse_shortcuts_tree_view);
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_files_tree_view));
+ gtk_tree_selection_set_select_function (selection,
+ list_select_func,
+ impl, NULL);
+ gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->priv->browse_files_tree_view),
+ GDK_BUTTON1_MASK,
+ NULL, 0,
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+ gtk_drag_source_add_uri_targets (impl->priv->browse_files_tree_view);
+
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view));
+ gtk_tree_selection_set_select_function (selection,
+ shortcuts_select_func,
+ impl, NULL);
+
+ gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (impl->priv->browse_shortcuts_tree_view),
+ shortcuts_row_separator_func,
+ NULL, NULL);
+
+ gtk_drag_dest_set (impl->priv->browse_files_tree_view,
+ GTK_DEST_DEFAULT_ALL,
+ NULL, 0,
+ GDK_ACTION_COPY | GDK_ACTION_MOVE);
+ gtk_drag_dest_add_uri_targets (impl->priv->browse_files_tree_view);
+
+ /* GtkStyleContext 'junctions' cannot be set with GtkBuilder */
+ context = gtk_widget_get_style_context (impl->priv->browse_shortcuts_swin);
+ gtk_style_context_set_junction_sides (context, GTK_JUNCTION_BOTTOM);
+
+ context = gtk_widget_get_style_context (impl->priv->browse_shortcuts_toolbar);
+ gtk_style_context_set_junction_sides (context, GTK_JUNCTION_TOP);
+
+ /* File browser treemodel columns are shared between GtkFileChooser implementations,
+ * so we don't set cell renderer attributes in GtkBuilder, but rather keep that
+ * in code.
+ */
+ file_list_set_sort_column_ids (impl);
+ update_cell_renderer_attributes (impl);
+
+ /* Get the combo's text renderer and set ellipsize parameters,
+ * perhaps GtkComboBoxText should declare the cell renderer
+ * as an 'internal-child', then we could configure it in GtkBuilder
+ * instead of hard coding it here.
+ */
+ cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (impl->priv->filter_combo));
+ g_assert (cells);
+ cell = cells->data;
+ g_object_set (G_OBJECT (cell),
+ "ellipsize", PANGO_ELLIPSIZE_END,
+ NULL);
+
+ g_list_free (cells);
+
+ /* Set the GtkPathBar file system backend */
+ _gtk_path_bar_set_file_system (GTK_PATH_BAR (impl->priv->browse_path_bar), impl->priv->file_system);
+
+ /* Set the fixed size icon renderer, this requires
+ * that priv->icon_size be already setup.
+ */
+ set_icon_cell_renderer_fixed_size (impl);
+}
+
+static void
+_gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
+{
+ profile_start ("start", NULL);
+#ifdef PROFILE_FILE_CHOOSER
+ access ("MARK: *** CREATE FILE CHOOSER", F_OK);
+#endif
+
+ impl->priv = G_TYPE_INSTANCE_GET_PRIVATE (impl,
+ GTK_TYPE_FILE_CHOOSER_DEFAULT,
+ GtkFileChooserDefaultPrivate);
+
+ impl->priv->local_only = TRUE;
+ impl->priv->preview_widget_active = TRUE;
+ impl->priv->use_preview_label = TRUE;
+ impl->priv->select_multiple = FALSE;
+ impl->priv->show_hidden = FALSE;
+ impl->priv->show_size_column = TRUE;
+ impl->priv->icon_size = FALLBACK_ICON_SIZE;
+ impl->priv->load_state = LOAD_EMPTY;
+ impl->priv->reload_state = RELOAD_EMPTY;
+ impl->priv->pending_select_files = NULL;
+ impl->priv->location_mode = LOCATION_MODE_PATH_BAR;
+ impl->priv->operation_mode = OPERATION_MODE_BROWSE;
+ impl->priv->sort_column = MODEL_COL_NAME;
+ impl->priv->sort_order = GTK_SORT_ASCENDING;
+ impl->priv->recent_manager = gtk_recent_manager_get_default ();
+ impl->priv->create_folders = TRUE;
+
+ /* Ensure GTK+ private types used by the template
+ * definition before calling gtk_widget_init_template()
+ */
+ g_type_ensure (SHORTCUTS_PANE_MODEL_FILTER_TYPE);
+ g_type_ensure (GTK_TYPE_PATH_BAR);
+ gtk_widget_init_template (GTK_WIDGET (impl));
+
+ set_file_system_backend (impl);
+
+ /* Populate the Places sidebar */
+ shortcuts_model_populate (impl);
+
+ /* Setup various attributes and callbacks in the UI
+ * which cannot be done with GtkBuilder.
+ */
+ post_process_ui (impl);
+
+ profile_end ("end", NULL);
+}
diff --git a/gtk/gtkfilechooserdefault.ui b/gtk/gtkfilechooserdefault.ui
new file mode 100644
index 0000000..44124ca
--- /dev/null
+++ b/gtk/gtkfilechooserdefault.ui
@@ -0,0 +1,555 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interface domain="gtk30">
+ <!-- interface-requires gtkprivate 3.10 -->
+ <!-- interface-requires gtk+ 3.10 -->
+ <object class="GtkImage" id="location_button_image">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-edit</property>
+ </object>
+ <template class="GtkFileChooserDefault" parent="GtkBox">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkBox" id="browse_widgets_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkBox" id="browse_header_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkBox" id="location_entry_box">
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkLabel" id="location_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label" translatable="yes">Location:</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="browse_path_bar_hbox">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkToggleButton" id="location_button">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="tooltip_text" translatable="yes">Type a file name</property>
+ <property name="image">location_button_image</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="location_button-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Type a file
name</property>
+ </object>
+ </child>
+ <signal name="toggled" handler="location_button_toggled_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkPathBar" id="browse_path_bar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <signal name="path-clicked" handler="path_bar_clicked" after="yes" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkInfoBar" id="browse_select_a_folder_info_bar">
+ <property name="app_paintable">True</property>
+ <property name="can_focus">False</property>
+ <child internal-child="content_area">
+ <object class="GtkBox" id="infobar-content_area1">
+ <property name="can_focus">False</property>
+ <property name="border_width">8</property>
+ <property name="spacing">16</property>
+ <child>
+ <object class="GtkImage" id="browse_select_a_folder_icon">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-directory</property>
+ <property name="icon_size">1</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="browse_select_a_folder_label">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="label">message</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child internal-child="action_area">
+ <object class="GtkButtonBox" id="infobar-action_area1">
+ <property name="can_focus">False</property>
+ <property name="border_width">5</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <property name="layout_style">end</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">2</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkImage" id="browse_special_mode_icon">
+ <property name="can_focus">False</property>
+ <property name="stock">gtk-missing-image</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">3</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkLabel" id="browse_special_mode_label">
+ <property name="can_focus">False</property>
+ <property name="label">special</property>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">4</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkButton" id="browse_new_folder_button">
+ <property name="label" translatable="yes">Create Fo_lder</property>
+ <property name="can_focus">True</property>
+ <property name="receives_default">True</property>
+ <property name="use_underline">True</property>
+ <signal name="clicked" handler="new_folder_button_clicked" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">5</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkPaned" id="browse_widgets_hpaned">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <child>
+ <object class="GtkBox" id="browse_shortcuts_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <child>
+ <object class="GtkScrolledWindow" id="browse_shortcuts_swin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="hscrollbar_policy">never</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="browse_shortcuts_tree_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="model">shortcuts_pane_filter_model</property>
+ <property name="enable_search">False</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="browse_shortcuts_tree_view-atkobject">
+ <property name="AtkObject::accessible-name" translatable="yes">Places</property>
+ </object>
+ </child>
+ <style>
+ <class name="sidebar"/>
+ </style>
+ <signal name="button-press-event" handler="shortcuts_button_press_event_cb"
swapped="no"/>
+ <signal name="drag-begin" handler="shortcuts_drag_begin_cb" swapped="no"/>
+ <signal name="drag-data-delete" handler="shortcuts_drag_data_delete_cb"
swapped="no"/>
+ <signal name="drag-data-received" handler="shortcuts_drag_data_received_cb"
swapped="no"/>
+ <signal name="drag-drop" handler="shortcuts_drag_drop_cb" swapped="no"/>
+ <signal name="drag-end" handler="shortcuts_drag_end_cb" swapped="no"/>
+ <signal name="drag-leave" handler="shortcuts_drag_leave_cb" swapped="no"/>
+ <signal name="drag-motion" handler="shortcuts_drag_motion_cb" swapped="no"/>
+ <signal name="key-press-event" handler="shortcuts_key_press_event_after_cb"
after="yes" swapped="no"/>
+ <signal name="key-press-event" handler="shortcuts_key_press_event_cb" swapped="no"/>
+ <signal name="popup-menu" handler="shortcuts_popup_menu_cb" swapped="no"/>
+ <signal name="query-tooltip" handler="shortcuts_query_tooltip_cb" swapped="no"/>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection1">
+ <signal name="changed" handler="shortcuts_selection_changed_cb" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <property name="title" translatable="yes">Places</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="cellrendererpixbuf1"/>
+ <attributes>
+ <attribute name="visible">5</attribute>
+ <attribute name="pixbuf">0</attribute>
+ </attributes>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1">
+ <property name="ellipsize">end</property>
+ <property name="width_chars">12</property>
+ <signal name="edited" handler="shortcuts_edited" swapped="no"/>
+ <signal name="editing-canceled" handler="shortcuts_editing_canceled"
swapped="no"/>
+ </object>
+ <attributes>
+ <attribute name="text">1</attribute>
+ </attributes>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolbar" id="browse_shortcuts_toolbar">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="toolbar_style">icons</property>
+ <style>
+ <class name="inline-toolbar"/>
+ </style>
+ <property name="icon_size">1</property>
+ <child>
+ <object class="GtkToolButton" id="browse_shortcuts_add_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Add the selected folder to the
Bookmarks</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-add-symbolic</property>
+ <signal name="clicked" handler="add_bookmark_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkToolButton" id="browse_shortcuts_remove_button">
+ <property name="visible">True</property>
+ <property name="sensitive">False</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Remove the selected
bookmark</property>
+ <property name="use_underline">True</property>
+ <property name="icon_name">list-remove-symbolic</property>
+ <signal name="clicked" handler="remove_bookmark_button_clicked_cb" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="homogeneous">True</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">False</property>
+ <property name="shrink">False</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="browse_files_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">6</property>
+ <child>
+ <object class="GtkBox" id="list_and_preview_box">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkScrolledWindow" id="browse_files_swin">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="vscrollbar_policy">always</property>
+ <property name="shadow_type">in</property>
+ <child>
+ <object class="GtkTreeView" id="browse_files_tree_view">
+ <property name="visible">True</property>
+ <property name="can_focus">True</property>
+ <property name="has_tooltip">True</property>
+ <property name="rules_hint">True</property>
+ <child internal-child="accessible">
+ <object class="AtkObject" id="browse_files_tree_view-atkobject">
+ <property name="AtkObject::accessible-name"
translatable="yes">Files</property>
+ </object>
+ </child>
+ <signal name="button-press-event" handler="list_button_press_event_cb"
swapped="no"/>
+ <signal name="drag-data-received" handler="file_list_drag_data_received_cb"
swapped="no"/>
+ <signal name="drag-drop" handler="file_list_drag_drop_cb" swapped="no"/>
+ <signal name="drag-motion" handler="file_list_drag_motion_cb" swapped="no"/>
+ <signal name="key-press-event" handler="browse_files_key_press_event_cb"
swapped="no"/>
+ <signal name="popup-menu" handler="list_popup_menu_cb" swapped="no"/>
+ <signal name="query-tooltip" handler="file_list_query_tooltip_cb" swapped="no"/>
+ <signal name="row-activated" handler="list_row_activated" swapped="no"/>
+ <child internal-child="selection">
+ <object class="GtkTreeSelection" id="treeview-selection2">
+ <signal name="changed" handler="list_selection_changed" swapped="no"/>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="list_name_column">
+ <property name="resizable">True</property>
+ <property name="title" translatable="yes">Name</property>
+ <property name="expand">True</property>
+ <child>
+ <object class="GtkCellRendererPixbuf" id="list_pixbuf_renderer"/>
+ </child>
+ <child>
+ <object class="GtkCellRendererText" id="list_name_renderer">
+ <property name="ellipsize">end</property>
+ <signal name="edited" handler="renderer_edited_cb" swapped="no"/>
+ <signal name="editing-canceled" handler="renderer_editing_canceled_cb"
swapped="no"/>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="list_size_column">
+ <property name="resizable">True</property>
+ <property name="title" translatable="yes">Size</property>
+ <child>
+ <object class="GtkCellRendererText" id="list_size_renderer">
+ <property name="alignment">right</property>
+ </object>
+ </child>
+ </object>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="list_mtime_column">
+ <property name="resizable">True</property>
+ <property name="title" translatable="yes">Modifed</property>
+ <child>
+ <object class="GtkCellRendererText" id="list_mtime_renderer"/>
+ </child>
+ </object>
+ </child>
+ </object>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="preview_box">
+ <property name="can_focus">False</property>
+ <property name="orientation">vertical</property>
+ <property name="spacing">12</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="filter_combo_hbox">
+ <property name="can_focus">False</property>
+ <property name="spacing">12</property>
+ <child>
+ <object class="GtkComboBoxText" id="filter_combo">
+ <property name="visible">True</property>
+ <property name="can_focus">False</property>
+ <property name="tooltip_text" translatable="yes">Select which types of files are
shown</property>
+ <property name="focus_on_click">False</property>
+ <property name="entry_text_column">0</property>
+ <property name="id_column">1</property>
+ <signal name="changed" handler="filter_combo_changed" swapped="no"/>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="pack_type">end</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="resize">True</property>
+ <property name="shrink">False</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">True</property>
+ <property name="fill">True</property>
+ <property name="position">0</property>
+ </packing>
+ </child>
+ <child>
+ <object class="GtkBox" id="extra_align">
+ <property name="can_focus">False</property>
+ <property name="halign">start</property>
+ <property name="valign">center</property>
+ <child>
+ <placeholder/>
+ </child>
+ <child>
+ <placeholder/>
+ </child>
+ </object>
+ <packing>
+ <property name="expand">False</property>
+ <property name="fill">False</property>
+ <property name="position">1</property>
+ </packing>
+ </child>
+ </template>
+ <object class="GtkSizeGroup" id="browse_path_bar_size_group">
+ <property name="mode">vertical</property>
+ <widgets>
+ <widget name="location_button"/>
+ <widget name="browse_path_bar"/>
+ <widget name="browse_select_a_folder_info_bar"/>
+ <widget name="browse_special_mode_icon"/>
+ <widget name="browse_special_mode_label"/>
+ <widget name="browse_new_folder_button"/>
+ </widgets>
+ </object>
+ <object class="GtkSizeGroup" id="paned_group">
+ <property name="mode">vertical</property>
+ <widgets>
+ <widget name="browse_shortcuts_swin"/>
+ <widget name="browse_files_swin"/>
+ </widgets>
+ </object>
+ <object class="GtkListStore" id="shortcuts_model">
+ <columns>
+ <!-- column-name pixbuf -->
+ <column type="GdkPixbuf"/>
+ <!-- column-name name -->
+ <column type="gchararray"/>
+ <!-- column-name path-or-volume -->
+ <column type="gpointer"/>
+ <!-- column-name shortcut-type -->
+ <column type="gint"/>
+ <!-- column-name removable -->
+ <column type="gboolean"/>
+ <!-- column-name pixbuf-visible -->
+ <column type="gboolean"/>
+ <!-- column-name cancellable -->
+ <column type="gpointer"/>
+ </columns>
+ </object>
+ <object class="ShortcutsPaneModelFilter" id="shortcuts_pane_filter_model">
+ <property name="child_model">shortcuts_model</property>
+ </object>
+</interface>
diff --git a/gtk/gtkfilechooserprivate.h b/gtk/gtkfilechooserprivate.h
index 96329ad..3f7d08c 100644
--- a/gtk/gtkfilechooserprivate.h
+++ b/gtk/gtkfilechooserprivate.h
@@ -46,6 +46,7 @@ G_BEGIN_DECLS
#define GTK_FILE_CHOOSER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FILE_CHOOSER,
GtkFileChooserIface))
typedef struct _GtkFileChooserIface GtkFileChooserIface;
+typedef struct _GtkFileChooserDefaultPrivate GtkFileChooserDefaultPrivate;
struct _GtkFileChooserIface
{
@@ -152,160 +153,9 @@ struct _GtkFileChooserDefault
{
GtkBox parent_instance;
- GtkFileChooserAction action;
-
- GtkFileSystem *file_system;
-
- /* Save mode widgets */
- GtkWidget *save_widgets;
- GtkWidget *save_widgets_table;
-
- GtkWidget *save_folder_label;
-
- /* The file browsing widgets */
- GtkWidget *browse_widgets_box;
- GtkWidget *browse_widgets_hpaned;
- GtkWidget *browse_header_box;
- GtkWidget *browse_shortcuts_tree_view;
- GtkWidget *browse_shortcuts_add_button;
- GtkWidget *browse_shortcuts_remove_button;
- GtkWidget *browse_shortcuts_popup_menu;
- GtkWidget *browse_shortcuts_popup_menu_remove_item;
- GtkWidget *browse_shortcuts_popup_menu_rename_item;
- GtkWidget *browse_files_tree_view;
- GtkWidget *browse_files_popup_menu;
- GtkWidget *browse_files_popup_menu_add_shortcut_item;
- GtkWidget *browse_files_popup_menu_hidden_files_item;
- GtkWidget *browse_files_popup_menu_size_column_item;
- GtkWidget *browse_files_popup_menu_copy_file_location_item;
- GtkWidget *browse_files_popup_menu_visit_file_item;
- GtkWidget *browse_new_folder_button;
- GtkWidget *browse_path_bar_hbox;
- GtkSizeGroup *browse_path_bar_size_group;
- GtkWidget *browse_path_bar;
- GtkWidget *browse_special_mode_icon;
- GtkWidget *browse_special_mode_label;
- GtkWidget *browse_select_a_folder_info_bar;
- GtkWidget *browse_select_a_folder_label;
- GtkWidget *browse_select_a_folder_icon;
-
- GtkFileSystemModel *browse_files_model;
- char *browse_files_last_selected_name;
-
- /* OPERATION_MODE_SEARCH */
- GtkWidget *search_hbox;
- GtkWidget *search_entry;
- GtkSearchEngine *search_engine;
- GtkQuery *search_query;
- GtkFileSystemModel *search_model;
-
- /* OPERATION_MODE_RECENT */
- GtkRecentManager *recent_manager;
- GtkFileSystemModel *recent_model;
- guint load_recent_id;
-
- GtkWidget *filter_combo_hbox;
- GtkWidget *filter_combo;
- GtkWidget *preview_box;
- GtkWidget *preview_label;
- GtkWidget *preview_widget;
- GtkWidget *extra_align;
- GtkWidget *extra_widget;
-
- GtkWidget *location_button;
- GtkWidget *location_entry_box;
- GtkWidget *location_label;
- GtkWidget *location_entry;
- LocationMode location_mode;
-
- GtkListStore *shortcuts_model;
-
- /* Filter for the shortcuts pane. We filter out the "current folder" row and
- * the separator that we use for the "Save in folder" combo.
- */
- GtkTreeModel *shortcuts_pane_filter_model;
-
- /* Handles */
- GSList *loading_shortcuts;
- GSList *reload_icon_cancellables;
- GCancellable *file_list_drag_data_received_cancellable;
- GCancellable *update_current_folder_cancellable;
- GCancellable *should_respond_get_info_cancellable;
- GCancellable *file_exists_get_info_cancellable;
- GCancellable *update_from_entry_cancellable;
- GCancellable *shortcuts_activate_iter_cancellable;
-
- LoadState load_state;
- ReloadState reload_state;
- guint load_timeout_id;
-
- OperationMode operation_mode;
-
- GSList *pending_select_files;
-
- GtkFileFilter *current_filter;
- GSList *filters;
-
- int num_volumes;
- int num_shortcuts;
- int num_bookmarks;
-
- gulong volumes_changed_id;
- gulong bookmarks_changed_id;
-
- GFile *current_volume_file;
- GFile *current_folder;
- GFile *preview_file;
- char *preview_display_name;
-
- GtkTreeViewColumn *list_name_column;
- GtkCellRenderer *list_name_renderer;
- GtkTreeViewColumn *list_mtime_column;
- GtkTreeViewColumn *list_size_column;
-
- GSource *edited_idle;
- char *edited_new_text;
-
- gulong settings_signal_id;
- int icon_size;
-
- GSource *focus_entry_idle;
-
- gulong toplevel_set_focus_id;
- GtkWidget *toplevel_last_focus_widget;
-
- gint sort_column;
- GtkSortType sort_order;
-
-#if 0
- GdkDragContext *shortcuts_drag_context;
- GSource *shortcuts_drag_outside_idle;
-#endif
-
- /* Flags */
-
- guint local_only : 1;
- guint preview_widget_active : 1;
- guint use_preview_label : 1;
- guint select_multiple : 1;
- guint show_hidden : 1;
- guint do_overwrite_confirmation : 1;
- guint list_sort_ascending : 1;
- guint changing_folder : 1;
- guint shortcuts_current_folder_active : 1;
- guint has_home : 1;
- guint has_desktop : 1;
- guint has_search : 1;
- guint has_recent: 1;
- guint show_size_column : 1;
- guint create_folders : 1;
-
-#if 0
- guint shortcuts_drag_outside : 1;
-#endif
+ GtkFileChooserDefaultPrivate *priv;
};
-
G_END_DECLS
#endif /* __GTK_FILE_CHOOSER_PRIVATE_H__ */
diff --git a/gtk/tests/templates.c b/gtk/tests/templates.c
index a76e20a..b9c7fd9 100644
--- a/gtk/tests/templates.c
+++ b/gtk/tests/templates.c
@@ -18,6 +18,14 @@
*/
#include <gtk/gtk.h>
+static gboolean
+main_loop_quit_cb (gpointer data)
+{
+ gtk_main_quit ();
+
+ return FALSE;
+}
+
static void
test_dialog_basic (void)
{
@@ -25,6 +33,9 @@ test_dialog_basic (void)
dialog = gtk_dialog_new();
g_assert (GTK_IS_DIALOG (dialog));
+ g_assert (gtk_dialog_get_action_area (GTK_DIALOG (dialog)) != NULL);
+ g_assert (gtk_dialog_get_content_area (GTK_DIALOG (dialog)) != NULL);
+
gtk_widget_destroy (dialog);
}
@@ -136,6 +147,13 @@ test_app_chooser_dialog_basic (void)
widget = gtk_app_chooser_dialog_new_for_content_type (NULL, 0, "text/plain");
g_assert (GTK_IS_APP_CHOOSER_DIALOG (widget));
+
+ /* GtkAppChooserDialog bug, if destroyed before spinning
+ * the main context then app_chooser_online_get_default_ready_cb()
+ * will be eventually called and segfault.
+ */
+ g_timeout_add (500, main_loop_quit_cb, NULL);
+ gtk_main();
gtk_widget_destroy (widget);
}
@@ -149,6 +167,44 @@ test_color_chooser_dialog_basic (void)
gtk_widget_destroy (widget);
}
+/* Avoid warnings from GVFS-RemoteVolumeMonitor */
+static gboolean
+ignore_gvfs_warning (const gchar *log_domain,
+ GLogLevelFlags log_level,
+ const gchar *message,
+ gpointer user_data)
+{
+ if (g_strcmp0 (log_domain, "GVFS-RemoteVolumeMonitor") == 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+static void
+test_file_chooser_widget_basic (void)
+{
+ GtkWidget *widget;
+
+ g_test_log_set_fatal_handler (ignore_gvfs_warning, NULL);
+
+ widget = gtk_file_chooser_widget_new (GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER);
+ g_assert (GTK_IS_FILE_CHOOSER_WIDGET (widget));
+
+ /* XXX BUG:
+ *
+ * Spin the mainloop for a bit, this allows the file operations
+ * to complete, GtkFileChooserDefault has a bug where it leaks
+ * GtkTreeRowReferences to the internal shortcuts_model
+ *
+ * Since we assert all automated children are finalized we
+ * can catch this
+ */
+ g_timeout_add (100, main_loop_quit_cb, NULL);
+ gtk_main();
+
+ gtk_widget_destroy (widget);
+}
+
int
main (int argc, char **argv)
{
@@ -173,6 +229,7 @@ main (int argc, char **argv)
g_test_add_func ("/Template/GtkAppChooserWidget/Basic", test_app_chooser_widget_basic);
g_test_add_func ("/Template/GtkAppChooserDialog/Basic", test_app_chooser_dialog_basic);
g_test_add_func ("/Template/GtkColorChooserDialog/Basic", test_color_chooser_dialog_basic);
+ g_test_add_func ("/Template/GtkFileChooserWidget/Basic", test_file_chooser_widget_basic);
return g_test_run();
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]