summaryrefslogtreecommitdiffstats
path: root/meta/packages/gtk+
diff options
context:
space:
mode:
authorTomas Frydrych <tf@openedhand.com>2007-02-09 18:18:44 +0000
committerTomas Frydrych <tf@openedhand.com>2007-02-09 18:18:44 +0000
commit91d6da983316dc9b9f09cb44091c0c81e8a679ac (patch)
treeae979560a6e8dfe05748415624b6245893ba4c9a /meta/packages/gtk+
parent19d07794eed15aad348bb6c8b4514936b49a421a (diff)
downloadpoky-91d6da983316dc9b9f09cb44091c0c81e8a679ac.tar.gz
added filter selector
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1267 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta/packages/gtk+')
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch990
-rw-r--r--meta/packages/gtk+/gtk+_2.6.8.bb2
2 files changed, 410 insertions, 582 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch b/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch
index d4534212a0..fa2dfb4843 100644
--- a/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch
+++ b/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch
@@ -1,5 +1,5 @@
1--- gtk+-2.6.8/gtk/gtkfilechooserdefault.c.orig 2007-02-09 12:28:31.000000000 +0000 1--- gtk+-2.6.8/gtk/gtkfilechooserdefault.c.orig 2007-02-09 18:37:47.000000000 +0000
2+++ gtk+-2.6.8/gtk/gtkfilechooserdefault.c 2007-02-09 12:28:31.000000000 +0000 2+++ gtk+-2.6.8/gtk/gtkfilechooserdefault.c 2007-02-09 18:37:47.000000000 +0000
3@@ -31,7 +31,6 @@ 3@@ -31,7 +31,6 @@
4 #include "gtkcombobox.h" 4 #include "gtkcombobox.h"
5 #include "gtkentry.h" 5 #include "gtkentry.h"
@@ -40,7 +40,7 @@
40 40
41 #define MAX_LOADING_TIME 500 41 #define MAX_LOADING_TIME 500
42 42
43@@ -109,63 +112,33 @@ 43@@ -109,63 +112,38 @@
44 44
45 /* Save mode widgets */ 45 /* Save mode widgets */
46 GtkWidget *save_widgets; 46 GtkWidget *save_widgets;
@@ -68,7 +68,7 @@
68 GtkFileSystemModel *browse_files_model; 68 GtkFileSystemModel *browse_files_model;
69 69
70- GtkWidget *filter_combo_hbox; 70- GtkWidget *filter_combo_hbox;
71- GtkWidget *filter_combo; 71 GtkWidget *filter_combo;
72- GtkWidget *preview_box; 72- GtkWidget *preview_box;
73- GtkWidget *preview_label; 73- GtkWidget *preview_label;
74- GtkWidget *preview_widget; 74- GtkWidget *preview_widget;
@@ -78,6 +78,7 @@
78- GtkListStore *shortcuts_model; 78- GtkListStore *shortcuts_model;
79- GtkTreeModel *shortcuts_filter_model; 79- GtkTreeModel *shortcuts_filter_model;
80- 80-
81+
81 GtkTreeModelSort *sort_model; 82 GtkTreeModelSort *sort_model;
82 83
83 LoadState load_state; 84 LoadState load_state;
@@ -85,11 +86,11 @@
85 86
86 GSList *pending_select_paths; 87 GSList *pending_select_paths;
87- 88-
88- GtkFileFilter *current_filter;
89- GSList *filters;
90-
91+ GSList * path_history; 89+ GSList * path_history;
92+ 90+
91 GtkFileFilter *current_filter;
92 GSList *filters;
93
93 GtkTooltips *tooltips; 94 GtkTooltips *tooltips;
94 95
95- gboolean has_home; 96- gboolean has_home;
@@ -109,7 +110,7 @@
109 110
110 GtkTreeViewColumn *list_name_column; 111 GtkTreeViewColumn *list_name_column;
111 GtkCellRenderer *list_name_renderer; 112 GtkCellRenderer *list_name_renderer;
112@@ -179,25 +152,15 @@ 113@@ -179,25 +157,15 @@
113 gulong toplevel_set_focus_id; 114 gulong toplevel_set_focus_id;
114 GtkWidget *toplevel_last_focus_widget; 115 GtkWidget *toplevel_last_focus_widget;
115 116
@@ -137,7 +138,7 @@
137 }; 138 };
138 139
139 /* Signal IDs */ 140 /* Signal IDs */
140@@ -211,17 +174,6 @@ 141@@ -211,17 +179,6 @@
141 142
142 static guint signals[LAST_SIGNAL] = { 0 }; 143 static guint signals[LAST_SIGNAL] = { 0 };
143 144
@@ -155,7 +156,7 @@
155 /* Column numbers for the file list */ 156 /* Column numbers for the file list */
156 enum { 157 enum {
157 FILE_LIST_COL_NAME, 158 FILE_LIST_COL_NAME,
158@@ -236,23 +188,6 @@ 159@@ -236,23 +193,6 @@
159 TEXT_URI_LIST 160 TEXT_URI_LIST
160 }; 161 };
161 162
@@ -179,7 +180,7 @@
179 /* Target types for DnD from the file list */ 180 /* Target types for DnD from the file list */
180 static const GtkTargetEntry file_list_source_targets[] = { 181 static const GtkTargetEntry file_list_source_targets[] = {
181 { "text/uri-list", 0, TEXT_URI_LIST } 182 { "text/uri-list", 0, TEXT_URI_LIST }
182@@ -261,22 +196,10 @@ 183@@ -261,22 +201,10 @@
183 static const int num_file_list_source_targets = (sizeof (file_list_source_targets) 184 static const int num_file_list_source_targets = (sizeof (file_list_source_targets)
184 / sizeof (file_list_source_targets[0])); 185 / sizeof (file_list_source_targets[0]));
185 186
@@ -203,7 +204,7 @@
203 #define NUM_LINES 40 204 #define NUM_LINES 40
204 #define NUM_CHARS 60 205 #define NUM_CHARS 60
205 206
206@@ -335,7 +258,6 @@ 207@@ -335,7 +263,6 @@
207 const GtkFilePath *path, 208 const GtkFilePath *path,
208 GError **error); 209 GError **error);
209 static GSList * gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser); 210 static GSList * gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser);
@@ -211,7 +212,7 @@
211 static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed, 212 static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
212 gint *default_width, 213 gint *default_width,
213 gint *default_height); 214 gint *default_height);
214@@ -352,37 +274,6 @@ 215@@ -352,37 +279,11 @@
215 static void home_folder_handler (GtkFileChooserDefault *impl); 216 static void home_folder_handler (GtkFileChooserDefault *impl);
216 static void update_appearance (GtkFileChooserDefault *impl); 217 static void update_appearance (GtkFileChooserDefault *impl);
217 218
@@ -219,8 +220,8 @@
219- GtkFileFilter *filter); 220- GtkFileFilter *filter);
220-static void check_preview_change (GtkFileChooserDefault *impl); 221-static void check_preview_change (GtkFileChooserDefault *impl);
221- 222-
222-static void filter_combo_changed (GtkComboBox *combo_box, 223 static void filter_combo_changed (GtkComboBox *combo_box,
223- GtkFileChooserDefault *impl); 224 GtkFileChooserDefault *impl);
224-static void shortcuts_row_activated_cb (GtkTreeView *tree_view, 225-static void shortcuts_row_activated_cb (GtkTreeView *tree_view,
225- GtkTreePath *path, 226- GtkTreePath *path,
226- GtkTreeViewColumn *column, 227- GtkTreeViewColumn *column,
@@ -245,11 +246,13 @@
245- const GtkFilePath *path); 246- const GtkFilePath *path);
246- 247-
247-static void bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl); 248-static void bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl);
248- 249
250+static void set_current_filter (GtkFileChooserDefault *impl,
251+ GtkFileFilter *filter);
249 static gboolean list_select_func (GtkTreeSelection *selection, 252 static gboolean list_select_func (GtkTreeSelection *selection,
250 GtkTreeModel *model, 253 GtkTreeModel *model,
251 GtkTreePath *path, 254 GtkTreePath *path,
252@@ -401,16 +292,6 @@ 255@@ -401,16 +302,6 @@
253 GtkTreeIter *iter, 256 GtkTreeIter *iter,
254 gpointer user_data); 257 gpointer user_data);
255 258
@@ -266,7 +269,7 @@
266 static void list_icon_data_func (GtkTreeViewColumn *tree_column, 269 static void list_icon_data_func (GtkTreeViewColumn *tree_column,
267 GtkCellRenderer *cell, 270 GtkCellRenderer *cell,
268 GtkTreeModel *tree_model, 271 GtkTreeModel *tree_model,
269@@ -441,36 +322,6 @@ 272@@ -441,36 +332,6 @@
270 273
271 static GObjectClass *parent_class; 274 static GObjectClass *parent_class;
272 275
@@ -303,7 +306,7 @@
303 306
304 GType 307 GType
305 _gtk_file_chooser_default_get_type (void) 308 _gtk_file_chooser_default_get_type (void)
306@@ -520,6 +371,11 @@ 309@@ -520,6 +381,11 @@
307 return file_chooser_default_type; 310 return file_chooser_default_type;
308 } 311 }
309 312
@@ -315,7 +318,7 @@
315 static void 318 static void
316 gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class) 319 gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
317 { 320 {
318@@ -617,6 +473,14 @@ 321@@ -617,6 +483,14 @@
319 "home-folder", 322 "home-folder",
320 0); 323 0);
321 324
@@ -330,7 +333,7 @@
330 _gtk_file_chooser_install_properties (gobject_class); 333 _gtk_file_chooser_install_properties (gobject_class);
331 334
332 gtk_settings_install_property (g_param_spec_string ("gtk-file-chooser-backend", 335 gtk_settings_install_property (g_param_spec_string ("gtk-file-chooser-backend",
333@@ -634,17 +498,19 @@ 336@@ -634,7 +508,6 @@
334 iface->select_all = gtk_file_chooser_default_select_all; 337 iface->select_all = gtk_file_chooser_default_select_all;
335 iface->unselect_all = gtk_file_chooser_default_unselect_all; 338 iface->unselect_all = gtk_file_chooser_default_unselect_all;
336 iface->get_paths = gtk_file_chooser_default_get_paths; 339 iface->get_paths = gtk_file_chooser_default_get_paths;
@@ -338,13 +341,13 @@
338 iface->get_file_system = gtk_file_chooser_default_get_file_system; 341 iface->get_file_system = gtk_file_chooser_default_get_file_system;
339 iface->set_current_folder = gtk_file_chooser_default_set_current_folder; 342 iface->set_current_folder = gtk_file_chooser_default_set_current_folder;
340 iface->get_current_folder = gtk_file_chooser_default_get_current_folder; 343 iface->get_current_folder = gtk_file_chooser_default_get_current_folder;
341 iface->set_current_name = gtk_file_chooser_default_set_current_name; 344@@ -642,9 +515,12 @@
342+
343+ /* these are only stubs */
344+ iface->get_preview_path = gtk_file_chooser_default_get_preview_path;
345 iface->add_filter = gtk_file_chooser_default_add_filter; 345 iface->add_filter = gtk_file_chooser_default_add_filter;
346 iface->remove_filter = gtk_file_chooser_default_remove_filter; 346 iface->remove_filter = gtk_file_chooser_default_remove_filter;
347 iface->list_filters = gtk_file_chooser_default_list_filters; 347 iface->list_filters = gtk_file_chooser_default_list_filters;
348+
349+ /* these are only stubs */
350+ iface->get_preview_path = gtk_file_chooser_default_get_preview_path;
348 iface->add_shortcut_folder = gtk_file_chooser_default_add_shortcut_folder; 351 iface->add_shortcut_folder = gtk_file_chooser_default_add_shortcut_folder;
349 iface->remove_shortcut_folder = gtk_file_chooser_default_remove_shortcut_folder; 352 iface->remove_shortcut_folder = gtk_file_chooser_default_remove_shortcut_folder;
350- iface->list_shortcut_folders = gtk_file_chooser_default_list_shortcut_folders; 353- iface->list_shortcut_folders = gtk_file_chooser_default_list_shortcut_folders;
@@ -352,7 +355,7 @@
352 } 355 }
353 356
354 static void 357 static void
355@@ -659,71 +525,22 @@ 358@@ -659,71 +535,22 @@
356 gtk_file_chooser_default_init (GtkFileChooserDefault *impl) 359 gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
357 { 360 {
358 impl->local_only = TRUE; 361 impl->local_only = TRUE;
@@ -374,7 +377,7 @@
374 g_object_ref (impl->tooltips); 377 g_object_ref (impl->tooltips);
375 gtk_object_sink (GTK_OBJECT (impl->tooltips)); 378 gtk_object_sink (GTK_OBJECT (impl->tooltips));
376-} 379-}
377- 380
378-/* Frees the data columns for the specified iter in the shortcuts model*/ 381-/* Frees the data columns for the specified iter in the shortcuts model*/
379-static void 382-static void
380-shortcuts_free_row_data (GtkFileChooserDefault *impl, 383-shortcuts_free_row_data (GtkFileChooserDefault *impl,
@@ -421,7 +424,7 @@
421- shortcuts_free_row_data (impl, &iter); 424- shortcuts_free_row_data (impl, &iter);
422- } 425- }
423- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter)); 426- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter));
424 427-
425- g_object_unref (impl->shortcuts_model); 428- g_object_unref (impl->shortcuts_model);
426- impl->shortcuts_model = NULL; 429- impl->shortcuts_model = NULL;
427+ if (!impl->root_folder) 430+ if (!impl->root_folder)
@@ -429,7 +432,7 @@
429 } 432 }
430 433
431 static void 434 static void
432@@ -743,6 +560,7 @@ 435@@ -743,6 +570,7 @@
433 impl->pending_select_paths = NULL; 436 impl->pending_select_paths = NULL;
434 } 437 }
435 438
@@ -437,7 +440,7 @@
437 static void 440 static void
438 pending_select_paths_add (GtkFileChooserDefault *impl, 441 pending_select_paths_add (GtkFileChooserDefault *impl,
439 const GtkFilePath *path) 442 const GtkFilePath *path)
440@@ -782,45 +600,40 @@ 443@@ -782,20 +610,30 @@
441 } 444 }
442 445
443 static void 446 static void
@@ -465,6 +468,7 @@
465+static void 468+static void
466+gtk_file_chooser_default_finalize (GObject *object) 469+gtk_file_chooser_default_finalize (GObject *object)
467+{ 470+{
471+ GSList *l;
468+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object); 472+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object);
469 473
470 g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id); 474 g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id);
@@ -473,21 +477,8 @@
473- impl->bookmarks_changed_id = 0; 477- impl->bookmarks_changed_id = 0;
474 g_object_unref (impl->file_system); 478 g_object_unref (impl->file_system);
475 479
476- for (l = impl->filters; l; l = l->next) 480 for (l = impl->filters; l; l = l->next)
477- { 481@@ -816,11 +654,9 @@
478- GtkFileFilter *filter;
479-
480- filter = GTK_FILE_FILTER (l->data);
481- g_object_unref (filter);
482- }
483- g_slist_free (impl->filters);
484-
485- if (impl->current_filter)
486- g_object_unref (impl->current_filter);
487-
488 if (impl->current_volume_path)
489 gtk_file_path_free (impl->current_volume_path);
490
491 if (impl->current_folder) 482 if (impl->current_folder)
492 gtk_file_path_free (impl->current_folder); 483 gtk_file_path_free (impl->current_folder);
493 484
@@ -501,7 +492,7 @@
501 load_remove_timer (impl); 492 load_remove_timer (impl);
502 493
503 /* Free all the Models we have */ 494 /* Free all the Models we have */
504@@ -830,12 +643,12 @@ 495@@ -830,12 +666,12 @@
505 if (impl->sort_model) 496 if (impl->sort_model)
506 g_object_unref (impl->sort_model); 497 g_object_unref (impl->sort_model);
507 498
@@ -516,7 +507,7 @@
516 G_OBJECT_CLASS (parent_class)->finalize (object); 507 G_OBJECT_CLASS (parent_class)->finalize (object);
517 } 508 }
518 509
519@@ -916,28 +729,6 @@ 510@@ -916,28 +752,6 @@
520 path, error); 511 path, error);
521 } 512 }
522 513
@@ -545,7 +536,7 @@
545 /* Shows an error dialog about not being able to create a folder */ 536 /* Shows an error dialog about not being able to create a folder */
546 static void 537 static void
547 error_creating_folder_dialog (GtkFileChooserDefault *impl, 538 error_creating_folder_dialog (GtkFileChooserDefault *impl,
548@@ -949,21 +740,6 @@ 539@@ -949,21 +763,6 @@
549 path, error); 540 path, error);
550 } 541 }
551 542
@@ -567,7 +558,7 @@
567 /* Shows an error dialog about not being able to create a filename */ 558 /* Shows an error dialog about not being able to create a filename */
568 static void 559 static void
569 error_building_filename_dialog (GtkFileChooserDefault *impl, 560 error_building_filename_dialog (GtkFileChooserDefault *impl,
570@@ -993,6 +769,7 @@ 561@@ -993,6 +792,7 @@
571 GError *error; 562 GError *error;
572 gboolean result; 563 gboolean result;
573 GtkFilePath *path_copy; 564 GtkFilePath *path_copy;
@@ -575,7 +566,7 @@
575 566
576 /* We copy the path because of this case: 567 /* We copy the path because of this case:
577 * 568 *
578@@ -1005,6 +782,29 @@ 569@@ -1005,6 +805,29 @@
579 570
580 path_copy = gtk_file_path_copy (path); 571 path_copy = gtk_file_path_copy (path);
581 572
@@ -605,7 +596,7 @@
605 error = NULL; 596 error = NULL;
606 result = _gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), path_copy, &error); 597 result = _gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), path_copy, &error);
607 598
608@@ -1012,2009 +812,234 @@ 599@@ -1012,2009 +835,245 @@
609 error_changing_folder_dialog (impl, path_copy, error); 600 error_changing_folder_dialog (impl, path_copy, error);
610 601
611 gtk_file_path_free (path_copy); 602 gtk_file_path_free (path_copy);
@@ -770,11 +761,11 @@
770+ 761+
771+ g_source_destroy (impl->edited_idle); 762+ g_source_destroy (impl->edited_idle);
772+ impl->edited_idle = NULL; 763+ impl->edited_idle = NULL;
773+
774+ _gtk_file_system_model_remove_editable (impl->browse_files_model);
775+ g_object_set (impl->list_name_renderer, "editable", FALSE, NULL);
776 764
777- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view)); 765- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
766+ _gtk_file_system_model_remove_editable (impl->browse_files_model);
767+ g_object_set (impl->list_name_renderer, "editable", FALSE, NULL);
768+
778+ gtk_widget_set_sensitive (impl->browse_new_folder_button, TRUE); 769+ gtk_widget_set_sensitive (impl->browse_new_folder_button, TRUE);
779 770
780- g_assert (folder != NULL); 771- g_assert (folder != NULL);
@@ -784,21 +775,9 @@
784 { 775 {
785- gtk_tree_selection_unselect_all (selection); 776- gtk_tree_selection_unselect_all (selection);
786- return; 777- return;
787- }
788-
789- path = gtk_tree_path_new_from_indices (pos, -1);
790- gtk_tree_selection_select_path (selection, path);
791- gtk_tree_path_free (path);
792-}
793+ GError *error; 778+ GError *error;
794+ GtkFilePath *file_path; 779+ GtkFilePath *file_path;
795 780+
796-/* If a shortcut corresponds to the current folder, selects it */
797-static void
798-shortcuts_find_current_folder (GtkFileChooserDefault *impl)
799-{
800- shortcuts_find_folder (impl, impl->current_folder);
801-}
802+ error = NULL; 781+ error = NULL;
803+ file_path = gtk_file_system_make_path (impl->file_system, impl->current_folder, impl->edited_new_text, 782+ file_path = gtk_file_system_make_path (impl->file_system, impl->current_folder, impl->edited_new_text,
804+ &error); 783+ &error);
@@ -813,6 +792,35 @@
813+ change_folder_and_display_error (impl, file_path); 792+ change_folder_and_display_error (impl, file_path);
814+ else 793+ else
815+ error_creating_folder_dialog (impl, file_path, error); 794+ error_creating_folder_dialog (impl, file_path, error);
795+
796+ gtk_file_path_free (file_path);
797+ }
798+ else
799+ error_creating_folder_dialog (impl, file_path, error);
800+
801+ g_free (impl->edited_new_text);
802+ impl->edited_new_text = NULL;
803 }
804
805- path = gtk_tree_path_new_from_indices (pos, -1);
806- gtk_tree_selection_select_path (selection, path);
807- gtk_tree_path_free (path);
808+ GDK_THREADS_LEAVE ();
809+
810+ return FALSE;
811 }
812
813-/* If a shortcut corresponds to the current folder, selects it */
814 static void
815-shortcuts_find_current_folder (GtkFileChooserDefault *impl)
816+queue_edited_idle (GtkFileChooserDefault *impl,
817+ const gchar *new_text)
818 {
819- shortcuts_find_folder (impl, impl->current_folder);
820-}
821+ /* We create the folder in an idle handler so that we don't modify the tree
822+ * just now.
823+ */
816 824
817-/* Convenience function to get the display name and icon info for a path */ 825-/* Convenience function to get the display name and icon info for a path */
818-static GtkFileInfo * 826-static GtkFileInfo *
@@ -845,10 +853,8 @@
845- out: 853- out:
846- if (parent_path) 854- if (parent_path)
847- gtk_file_path_free (parent_path); 855- gtk_file_path_free (parent_path);
848+ gtk_file_path_free (file_path); 856+ g_assert (!impl->edited_idle);
849+ } 857+ g_assert (!impl->edited_new_text);
850+ else
851+ error_creating_folder_dialog (impl, file_path, error);
852 858
853- if (tmp) 859- if (tmp)
854- { 860- {
@@ -859,16 +865,11 @@
859- gtk_file_path_get_string (path), 865- gtk_file_path_get_string (path),
860- tmp->message); 866- tmp->message);
861- g_error_free (tmp); 867- g_error_free (tmp);
862+ g_free (impl->edited_new_text); 868- }
863+ impl->edited_new_text = NULL; 869-
864 }
865
866- return info; 870- return info;
867+ GDK_THREADS_LEAVE (); 871-}
868+ 872-
869+ return FALSE;
870 }
871
872-/* Returns whether a path is a folder */ 873-/* Returns whether a path is a folder */
873-static gboolean 874-static gboolean
874-check_is_folder (GtkFileSystem *file_system, 875-check_is_folder (GtkFileSystem *file_system,
@@ -2034,7 +2035,7 @@
2034-/* Creates a suitable drag cursor to indicate that the selected bookmark will be 2035-/* Creates a suitable drag cursor to indicate that the selected bookmark will be
2035- * deleted or not. 2036- * deleted or not.
2036- */ 2037- */
2037 static void 2038-static void
2038-shortcuts_drag_set_delete_cursor (GtkFileChooserDefault *impl, 2039-shortcuts_drag_set_delete_cursor (GtkFileChooserDefault *impl,
2039- gboolean delete) 2040- gboolean delete)
2040-{ 2041-{
@@ -2176,9 +2177,7 @@
2176- */ 2177- */
2177-static gboolean 2178-static gboolean
2178-shortcuts_drag_outside_idle_cb (GtkFileChooserDefault *impl) 2179-shortcuts_drag_outside_idle_cb (GtkFileChooserDefault *impl)
2179+queue_edited_idle (GtkFileChooserDefault *impl, 2180-{
2180+ const gchar *new_text)
2181 {
2182- GDK_THREADS_ENTER (); 2181- GDK_THREADS_ENTER ();
2183- 2182-
2184- shortcuts_drag_set_delete_cursor (impl, TRUE); 2183- shortcuts_drag_set_delete_cursor (impl, TRUE);
@@ -2191,10 +2190,7 @@
2191- return FALSE; 2190- return FALSE;
2192-} 2191-}
2193-#endif 2192-#endif
2194+ /* We create the folder in an idle handler so that we don't modify the tree 2193-
2195+ * just now.
2196+ */
2197
2198-/* GtkWidget::drag-leave handler for the shortcuts list. We unhighlight the 2194-/* GtkWidget::drag-leave handler for the shortcuts list. We unhighlight the
2199- * drop position. 2195- * drop position.
2200- */ 2196- */
@@ -2214,36 +2210,22 @@
2214- g_source_attach (impl->shortcuts_drag_outside_idle, NULL); 2210- g_source_attach (impl->shortcuts_drag_outside_idle, NULL);
2215- } 2211- }
2216-#endif 2212-#endif
2217+ g_assert (!impl->edited_idle); 2213-
2218+ g_assert (!impl->edited_new_text);
2219
2220- gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), 2214- gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
2221- NULL, 2215- NULL,
2222- GTK_TREE_VIEW_DROP_BEFORE); 2216- GTK_TREE_VIEW_DROP_BEFORE);
2223+ impl->edited_idle = g_idle_source_new (); 2217-
2224+ g_source_set_closure (impl->edited_idle,
2225+ g_cclosure_new_object (G_CALLBACK (edited_idle_cb),
2226+ G_OBJECT (impl)));
2227+ g_source_attach (impl->edited_idle, NULL);
2228
2229- g_signal_stop_emission_by_name (widget, "drag-leave"); 2218- g_signal_stop_emission_by_name (widget, "drag-leave");
2230+ if (new_text) 2219-}
2231+ impl->edited_new_text = g_strdup (new_text); 2220-
2232 }
2233
2234-/* Computes the appropriate row and position for dropping */ 2221-/* Computes the appropriate row and position for dropping */
2235+/* Callback used from the text cell renderer when the new folder is named */ 2222-static void
2236 static void
2237-shortcuts_compute_drop_position (GtkFileChooserDefault *impl, 2223-shortcuts_compute_drop_position (GtkFileChooserDefault *impl,
2238- int x, 2224- int x,
2239- int y, 2225- int y,
2240- GtkTreePath **path, 2226- GtkTreePath **path,
2241- GtkTreeViewDropPosition *pos) 2227- GtkTreeViewDropPosition *pos)
2242+renderer_edited_cb (GtkCellRendererText *cell_renderer_text, 2228-{
2243+ const gchar *path,
2244+ const gchar *new_text,
2245+ GtkFileChooserDefault *impl)
2246 {
2247- GtkTreeView *tree_view; 2229- GtkTreeView *tree_view;
2248- GtkTreeViewColumn *column; 2230- GtkTreeViewColumn *column;
2249- int cell_y; 2231- int cell_y;
@@ -2292,18 +2274,12 @@
2292- } 2274- }
2293- 2275-
2294- *path = gtk_tree_path_new_from_indices (row, -1); 2276- *path = gtk_tree_path_new_from_indices (row, -1);
2295+ /* work around bug #154921 */ 2277-}
2296+ g_object_set (cell_renderer_text, 2278-
2297+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
2298+ queue_edited_idle (impl, new_text);
2299 }
2300
2301-/* GtkWidget::drag-motion handler for the shortcuts list. We basically 2279-/* GtkWidget::drag-motion handler for the shortcuts list. We basically
2302- * implement the destination side of DnD by hand, due to limitations in 2280- * implement the destination side of DnD by hand, due to limitations in
2303- * GtkTreeView's DnD API. 2281- * GtkTreeView's DnD API.
2304+/* Callback used from the text cell renderer when the new folder edition gets 2282- */
2305+ * canceled.
2306 */
2307-static gboolean 2283-static gboolean
2308-shortcuts_drag_motion_cb (GtkWidget *widget, 2284-shortcuts_drag_motion_cb (GtkWidget *widget,
2309- GdkDragContext *context, 2285- GdkDragContext *context,
@@ -2417,12 +2393,10 @@
2417-} 2393-}
2418- 2394-
2419-/* Reorders the selected bookmark to the specified position */ 2395-/* Reorders the selected bookmark to the specified position */
2420 static void 2396-static void
2421-shortcuts_reorder (GtkFileChooserDefault *impl, 2397-shortcuts_reorder (GtkFileChooserDefault *impl,
2422- int new_position) 2398- int new_position)
2423+renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text, 2399-{
2424+ GtkFileChooserDefault *impl)
2425 {
2426- GtkTreeIter iter; 2400- GtkTreeIter iter;
2427- gpointer col_data; 2401- gpointer col_data;
2428- gboolean is_volume; 2402- gboolean is_volume;
@@ -2473,12 +2447,8 @@
2473- out: 2447- out:
2474- 2448-
2475- gtk_file_path_free (file_path_copy); 2449- gtk_file_path_free (file_path_copy);
2476+ /* work around bug #154921 */ 2450-}
2477+ g_object_set (cell_renderer_text, 2451-
2478+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
2479+ queue_edited_idle (impl, NULL);
2480 }
2481
2482-/* Callback used when we get the drag data for the bookmarks list. We add the 2452-/* Callback used when we get the drag data for the bookmarks list. We add the
2483- * received URIs as bookmarks if they are folders. 2453- * received URIs as bookmarks if they are folders.
2484- */ 2454- */
@@ -2492,8 +2462,7 @@
2492- guint time_, 2462- guint time_,
2493- gpointer data) 2463- gpointer data)
2494-{ 2464-{
2495+struct selection_check_closure { 2465- GtkFileChooserDefault *impl;
2496 GtkFileChooserDefault *impl;
2497- GtkTreePath *tree_path; 2466- GtkTreePath *tree_path;
2498- GtkTreeViewDropPosition tree_pos; 2467- GtkTreeViewDropPosition tree_pos;
2499- int position; 2468- int position;
@@ -2519,12 +2488,20 @@
2519- shortcuts_drop_uris (impl, selection_data->data, position); 2488- shortcuts_drop_uris (impl, selection_data->data, position);
2520- else if (selection_data->target == gdk_atom_intern ("GTK_TREE_MODEL_ROW", FALSE)) 2489- else if (selection_data->target == gdk_atom_intern ("GTK_TREE_MODEL_ROW", FALSE))
2521- shortcuts_reorder (impl, position); 2490- shortcuts_reorder (impl, position);
2522- 2491+ impl->edited_idle = g_idle_source_new ();
2492+ g_source_set_closure (impl->edited_idle,
2493+ g_cclosure_new_object (G_CALLBACK (edited_idle_cb),
2494+ G_OBJECT (impl)));
2495+ g_source_attach (impl->edited_idle, NULL);
2496
2523- g_signal_stop_emission_by_name (widget, "drag-data-received"); 2497- g_signal_stop_emission_by_name (widget, "drag-data-received");
2524-} 2498+ if (new_text)
2525- 2499+ impl->edited_new_text = g_strdup (new_text);
2500 }
2501
2526-/* Callback used when the selection in the shortcuts tree changes */ 2502-/* Callback used when the selection in the shortcuts tree changes */
2527-static void 2503+/* Callback used from the text cell renderer when the new folder is named */
2504 static void
2528-shortcuts_selection_changed_cb (GtkTreeSelection *selection, 2505-shortcuts_selection_changed_cb (GtkTreeSelection *selection,
2529- GtkFileChooserDefault *impl) 2506- GtkFileChooserDefault *impl)
2530-{ 2507-{
@@ -2535,7 +2512,11 @@
2535-shortcuts_row_separator_func (GtkTreeModel *model, 2512-shortcuts_row_separator_func (GtkTreeModel *model,
2536- GtkTreeIter *iter, 2513- GtkTreeIter *iter,
2537- gpointer data) 2514- gpointer data)
2538-{ 2515+renderer_edited_cb (GtkCellRendererText *cell_renderer_text,
2516+ const gchar *path,
2517+ const gchar *new_text,
2518+ GtkFileChooserDefault *impl)
2519 {
2539- gint column = GPOINTER_TO_INT (data); 2520- gint column = GPOINTER_TO_INT (data);
2540- gchar *text; 2521- gchar *text;
2541- 2522-
@@ -2547,16 +2528,25 @@
2547- g_free (text); 2528- g_free (text);
2548- 2529-
2549- return FALSE; 2530- return FALSE;
2550-} 2531+ /* work around bug #154921 */
2551- 2532+ g_object_set (cell_renderer_text,
2533+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
2534+ queue_edited_idle (impl, new_text);
2535 }
2536
2552-/* Since GtkTreeView has a keybinding attached to '/', we need to catch 2537-/* Since GtkTreeView has a keybinding attached to '/', we need to catch
2553- * keypresses before the TreeView gets them. 2538- * keypresses before the TreeView gets them.
2554- */ 2539+/* Callback used from the text cell renderer when the new folder edition gets
2540+ * canceled.
2541 */
2555-static gboolean 2542-static gboolean
2556-tree_view_keybinding_cb (GtkWidget *tree_view, 2543-tree_view_keybinding_cb (GtkWidget *tree_view,
2557- GdkEventKey *event, 2544- GdkEventKey *event,
2558- GtkFileChooserDefault *impl) 2545- GtkFileChooserDefault *impl)
2559-{ 2546+static void
2547+renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
2548+ GtkFileChooserDefault *impl)
2549 {
2560- if (event->keyval == GDK_slash && 2550- if (event->keyval == GDK_slash &&
2561- ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ()))) 2551- ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ())))
2562- { 2552- {
@@ -2565,13 +2555,19 @@
2565- } 2555- }
2566- 2556-
2567- return FALSE; 2557- return FALSE;
2568-} 2558+ /* work around bug #154921 */
2569- 2559+ g_object_set (cell_renderer_text,
2560+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
2561+ queue_edited_idle (impl, NULL);
2562 }
2563
2570- 2564-
2571-/* Creates the widgets for the shortcuts and bookmarks tree */ 2565-/* Creates the widgets for the shortcuts and bookmarks tree */
2572-static GtkWidget * 2566+/* Creates the widgets for the filter combo box */
2567 static GtkWidget *
2573-shortcuts_list_create (GtkFileChooserDefault *impl) 2568-shortcuts_list_create (GtkFileChooserDefault *impl)
2574-{ 2569+filter_create (GtkFileChooserDefault *impl)
2570 {
2575- GtkWidget *swin; 2571- GtkWidget *swin;
2576- GtkTreeSelection *selection; 2572- GtkTreeSelection *selection;
2577- GtkTreeViewColumn *column; 2573- GtkTreeViewColumn *column;
@@ -2593,9 +2589,14 @@
2593- G_CALLBACK (tree_view_keybinding_cb), impl); 2589- G_CALLBACK (tree_view_keybinding_cb), impl);
2594- atk_object_set_name (gtk_widget_get_accessible (impl->browse_shortcuts_tree_view), _("Shortcuts")); 2590- atk_object_set_name (gtk_widget_get_accessible (impl->browse_shortcuts_tree_view), _("Shortcuts"));
2595- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), FALSE); 2591- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), FALSE);
2596- 2592+ impl->filter_combo = gtk_combo_box_new_text ();
2593+ g_signal_connect (impl->filter_combo, "changed",
2594+ G_CALLBACK (filter_combo_changed), impl);
2595
2597- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), impl->shortcuts_filter_model); 2596- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), impl->shortcuts_filter_model);
2598- 2597+ return impl->filter_combo;
2598+}
2599
2599- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), 2600- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
2600- GDK_BUTTON1_MASK, 2601- GDK_BUTTON1_MASK,
2601- shortcuts_source_targets, 2602- shortcuts_source_targets,
@@ -2607,22 +2608,44 @@
2607- shortcuts_dest_targets, 2608- shortcuts_dest_targets,
2608- num_shortcuts_dest_targets, 2609- num_shortcuts_dest_targets,
2609- GDK_ACTION_COPY | GDK_ACTION_MOVE); 2610- GDK_ACTION_COPY | GDK_ACTION_MOVE);
2610- 2611+struct selection_check_closure {
2612+ GtkFileChooserDefault *impl;
2613+ int num_selected;
2614+ gboolean all_files;
2615+ gboolean all_folders;
2616+};
2617
2611- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view)); 2618- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
2612- gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); 2619- gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
2613- gtk_tree_selection_set_select_function (selection, 2620- gtk_tree_selection_set_select_function (selection,
2614- shortcuts_select_func, 2621- shortcuts_select_func,
2615- impl, NULL); 2622- impl, NULL);
2616- 2623+/* Used from gtk_tree_selection_selected_foreach() */
2624+static void
2625+selection_check_foreach_cb (GtkTreeModel *model,
2626+ GtkTreePath *path,
2627+ GtkTreeIter *iter,
2628+ gpointer data)
2629+{
2630+ struct selection_check_closure *closure;
2631+ GtkTreeIter child_iter;
2632+ const GtkFileInfo *info;
2633+ gboolean is_folder;
2634
2617- g_signal_connect (selection, "changed", 2635- g_signal_connect (selection, "changed",
2618- G_CALLBACK (shortcuts_selection_changed_cb), impl); 2636- G_CALLBACK (shortcuts_selection_changed_cb), impl);
2619- 2637+ closure = data;
2638+ closure->num_selected++;
2639
2620- g_signal_connect (impl->browse_shortcuts_tree_view, "row-activated", 2640- g_signal_connect (impl->browse_shortcuts_tree_view, "row-activated",
2621- G_CALLBACK (shortcuts_row_activated_cb), impl); 2641- G_CALLBACK (shortcuts_row_activated_cb), impl);
2622- 2642+ gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter);
2643
2623- g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event", 2644- g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event",
2624- G_CALLBACK (shortcuts_key_press_event_cb), impl); 2645- G_CALLBACK (shortcuts_key_press_event_cb), impl);
2625- 2646+ info = _gtk_file_system_model_get_info (closure->impl->browse_files_model, &child_iter);
2647+ is_folder = info ? gtk_file_info_get_is_folder (info) : FALSE;
2648
2626- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-begin", 2649- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-begin",
2627- G_CALLBACK (shortcuts_drag_begin_cb), impl); 2650- G_CALLBACK (shortcuts_drag_begin_cb), impl);
2628- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-end", 2651- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-end",
@@ -2638,29 +2661,34 @@
2638- G_CALLBACK (shortcuts_drag_drop_cb), impl); 2661- G_CALLBACK (shortcuts_drag_drop_cb), impl);
2639- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-received", 2662- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-received",
2640- G_CALLBACK (shortcuts_drag_data_received_cb), impl); 2663- G_CALLBACK (shortcuts_drag_data_received_cb), impl);
2641- 2664+ closure->all_folders = closure->all_folders && is_folder;
2665+ closure->all_files = closure->all_files && !is_folder;
2666+}
2667
2642- gtk_container_add (GTK_CONTAINER (swin), impl->browse_shortcuts_tree_view); 2668- gtk_container_add (GTK_CONTAINER (swin), impl->browse_shortcuts_tree_view);
2643- gtk_widget_show (impl->browse_shortcuts_tree_view); 2669- gtk_widget_show (impl->browse_shortcuts_tree_view);
2644- 2670+/* Checks whether the selected items in the file list are all files or all folders */
2671+static void
2672+selection_check (GtkFileChooserDefault *impl,
2673+ gint *num_selected,
2674+ gboolean *all_files,
2675+ gboolean *all_folders)
2676+{
2677+ struct selection_check_closure closure;
2678+ GtkTreeSelection *selection;
2679
2645- /* Column */ 2680- /* Column */
2646+ int num_selected; 2681+ closure.impl = impl;
2647+ gboolean all_files; 2682+ closure.num_selected = 0;
2648+ gboolean all_folders; 2683+ closure.all_files = TRUE;
2649+}; 2684+ closure.all_folders = TRUE;
2650 2685
2651- column = gtk_tree_view_column_new (); 2686- column = gtk_tree_view_column_new ();
2652- gtk_tree_view_column_set_title (column, _("Folder")); 2687- gtk_tree_view_column_set_title (column, _("Folder"));
2653+/* Used from gtk_tree_selection_selected_foreach() */ 2688+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
2654+static void 2689+ gtk_tree_selection_selected_foreach (selection,
2655+selection_check_foreach_cb (GtkTreeModel *model, 2690+ selection_check_foreach_cb,
2656+ GtkTreePath *path, 2691+ &closure);
2657+ GtkTreeIter *iter,
2658+ gpointer data)
2659+{
2660+ struct selection_check_closure *closure;
2661+ GtkTreeIter child_iter;
2662+ const GtkFileInfo *info;
2663+ gboolean is_folder;
2664 2692
2665- renderer = gtk_cell_renderer_pixbuf_new (); 2693- renderer = gtk_cell_renderer_pixbuf_new ();
2666- gtk_tree_view_column_pack_start (column, renderer, FALSE); 2694- gtk_tree_view_column_pack_start (column, renderer, FALSE);
@@ -2668,8 +2696,7 @@
2668- "pixbuf", SHORTCUTS_COL_PIXBUF, 2696- "pixbuf", SHORTCUTS_COL_PIXBUF,
2669- "visible", SHORTCUTS_COL_PIXBUF_VISIBLE, 2697- "visible", SHORTCUTS_COL_PIXBUF_VISIBLE,
2670- NULL); 2698- NULL);
2671+ closure = data; 2699+ g_assert (closure.num_selected == 0 || !(closure.all_files && closure.all_folders));
2672+ closure->num_selected++;
2673 2700
2674- renderer = gtk_cell_renderer_text_new (); 2701- renderer = gtk_cell_renderer_text_new ();
2675- gtk_tree_view_column_pack_start (column, renderer, TRUE); 2702- gtk_tree_view_column_pack_start (column, renderer, TRUE);
@@ -2681,72 +2708,49 @@
2681- shortcuts_row_separator_func, 2708- shortcuts_row_separator_func,
2682- GINT_TO_POINTER (SHORTCUTS_COL_NAME), 2709- GINT_TO_POINTER (SHORTCUTS_COL_NAME),
2683- NULL); 2710- NULL);
2684+ gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter); 2711+ if (num_selected)
2712+ *num_selected = closure.num_selected;
2685 2713
2686- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), column); 2714- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), column);
2687+ info = _gtk_file_system_model_get_info (closure->impl->browse_files_model, &child_iter); 2715+ if (all_files)
2688+ is_folder = info ? gtk_file_info_get_is_folder (info) : FALSE; 2716+ *all_files = closure.all_files;
2689 2717
2690- return swin; 2718- return swin;
2691+ closure->all_folders = closure->all_folders && is_folder; 2719+ if (all_folders)
2692+ closure->all_files = closure->all_files && !is_folder; 2720+ *all_folders = closure.all_folders;
2693 } 2721 }
2694 2722
2695-/* Creates the widgets for the shortcuts/bookmarks pane */ 2723-/* Creates the widgets for the shortcuts/bookmarks pane */
2696-static GtkWidget * 2724-static GtkWidget *
2697-shortcuts_pane_create (GtkFileChooserDefault *impl, 2725-shortcuts_pane_create (GtkFileChooserDefault *impl,
2698- GtkSizeGroup *size_group) 2726- GtkSizeGroup *size_group)
2699+/* Checks whether the selected items in the file list are all files or all folders */ 2727-{
2700+static void
2701+selection_check (GtkFileChooserDefault *impl,
2702+ gint *num_selected,
2703+ gboolean *all_files,
2704+ gboolean *all_folders)
2705 {
2706- GtkWidget *vbox; 2728- GtkWidget *vbox;
2707- GtkWidget *hbox; 2729- GtkWidget *hbox;
2708- GtkWidget *widget; 2730- GtkWidget *widget;
2709+ struct selection_check_closure closure; 2731-
2710+ GtkTreeSelection *selection;
2711
2712- vbox = gtk_vbox_new (FALSE, 6); 2732- vbox = gtk_vbox_new (FALSE, 6);
2713- gtk_widget_show (vbox); 2733- gtk_widget_show (vbox);
2714+ closure.impl = impl; 2734-
2715+ closure.num_selected = 0;
2716+ closure.all_files = TRUE;
2717+ closure.all_folders = TRUE;
2718+
2719+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
2720+ gtk_tree_selection_selected_foreach (selection,
2721+ selection_check_foreach_cb,
2722+ &closure);
2723
2724- /* Shortcuts tree */ 2735- /* Shortcuts tree */
2725+ g_assert (closure.num_selected == 0 || !(closure.all_files && closure.all_folders)); 2736-
2726
2727- widget = shortcuts_list_create (impl); 2737- widget = shortcuts_list_create (impl);
2728- gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0); 2738- gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
2729+ if (num_selected) 2739-
2730+ *num_selected = closure.num_selected;
2731
2732- /* Box for buttons */ 2740- /* Box for buttons */
2733+ if (all_files) 2741-
2734+ *all_files = closure.all_files;
2735
2736- hbox = gtk_hbox_new (TRUE, 6); 2742- hbox = gtk_hbox_new (TRUE, 6);
2737- gtk_size_group_add_widget (size_group, hbox); 2743- gtk_size_group_add_widget (size_group, hbox);
2738- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); 2744- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
2739- gtk_widget_show (hbox); 2745- gtk_widget_show (hbox);
2740+ if (all_folders)
2741+ *all_folders = closure.all_folders;
2742+}
2743
2744- /* Add bookmark button */
2745+struct get_selected_path_closure { 2746+struct get_selected_path_closure {
2746+ GtkFileChooserDefault *impl; 2747+ GtkFileChooserDefault *impl;
2747+ const GtkFilePath *path; 2748+ const GtkFilePath *path;
2748+}; 2749+};
2749 2750
2751- /* Add bookmark button */
2752+/* Returns a selected path from the file list */
2753
2750- impl->browse_shortcuts_add_button = button_new (impl, 2754- impl->browse_shortcuts_add_button = button_new (impl,
2751- _("_Add"), 2755- _("_Add"),
2752- GTK_STOCK_ADD, 2756- GTK_STOCK_ADD,
@@ -2768,8 +2772,6 @@
2768- gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_remove_button, TRUE, TRUE, 0); 2772- gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_remove_button, TRUE, TRUE, 0);
2769- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button, 2773- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button,
2770- _("Remove the selected bookmark"), NULL); 2774- _("Remove the selected bookmark"), NULL);
2771+/* Returns a selected path from the file list */
2772+
2773+typedef struct { 2775+typedef struct {
2774+ GtkFileChooserDefault *impl; 2776+ GtkFileChooserDefault *impl;
2775+ gchar *tip; 2777+ gchar *tip;
@@ -2780,7 +2782,7 @@
2780 2782
2781 /* Handles key press events on the file list, so that we can trap Enter to 2783 /* Handles key press events on the file list, so that we can trap Enter to
2782 * activate the default button on our own. Also, checks to see if '/' has been 2784 * activate the default button on our own. Also, checks to see if '/' has been
2783@@ -3026,14 +1051,11 @@ 2785@@ -3026,14 +1085,11 @@
2784 gpointer data) 2786 gpointer data)
2785 { 2787 {
2786 GtkFileChooserDefault *impl; 2788 GtkFileChooserDefault *impl;
@@ -2796,7 +2798,7 @@
2796 { 2798 {
2797 location_popup_handler (impl, "/"); 2799 location_popup_handler (impl, "/");
2798 return TRUE; 2800 return TRUE;
2799@@ -3043,7 +1065,6 @@ 2801@@ -3043,7 +1099,6 @@
2800 || event->keyval == GDK_ISO_Enter 2802 || event->keyval == GDK_ISO_Enter
2801 || event->keyval == GDK_KP_Enter 2803 || event->keyval == GDK_KP_Enter
2802 || event->keyval == GDK_space) 2804 || event->keyval == GDK_space)
@@ -2804,7 +2806,7 @@
2804 && !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER || 2806 && !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
2805 impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)) 2807 impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
2806 { 2808 {
2807@@ -3063,37 +1084,7 @@ 2809@@ -3063,37 +1118,7 @@
2808 return FALSE; 2810 return FALSE;
2809 } 2811 }
2810 2812
@@ -2843,7 +2845,7 @@
2843 /* Callback used when the "Show Hidden Files" menu item is toggled */ 2845 /* Callback used when the "Show Hidden Files" menu item is toggled */
2844 static void 2846 static void
2845 show_hidden_toggled_cb (GtkCheckMenuItem *item, 2847 show_hidden_toggled_cb (GtkCheckMenuItem *item,
2846@@ -3103,145 +1094,7 @@ 2848@@ -3103,145 +1128,7 @@
2847 "show-hidden", gtk_check_menu_item_get_active (item), 2849 "show-hidden", gtk_check_menu_item_get_active (item),
2848 NULL); 2850 NULL);
2849 } 2851 }
@@ -2990,7 +2992,7 @@
2990 2992
2991 /* Creates the widgets for the file list */ 2993 /* Creates the widgets for the file list */
2992 static GtkWidget * 2994 static GtkWidget *
2993@@ -3272,11 +1125,7 @@ 2995@@ -3272,11 +1159,7 @@
2994 G_CALLBACK (list_row_activated), impl); 2996 G_CALLBACK (list_row_activated), impl);
2995 g_signal_connect (impl->browse_files_tree_view, "key-press-event", 2997 g_signal_connect (impl->browse_files_tree_view, "key-press-event",
2996 G_CALLBACK (trap_activate_cb), impl); 2998 G_CALLBACK (trap_activate_cb), impl);
@@ -3003,7 +3005,7 @@
3003 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); 3005 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
3004 gtk_tree_selection_set_select_function (selection, 3006 gtk_tree_selection_set_select_function (selection,
3005 list_select_func, 3007 list_select_func,
3006@@ -3346,70 +1195,158 @@ 3008@@ -3346,70 +1229,163 @@
3007 return swin; 3009 return swin;
3008 } 3010 }
3009 3011
@@ -3131,16 +3133,16 @@
3131+ gtk_widget_show_all (button); 3133+ gtk_widget_show_all (button);
3132+ 3134+
3133+ g_object_set_data (G_OBJECT (button), "file-path", base_path); 3135+ g_object_set_data (G_OBJECT (button), "file-path", base_path);
3134+ 3136
3137- gtk_container_forall (GTK_CONTAINER (combo),
3138- set_filter_tooltip,
3139- impl->tooltips);
3135+ g_signal_connect (button, "clicked", 3140+ g_signal_connect (button, "clicked",
3136+ G_CALLBACK (volume_button_clicked_cb), impl); 3141+ G_CALLBACK (volume_button_clicked_cb), impl);
3137+ 3142+
3138+ gtk_box_pack_start (GTK_BOX(bar), button, FALSE, FALSE, 0); 3143+ gtk_box_pack_start (GTK_BOX(bar), button, FALSE, FALSE, 0);
3139+ } 3144+ }
3140 3145+
3141- gtk_container_forall (GTK_CONTAINER (combo),
3142- set_filter_tooltip,
3143- impl->tooltips);
3144+ impl->num_volumes = n; 3146+ impl->num_volumes = n;
3145+ g_slist_free (list); 3147+ g_slist_free (list);
3146+ 3148+
@@ -3188,6 +3190,11 @@
3188 g_signal_connect (impl->browse_new_folder_button, "clicked", 3190 g_signal_connect (impl->browse_new_folder_button, "clicked",
3189 G_CALLBACK (new_folder_button_clicked), impl); 3191 G_CALLBACK (new_folder_button_clicked), impl);
3190 gtk_box_pack_end (GTK_BOX (hbox), impl->browse_new_folder_button, FALSE, FALSE, 0); 3192 gtk_box_pack_end (GTK_BOX (hbox), impl->browse_new_folder_button, FALSE, FALSE, 0);
3193+
3194+ widget = filter_create (impl);
3195+ gtk_widget_hide (widget);
3196+ gtk_box_pack_end (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
3197+
3191 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); 3198 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
3192 3199
3193- /* Box for lists and preview */ 3200- /* Box for lists and preview */
@@ -3198,7 +3205,7 @@
3198 gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0); 3205 gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
3199 gtk_widget_show (hbox); 3206 gtk_widget_show (hbox);
3200 3207
3201@@ -3418,157 +1355,37 @@ 3208@@ -3418,157 +1394,37 @@
3202 widget = create_file_list (impl); 3209 widget = create_file_list (impl);
3203 gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0); 3210 gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
3204 3211
@@ -3296,7 +3303,7 @@
3296+ GtkWidget *hbox; 3303+ GtkWidget *hbox;
3297 GtkWidget *widget; 3304 GtkWidget *widget;
3298- GtkWidget *alignment; 3305- GtkWidget *alignment;
3299- 3306
3300- vbox = gtk_vbox_new (FALSE, 12); 3307- vbox = gtk_vbox_new (FALSE, 12);
3301- 3308-
3302- table = gtk_table_new (2, 2, FALSE); 3309- table = gtk_table_new (2, 2, FALSE);
@@ -3306,7 +3313,7 @@
3306- gtk_table_set_col_spacings (GTK_TABLE (table), 12); 3313- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
3307- 3314-
3308- /* Name entry */ 3315- /* Name entry */
3309 3316-
3310- widget = gtk_label_new_with_mnemonic (_("_Name:")); 3317- widget = gtk_label_new_with_mnemonic (_("_Name:"));
3311+ vbox = gtk_vbox_new (FALSE, 0); 3318+ vbox = gtk_vbox_new (FALSE, 0);
3312+ hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING); 3319+ hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING);
@@ -3368,7 +3375,7 @@
3368 return vbox; 3375 return vbox;
3369 } 3376 }
3370 3377
3371@@ -3576,29 +1393,11 @@ 3378@@ -3576,29 +1432,11 @@
3372 static GtkWidget * 3379 static GtkWidget *
3373 browse_widgets_create (GtkFileChooserDefault *impl) 3380 browse_widgets_create (GtkFileChooserDefault *impl)
3374 { 3381 {
@@ -3376,7 +3383,7 @@
3376- GtkWidget *hpaned; 3383- GtkWidget *hpaned;
3377 GtkWidget *widget; 3384 GtkWidget *widget;
3378- GtkSizeGroup *size_group; 3385- GtkSizeGroup *size_group;
3379- 3386
3380- /* size group is used by the [+][-] buttons and the filter combo */ 3387- /* size group is used by the [+][-] buttons and the filter combo */
3381- size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL); 3388- size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
3382- vbox = gtk_vbox_new (FALSE, 12); 3389- vbox = gtk_vbox_new (FALSE, 12);
@@ -3391,16 +3398,16 @@
3391- gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE); 3398- gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE);
3392- widget = file_pane_create (impl, size_group); 3399- widget = file_pane_create (impl, size_group);
3393- gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE); 3400- gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE);
3394
3395- g_object_unref (size_group);
3396+ widget = file_pane_create (impl); 3401+ widget = file_pane_create (impl);
3397 3402
3403- g_object_unref (size_group);
3404-
3398- return vbox; 3405- return vbox;
3399+ return widget; 3406+ return widget;
3400 } 3407 }
3401 3408
3402 static GObject* 3409 static GObject*
3403@@ -3618,54 +1417,18 @@ 3410@@ -3618,56 +1456,20 @@
3404 3411
3405 gtk_widget_push_composite_child (); 3412 gtk_widget_push_composite_child ();
3406 3413
@@ -3420,12 +3427,16 @@
3420- impl->extra_align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0); 3427- impl->extra_align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
3421- gtk_box_pack_start (GTK_BOX (impl), impl->extra_align, FALSE, FALSE, 0); 3428- gtk_box_pack_start (GTK_BOX (impl), impl->extra_align, FALSE, FALSE, 0);
3422- 3429-
3423- gtk_widget_pop_composite_child (); 3430+ /* Widgets for Save mode */
3424- update_appearance (impl); 3431+ impl->save_widgets = save_widgets_create (impl);
3425- 3432+ gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
3426- return object; 3433+
3427-} 3434 gtk_widget_pop_composite_child ();
3428- 3435 update_appearance (impl);
3436
3437 return object;
3438 }
3439
3429-/* Sets the extra_widget by packing it in the appropriate place */ 3440-/* Sets the extra_widget by packing it in the appropriate place */
3430-static void 3441-static void
3431-set_extra_widget (GtkFileChooserDefault *impl, 3442-set_extra_widget (GtkFileChooserDefault *impl,
@@ -3443,13 +3454,7 @@
3443- gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget); 3454- gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
3444- g_object_unref (impl->extra_widget); 3455- g_object_unref (impl->extra_widget);
3445- } 3456- }
3446+ /* Widgets for Save mode */ 3457-
3447+ impl->save_widgets = save_widgets_create (impl);
3448+ gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
3449+
3450+ gtk_widget_pop_composite_child ();
3451+ update_appearance (impl);
3452
3453- impl->extra_widget = extra_widget; 3458- impl->extra_widget = extra_widget;
3454- if (impl->extra_widget) 3459- if (impl->extra_widget)
3455- { 3460- {
@@ -3458,11 +3463,12 @@
3458- } 3463- }
3459- else 3464- else
3460- gtk_widget_hide (impl->extra_align); 3465- gtk_widget_hide (impl->extra_align);
3461+ return object; 3466-}
3462 } 3467-
3463
3464 static void 3468 static void
3465@@ -3676,12 +1439,6 @@ 3469 set_local_only (GtkFileChooserDefault *impl,
3470 gboolean local_only)
3471@@ -3676,12 +1478,6 @@
3466 { 3472 {
3467 impl->local_only = local_only; 3473 impl->local_only = local_only;
3468 3474
@@ -3475,7 +3481,7 @@
3475 if (local_only && 3481 if (local_only &&
3476 !gtk_file_system_path_is_local (impl->file_system, impl->current_folder)) 3482 !gtk_file_system_path_is_local (impl->file_system, impl->current_folder))
3477 { 3483 {
3478@@ -3708,18 +1465,7 @@ 3484@@ -3708,18 +1504,7 @@
3479 volumes_changed_cb (GtkFileSystem *file_system, 3485 volumes_changed_cb (GtkFileSystem *file_system,
3480 GtkFileChooserDefault *impl) 3486 GtkFileChooserDefault *impl)
3481 { 3487 {
@@ -3495,7 +3501,7 @@
3495 } 3501 }
3496 3502
3497 /* Sets the file chooser to multiple selection mode */ 3503 /* Sets the file chooser to multiple selection mode */
3498@@ -3741,8 +1487,6 @@ 3504@@ -3741,8 +1526,6 @@
3499 3505
3500 impl->select_multiple = select_multiple; 3506 impl->select_multiple = select_multiple;
3501 g_object_notify (G_OBJECT (impl), "select-multiple"); 3507 g_object_notify (G_OBJECT (impl), "select-multiple");
@@ -3504,7 +3510,7 @@
3504 } 3510 }
3505 3511
3506 static void 3512 static void
3507@@ -3753,8 +1497,6 @@ 3513@@ -3753,8 +1536,6 @@
3508 { 3514 {
3509 g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id); 3515 g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id);
3510 impl->volumes_changed_id = 0; 3516 impl->volumes_changed_id = 0;
@@ -3513,7 +3519,7 @@
3513 g_object_unref (impl->file_system); 3519 g_object_unref (impl->file_system);
3514 } 3520 }
3515 3521
3516@@ -3790,9 +1532,6 @@ 3522@@ -3790,9 +1571,6 @@
3517 impl->volumes_changed_id = g_signal_connect (impl->file_system, "volumes-changed", 3523 impl->volumes_changed_id = g_signal_connect (impl->file_system, "volumes-changed",
3518 G_CALLBACK (volumes_changed_cb), 3524 G_CALLBACK (volumes_changed_cb),
3519 impl); 3525 impl);
@@ -3523,7 +3529,7 @@
3523 } 3529 }
3524 } 3530 }
3525 3531
3526@@ -3807,30 +1546,8 @@ 3532@@ -3807,30 +1585,8 @@
3527 if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || 3533 if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
3528 impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) 3534 impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
3529 { 3535 {
@@ -3555,7 +3561,7 @@
3555 gtk_widget_show (impl->browse_new_folder_button); 3561 gtk_widget_show (impl->browse_new_folder_button);
3556 3562
3557 if (impl->select_multiple) 3563 if (impl->select_multiple)
3558@@ -3844,6 +1561,7 @@ 3564@@ -3844,6 +1600,7 @@
3559 impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER) 3565 impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
3560 { 3566 {
3561 gtk_widget_hide (impl->save_widgets); 3567 gtk_widget_hide (impl->save_widgets);
@@ -3563,7 +3569,7 @@
3563 gtk_widget_show (impl->browse_widgets); 3569 gtk_widget_show (impl->browse_widgets);
3564 } 3570 }
3565 3571
3566@@ -3876,12 +1594,9 @@ 3572@@ -3876,12 +1633,9 @@
3567 { 3573 {
3568 gtk_file_chooser_default_unselect_all (GTK_FILE_CHOOSER (impl)); 3574 gtk_file_chooser_default_unselect_all (GTK_FILE_CHOOSER (impl));
3569 3575
@@ -3578,13 +3584,7 @@
3578 set_select_multiple (impl, FALSE, TRUE); 3584 set_select_multiple (impl, FALSE, TRUE);
3579 } 3585 }
3580 impl->action = action; 3586 impl->action = action;
3581@@ -3896,35 +1611,15 @@ 3587@@ -3902,29 +1656,12 @@
3582 case GTK_FILE_CHOOSER_PROP_FILE_SYSTEM_BACKEND:
3583 set_file_system_backend (impl, g_value_get_string (value));
3584 break;
3585- case GTK_FILE_CHOOSER_PROP_FILTER:
3586- set_current_filter (impl, g_value_get_object (value));
3587- break;
3588 case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY: 3588 case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY:
3589 set_local_only (impl, g_value_get_boolean (value)); 3589 set_local_only (impl, g_value_get_boolean (value));
3590 break; 3590 break;
@@ -3616,7 +3616,7 @@
3616 return; 3616 return;
3617 } 3617 }
3618 3618
3619@@ -3943,6 +1638,11 @@ 3619@@ -3943,6 +1680,19 @@
3620 } 3620 }
3621 } 3621 }
3622 break; 3622 break;
@@ -3625,44 +3625,59 @@
3625+ impl->root_folder = g_strdup (g_value_get_string (value)); 3625+ impl->root_folder = g_strdup (g_value_get_string (value));
3626+ } 3626+ }
3627+ break; 3627+ break;
3628+
3629+ /* These are not supported */
3630+ case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET:
3631+ case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
3632+ case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
3633+ case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET:
3634+ break;
3635+
3628 default: 3636 default:
3629 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 3637 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
3630 break; 3638 break;
3631@@ -3962,30 +1662,18 @@ 3639@@ -3968,24 +1718,30 @@
3632 case GTK_FILE_CHOOSER_PROP_ACTION:
3633 g_value_set_enum (value, impl->action);
3634 break;
3635- case GTK_FILE_CHOOSER_PROP_FILTER:
3636- g_value_set_object (value, impl->current_filter);
3637- break;
3638 case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY: 3640 case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY:
3639 g_value_set_boolean (value, impl->local_only); 3641 g_value_set_boolean (value, impl->local_only);
3640 break; 3642 break;
3641- case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET: 3643+ case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
3644+ g_value_set_boolean (value, impl->select_multiple);
3645+ break;
3646+ case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
3647+ g_value_set_boolean (value, impl->show_hidden);
3648+ break;
3649+ case GTK_FILE_CHOOSER_PROP_ROOT_FOLDER:
3650+ g_value_set_string (value, impl->root_folder);
3651+ break;
3652+
3653+ /* These are not supported */
3654 case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET:
3642- g_value_set_object (value, impl->preview_widget); 3655- g_value_set_object (value, impl->preview_widget);
3643- break; 3656+ g_value_set_object (value, NULL);
3644- case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE: 3657 break;
3658 case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
3645- g_value_set_boolean (value, impl->preview_widget_active); 3659- g_value_set_boolean (value, impl->preview_widget_active);
3646- break; 3660+ g_value_set_boolean (value, FALSE);
3647- case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL: 3661 break;
3662 case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
3648- g_value_set_boolean (value, impl->use_preview_label); 3663- g_value_set_boolean (value, impl->use_preview_label);
3649- break; 3664+ g_value_set_boolean (value, FALSE);
3650- case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET: 3665 break;
3666 case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET:
3651- g_value_set_object (value, impl->extra_widget); 3667- g_value_set_object (value, impl->extra_widget);
3652- break; 3668- break;
3653 case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE: 3669- case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
3654 g_value_set_boolean (value, impl->select_multiple); 3670- g_value_set_boolean (value, impl->select_multiple);
3655 break; 3671- break;
3656 case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN: 3672- case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
3657 g_value_set_boolean (value, impl->show_hidden); 3673- g_value_set_boolean (value, impl->show_hidden);
3674+ g_value_set_object (value, NULL);
3658 break; 3675 break;
3659+ case GTK_FILE_CHOOSER_PROP_ROOT_FOLDER: 3676+
3660+ g_value_set_string (value, impl->root_folder);
3661+ break;
3662 default: 3677 default:
3663 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); 3678 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
3664 break; 3679 break;
3665@@ -4013,12 +1701,6 @@ 3680@@ -4013,12 +1769,6 @@
3666 { 3681 {
3667 GtkFileChooserDefault *impl = (GtkFileChooserDefault *) object; 3682 GtkFileChooserDefault *impl = (GtkFileChooserDefault *) object;
3668 3683
@@ -3675,7 +3690,7 @@
3675 remove_settings_signal (impl, gtk_widget_get_screen (GTK_WIDGET (impl))); 3690 remove_settings_signal (impl, gtk_widget_get_screen (GTK_WIDGET (impl)));
3676 3691
3677 G_OBJECT_CLASS (parent_class)->dispose (object); 3692 G_OBJECT_CLASS (parent_class)->dispose (object);
3678@@ -4031,12 +1713,7 @@ 3693@@ -4031,12 +1781,7 @@
3679 static void 3694 static void
3680 gtk_file_chooser_default_show_all (GtkWidget *widget) 3695 gtk_file_chooser_default_show_all (GtkWidget *widget)
3681 { 3696 {
@@ -3688,7 +3703,7 @@
3688 } 3703 }
3689 3704
3690 /* Handler for GtkWindow::set-focus; this is where we save the last-focused 3705 /* Handler for GtkWindow::set-focus; this is where we save the last-focused
3691@@ -4095,7 +1772,6 @@ 3706@@ -4095,7 +1840,6 @@
3692 else 3707 else
3693 impl->icon_size = FALLBACK_ICON_SIZE; 3708 impl->icon_size = FALLBACK_ICON_SIZE;
3694 3709
@@ -3696,112 +3711,16 @@
3696 gtk_widget_queue_resize (impl->browse_files_tree_view); 3711 gtk_widget_queue_resize (impl->browse_files_tree_view);
3697 } 3712 }
3698 3713
3699@@ -4169,53 +1845,6 @@ 3714@@ -4231,8 +1975,6 @@
3700 g_signal_emit_by_name (widget, "default-size-changed");
3701 }
3702
3703-static gboolean
3704-get_is_file_filtered (GtkFileChooserDefault *impl,
3705- const GtkFilePath *path,
3706- GtkFileInfo *file_info)
3707-{
3708- GtkFileFilterInfo filter_info;
3709- GtkFileFilterFlags needed;
3710- gboolean result;
3711-
3712- if (!impl->current_filter)
3713- return FALSE;
3714-
3715- filter_info.contains = GTK_FILE_FILTER_DISPLAY_NAME | GTK_FILE_FILTER_MIME_TYPE;
3716-
3717- needed = gtk_file_filter_get_needed (impl->current_filter);
3718-
3719- filter_info.display_name = gtk_file_info_get_display_name (file_info);
3720- filter_info.mime_type = gtk_file_info_get_mime_type (file_info);
3721-
3722- if (needed & GTK_FILE_FILTER_FILENAME)
3723- {
3724- filter_info.filename = gtk_file_system_path_to_filename (impl->file_system, path);
3725- if (filter_info.filename)
3726- filter_info.contains |= GTK_FILE_FILTER_FILENAME;
3727- }
3728- else
3729- filter_info.filename = NULL;
3730-
3731- if (needed & GTK_FILE_FILTER_URI)
3732- {
3733- filter_info.uri = gtk_file_system_path_to_uri (impl->file_system, path);
3734- if (filter_info.uri)
3735- filter_info.contains |= GTK_FILE_FILTER_URI;
3736- }
3737- else
3738- filter_info.uri = NULL;
3739-
3740- result = gtk_file_filter_filter (impl->current_filter, &filter_info);
3741-
3742- if (filter_info.filename)
3743- g_free ((gchar *)filter_info.filename);
3744- if (filter_info.uri)
3745- g_free ((gchar *)filter_info.uri);
3746-
3747- return !result;
3748-}
3749-
3750 /* GtkWidget::map method */
3751 static void
3752 gtk_file_chooser_default_map (GtkWidget *widget)
3753@@ -4231,50 +1860,8 @@
3754 pending_select_paths_store_selection (impl); 3715 pending_select_paths_store_selection (impl);
3755 change_folder_and_display_error (impl, impl->current_folder); 3716 change_folder_and_display_error (impl, impl->current_folder);
3756 } 3717 }
3757- 3718-
3758- bookmarks_changed_cb (impl->file_system, impl); 3719- bookmarks_changed_cb (impl->file_system, impl);
3759-}
3760-
3761-static gboolean
3762-list_model_filter_func (GtkFileSystemModel *model,
3763- GtkFilePath *path,
3764- const GtkFileInfo *file_info,
3765- gpointer user_data)
3766-{
3767- GtkFileChooserDefault *impl = user_data;
3768-
3769- if (!impl->current_filter)
3770- return TRUE;
3771-
3772- if (gtk_file_info_get_is_folder (file_info))
3773- return TRUE;
3774-
3775- return !get_is_file_filtered (impl, path, (GtkFileInfo *) file_info);
3776 } 3720 }
3777 3721
3778-static void 3722 static gboolean
3779-install_list_model_filter (GtkFileChooserDefault *impl) 3723@@ -4519,18 +2261,21 @@
3780-{
3781- GtkFileSystemModelFilter filter;
3782- gpointer data;
3783-
3784- g_assert (impl->browse_files_model != NULL);
3785-
3786- if (impl->current_filter)
3787- {
3788- filter = list_model_filter_func;
3789- data = impl;
3790- }
3791- else
3792- {
3793- filter = NULL;
3794- data = NULL;
3795- }
3796-
3797- _gtk_file_system_model_set_filter (impl->browse_files_model,
3798- filter,
3799- data);
3800-}
3801
3802 #define COMPARE_DIRECTORIES \
3803 GtkFileChooserDefault *impl = user_data; \
3804@@ -4519,18 +2106,21 @@
3805 GtkFileFolder *folder; 3724 GtkFileFolder *folder;
3806 gboolean success; 3725 gboolean success;
3807 gboolean have_hidden; 3726 gboolean have_hidden;
@@ -3825,7 +3744,7 @@
3825 3744
3826 if (only_one_path) 3745 if (only_one_path)
3827 { 3746 {
3828@@ -4541,7 +2131,6 @@ 3747@@ -4541,7 +2286,6 @@
3829 { 3748 {
3830 success = TRUE; 3749 success = TRUE;
3831 have_hidden = gtk_file_info_get_is_hidden (info); 3750 have_hidden = gtk_file_info_get_is_hidden (info);
@@ -3833,7 +3752,7 @@
3833 gtk_file_info_free (info); 3752 gtk_file_info_free (info);
3834 } 3753 }
3835 } 3754 }
3836@@ -4563,12 +2152,9 @@ 3755@@ -4563,12 +2307,9 @@
3837 if (!have_hidden) 3756 if (!have_hidden)
3838 have_hidden = gtk_file_info_get_is_hidden (info); 3757 have_hidden = gtk_file_info_get_is_hidden (info);
3839 3758
@@ -3847,7 +3766,7 @@
3847 break; /* we now have all the information we need */ 3766 break; /* we now have all the information we need */
3848 } 3767 }
3849 } 3768 }
3850@@ -4584,9 +2170,6 @@ 3769@@ -4584,9 +2325,6 @@
3851 if (have_hidden) 3770 if (have_hidden)
3852 g_object_set (impl, "show-hidden", TRUE, NULL); 3771 g_object_set (impl, "show-hidden", TRUE, NULL);
3853 3772
@@ -3857,7 +3776,7 @@
3857 if (only_one_path) 3776 if (only_one_path)
3858 _gtk_file_system_model_path_do (impl->browse_files_model, only_one_path, select_func, impl); 3777 _gtk_file_system_model_path_do (impl->browse_files_model, only_one_path, select_func, impl);
3859 else 3778 else
3860@@ -4629,13 +2212,11 @@ 3779@@ -4629,13 +2367,11 @@
3861 * that case, the chooser's selection should be what the caller expects, 3780 * that case, the chooser's selection should be what the caller expects,
3862 * as the user can't see that something else got selected. See bug #165264. 3781 * as the user can't see that something else got selected. See bug #165264.
3863 * 3782 *
@@ -3875,16 +3794,7 @@
3875 browse_files_select_first_row (impl); 3794 browse_files_select_first_row (impl);
3876 } 3795 }
3877 3796
3878@@ -4713,8 +2294,6 @@ 3797@@ -4725,19 +2461,15 @@
3879
3880 _gtk_file_system_model_set_show_hidden (impl->browse_files_model, impl->show_hidden);
3881
3882- install_list_model_filter (impl);
3883-
3884 return TRUE;
3885 }
3886
3887@@ -4725,19 +2304,15 @@
3888 const GtkFileInfo *info; 3798 const GtkFileInfo *info;
3889 GtkTreeIter iter; 3799 GtkTreeIter iter;
3890 GtkTreeIter child_iter; 3800 GtkTreeIter child_iter;
@@ -3906,7 +3816,7 @@
3906 3816
3907 gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, 3817 gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model,
3908 &child_iter, 3818 &child_iter,
3909@@ -4745,12 +2320,7 @@ 3819@@ -4745,12 +2477,7 @@
3910 3820
3911 info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter); 3821 info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
3912 3822
@@ -3920,7 +3830,7 @@
3920 _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), 3830 _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
3921 gtk_file_info_get_display_name (info)); 3831 gtk_file_info_get_display_name (info));
3922 } 3832 }
3923@@ -4780,9 +2350,6 @@ 3833@@ -4780,9 +2507,6 @@
3924 if (!check_is_folder (impl->file_system, path, error)) 3834 if (!check_is_folder (impl->file_system, path, error))
3925 return FALSE; 3835 return FALSE;
3926 3836
@@ -3930,7 +3840,7 @@
3930 if (impl->current_folder != path) 3840 if (impl->current_folder != path)
3931 { 3841 {
3932 if (impl->current_folder) 3842 if (impl->current_folder)
3933@@ -4791,17 +2358,6 @@ 3843@@ -4791,17 +2515,6 @@
3934 impl->current_folder = gtk_file_path_copy (path); 3844 impl->current_folder = gtk_file_path_copy (path);
3935 } 3845 }
3936 3846
@@ -3948,7 +3858,7 @@
3948 /* Set the folder on the save entry */ 3858 /* Set the folder on the save entry */
3949 3859
3950 _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), 3860 _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
3951@@ -4815,13 +2371,7 @@ 3861@@ -4815,13 +2528,7 @@
3952 3862
3953 /* Refresh controls */ 3863 /* Refresh controls */
3954 3864
@@ -3962,7 +3872,7 @@
3962 g_signal_emit_by_name (impl, "selection-changed", 0); 3872 g_signal_emit_by_name (impl, "selection-changed", 0);
3963 3873
3964 return result; 3874 return result;
3965@@ -4844,7 +2394,6 @@ 3875@@ -4844,7 +2551,6 @@
3966 g_return_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE 3876 g_return_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
3967 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER); 3877 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
3968 3878
@@ -3970,7 +3880,7 @@
3970 _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), name); 3880 _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), name);
3971 } 3881 }
3972 3882
3973@@ -4983,24 +2532,13 @@ 3883@@ -4983,24 +2689,13 @@
3974 GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); 3884 GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
3975 3885
3976 gtk_tree_selection_unselect_all (selection); 3886 gtk_tree_selection_unselect_all (selection);
@@ -3999,7 +3909,7 @@
3999 { 3909 {
4000 GtkFileChooserEntry *chooser_entry; 3910 GtkFileChooserEntry *chooser_entry;
4001 const GtkFilePath *current_folder; 3911 const GtkFilePath *current_folder;
4002@@ -5013,31 +2551,17 @@ 3912@@ -5013,31 +2708,17 @@
4003 3913
4004 chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry); 3914 chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry);
4005 3915
@@ -4035,7 +3945,7 @@
4035 3945
4036 error = NULL; 3946 error = NULL;
4037 path = gtk_file_system_make_path (impl->file_system, current_folder, file_part, &error); 3947 path = gtk_file_system_make_path (impl->file_system, current_folder, file_part, &error);
4038@@ -5045,14 +2569,12 @@ 3948@@ -5045,14 +2726,12 @@
4039 if (!path) 3949 if (!path)
4040 { 3950 {
4041 error_building_filename_dialog (impl, current_folder, file_part, error); 3951 error_building_filename_dialog (impl, current_folder, file_part, error);
@@ -4054,15 +3964,15 @@
4054 } 3964 }
4055 3965
4056 struct get_paths_closure { 3966 struct get_paths_closure {
4057@@ -5098,21 +2620,11 @@ 3967@@ -5098,21 +2777,11 @@
4058 if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE 3968 if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
4059 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER) 3969 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
4060 { 3970 {
4061- gboolean is_well_formed, is_empty, is_file_part_empty; 3971- gboolean is_well_formed, is_empty, is_file_part_empty;
4062-
4063- check_save_entry (impl, &info.path_from_entry, &is_well_formed, &is_empty, &is_file_part_empty);
4064+ gboolean is_valid, is_empty; 3972+ gboolean is_valid, is_empty;
4065 3973
3974- check_save_entry (impl, &info.path_from_entry, &is_well_formed, &is_empty, &is_file_part_empty);
3975-
4066- if (!is_well_formed) 3976- if (!is_well_formed)
4067+ info.path_from_entry = check_save_entry (impl, &is_valid, &is_empty); 3977+ info.path_from_entry = check_save_entry (impl, &is_valid, &is_empty);
4068+ if (!is_valid && !is_empty) 3978+ if (!is_valid && !is_empty)
@@ -4079,7 +3989,7 @@
4079 } 3989 }
4080 3990
4081 if (!info.path_from_entry || impl->select_multiple) 3991 if (!info.path_from_entry || impl->select_multiple)
4082@@ -5137,243 +2649,12 @@ 3992@@ -5137,17 +2806,6 @@
4083 return g_slist_reverse (info.result); 3993 return g_slist_reverse (info.result);
4084 } 3994 }
4085 3995
@@ -4094,73 +4004,34 @@
4094- return NULL; 4004- return NULL;
4095-} 4005-}
4096- 4006-
4097-static GtkFileSystem * 4007 static GtkFileSystem *
4098-gtk_file_chooser_default_get_file_system (GtkFileChooser *chooser) 4008 gtk_file_chooser_default_get_file_system (GtkFileChooser *chooser)
4099-{ 4009 {
4100- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); 4010@@ -5162,9 +2820,9 @@
4101- 4011 gboolean show)
4102- return impl->file_system; 4012 {
4103-} 4013 if (show)
4104-
4105-/* Shows or hides the filter widgets */
4106-static void
4107-show_filters (GtkFileChooserDefault *impl,
4108- gboolean show)
4109-{
4110- if (show)
4111- gtk_widget_show (impl->filter_combo_hbox); 4014- gtk_widget_show (impl->filter_combo_hbox);
4112- else 4015+ gtk_widget_show (impl->filter_combo);
4016 else
4113- gtk_widget_hide (impl->filter_combo_hbox); 4017- gtk_widget_hide (impl->filter_combo_hbox);
4114-} 4018+ gtk_widget_hide (impl->filter_combo);
4115- 4019 }
4116-static void 4020
4117-gtk_file_chooser_default_add_filter (GtkFileChooser *chooser, 4021 static void
4118- GtkFileFilter *filter) 4022@@ -5174,6 +2832,8 @@
4119-{ 4023 GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4120- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); 4024 const gchar *name;
4121- const gchar *name; 4025
4122- 4026+ g_debug ("adding filter");
4123- if (g_slist_find (impl->filters, filter)) 4027+
4124- { 4028 if (g_slist_find (impl->filters, filter))
4125- g_warning ("gtk_file_chooser_add_filter() called on filter already in list\n"); 4029 {
4126- return; 4030 g_warning ("gtk_file_chooser_add_filter() called on filter already in list\n");
4127- } 4031@@ -5215,165 +2875,31 @@
4128- 4032
4129- g_object_ref (filter); 4033 impl->filters = g_slist_remove (impl->filters, filter);
4130- gtk_object_sink (GTK_OBJECT (filter)); 4034
4131- impl->filters = g_slist_append (impl->filters, filter);
4132-
4133- name = gtk_file_filter_get_name (filter);
4134- if (!name)
4135- name = "Untitled filter"; /* Place-holder, doesn't need to be marked for translation */
4136-
4137- gtk_combo_box_append_text (GTK_COMBO_BOX (impl->filter_combo), name);
4138-
4139- if (!g_slist_find (impl->filters, impl->current_filter))
4140- set_current_filter (impl, filter);
4141-
4142- show_filters (impl, TRUE);
4143-}
4144-
4145-static void
4146-gtk_file_chooser_default_remove_filter (GtkFileChooser *chooser,
4147- GtkFileFilter *filter)
4148-{
4149- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4150- GtkTreeModel *model;
4151- GtkTreeIter iter;
4152- gint filter_index;
4153-
4154- filter_index = g_slist_index (impl->filters, filter);
4155-
4156- if (filter_index < 0)
4157- {
4158- g_warning ("gtk_file_chooser_remove_filter() called on filter not in list\n");
4159- return;
4160- }
4161-
4162- impl->filters = g_slist_remove (impl->filters, filter);
4163-
4164- if (filter == impl->current_filter) 4035- if (filter == impl->current_filter)
4165- { 4036- {
4166- if (impl->filters) 4037- if (impl->filters)
@@ -4263,10 +4134,20 @@
4263- 4134-
4264- if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter)) 4135- if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
4265- g_assert_not_reached (); 4136- g_assert_not_reached ();
4266- } 4137+ if (filter == impl->current_filter)
4267- 4138+ {
4139+ if (impl->filters)
4140+ set_current_filter (impl, impl->filters->data);
4141+ else
4142+ set_current_filter (impl, NULL);
4143 }
4144
4268- out: 4145- out:
4269- 4146+ /* Remove row from the combo box */
4147+ model = gtk_combo_box_get_model (GTK_COMBO_BOX (impl->filter_combo));
4148+ gtk_tree_model_iter_nth_child (model, &iter, NULL, filter_index);
4149+ gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
4150
4270- uri = gtk_file_system_path_to_uri (impl->file_system, path); 4151- uri = gtk_file_system_path_to_uri (impl->file_system, path);
4271- g_set_error (error, 4152- g_set_error (error,
4272- GTK_FILE_CHOOSER_ERROR, 4153- GTK_FILE_CHOOSER_ERROR,
@@ -4274,19 +4155,23 @@
4274- _("Shortcut %s does not exist"), 4155- _("Shortcut %s does not exist"),
4275- uri); 4156- uri);
4276- g_free (uri); 4157- g_free (uri);
4277- 4158+ g_object_unref (filter);
4159
4278- return FALSE; 4160- return FALSE;
4279-} 4161+ if (!impl->filters)
4280- 4162+ show_filters (impl, FALSE);
4281-static GSList * 4163 }
4164
4165 static GSList *
4282-gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser) 4166-gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
4283-{ 4167+gtk_file_chooser_default_list_filters (GtkFileChooser *chooser)
4284- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser); 4168 {
4169 GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4285- int pos; 4170- int pos;
4286- GtkTreeIter iter; 4171- GtkTreeIter iter;
4287- int i; 4172- int i;
4288- GSList *list; 4173- GSList *list;
4289- 4174
4290- if (impl->num_shortcuts == 0) 4175- if (impl->num_shortcuts == 0)
4291- return NULL; 4176- return NULL;
4292- 4177-
@@ -4318,17 +4203,13 @@
4318- g_assert_not_reached (); 4203- g_assert_not_reached ();
4319- } 4204- }
4320- } 4205- }
4321+static GtkFileSystem * 4206-
4322+gtk_file_chooser_default_get_file_system (GtkFileChooser *chooser)
4323+{
4324+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4325
4326- return g_slist_reverse (list); 4207- return g_slist_reverse (list);
4327+ return impl->file_system; 4208+ return g_slist_copy (impl->filters);
4328 } 4209 }
4329 4210
4330 /* Guesses a size based upon font sizes */ 4211 /* Guesses a size based upon font sizes */
4331@@ -5386,7 +2667,6 @@ 4212@@ -5386,7 +2912,6 @@
4332 gint default_width, default_height; 4213 gint default_width, default_height;
4333 int font_size; 4214 int font_size;
4334 GtkRequisition req; 4215 GtkRequisition req;
@@ -4336,7 +4217,7 @@
4336 4217
4337 g_assert (widget->style != NULL); 4218 g_assert (widget->style != NULL);
4338 impl = GTK_FILE_CHOOSER_DEFAULT (widget); 4219 impl = GTK_FILE_CHOOSER_DEFAULT (widget);
4339@@ -5400,12 +2680,7 @@ 4220@@ -5400,12 +2925,7 @@
4340 /* Use at least the requisition size not including the preview widget */ 4221 /* Use at least the requisition size not including the preview widget */
4341 gtk_widget_size_request (widget, &req); 4222 gtk_widget_size_request (widget, &req);
4342 4223
@@ -4350,7 +4231,7 @@
4350 default_height = MAX (default_height, req.height); 4231 default_height = MAX (default_height, req.height);
4351 4232
4352 *width = default_width; 4233 *width = default_width;
4353@@ -5423,8 +2698,6 @@ 4234@@ -5423,8 +2943,6 @@
4354 4235
4355 find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height); 4236 find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height);
4356 4237
@@ -4359,7 +4240,7 @@
4359 } 4240 }
4360 4241
4361 static void 4242 static void
4362@@ -5441,16 +2714,6 @@ 4243@@ -5441,16 +2959,6 @@
4363 4244
4364 *resize_horizontally = TRUE; 4245 *resize_horizontally = TRUE;
4365 *resize_vertically = TRUE; 4246 *resize_vertically = TRUE;
@@ -4376,7 +4257,7 @@
4376 } 4257 }
4377 4258
4378 struct switch_folder_closure { 4259 struct switch_folder_closure {
4379@@ -5517,84 +2780,49 @@ 4260@@ -5517,84 +3025,49 @@
4380 4261
4381 if (current_focus == impl->browse_files_tree_view) 4262 if (current_focus == impl->browse_files_tree_view)
4382 { 4263 {
@@ -4485,7 +4366,7 @@
4485 4366
4486 save_entry: 4367 save_entry:
4487 4368
4488@@ -5602,103 +2830,39 @@ 4369@@ -5602,103 +3075,39 @@
4489 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER); 4370 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
4490 4371
4491 entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry); 4372 entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry);
@@ -4605,55 +4486,11 @@
4605 else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view) 4486 else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
4606 { 4487 {
4607 /* The focus is on a dialog's action area button, *and* the widget that 4488 /* The focus is on a dialog's action area button, *and* the widget that
4608@@ -5742,242 +2906,6 @@ 4489@@ -5786,199 +3195,6 @@
4609 gtk_widget_grab_focus (widget); 4490 set_current_filter (impl, new_filter);
4610 } 4491 }
4611 4492
4612-static void 4493-static void
4613-set_current_filter (GtkFileChooserDefault *impl,
4614- GtkFileFilter *filter)
4615-{
4616- if (impl->current_filter != filter)
4617- {
4618- int filter_index;
4619-
4620- /* NULL filters are allowed to reset to non-filtered status
4621- */
4622- filter_index = g_slist_index (impl->filters, filter);
4623- if (impl->filters && filter && filter_index < 0)
4624- return;
4625-
4626- if (impl->current_filter)
4627- g_object_unref (impl->current_filter);
4628- impl->current_filter = filter;
4629- if (impl->current_filter)
4630- {
4631- g_object_ref (impl->current_filter);
4632- gtk_object_sink (GTK_OBJECT (filter));
4633- }
4634-
4635- if (impl->filters)
4636- gtk_combo_box_set_active (GTK_COMBO_BOX (impl->filter_combo),
4637- filter_index);
4638-
4639- if (impl->browse_files_model)
4640- install_list_model_filter (impl);
4641-
4642- g_object_notify (G_OBJECT (impl), "filter");
4643- }
4644-}
4645-
4646-static void
4647-filter_combo_changed (GtkComboBox *combo_box,
4648- GtkFileChooserDefault *impl)
4649-{
4650- gint new_index = gtk_combo_box_get_active (combo_box);
4651- GtkFileFilter *new_filter = g_slist_nth_data (impl->filters, new_index);
4652-
4653- set_current_filter (impl, new_filter);
4654-}
4655-
4656-static void
4657-check_preview_change (GtkFileChooserDefault *impl) 4494-check_preview_change (GtkFileChooserDefault *impl)
4658-{ 4495-{
4659- GtkTreePath *cursor_path; 4496- GtkTreePath *cursor_path;
@@ -4845,10 +4682,11 @@
4845- 4682-
4846- return (*gtk_tree_path_get_indices (path) != shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR)); 4683- return (*gtk_tree_path_get_indices (path) != shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR));
4847-} 4684-}
4848 4685-
4849 static gboolean 4686 static gboolean
4850 list_select_func (GtkTreeSelection *selection, 4687 list_select_func (GtkTreeSelection *selection,
4851@@ -6022,7 +2950,7 @@ 4688 GtkTreeModel *model,
4689@@ -6022,7 +3238,7 @@
4852 g_assert (!impl->select_multiple); 4690 g_assert (!impl->select_multiple);
4853 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view)); 4691 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
4854 if (!gtk_tree_selection_get_selected (selection, NULL, &iter)) 4692 if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
@@ -4857,7 +4695,7 @@
4857 4695
4858 gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, 4696 gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model,
4859 &child_iter, 4697 &child_iter,
4860@@ -6033,11 +2961,7 @@ 4698@@ -6033,11 +3249,7 @@
4861 return; /* We are on the editable row for New Folder */ 4699 return; /* We are on the editable row for New Folder */
4862 } 4700 }
4863 4701
@@ -4869,7 +4707,7 @@
4869 4707
4870 g_signal_emit_by_name (impl, "selection-changed", 0); 4708 g_signal_emit_by_name (impl, "selection-changed", 0);
4871 } 4709 }
4872@@ -6074,23 +2998,6 @@ 4710@@ -6074,23 +3286,6 @@
4873 g_signal_emit_by_name (impl, "file-activated"); 4711 g_signal_emit_by_name (impl, "file-activated");
4874 } 4712 }
4875 4713
@@ -4893,7 +4731,7 @@
4893 static const GtkFileInfo * 4731 static const GtkFileInfo *
4894 get_list_file_info (GtkFileChooserDefault *impl, 4732 get_list_file_info (GtkFileChooserDefault *impl,
4895 GtkTreeIter *iter) 4733 GtkTreeIter *iter)
4896@@ -6257,33 +3164,31 @@ 4734@@ -6257,33 +3452,31 @@
4897 4735
4898 time_mtime = gtk_file_info_get_modification_time (info); 4736 time_mtime = gtk_file_info_get_modification_time (info);
4899 4737
@@ -4932,13 +4770,13 @@
4932 else 4770 else
4933- { 4771- {
4934- char *format; 4772- char *format;
4935- 4773+ format = "%x"; /* Any other date */
4774
4936- if (days_diff > 1 && days_diff < 7) 4775- if (days_diff > 1 && days_diff < 7)
4937- format = "%A"; /* Days from last week */ 4776- format = "%A"; /* Days from last week */
4938- else 4777- else
4939- format = "%x"; /* Any other date */ 4778- format = "%x"; /* Any other date */
4940+ format = "%x"; /* Any other date */ 4779-
4941
4942- if (g_date_strftime (buf, sizeof (buf), format, &mtime) == 0) 4780- if (g_date_strftime (buf, sizeof (buf), format, &mtime) == 0)
4943- strcpy (buf, _("Unknown")); 4781- strcpy (buf, _("Unknown"));
4944- } 4782- }
@@ -4947,7 +4785,7 @@
4947 } 4785 }
4948 4786
4949 if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER || 4787 if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
4950@@ -6376,8 +3281,11 @@ 4788@@ -6376,8 +3569,11 @@
4951 */ 4789 */
4952 4790
4953 error = NULL; 4791 error = NULL;
@@ -4960,7 +4798,7 @@
4960 if (!folder) 4798 if (!folder)
4961 { 4799 {
4962 error_getting_info_dialog (impl, folder_path, error); 4800 error_getting_info_dialog (impl, folder_path, error);
4963@@ -6487,8 +3395,8 @@ 4801@@ -6487,8 +3683,8 @@
4964 accept_stock, GTK_RESPONSE_ACCEPT, 4802 accept_stock, GTK_RESPONSE_ACCEPT,
4965 NULL); 4803 NULL);
4966 gtk_window_set_default_size (GTK_WINDOW (dialog), 300, -1); 4804 gtk_window_set_default_size (GTK_WINDOW (dialog), 300, -1);
@@ -4971,7 +4809,7 @@
4971 gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT); 4809 gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
4972 4810
4973 gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog), 4811 gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
4974@@ -6496,17 +3404,16 @@ 4812@@ -6496,17 +3692,16 @@
4975 GTK_RESPONSE_CANCEL, 4813 GTK_RESPONSE_CANCEL,
4976 -1); 4814 -1);
4977 4815
@@ -4991,7 +4829,7 @@
4991 4829
4992 /* Run */ 4830 /* Run */
4993 4831
4994@@ -6555,115 +3462,86 @@ 4832@@ -6555,115 +3750,68 @@
4995 static void 4833 static void
4996 up_folder_handler (GtkFileChooserDefault *impl) 4834 up_folder_handler (GtkFileChooserDefault *impl)
4997 { 4835 {
@@ -5040,38 +4878,33 @@
5040- g_assert_not_reached (); 4878- g_assert_not_reached ();
5041- 4879-
5042- shortcuts_activate_iter (impl, &iter); 4880- shortcuts_activate_iter (impl, &iter);
5043 } 4881-}
5044 4882-
5045- 4883-
5046- 4884-
5047-/* Drag and drop interfaces */ 4885-/* Drag and drop interfaces */
5048+static GtkFilePath * 4886-
5049+gtk_file_chooser_default_get_preview_path (GtkFileChooser *chooser) 4887-static void
5050+{
5051+ return NULL;
5052+}
5053
5054 static void
5055-_shortcuts_model_filter_class_init (ShortcutsModelFilterClass *class) 4888-_shortcuts_model_filter_class_init (ShortcutsModelFilterClass *class)
5056+gtk_file_chooser_default_add_filter (GtkFileChooser *chooser, 4889-{
5057+ GtkFileFilter *filter)
5058 {
5059 } 4890 }
5060 4891
5061 static void 4892-static void
5062-_shortcuts_model_filter_init (ShortcutsModelFilter *model) 4893-_shortcuts_model_filter_init (ShortcutsModelFilter *model)
5063+gtk_file_chooser_default_remove_filter (GtkFileChooser *chooser, 4894+static GtkFilePath *
5064+ GtkFileFilter *filter) 4895+gtk_file_chooser_default_get_preview_path (GtkFileChooser *chooser)
5065 { 4896 {
5066- model->impl = NULL; 4897- model->impl = NULL;
4898+ return NULL;
5067 } 4899 }
5068 4900
5069-/* GtkTreeDragSource::row_draggable implementation for the shortcuts filter model */ 4901-/* GtkTreeDragSource::row_draggable implementation for the shortcuts filter model */
5070-static gboolean 4902 static gboolean
5071-shortcuts_model_filter_row_draggable (GtkTreeDragSource *drag_source, 4903-shortcuts_model_filter_row_draggable (GtkTreeDragSource *drag_source,
5072- GtkTreePath *path) 4904- GtkTreePath *path)
5073+static GSList * 4905+gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
5074+gtk_file_chooser_default_list_filters (GtkFileChooser *chooser) 4906+ const GtkFilePath *path,
4907+ GError **error)
5075 { 4908 {
5076- ShortcutsModelFilter *model; 4909- ShortcutsModelFilter *model;
5077- int pos; 4910- int pos;
@@ -5083,7 +4916,7 @@
5083- bookmarks_pos = shortcuts_get_index (model->impl, SHORTCUTS_BOOKMARKS); 4916- bookmarks_pos = shortcuts_get_index (model->impl, SHORTCUTS_BOOKMARKS);
5084- 4917-
5085- return (pos >= bookmarks_pos && pos < bookmarks_pos + model->impl->num_bookmarks); 4918- return (pos >= bookmarks_pos && pos < bookmarks_pos + model->impl->num_bookmarks);
5086+ return NULL; 4919+ return FALSE;
5087 } 4920 }
5088 4921
5089-/* GtkTreeDragSource::drag_data_get implementation for the shortcuts filter model */ 4922-/* GtkTreeDragSource::drag_data_get implementation for the shortcuts filter model */
@@ -5091,10 +4924,7 @@
5091-shortcuts_model_filter_drag_data_get (GtkTreeDragSource *drag_source, 4924-shortcuts_model_filter_drag_data_get (GtkTreeDragSource *drag_source,
5092- GtkTreePath *path, 4925- GtkTreePath *path,
5093- GtkSelectionData *selection_data) 4926- GtkSelectionData *selection_data)
5094+gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser, 4927-{
5095+ const GtkFilePath *path,
5096+ GError **error)
5097 {
5098- ShortcutsModelFilter *model; 4928- ShortcutsModelFilter *model;
5099- 4929-
5100- model = SHORTCUTS_MODEL_FILTER (drag_source); 4930- model = SHORTCUTS_MODEL_FILTER (drag_source);
@@ -5102,13 +4932,11 @@
5102- /* FIXME */ 4932- /* FIXME */
5103- 4933-
5104- return FALSE; 4934- return FALSE;
5105+ return FALSE; 4935-}
5106 } 4936-
5107
5108-/* Fill the GtkTreeDragSourceIface vtable */ 4937-/* Fill the GtkTreeDragSourceIface vtable */
5109-static void 4938-static void
5110-shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface) 4939-shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface)
5111+static gboolean
5112+gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser, 4940+gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser,
5113+ const GtkFilePath *path, 4941+ const GtkFilePath *path,
5114+ GError **error) 4942+ GError **error)
diff --git a/meta/packages/gtk+/gtk+_2.6.8.bb b/meta/packages/gtk+/gtk+_2.6.8.bb
index 9fa6700a55..f1ccb46b61 100644
--- a/meta/packages/gtk+/gtk+_2.6.8.bb
+++ b/meta/packages/gtk+/gtk+_2.6.8.bb
@@ -5,7 +5,7 @@ HOMEPAGE = "http://www.gtk.org"
5SECTION = "libs" 5SECTION = "libs"
6PRIORITY = "optional" 6PRIORITY = "optional"
7DEPENDS = "glib-2.0 pango atk jpeg libpng libxext libxcursor gtk-doc libgcrypt" 7DEPENDS = "glib-2.0 pango atk jpeg libpng libxext libxcursor gtk-doc libgcrypt"
8PR = "r4" 8PR = "r5"
9 9
10SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \ 10SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \
11 file://no-demos.patch;patch=1 \ 11 file://no-demos.patch;patch=1 \