1 /* GTK - The GIMP Toolkit
2 * gtkfilechooserprivate.h: Interface definition for file selector GUIs
3 * Copyright (C) 2003, Red Hat, Inc.
5 * This library is free software; you can redistribute it and/or
6 * modify it under the terms of the GNU Lesser General Public
7 * License as published by the Free Software Foundation; either
8 * version 2 of the License, or (at your option) any later version.
10 * This library is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 * Lesser General Public License for more details.
15 * You should have received a copy of the GNU Lesser General Public
16 * License along with this library; if not, write to the
17 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 * Boston, MA 02111-1307, USA.
21 #ifndef __GTK_FILE_CHOOSER_PRIVATE_H__
22 #define __GTK_FILE_CHOOSER_PRIVATE_H__
24 #include "gtkfilechooser.h"
25 #include "gtkfilesystem.h"
26 #include "gtkfilesystemmodel.h"
27 #include "gtkliststore.h"
28 #include "gtktooltips.h"
29 #include "gtktreemodelsort.h"
30 #include "gtktreestore.h"
31 #include "gtktreeview.h"
36 #define GTK_FILE_CHOOSER_GET_IFACE(inst) (G_TYPE_INSTANCE_GET_INTERFACE ((inst), GTK_TYPE_FILE_CHOOSER, GtkFileChooserIface))
38 typedef struct _GtkFileChooserIface GtkFileChooserIface;
40 struct _GtkFileChooserIface
42 GTypeInterface base_iface;
46 gboolean (*set_current_folder) (GtkFileChooser *chooser,
47 const GtkFilePath *path,
49 GtkFilePath * (*get_current_folder) (GtkFileChooser *chooser);
50 void (*set_current_name) (GtkFileChooser *chooser,
52 gboolean (*select_path) (GtkFileChooser *chooser,
53 const GtkFilePath *path,
55 void (*unselect_path) (GtkFileChooser *chooser,
56 const GtkFilePath *path);
57 void (*select_all) (GtkFileChooser *chooser);
58 void (*unselect_all) (GtkFileChooser *chooser);
59 GSList * (*get_paths) (GtkFileChooser *chooser);
60 GtkFilePath * (*get_preview_path) (GtkFileChooser *chooser);
61 GtkFileSystem *(*get_file_system) (GtkFileChooser *chooser);
62 void (*add_filter) (GtkFileChooser *chooser,
63 GtkFileFilter *filter);
64 void (*remove_filter) (GtkFileChooser *chooser,
65 GtkFileFilter *filter);
66 GSList * (*list_filters) (GtkFileChooser *chooser);
67 gboolean (*add_shortcut_folder) (GtkFileChooser *chooser,
68 const GtkFilePath *path,
70 gboolean (*remove_shortcut_folder) (GtkFileChooser *chooser,
71 const GtkFilePath *path,
73 GSList * (*list_shortcut_folders) (GtkFileChooser *chooser);
77 void (*current_folder_changed) (GtkFileChooser *chooser);
78 void (*selection_changed) (GtkFileChooser *chooser);
79 void (*update_preview) (GtkFileChooser *chooser);
80 void (*file_activated) (GtkFileChooser *chooser);
81 GtkFileChooserConfirmation (*confirm_overwrite) (GtkFileChooser *chooser);
84 GtkFileSystem *_gtk_file_chooser_get_file_system (GtkFileChooser *chooser);
85 gboolean _gtk_file_chooser_set_current_folder_path (GtkFileChooser *chooser,
86 const GtkFilePath *path,
88 GtkFilePath * _gtk_file_chooser_get_current_folder_path (GtkFileChooser *chooser);
89 gboolean _gtk_file_chooser_select_path (GtkFileChooser *chooser,
90 const GtkFilePath *path,
92 void _gtk_file_chooser_unselect_path (GtkFileChooser *chooser,
93 const GtkFilePath *path);
94 GSList * _gtk_file_chooser_get_paths (GtkFileChooser *chooser);
95 GtkFilePath * _gtk_file_chooser_get_preview_path (GtkFileChooser *chooser);
96 gboolean _gtk_file_chooser_add_shortcut_folder (GtkFileChooser *chooser,
97 const GtkFilePath *path,
99 gboolean _gtk_file_chooser_remove_shortcut_folder (GtkFileChooser *chooser,
100 const GtkFilePath *path,
103 /* GtkFileChooserDialog private */
105 struct _GtkFileChooserDialogPrivate
111 /* for use with GtkFileChooserEmbed */
114 gboolean resize_horizontally;
115 gboolean resize_vertically;
119 /* GtkFileChooserWidget private */
121 struct _GtkFileChooserWidgetPrivate
129 /* GtkFileChooserDefault private */
132 LOAD_EMPTY, /* There is no model */
133 LOAD_PRELOAD, /* Model is loading and a timer is running; model isn't inserted into the tree yet */
134 LOAD_LOADING, /* Timeout expired, model is inserted into the tree, but not fully loaded yet */
135 LOAD_FINISHED /* Model is fully loaded and inserted into the tree */
138 struct _GtkFileChooserDefault
140 GtkVBox parent_instance;
142 GtkFileChooserAction action;
144 GtkFileSystem *file_system;
146 /* Save mode widgets */
147 GtkWidget *save_widgets;
149 GtkWidget *save_file_name_entry;
150 GtkWidget *save_folder_label;
151 GtkWidget *save_folder_combo;
152 GtkWidget *save_expander;
154 /* The file browsing widgets */
155 GtkWidget *browse_widgets;
156 GtkWidget *browse_shortcuts_tree_view;
157 GtkWidget *browse_shortcuts_add_button;
158 GtkWidget *browse_shortcuts_remove_button;
159 GtkWidget *browse_shortcuts_popup_menu;
160 GtkWidget *browse_shortcuts_popup_menu_remove_item;
161 GtkWidget *browse_shortcuts_popup_menu_rename_item;
162 GtkWidget *browse_files_tree_view;
163 GtkWidget *browse_files_popup_menu;
164 GtkWidget *browse_files_popup_menu_add_shortcut_item;
165 GtkWidget *browse_files_popup_menu_hidden_files_item;
166 GtkWidget *browse_new_folder_button;
167 GtkWidget *browse_path_bar;
169 GtkFileSystemModel *browse_files_model;
171 GtkWidget *filter_combo_hbox;
172 GtkWidget *filter_combo;
173 GtkWidget *preview_box;
174 GtkWidget *preview_label;
175 GtkWidget *preview_widget;
176 GtkWidget *extra_align;
177 GtkWidget *extra_widget;
179 GtkListStore *shortcuts_model;
180 GtkTreeModel *shortcuts_filter_model;
182 GtkTreeModelSort *sort_model;
184 LoadState load_state;
185 guint load_timeout_id;
187 GSList *pending_select_paths;
189 GtkFileFilter *current_filter;
192 GtkTooltips *tooltips;
195 gboolean has_desktop;
201 gulong volumes_changed_id;
202 gulong bookmarks_changed_id;
204 GtkFilePath *current_volume_path;
205 GtkFilePath *current_folder;
206 GtkFilePath *preview_path;
207 char *preview_display_name;
209 GtkTreeViewColumn *list_name_column;
210 GtkCellRenderer *list_name_renderer;
212 GSource *edited_idle;
213 char *edited_new_text;
215 gulong settings_signal_id;
218 gulong toplevel_set_focus_id;
219 GtkWidget *toplevel_last_focus_widget;
222 GdkDragContext *shortcuts_drag_context;
223 GSource *shortcuts_drag_outside_idle;
228 guint local_only : 1;
229 guint preview_widget_active : 1;
230 guint use_preview_label : 1;
231 guint select_multiple : 1;
232 guint show_hidden : 1;
233 guint do_overwrite_confirmation : 1;
234 guint list_sort_ascending : 1;
235 guint changing_folder : 1;
236 guint shortcuts_current_folder_active : 1;
239 guint shortcuts_drag_outside : 1;
244 /* GtkFileSystemModel private */
246 typedef struct _FileModelNode FileModelNode;
248 struct _GtkFileSystemModel
250 GObject parent_instance;
252 GtkFileSystem *file_system;
253 GtkFileInfoType types;
254 FileModelNode *roots;
255 GtkFileFolder *root_folder;
256 GtkFilePath *root_path;
258 GtkFileSystemModelFilter filter_func;
259 gpointer filter_data;
262 GSource *idle_clear_source;
263 GSource *idle_finished_loading_source;
267 guint show_hidden : 1;
268 guint show_folders : 1;
269 guint show_files : 1;
270 guint folders_only : 1;
271 guint has_editable : 1;
274 struct _FileModelNode
280 GtkFileFolder *folder;
282 FileModelNode *children;
283 FileModelNode *parent;
284 GtkFileSystemModel *model;
287 guint n_referenced_children;
293 guint is_visible : 1;
295 guint idle_clear : 1;
301 #endif /* __GTK_FILE_CHOOSER_PRIVATE_H__ */