summaryrefslogtreecommitdiffstats
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/automake-lossage.patch24
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/disable-tooltips.patch11
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch4980
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/filechooser-respect-style.patch77
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/filesystem-volumes.patch182
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/gtk+-handhelds.patch186
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/gtklabel-resize-patch10
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/hardcoded_libtool.patch29
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/menu-deactivate.patch50
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/no-demos.patch10
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/no-deprecation.patch334
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/no-xwc.patch151
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/scroll-timings.patch15
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/smaller-filechooser.patch47
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/spinbutton.patch128
-rw-r--r--meta/packages/gtk+/gtk+_2.6.8.bb95
16 files changed, 0 insertions, 6329 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.8/automake-lossage.patch b/meta/packages/gtk+/gtk+-2.6.8/automake-lossage.patch
deleted file mode 100644
index 0d423ddbb9..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/automake-lossage.patch
+++ /dev/null
@@ -1,24 +0,0 @@
1--- gtk+-2.4.1/docs/tutorial/Makefile.am~ 2003-05-06 22:54:20.000000000 +0100
2+++ gtk+-2.4.1/docs/tutorial/Makefile.am 2004-05-08 12:31:41.000000000 +0100
3@@ -52,21 +52,5 @@
4
5 dist-hook: html
6 cp -Rp $(srcdir)/html $(distdir)
7-else
8-html:
9- echo "***"
10- echo "*** Warning: Tutorial not built"
11- echo "***"
12-
13-pdf:
14- echo "***"
15- echo "*** Warning: Tutorial not built"
16- echo "***"
17-
18-dist-hook:
19- echo "***"
20- echo "*** Warning: Tutorial not built"
21- echo "*** DISTRIBUTION IS INCOMPLETE"
22- echo "***"
23 endif
24
diff --git a/meta/packages/gtk+/gtk+-2.6.8/disable-tooltips.patch b/meta/packages/gtk+/gtk+-2.6.8/disable-tooltips.patch
deleted file mode 100644
index d71d839c3c..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/disable-tooltips.patch
+++ /dev/null
@@ -1,11 +0,0 @@
1--- gtk+-2.4.3/gtk/gtktooltips.c.old 2004-07-04 18:52:04.000000000 +0100
2+++ gtk+-2.4.3/gtk/gtktooltips.c 2004-07-04 18:52:08.000000000 +0100
3@@ -118,7 +118,7 @@
4 tooltips->tips_data_list = NULL;
5
6 tooltips->delay = DEFAULT_DELAY;
7- tooltips->enabled = TRUE;
8+ tooltips->enabled = FALSE;
9 tooltips->timer_tag = 0;
10 tooltips->use_sticky_delay = FALSE;
11 tooltips->last_popdown.tv_sec = -1;
diff --git a/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch b/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch
deleted file mode 100644
index fa2dfb4843..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch
+++ /dev/null
@@ -1,4980 +0,0 @@
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 18:37:47.000000000 +0000
3@@ -31,7 +31,6 @@
4 #include "gtkcombobox.h"
5 #include "gtkentry.h"
6 #include "gtkeventbox.h"
7-#include "gtkexpander.h"
8 #include "gtkfilechooserdefault.h"
9 #include "gtkfilechooserembed.h"
10 #include "gtkfilechooserentry.h"
11@@ -50,7 +49,6 @@
12 #include "gtkmarshalers.h"
13 #include "gtkmenuitem.h"
14 #include "gtkmessagedialog.h"
15-#include "gtkpathbar.h"
16 #include "gtkprivate.h"
17 #include "gtkscrolledwindow.h"
18 #include "gtkseparatormenuitem.h"
19@@ -79,18 +77,23 @@
20 #include <string.h>
21 #include <time.h>
22
23+#define DEFAULT_SPACING 5
24+
25+#define GTK26
26 typedef struct _GtkFileChooserDefaultClass GtkFileChooserDefaultClass;
27
28 #define GTK_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass))
29 #define GTK_IS_FILE_CHOOSER_DEFAULT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GTK_TYPE_FILE_CHOOSER_DEFAULT))
30 #define GTK_FILE_CHOOSER_DEFAULT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GTK_TYPE_FILE_CHOOSER_DEFAULT, GtkFileChooserDefaultClass))
31
32+#ifdef GTK26
33 typedef enum {
34 LOAD_EMPTY, /* There is no model */
35 LOAD_PRELOAD, /* Model is loading and a timer is running; model isn't inserted into the tree yet */
36 LOAD_LOADING, /* Timeout expired, model is inserted into the tree, but not fully loaded yet */
37 LOAD_FINISHED /* Model is fully loaded and inserted into the tree */
38 } LoadState;
39+#endif
40
41 #define MAX_LOADING_TIME 500
42
43@@ -109,63 +112,38 @@
44
45 /* Save mode widgets */
46 GtkWidget *save_widgets;
47-
48 GtkWidget *save_file_name_entry;
49- GtkWidget *save_folder_label;
50- GtkWidget *save_folder_combo;
51- GtkWidget *save_expander;
52
53 /* The file browsing widgets */
54 GtkWidget *browse_widgets;
55- GtkWidget *browse_shortcuts_tree_view;
56- GtkWidget *browse_shortcuts_add_button;
57- GtkWidget *browse_shortcuts_remove_button;
58 GtkWidget *browse_files_tree_view;
59- GtkWidget *browse_files_popup_menu;
60- GtkWidget *browse_files_popup_menu_add_shortcut_item;
61- GtkWidget *browse_files_popup_menu_hidden_files_item;
62 GtkWidget *browse_new_folder_button;
63- GtkWidget *browse_path_bar;
64-
65+ GtkWidget *bar;
66+ GtkWidget * up_button;
67+
68 GtkFileSystemModel *browse_files_model;
69
70- GtkWidget *filter_combo_hbox;
71 GtkWidget *filter_combo;
72- GtkWidget *preview_box;
73- GtkWidget *preview_label;
74- GtkWidget *preview_widget;
75- GtkWidget *extra_align;
76- GtkWidget *extra_widget;
77-
78- GtkListStore *shortcuts_model;
79- GtkTreeModel *shortcuts_filter_model;
80-
81+
82 GtkTreeModelSort *sort_model;
83
84 LoadState load_state;
85 guint load_timeout_id;
86
87 GSList *pending_select_paths;
88-
89+ GSList * path_history;
90+
91 GtkFileFilter *current_filter;
92 GSList *filters;
93
94 GtkTooltips *tooltips;
95
96- gboolean has_home;
97- gboolean has_desktop;
98-
99 int num_volumes;
100- int num_shortcuts;
101- int num_bookmarks;
102
103 gulong volumes_changed_id;
104- gulong bookmarks_changed_id;
105
106 GtkFilePath *current_volume_path;
107 GtkFilePath *current_folder;
108- GtkFilePath *preview_path;
109- char *preview_display_name;
110
111 GtkTreeViewColumn *list_name_column;
112 GtkCellRenderer *list_name_renderer;
113@@ -179,25 +157,15 @@
114 gulong toplevel_set_focus_id;
115 GtkWidget *toplevel_last_focus_widget;
116
117-#if 0
118- GdkDragContext *shortcuts_drag_context;
119- GSource *shortcuts_drag_outside_idle;
120-#endif
121-
122+ gchar * root_folder;
123+
124 /* Flags */
125
126 guint local_only : 1;
127- guint preview_widget_active : 1;
128- guint use_preview_label : 1;
129 guint select_multiple : 1;
130 guint show_hidden : 1;
131 guint list_sort_ascending : 1;
132 guint changing_folder : 1;
133- guint shortcuts_current_folder_active : 1;
134-
135-#if 0
136- guint shortcuts_drag_outside : 1;
137-#endif
138 };
139
140 /* Signal IDs */
141@@ -211,17 +179,6 @@
142
143 static guint signals[LAST_SIGNAL] = { 0 };
144
145-/* Column numbers for the shortcuts tree. Keep these in sync with shortcuts_model_create() */
146-enum {
147- SHORTCUTS_COL_PIXBUF,
148- SHORTCUTS_COL_NAME,
149- SHORTCUTS_COL_DATA,
150- SHORTCUTS_COL_IS_VOLUME,
151- SHORTCUTS_COL_REMOVABLE,
152- SHORTCUTS_COL_PIXBUF_VISIBLE,
153- SHORTCUTS_COL_NUM_COLUMNS
154-};
155-
156 /* Column numbers for the file list */
157 enum {
158 FILE_LIST_COL_NAME,
159@@ -236,23 +193,6 @@
160 TEXT_URI_LIST
161 };
162
163-/* Target types for dragging from the shortcuts list */
164-static const GtkTargetEntry shortcuts_source_targets[] = {
165- { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, GTK_TREE_MODEL_ROW }
166-};
167-
168-static const int num_shortcuts_source_targets = (sizeof (shortcuts_source_targets)
169- / sizeof (shortcuts_source_targets[0]));
170-
171-/* Target types for dropping into the shortcuts list */
172-static const GtkTargetEntry shortcuts_dest_targets[] = {
173- { "GTK_TREE_MODEL_ROW", GTK_TARGET_SAME_WIDGET, GTK_TREE_MODEL_ROW },
174- { "text/uri-list", 0, TEXT_URI_LIST }
175-};
176-
177-static const int num_shortcuts_dest_targets = (sizeof (shortcuts_dest_targets)
178- / sizeof (shortcuts_dest_targets[0]));
179-
180 /* Target types for DnD from the file list */
181 static const GtkTargetEntry file_list_source_targets[] = {
182 { "text/uri-list", 0, TEXT_URI_LIST }
183@@ -261,22 +201,10 @@
184 static const int num_file_list_source_targets = (sizeof (file_list_source_targets)
185 / sizeof (file_list_source_targets[0]));
186
187-/* Interesting places in the shortcuts bar */
188-typedef enum {
189- SHORTCUTS_HOME,
190- SHORTCUTS_DESKTOP,
191- SHORTCUTS_VOLUMES,
192- SHORTCUTS_SHORTCUTS,
193- SHORTCUTS_BOOKMARKS_SEPARATOR,
194- SHORTCUTS_BOOKMARKS,
195- SHORTCUTS_CURRENT_FOLDER_SEPARATOR,
196- SHORTCUTS_CURRENT_FOLDER
197-} ShortcutsIndex;
198-
199 /* Icon size for if we can't get it from the theme */
200 #define FALLBACK_ICON_SIZE 16
201
202-#define PREVIEW_HBOX_SPACING 12
203+#define LIST_HBOX_SPACING DEFAULT_SPACING
204 #define NUM_LINES 40
205 #define NUM_CHARS 60
206
207@@ -335,7 +263,6 @@
208 const GtkFilePath *path,
209 GError **error);
210 static GSList * gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser);
211-
212 static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
213 gint *default_width,
214 gint *default_height);
215@@ -352,37 +279,11 @@
216 static void home_folder_handler (GtkFileChooserDefault *impl);
217 static void update_appearance (GtkFileChooserDefault *impl);
218
219-static void set_current_filter (GtkFileChooserDefault *impl,
220- GtkFileFilter *filter);
221-static void check_preview_change (GtkFileChooserDefault *impl);
222-
223 static void filter_combo_changed (GtkComboBox *combo_box,
224 GtkFileChooserDefault *impl);
225-static void shortcuts_row_activated_cb (GtkTreeView *tree_view,
226- GtkTreePath *path,
227- GtkTreeViewColumn *column,
228- GtkFileChooserDefault *impl);
229-
230-static gboolean shortcuts_key_press_event_cb (GtkWidget *widget,
231- GdkEventKey *event,
232- GtkFileChooserDefault *impl);
233-
234-static gboolean shortcuts_select_func (GtkTreeSelection *selection,
235- GtkTreeModel *model,
236- GtkTreePath *path,
237- gboolean path_currently_selected,
238- gpointer data);
239-static gboolean shortcuts_get_selected (GtkFileChooserDefault *impl,
240- GtkTreeIter *iter);
241-static void shortcuts_activate_iter (GtkFileChooserDefault *impl,
242- GtkTreeIter *iter);
243-static int shortcuts_get_index (GtkFileChooserDefault *impl,
244- ShortcutsIndex where);
245-static int shortcut_find_position (GtkFileChooserDefault *impl,
246- const GtkFilePath *path);
247-
248-static void bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl);
249
250+static void set_current_filter (GtkFileChooserDefault *impl,
251+ GtkFileFilter *filter);
252 static gboolean list_select_func (GtkTreeSelection *selection,
253 GtkTreeModel *model,
254 GtkTreePath *path,
255@@ -401,16 +302,6 @@
256 GtkTreeIter *iter,
257 gpointer user_data);
258
259-static void path_bar_clicked (GtkPathBar *path_bar,
260- GtkFilePath *file_path,
261- gboolean child_is_hidden,
262- GtkFileChooserDefault *impl);
263-
264-static void add_bookmark_button_clicked_cb (GtkButton *button,
265- GtkFileChooserDefault *impl);
266-static void remove_bookmark_button_clicked_cb (GtkButton *button,
267- GtkFileChooserDefault *impl);
268-
269 static void list_icon_data_func (GtkTreeViewColumn *tree_column,
270 GtkCellRenderer *cell,
271 GtkTreeModel *tree_model,
272@@ -441,36 +332,6 @@
273
274 static GObjectClass *parent_class;
275
276-
277-
278-/* Drag and drop interface declarations */
279-
280-typedef struct {
281- GtkTreeModelFilter parent;
282-
283- GtkFileChooserDefault *impl;
284-} ShortcutsModelFilter;
285-
286-typedef struct {
287- GtkTreeModelFilterClass parent_class;
288-} ShortcutsModelFilterClass;
289-
290-#define SHORTCUTS_MODEL_FILTER_TYPE (_shortcuts_model_filter_get_type ())
291-#define SHORTCUTS_MODEL_FILTER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), SHORTCUTS_MODEL_FILTER_TYPE, ShortcutsModelFilter))
292-
293-static void shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface);
294-
295-G_DEFINE_TYPE_WITH_CODE (ShortcutsModelFilter,
296- _shortcuts_model_filter,
297- GTK_TYPE_TREE_MODEL_FILTER,
298- G_IMPLEMENT_INTERFACE (GTK_TYPE_TREE_DRAG_SOURCE,
299- shortcuts_model_filter_drag_source_iface_init));
300-
301-static GtkTreeModel *shortcuts_model_filter_new (GtkFileChooserDefault *impl,
302- GtkTreeModel *child_model,
303- GtkTreePath *root);
304-
305-
306
307 GType
308 _gtk_file_chooser_default_get_type (void)
309@@ -520,6 +381,11 @@
310 return file_chooser_default_type;
311 }
312
313+enum
314+{
315+ GTK_FILE_CHOOSER_PROP_ROOT_FOLDER = GTK_FILE_CHOOSER_PROP_LAST + 1,
316+};
317+
318 static void
319 gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
320 {
321@@ -617,6 +483,14 @@
322 "home-folder",
323 0);
324
325+ g_object_class_install_property (gobject_class,
326+ GTK_FILE_CHOOSER_PROP_ROOT_FOLDER,
327+ g_param_spec_string ("root-folder",
328+ P_("File System Root"),
329+ P_("Root folder for the file system below which the user should not be able to switch"),
330+ NULL,
331+ G_PARAM_WRITABLE));
332+
333 _gtk_file_chooser_install_properties (gobject_class);
334
335 gtk_settings_install_property (g_param_spec_string ("gtk-file-chooser-backend",
336@@ -634,7 +508,6 @@
337 iface->select_all = gtk_file_chooser_default_select_all;
338 iface->unselect_all = gtk_file_chooser_default_unselect_all;
339 iface->get_paths = gtk_file_chooser_default_get_paths;
340- iface->get_preview_path = gtk_file_chooser_default_get_preview_path;
341 iface->get_file_system = gtk_file_chooser_default_get_file_system;
342 iface->set_current_folder = gtk_file_chooser_default_set_current_folder;
343 iface->get_current_folder = gtk_file_chooser_default_get_current_folder;
344@@ -642,9 +515,12 @@
345 iface->add_filter = gtk_file_chooser_default_add_filter;
346 iface->remove_filter = gtk_file_chooser_default_remove_filter;
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;
351 iface->add_shortcut_folder = gtk_file_chooser_default_add_shortcut_folder;
352 iface->remove_shortcut_folder = gtk_file_chooser_default_remove_shortcut_folder;
353- iface->list_shortcut_folders = gtk_file_chooser_default_list_shortcut_folders;
354+
355 }
356
357 static void
358@@ -659,71 +535,22 @@
359 gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
360 {
361 impl->local_only = TRUE;
362- impl->preview_widget_active = TRUE;
363- impl->use_preview_label = TRUE;
364 impl->select_multiple = FALSE;
365 impl->show_hidden = FALSE;
366 impl->icon_size = FALLBACK_ICON_SIZE;
367 impl->load_state = LOAD_EMPTY;
368 impl->pending_select_paths = NULL;
369-
370+ impl->path_history = NULL;
371+
372 gtk_widget_set_redraw_on_allocate (GTK_WIDGET (impl), TRUE);
373- gtk_box_set_spacing (GTK_BOX (impl), 12);
374+ gtk_box_set_spacing (GTK_BOX (impl), DEFAULT_SPACING);
375
376 impl->tooltips = gtk_tooltips_new ();
377 g_object_ref (impl->tooltips);
378 gtk_object_sink (GTK_OBJECT (impl->tooltips));
379-}
380
381-/* Frees the data columns for the specified iter in the shortcuts model*/
382-static void
383-shortcuts_free_row_data (GtkFileChooserDefault *impl,
384- GtkTreeIter *iter)
385-{
386- gpointer col_data;
387- gboolean is_volume;
388-
389- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter,
390- SHORTCUTS_COL_DATA, &col_data,
391- SHORTCUTS_COL_IS_VOLUME, &is_volume,
392- -1);
393- if (!col_data)
394- return;
395-
396- if (is_volume)
397- {
398- GtkFileSystemVolume *volume;
399-
400- volume = col_data;
401- gtk_file_system_volume_free (impl->file_system, volume);
402- }
403- else
404- {
405- GtkFilePath *path;
406-
407- path = col_data;
408- gtk_file_path_free (path);
409- }
410-}
411-
412-/* Frees all the data columns in the shortcuts model */
413-static void
414-shortcuts_free (GtkFileChooserDefault *impl)
415-{
416- GtkTreeIter iter;
417-
418- if (!impl->shortcuts_model)
419- return;
420-
421- if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
422- do
423- {
424- shortcuts_free_row_data (impl, &iter);
425- }
426- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter));
427-
428- g_object_unref (impl->shortcuts_model);
429- impl->shortcuts_model = NULL;
430+ if (!impl->root_folder)
431+ impl->root_folder = g_strdup ("/");
432 }
433
434 static void
435@@ -743,6 +570,7 @@
436 impl->pending_select_paths = NULL;
437 }
438
439+
440 static void
441 pending_select_paths_add (GtkFileChooserDefault *impl,
442 const GtkFilePath *path)
443@@ -782,20 +610,30 @@
444 }
445
446 static void
447-gtk_file_chooser_default_finalize (GObject *object)
448+path_history_free (GtkFileChooserDefault *impl)
449 {
450- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object);
451 GSList *l;
452
453- if (impl->shortcuts_filter_model)
454- g_object_unref (impl->shortcuts_filter_model);
455+ for (l = impl->path_history; l; l = l->next)
456+ {
457+ GtkFilePath *path;
458+
459+ path = l->data;
460+ gtk_file_path_free (path);
461+ }
462+
463+ g_slist_free (impl->path_history);
464+ impl->path_history = NULL;
465+}
466
467- shortcuts_free (impl);
468+static void
469+gtk_file_chooser_default_finalize (GObject *object)
470+{
471+ GSList *l;
472+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object);
473
474 g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id);
475 impl->volumes_changed_id = 0;
476- g_signal_handler_disconnect (impl->file_system, impl->bookmarks_changed_id);
477- impl->bookmarks_changed_id = 0;
478 g_object_unref (impl->file_system);
479
480 for (l = impl->filters; l; l = l->next)
481@@ -816,11 +654,9 @@
482 if (impl->current_folder)
483 gtk_file_path_free (impl->current_folder);
484
485- if (impl->preview_path)
486- gtk_file_path_free (impl->preview_path);
487-
488 pending_select_paths_free (impl);
489-
490+ path_history_free (impl);
491+
492 load_remove_timer (impl);
493
494 /* Free all the Models we have */
495@@ -830,12 +666,12 @@
496 if (impl->sort_model)
497 g_object_unref (impl->sort_model);
498
499- g_free (impl->preview_display_name);
500-
501 g_free (impl->edited_new_text);
502
503 g_object_unref (impl->tooltips);
504
505+ g_free (impl->root_folder);
506+
507 G_OBJECT_CLASS (parent_class)->finalize (object);
508 }
509
510@@ -916,28 +752,6 @@
511 path, error);
512 }
513
514-/* Shows an error dialog about not being able to add a bookmark */
515-static void
516-error_adding_bookmark_dialog (GtkFileChooserDefault *impl,
517- const GtkFilePath *path,
518- GError *error)
519-{
520- error_dialog (impl,
521- _("Could not add a bookmark"),
522- path, error);
523-}
524-
525-/* Shows an error dialog about not being able to remove a bookmark */
526-static void
527-error_removing_bookmark_dialog (GtkFileChooserDefault *impl,
528- const GtkFilePath *path,
529- GError *error)
530-{
531- error_dialog (impl,
532- _("Could not remove bookmark"),
533- path, error);
534-}
535-
536 /* Shows an error dialog about not being able to create a folder */
537 static void
538 error_creating_folder_dialog (GtkFileChooserDefault *impl,
539@@ -949,21 +763,6 @@
540 path, error);
541 }
542
543-/* Shows an error about not being able to create a folder because a file with
544- * the same name is already there.
545- */
546-static void
547-error_creating_folder_over_existing_file_dialog (GtkFileChooserDefault *impl,
548- const GtkFilePath *path,
549- GError *error)
550-{
551- error_dialog (impl,
552- _("The folder could not be created, as a file with the same name "
553- "already exists. Try using a different name for the folder, "
554- "or rename the file first."),
555- path, error);
556-}
557-
558 /* Shows an error dialog about not being able to create a filename */
559 static void
560 error_building_filename_dialog (GtkFileChooserDefault *impl,
561@@ -993,6 +792,7 @@
562 GError *error;
563 gboolean result;
564 GtkFilePath *path_copy;
565+ gchar * file_name;
566
567 /* We copy the path because of this case:
568 *
569@@ -1005,6 +805,29 @@
570
571 path_copy = gtk_file_path_copy (path);
572
573+ file_name = gtk_file_system_path_to_filename (impl->file_system, path_copy);
574+
575+ /* refuse to change below the root */
576+ if (file_name && impl->root_folder &&
577+ strcmp (file_name, impl->root_folder) &&
578+ !strncmp (file_name, impl->root_folder, strlen (file_name)))
579+ {
580+
581+ gtk_file_path_free (path_copy);
582+ g_free (file_name);
583+ return 0;
584+ }
585+ else if (file_name && impl->root_folder &&
586+ !strcmp (file_name, impl->root_folder))
587+ {
588+ gtk_widget_set_sensitive (impl->up_button, FALSE);
589+ }
590+ else
591+ {
592+ gtk_widget_set_sensitive (impl->up_button, TRUE);
593+ }
594+
595+
596 error = NULL;
597 result = _gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), path_copy, &error);
598
599@@ -1012,2009 +835,245 @@
600 error_changing_folder_dialog (impl, path_copy, error);
601
602 gtk_file_path_free (path_copy);
603-
604+ g_free (file_name);
605+
606 return result;
607 }
608
609-static void
610-update_preview_widget_visibility (GtkFileChooserDefault *impl)
611-{
612- if (impl->use_preview_label)
613- {
614- if (!impl->preview_label)
615- {
616- impl->preview_label = gtk_label_new (impl->preview_display_name);
617- gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_label, FALSE, FALSE, 0);
618- gtk_box_reorder_child (GTK_BOX (impl->preview_box), impl->preview_label, 0);
619- gtk_label_set_ellipsize (GTK_LABEL (impl->preview_label), PANGO_ELLIPSIZE_MIDDLE);
620- gtk_widget_show (impl->preview_label);
621- }
622- }
623- else
624- {
625- if (impl->preview_label)
626- {
627- gtk_widget_destroy (impl->preview_label);
628- impl->preview_label = NULL;
629- }
630- }
631-
632- if (impl->preview_widget_active && impl->preview_widget)
633- gtk_widget_show (impl->preview_box);
634- else
635- gtk_widget_hide (impl->preview_box);
636-
637- g_signal_emit_by_name (impl, "default-size-changed");
638-}
639
640-static void
641-set_preview_widget (GtkFileChooserDefault *impl,
642- GtkWidget *preview_widget)
643+/* Returns whether a path is a folder */
644+static gboolean
645+check_is_folder (GtkFileSystem *file_system,
646+ const GtkFilePath *path,
647+ GError **error)
648 {
649- if (preview_widget == impl->preview_widget)
650- return;
651-
652- if (impl->preview_widget)
653- gtk_container_remove (GTK_CONTAINER (impl->preview_box),
654- impl->preview_widget);
655-
656- impl->preview_widget = preview_widget;
657- if (impl->preview_widget)
658- {
659- gtk_widget_show (impl->preview_widget);
660- gtk_box_pack_start (GTK_BOX (impl->preview_box), impl->preview_widget, TRUE, TRUE, 0);
661- gtk_box_reorder_child (GTK_BOX (impl->preview_box),
662- impl->preview_widget,
663- (impl->use_preview_label && impl->preview_label) ? 1 : 0);
664- }
665+ GtkFileFolder *folder;
666+#ifdef GTK26
667+ folder = gtk_file_system_get_folder (file_system, path, 0, error);
668+#else
669+ folder = gtk_file_system_get_folder (file_system, path, 0, NULL, NULL);
670+#endif
671+ if (!folder)
672+ return FALSE;
673
674- update_preview_widget_visibility (impl);
675+ g_object_unref (folder);
676+ return TRUE;
677 }
678
679-/* Re-reads all the icons for the shortcuts, used when the theme changes */
680+
681+/* Callback used when the "New Folder" button is clicked */
682 static void
683-shortcuts_reload_icons (GtkFileChooserDefault *impl)
684+new_folder_button_clicked (GtkButton *button,
685+ GtkFileChooserDefault *impl)
686 {
687 GtkTreeIter iter;
688+ GtkTreePath *path;
689
690- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
691- return;
692+ if (!impl->browse_files_model)
693+ return; /* FIXME: this sucks. Disable the New Folder button or something. */
694
695- do {
696- gpointer data;
697- gboolean is_volume;
698- gboolean pixbuf_visible;
699- GdkPixbuf *pixbuf;
700-
701- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
702- SHORTCUTS_COL_DATA, &data,
703- SHORTCUTS_COL_IS_VOLUME, &is_volume,
704- SHORTCUTS_COL_PIXBUF_VISIBLE, &pixbuf_visible,
705- -1);
706+ /* Prevent button from being clicked twice */
707+ gtk_widget_set_sensitive (impl->browse_new_folder_button, FALSE);
708
709- if (pixbuf_visible && data)
710- {
711- if (is_volume)
712- {
713- GtkFileSystemVolume *volume;
714+ _gtk_file_system_model_add_editable (impl->browse_files_model, &iter);
715
716- volume = data;
717- pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl),
718- impl->icon_size, NULL);
719- }
720- else
721- {
722- const GtkFilePath *path;
723+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->browse_files_model), &iter);
724+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->browse_files_tree_view),
725+ path, impl->list_name_column,
726+ FALSE, 0.0, 0.0);
727
728- path = data;
729- pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
730- impl->icon_size, NULL);
731- }
732+ g_object_set (impl->list_name_renderer, "editable", TRUE, NULL);
733+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view),
734+ path,
735+ impl->list_name_column,
736+ TRUE);
737
738- gtk_list_store_set (impl->shortcuts_model, &iter,
739- SHORTCUTS_COL_PIXBUF, pixbuf,
740- -1);
741- if (pixbuf)
742- g_object_unref (pixbuf);
743- }
744- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter));
745+ gtk_tree_path_free (path);
746 }
747
748-static void
749-shortcuts_find_folder (GtkFileChooserDefault *impl,
750- GtkFilePath *folder)
751+/* Idle handler for creating a new folder after editing its name cell, or for
752+ * canceling the editing.
753+ */
754+static gboolean
755+edited_idle_cb (GtkFileChooserDefault *impl)
756 {
757- GtkTreeSelection *selection;
758- int pos;
759- GtkTreePath *path;
760+ GDK_THREADS_ENTER ();
761+
762+ g_source_destroy (impl->edited_idle);
763+ impl->edited_idle = NULL;
764
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+
769+ gtk_widget_set_sensitive (impl->browse_new_folder_button, TRUE);
770
771- g_assert (folder != NULL);
772- pos = shortcut_find_position (impl, folder);
773- if (pos == -1)
774+ if (impl->edited_new_text) /* not cancelled? */
775 {
776- gtk_tree_selection_unselect_all (selection);
777- return;
778+ GError *error;
779+ GtkFilePath *file_path;
780+
781+ error = NULL;
782+ file_path = gtk_file_system_make_path (impl->file_system, impl->current_folder, impl->edited_new_text,
783+ &error);
784+ if (file_path)
785+ {
786+ error = NULL;
787+#ifdef GTK26
788+ if (gtk_file_system_create_folder (impl->file_system, file_path, &error))
789+#else
790+ if (gtk_file_system_create_folder (impl->file_system, file_path, NULL, NULL))
791+#endif
792+ change_folder_and_display_error (impl, file_path);
793+ else
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+ */
824
825-/* Convenience function to get the display name and icon info for a path */
826-static GtkFileInfo *
827-get_file_info (GtkFileSystem *file_system,
828- const GtkFilePath *path,
829- gboolean name_only,
830- GError **error)
831-{
832- GtkFilePath *parent_path;
833- GtkFileFolder *parent_folder;
834- GtkFileInfo *info;
835- GError *tmp = NULL;
836-
837- parent_path = NULL;
838- info = NULL;
839-
840- if (!gtk_file_system_get_parent (file_system, path, &parent_path, &tmp))
841- goto out;
842-
843- parent_folder = gtk_file_system_get_folder (file_system, parent_path ? parent_path : path,
844- GTK_FILE_INFO_DISPLAY_NAME
845- | (name_only ? 0 : GTK_FILE_INFO_IS_FOLDER),
846- &tmp);
847- if (!parent_folder)
848- goto out;
849-
850- info = gtk_file_folder_get_info (parent_folder, parent_path ? path : NULL, &tmp);
851- g_object_unref (parent_folder);
852-
853- out:
854- if (parent_path)
855- gtk_file_path_free (parent_path);
856+ g_assert (!impl->edited_idle);
857+ g_assert (!impl->edited_new_text);
858
859- if (tmp)
860- {
861- g_set_error (error,
862- GTK_FILE_CHOOSER_ERROR,
863- GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
864- _("Could not get information about '%s': %s"),
865- gtk_file_path_get_string (path),
866- tmp->message);
867- g_error_free (tmp);
868- }
869-
870- return info;
871-}
872-
873-/* Returns whether a path is a folder */
874-static gboolean
875-check_is_folder (GtkFileSystem *file_system,
876- const GtkFilePath *path,
877- GError **error)
878-{
879- GtkFileFolder *folder;
880-
881- folder = gtk_file_system_get_folder (file_system, path, 0, error);
882- if (!folder)
883- return FALSE;
884-
885- g_object_unref (folder);
886- return TRUE;
887-}
888-
889-/* Inserts a path in the shortcuts tree, making a copy of it; alternatively,
890- * inserts a volume. A position of -1 indicates the end of the tree.
891- */
892-static gboolean
893-shortcuts_insert_path (GtkFileChooserDefault *impl,
894- int pos,
895- gboolean is_volume,
896- GtkFileSystemVolume *volume,
897- const GtkFilePath *path,
898- const char *label,
899- gboolean removable,
900- GError **error)
901-{
902- char *label_copy;
903- GdkPixbuf *pixbuf;
904- gpointer data;
905- GtkTreeIter iter;
906-
907- if (is_volume)
908- {
909- data = volume;
910- label_copy = gtk_file_system_volume_get_display_name (impl->file_system, volume);
911- pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl),
912- impl->icon_size, NULL);
913- }
914- else
915- {
916- if (!check_is_folder (impl->file_system, path, error))
917- return FALSE;
918-
919- if (label)
920- label_copy = g_strdup (label);
921- else
922- {
923- GtkFileInfo *info = get_file_info (impl->file_system, path, TRUE, error);
924-
925- if (!info)
926- return FALSE;
927-
928- label_copy = g_strdup (gtk_file_info_get_display_name (info));
929- gtk_file_info_free (info);
930- }
931-
932- data = gtk_file_path_copy (path);
933- pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
934- impl->icon_size, NULL);
935- }
936-
937- if (pos == -1)
938- gtk_list_store_append (impl->shortcuts_model, &iter);
939- else
940- gtk_list_store_insert (impl->shortcuts_model, &iter, pos);
941-
942- gtk_list_store_set (impl->shortcuts_model, &iter,
943- SHORTCUTS_COL_PIXBUF, pixbuf,
944- SHORTCUTS_COL_PIXBUF_VISIBLE, TRUE,
945- SHORTCUTS_COL_NAME, label_copy,
946- SHORTCUTS_COL_DATA, data,
947- SHORTCUTS_COL_IS_VOLUME, is_volume,
948- SHORTCUTS_COL_REMOVABLE, removable,
949- -1);
950-
951- g_free (label_copy);
952-
953- if (pixbuf)
954- g_object_unref (pixbuf);
955-
956- return TRUE;
957-}
958-
959-/* Appends an item for the user's home directory to the shortcuts model */
960-static void
961-shortcuts_append_home (GtkFileChooserDefault *impl)
962-{
963- const char *home;
964- GtkFilePath *home_path;
965- GError *error;
966-
967- home = g_get_home_dir ();
968- if (home == NULL)
969- return;
970-
971- home_path = gtk_file_system_filename_to_path (impl->file_system, home);
972-
973- error = NULL;
974- impl->has_home = shortcuts_insert_path (impl, -1, FALSE, NULL, home_path, _("Home"), FALSE, &error);
975- if (!impl->has_home)
976- error_getting_info_dialog (impl, home_path, error);
977-
978- gtk_file_path_free (home_path);
979-}
980-
981-/* Appends the ~/Desktop directory to the shortcuts model */
982-static void
983-shortcuts_append_desktop (GtkFileChooserDefault *impl)
984-{
985- char *name;
986- GtkFilePath *path;
987-
988-#ifdef G_OS_WIN32
989- name = _gtk_file_system_win32_get_desktop ();
990-#else
991- const char *home = g_get_home_dir ();
992- if (home == NULL)
993- return;
994-
995- name = g_build_filename (home, "Desktop", NULL);
996-#endif
997-
998- path = gtk_file_system_filename_to_path (impl->file_system, name);
999- g_free (name);
1000-
1001- impl->has_desktop = shortcuts_insert_path (impl, -1, FALSE, NULL, path, _("Desktop"), FALSE, NULL);
1002- /* We do not actually pop up an error dialog if there is no desktop directory
1003- * because some people may really not want to have one.
1004- */
1005-
1006- gtk_file_path_free (path);
1007-}
1008-
1009-/* Appends a list of GtkFilePath to the shortcuts model; returns how many were inserted */
1010-static int
1011-shortcuts_append_paths (GtkFileChooserDefault *impl,
1012- GSList *paths)
1013-{
1014- int start_row;
1015- int num_inserted;
1016-
1017- /* As there is no separator now, we want to start there.
1018- */
1019- start_row = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR);
1020- num_inserted = 0;
1021-
1022- for (; paths; paths = paths->next)
1023- {
1024- GtkFilePath *path;
1025- GError *error;
1026-
1027- path = paths->data;
1028- error = NULL;
1029-
1030- if (impl->local_only &&
1031- !gtk_file_system_path_is_local (impl->file_system, path))
1032- continue;
1033-
1034- /* NULL GError, but we don't really want to show error boxes here */
1035- if (shortcuts_insert_path (impl, start_row + num_inserted, FALSE, NULL, path, NULL, TRUE, NULL))
1036- num_inserted++;
1037- }
1038-
1039- return num_inserted;
1040-}
1041-
1042-/* Returns the index for the corresponding item in the shortcuts bar */
1043-static int
1044-shortcuts_get_index (GtkFileChooserDefault *impl,
1045- ShortcutsIndex where)
1046-{
1047- int n;
1048-
1049- n = 0;
1050-
1051- if (where == SHORTCUTS_HOME)
1052- goto out;
1053-
1054- n += impl->has_home ? 1 : 0;
1055-
1056- if (where == SHORTCUTS_DESKTOP)
1057- goto out;
1058-
1059- n += impl->has_desktop ? 1 : 0;
1060-
1061- if (where == SHORTCUTS_VOLUMES)
1062- goto out;
1063-
1064- n += impl->num_volumes;
1065-
1066- if (where == SHORTCUTS_SHORTCUTS)
1067- goto out;
1068-
1069- n += impl->num_shortcuts;
1070-
1071- if (where == SHORTCUTS_BOOKMARKS_SEPARATOR)
1072- goto out;
1073-
1074- /* If there are no bookmarks there won't be a separator */
1075- n += (impl->num_bookmarks > 0) ? 1 : 0;
1076-
1077- if (where == SHORTCUTS_BOOKMARKS)
1078- goto out;
1079-
1080- n += impl->num_bookmarks;
1081-
1082- if (where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR)
1083- goto out;
1084-
1085- n += 1;
1086-
1087- if (where == SHORTCUTS_CURRENT_FOLDER)
1088- goto out;
1089-
1090- g_assert_not_reached ();
1091-
1092- out:
1093-
1094- return n;
1095-}
1096-
1097-/* Removes the specified number of rows from the shortcuts list */
1098-static void
1099-shortcuts_remove_rows (GtkFileChooserDefault *impl,
1100- int start_row,
1101- int n_rows)
1102-{
1103- GtkTreePath *path;
1104-
1105- path = gtk_tree_path_new_from_indices (start_row, -1);
1106-
1107- for (; n_rows; n_rows--)
1108- {
1109- GtkTreeIter iter;
1110-
1111- if (!gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->shortcuts_model), &iter, path))
1112- g_assert_not_reached ();
1113-
1114- shortcuts_free_row_data (impl, &iter);
1115- gtk_list_store_remove (impl->shortcuts_model, &iter);
1116- }
1117-
1118- gtk_tree_path_free (path);
1119-}
1120-
1121-/* Adds all the file system volumes to the shortcuts model */
1122-static void
1123-shortcuts_add_volumes (GtkFileChooserDefault *impl)
1124-{
1125- int start_row;
1126- GSList *list, *l;
1127- int n;
1128- gboolean old_changing_folders;
1129-
1130- old_changing_folders = impl->changing_folder;
1131- impl->changing_folder = TRUE;
1132-
1133- start_row = shortcuts_get_index (impl, SHORTCUTS_VOLUMES);
1134- shortcuts_remove_rows (impl, start_row, impl->num_volumes);
1135- impl->num_volumes = 0;
1136-
1137- list = gtk_file_system_list_volumes (impl->file_system);
1138-
1139- n = 0;
1140-
1141- for (l = list; l; l = l->next)
1142- {
1143- GtkFileSystemVolume *volume;
1144-
1145- volume = l->data;
1146-
1147- if (impl->local_only)
1148- {
1149- GtkFilePath *base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
1150- gboolean is_local = gtk_file_system_path_is_local (impl->file_system, base_path);
1151- gtk_file_path_free (base_path);
1152-
1153- if (!is_local)
1154- {
1155- gtk_file_system_volume_free (impl->file_system, volume);
1156- continue;
1157- }
1158- }
1159-
1160- if (shortcuts_insert_path (impl, start_row + n, TRUE, volume, NULL, NULL, FALSE, NULL))
1161- n++;
1162- else
1163- gtk_file_system_volume_free (impl->file_system, volume);
1164- }
1165-
1166- impl->num_volumes = n;
1167- g_slist_free (list);
1168-
1169- if (impl->shortcuts_filter_model)
1170- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
1171-
1172- impl->changing_folder = old_changing_folders;
1173-}
1174-
1175-/* Inserts a separator node in the shortcuts list */
1176-static void
1177-shortcuts_insert_separator (GtkFileChooserDefault *impl,
1178- ShortcutsIndex where)
1179-{
1180- GtkTreeIter iter;
1181-
1182- g_assert (where == SHORTCUTS_BOOKMARKS_SEPARATOR || where == SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
1183-
1184- gtk_list_store_insert (impl->shortcuts_model, &iter,
1185- shortcuts_get_index (impl, where));
1186- gtk_list_store_set (impl->shortcuts_model, &iter,
1187- SHORTCUTS_COL_PIXBUF, NULL,
1188- SHORTCUTS_COL_PIXBUF_VISIBLE, FALSE,
1189- SHORTCUTS_COL_NAME, NULL,
1190- SHORTCUTS_COL_DATA, NULL,
1191- -1);
1192-}
1193-
1194-/* Updates the list of bookmarks */
1195-static void
1196-shortcuts_add_bookmarks (GtkFileChooserDefault *impl)
1197-{
1198- GSList *bookmarks;
1199- gboolean old_changing_folders;
1200- GtkTreeIter iter;
1201- GtkFilePath *list_selected = NULL;
1202- GtkFilePath *combo_selected = NULL;
1203- gboolean is_volume;
1204- gpointer col_data;
1205-
1206- old_changing_folders = impl->changing_folder;
1207- impl->changing_folder = TRUE;
1208-
1209- if (shortcuts_get_selected (impl, &iter))
1210- {
1211- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model),
1212- &iter,
1213- SHORTCUTS_COL_DATA, &col_data,
1214- SHORTCUTS_COL_IS_VOLUME, &is_volume,
1215- -1);
1216-
1217- if (col_data && !is_volume)
1218- list_selected = gtk_file_path_copy (col_data);
1219- }
1220-
1221- if (impl->save_folder_combo &&
1222- gtk_combo_box_get_active_iter (GTK_COMBO_BOX (impl->save_folder_combo),
1223- &iter))
1224- {
1225- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model),
1226- &iter,
1227- SHORTCUTS_COL_DATA, &col_data,
1228- SHORTCUTS_COL_IS_VOLUME, &is_volume,
1229- -1);
1230-
1231- if (col_data && !is_volume)
1232- combo_selected = gtk_file_path_copy (col_data);
1233- }
1234-
1235- if (impl->num_bookmarks > 0)
1236- shortcuts_remove_rows (impl,
1237- shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR),
1238- impl->num_bookmarks + 1);
1239-
1240- bookmarks = gtk_file_system_list_bookmarks (impl->file_system);
1241- impl->num_bookmarks = shortcuts_append_paths (impl, bookmarks);
1242- gtk_file_paths_free (bookmarks);
1243-
1244- if (impl->num_bookmarks > 0)
1245- shortcuts_insert_separator (impl, SHORTCUTS_BOOKMARKS_SEPARATOR);
1246-
1247- if (impl->shortcuts_filter_model)
1248- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
1249-
1250- if (list_selected)
1251- {
1252- shortcuts_find_folder (impl, list_selected);
1253- gtk_file_path_free (list_selected);
1254- }
1255-
1256- if (combo_selected)
1257- {
1258- gint pos;
1259-
1260- pos = shortcut_find_position (impl, combo_selected);
1261- if (pos != -1)
1262- gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo),
1263- pos);
1264- gtk_file_path_free (combo_selected);
1265- }
1266-
1267- impl->changing_folder = old_changing_folders;
1268-}
1269-
1270-/* Appends a separator and a row to the shortcuts list for the current folder */
1271-static void
1272-shortcuts_add_current_folder (GtkFileChooserDefault *impl)
1273-{
1274- int pos;
1275- gboolean success;
1276-
1277- g_assert (!impl->shortcuts_current_folder_active);
1278-
1279- success = TRUE;
1280-
1281- g_assert (impl->current_folder != NULL);
1282-
1283- pos = shortcut_find_position (impl, impl->current_folder);
1284- if (pos == -1)
1285- {
1286- GtkFileSystemVolume *volume;
1287- GtkFilePath *base_path;
1288-
1289- /* Separator */
1290-
1291- shortcuts_insert_separator (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
1292-
1293- /* Item */
1294-
1295- pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER);
1296-
1297- volume = gtk_file_system_get_volume_for_path (impl->file_system, impl->current_folder);
1298- if (volume)
1299- base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
1300- else
1301- base_path = NULL;
1302-
1303- if (base_path &&
1304- strcmp (gtk_file_path_get_string (base_path), gtk_file_path_get_string (impl->current_folder)) == 0)
1305- {
1306- success = shortcuts_insert_path (impl, pos, TRUE, volume, NULL, NULL, FALSE, NULL);
1307- if (success)
1308- volume = NULL;
1309- }
1310- else
1311- success = shortcuts_insert_path (impl, pos, FALSE, NULL, impl->current_folder, NULL, FALSE, NULL);
1312-
1313- if (volume)
1314- gtk_file_system_volume_free (impl->file_system, volume);
1315-
1316- if (base_path)
1317- gtk_file_path_free (base_path);
1318-
1319- if (!success)
1320- shortcuts_remove_rows (impl, pos - 1, 1); /* remove the separator */
1321-
1322- impl->shortcuts_current_folder_active = success;
1323- }
1324-
1325- if (success)
1326- gtk_combo_box_set_active (GTK_COMBO_BOX (impl->save_folder_combo), pos);
1327-}
1328-
1329-/* Updates the current folder row in the shortcuts model */
1330-static void
1331-shortcuts_update_current_folder (GtkFileChooserDefault *impl)
1332-{
1333- int pos;
1334-
1335- pos = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
1336-
1337- if (impl->shortcuts_current_folder_active)
1338- {
1339- shortcuts_remove_rows (impl, pos, 2);
1340- impl->shortcuts_current_folder_active = FALSE;
1341- }
1342-
1343- shortcuts_add_current_folder (impl);
1344-}
1345-
1346-/* Filter function used for the shortcuts filter model */
1347-static gboolean
1348-shortcuts_filter_cb (GtkTreeModel *model,
1349- GtkTreeIter *iter,
1350- gpointer data)
1351-{
1352- GtkFileChooserDefault *impl;
1353- GtkTreePath *path;
1354- int pos;
1355-
1356- impl = GTK_FILE_CHOOSER_DEFAULT (data);
1357-
1358- path = gtk_tree_model_get_path (model, iter);
1359- if (!path)
1360- return FALSE;
1361-
1362- pos = *gtk_tree_path_get_indices (path);
1363- gtk_tree_path_free (path);
1364-
1365- return (pos < shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR));
1366-}
1367-
1368-/* Creates the list model for shortcuts */
1369-static void
1370-shortcuts_model_create (GtkFileChooserDefault *impl)
1371-{
1372- /* Keep this order in sync with the SHORCUTS_COL_* enum values */
1373- impl->shortcuts_model = gtk_list_store_new (SHORTCUTS_COL_NUM_COLUMNS,
1374- GDK_TYPE_PIXBUF, /* pixbuf */
1375- G_TYPE_STRING, /* name */
1376- G_TYPE_POINTER, /* path or volume */
1377- G_TYPE_BOOLEAN, /* is the previous column a volume? */
1378- G_TYPE_BOOLEAN, /* removable */
1379- G_TYPE_BOOLEAN); /* pixbuf cell visibility */
1380-
1381- if (impl->file_system)
1382- {
1383- shortcuts_append_home (impl);
1384- shortcuts_append_desktop (impl);
1385- shortcuts_add_volumes (impl);
1386- shortcuts_add_bookmarks (impl);
1387- }
1388-
1389- impl->shortcuts_filter_model = shortcuts_model_filter_new (impl,
1390- GTK_TREE_MODEL (impl->shortcuts_model),
1391- NULL);
1392-
1393- gtk_tree_model_filter_set_visible_func (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model),
1394- shortcuts_filter_cb,
1395- impl,
1396- NULL);
1397-}
1398-
1399-/* Callback used when the "New Folder" button is clicked */
1400-static void
1401-new_folder_button_clicked (GtkButton *button,
1402- GtkFileChooserDefault *impl)
1403-{
1404- GtkTreeIter iter;
1405- GtkTreePath *path;
1406-
1407- if (!impl->browse_files_model)
1408- return; /* FIXME: this sucks. Disable the New Folder button or something. */
1409-
1410- /* Prevent button from being clicked twice */
1411- gtk_widget_set_sensitive (impl->browse_new_folder_button, FALSE);
1412-
1413- _gtk_file_system_model_add_editable (impl->browse_files_model, &iter);
1414-
1415- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->browse_files_model), &iter);
1416- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->browse_files_tree_view),
1417- path, impl->list_name_column,
1418- FALSE, 0.0, 0.0);
1419-
1420- g_object_set (impl->list_name_renderer, "editable", TRUE, NULL);
1421- gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view),
1422- path,
1423- impl->list_name_column,
1424- TRUE);
1425-
1426- gtk_tree_path_free (path);
1427-}
1428-
1429-/* Idle handler for creating a new folder after editing its name cell, or for
1430- * canceling the editing.
1431- */
1432-static gboolean
1433-edited_idle_cb (GtkFileChooserDefault *impl)
1434-{
1435- GDK_THREADS_ENTER ();
1436-
1437- g_source_destroy (impl->edited_idle);
1438- impl->edited_idle = NULL;
1439-
1440- _gtk_file_system_model_remove_editable (impl->browse_files_model);
1441- g_object_set (impl->list_name_renderer, "editable", FALSE, NULL);
1442-
1443- gtk_widget_set_sensitive (impl->browse_new_folder_button, TRUE);
1444-
1445- if (impl->edited_new_text) /* not cancelled? */
1446- {
1447- GError *error;
1448- GtkFilePath *file_path;
1449-
1450- error = NULL;
1451- file_path = gtk_file_system_make_path (impl->file_system, impl->current_folder, impl->edited_new_text,
1452- &error);
1453- if (file_path)
1454- {
1455- error = NULL;
1456- if (gtk_file_system_create_folder (impl->file_system, file_path, &error))
1457- change_folder_and_display_error (impl, file_path);
1458- else
1459- error_creating_folder_dialog (impl, file_path, error);
1460-
1461- gtk_file_path_free (file_path);
1462- }
1463- else
1464- error_creating_folder_dialog (impl, file_path, error);
1465-
1466- g_free (impl->edited_new_text);
1467- impl->edited_new_text = NULL;
1468- }
1469-
1470- GDK_THREADS_LEAVE ();
1471-
1472- return FALSE;
1473-}
1474-
1475-static void
1476-queue_edited_idle (GtkFileChooserDefault *impl,
1477- const gchar *new_text)
1478-{
1479- /* We create the folder in an idle handler so that we don't modify the tree
1480- * just now.
1481- */
1482-
1483- g_assert (!impl->edited_idle);
1484- g_assert (!impl->edited_new_text);
1485-
1486- impl->edited_idle = g_idle_source_new ();
1487- g_source_set_closure (impl->edited_idle,
1488- g_cclosure_new_object (G_CALLBACK (edited_idle_cb),
1489- G_OBJECT (impl)));
1490- g_source_attach (impl->edited_idle, NULL);
1491-
1492- if (new_text)
1493- impl->edited_new_text = g_strdup (new_text);
1494-}
1495-
1496-/* Callback used from the text cell renderer when the new folder is named */
1497-static void
1498-renderer_edited_cb (GtkCellRendererText *cell_renderer_text,
1499- const gchar *path,
1500- const gchar *new_text,
1501- GtkFileChooserDefault *impl)
1502-{
1503- /* work around bug #154921 */
1504- g_object_set (cell_renderer_text,
1505- "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
1506- queue_edited_idle (impl, new_text);
1507-}
1508-
1509-/* Callback used from the text cell renderer when the new folder edition gets
1510- * canceled.
1511- */
1512-static void
1513-renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
1514- GtkFileChooserDefault *impl)
1515-{
1516- /* work around bug #154921 */
1517- g_object_set (cell_renderer_text,
1518- "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
1519- queue_edited_idle (impl, NULL);
1520-}
1521-
1522-/* Creates the widgets for the filter combo box */
1523-static GtkWidget *
1524-filter_create (GtkFileChooserDefault *impl)
1525-{
1526- impl->filter_combo = gtk_combo_box_new_text ();
1527- gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE);
1528-
1529- g_signal_connect (impl->filter_combo, "changed",
1530- G_CALLBACK (filter_combo_changed), impl);
1531-
1532- return impl->filter_combo;
1533-}
1534-
1535-static GtkWidget *
1536-button_new (GtkFileChooserDefault *impl,
1537- const char *text,
1538- const char *stock_id,
1539- gboolean sensitive,
1540- gboolean show,
1541- GCallback callback)
1542-{
1543- GtkWidget *button;
1544- GtkWidget *hbox;
1545- GtkWidget *widget;
1546- GtkWidget *align;
1547-
1548- button = gtk_button_new ();
1549- hbox = gtk_hbox_new (FALSE, 2);
1550- align = gtk_alignment_new (0.5, 0.5, 0.0, 0.0);
1551-
1552- gtk_container_add (GTK_CONTAINER (button), align);
1553- gtk_container_add (GTK_CONTAINER (align), hbox);
1554- widget = gtk_image_new_from_stock (stock_id, GTK_ICON_SIZE_BUTTON);
1555-
1556- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
1557-
1558- widget = gtk_label_new_with_mnemonic (text);
1559- gtk_label_set_mnemonic_widget (GTK_LABEL (widget), GTK_WIDGET (button));
1560- gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
1561-
1562- gtk_widget_set_sensitive (button, sensitive);
1563- g_signal_connect (button, "clicked", callback, impl);
1564-
1565- gtk_widget_show_all (align);
1566-
1567- if (show)
1568- gtk_widget_show (button);
1569-
1570- return button;
1571-}
1572-
1573-/* Looks for a path among the shortcuts; returns its index or -1 if it doesn't exist */
1574-static int
1575-shortcut_find_position (GtkFileChooserDefault *impl,
1576- const GtkFilePath *path)
1577-{
1578- GtkTreeIter iter;
1579- int i;
1580- int current_folder_separator_idx;
1581-
1582- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
1583- return -1;
1584-
1585- current_folder_separator_idx = shortcuts_get_index (impl, SHORTCUTS_CURRENT_FOLDER_SEPARATOR);
1586-
1587- for (i = 0; i < current_folder_separator_idx; i++)
1588- {
1589- gpointer col_data;
1590- gboolean is_volume;
1591-
1592- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
1593- SHORTCUTS_COL_DATA, &col_data,
1594- SHORTCUTS_COL_IS_VOLUME, &is_volume,
1595- -1);
1596-
1597- if (col_data)
1598- {
1599- if (is_volume)
1600- {
1601- GtkFileSystemVolume *volume;
1602- GtkFilePath *base_path;
1603- gboolean exists;
1604-
1605- volume = col_data;
1606- base_path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
1607-
1608- exists = strcmp (gtk_file_path_get_string (path),
1609- gtk_file_path_get_string (base_path)) == 0;
1610- g_free (base_path);
1611-
1612- if (exists)
1613- return i;
1614- }
1615- else
1616- {
1617- GtkFilePath *model_path;
1618-
1619- model_path = col_data;
1620-
1621- if (model_path && gtk_file_path_compare (model_path, path) == 0)
1622- return i;
1623- }
1624- }
1625-
1626- gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
1627- }
1628-
1629- return -1;
1630-}
1631-
1632-/* Tries to add a bookmark from a path name */
1633-static gboolean
1634-shortcuts_add_bookmark_from_path (GtkFileChooserDefault *impl,
1635- const GtkFilePath *path,
1636- int pos)
1637-{
1638- GError *error;
1639-
1640- if (shortcut_find_position (impl, path) != -1)
1641- return FALSE;
1642-
1643- /* FIXME: this check really belongs in gtk_file_system_insert_bookmark. */
1644- error = NULL;
1645- if (!check_is_folder (impl->file_system, path, &error))
1646- {
1647- error_adding_bookmark_dialog (impl, path, error);
1648- return FALSE;
1649- }
1650-
1651- error = NULL;
1652- if (!gtk_file_system_insert_bookmark (impl->file_system, path, pos, &error))
1653- {
1654- error_adding_bookmark_dialog (impl, path, error);
1655- return FALSE;
1656- }
1657-
1658- return TRUE;
1659-}
1660-
1661-static void
1662-add_bookmark_foreach_cb (GtkTreeModel *model,
1663- GtkTreePath *path,
1664- GtkTreeIter *iter,
1665- gpointer data)
1666-{
1667- GtkFileChooserDefault *impl;
1668- GtkFileSystemModel *fs_model;
1669- GtkTreeIter child_iter;
1670- const GtkFilePath *file_path;
1671-
1672- impl = (GtkFileChooserDefault *) data;
1673-
1674- fs_model = impl->browse_files_model;
1675- gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, iter);
1676-
1677- file_path = _gtk_file_system_model_get_path (fs_model, &child_iter);
1678- shortcuts_add_bookmark_from_path (impl, file_path, -1);
1679-}
1680-
1681-/* Adds a bookmark from the currently selected item in the file list */
1682-static void
1683-bookmarks_add_selected_folder (GtkFileChooserDefault *impl)
1684-{
1685- GtkTreeSelection *selection;
1686-
1687- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
1688-
1689- if (gtk_tree_selection_count_selected_rows (selection) == 0)
1690- shortcuts_add_bookmark_from_path (impl, impl->current_folder, -1);
1691- else
1692- gtk_tree_selection_selected_foreach (selection,
1693- add_bookmark_foreach_cb,
1694- impl);
1695-}
1696-
1697-/* Callback used when the "Add bookmark" button is clicked */
1698-static void
1699-add_bookmark_button_clicked_cb (GtkButton *button,
1700- GtkFileChooserDefault *impl)
1701-{
1702- bookmarks_add_selected_folder (impl);
1703-}
1704-
1705-/* Returns TRUE plus an iter in the shortcuts_model if a row is selected;
1706- * returns FALSE if no shortcut is selected.
1707- */
1708-static gboolean
1709-shortcuts_get_selected (GtkFileChooserDefault *impl,
1710- GtkTreeIter *iter)
1711-{
1712- GtkTreeSelection *selection;
1713- GtkTreeIter parent_iter;
1714-
1715- if (!impl->browse_shortcuts_tree_view)
1716- return FALSE;
1717-
1718- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
1719-
1720- if (!gtk_tree_selection_get_selected (selection, NULL, &parent_iter))
1721- return FALSE;
1722-
1723- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model),
1724- iter,
1725- &parent_iter);
1726- return TRUE;
1727-}
1728-
1729-/* Removes the selected bookmarks */
1730-static void
1731-remove_selected_bookmarks (GtkFileChooserDefault *impl)
1732-{
1733- GtkTreeIter iter;
1734- gpointer col_data;
1735- GtkFilePath *path;
1736- gboolean removable;
1737- GError *error;
1738-
1739- if (!shortcuts_get_selected (impl, &iter))
1740- return;
1741-
1742- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
1743- SHORTCUTS_COL_DATA, &col_data,
1744- SHORTCUTS_COL_REMOVABLE, &removable,
1745- -1);
1746- g_assert (col_data != NULL);
1747-
1748- if (!removable)
1749- return;
1750-
1751- path = col_data;
1752-
1753- error = NULL;
1754- if (!gtk_file_system_remove_bookmark (impl->file_system, path, &error))
1755- error_removing_bookmark_dialog (impl, path, error);
1756-}
1757-
1758-/* Callback used when the "Remove bookmark" button is clicked */
1759-static void
1760-remove_bookmark_button_clicked_cb (GtkButton *button,
1761- GtkFileChooserDefault *impl)
1762-{
1763- remove_selected_bookmarks (impl);
1764-}
1765-
1766-struct selection_check_closure {
1767- GtkFileChooserDefault *impl;
1768- int num_selected;
1769- gboolean all_files;
1770- gboolean all_folders;
1771-};
1772-
1773-/* Used from gtk_tree_selection_selected_foreach() */
1774-static void
1775-selection_check_foreach_cb (GtkTreeModel *model,
1776- GtkTreePath *path,
1777- GtkTreeIter *iter,
1778- gpointer data)
1779-{
1780- struct selection_check_closure *closure;
1781- GtkTreeIter child_iter;
1782- const GtkFileInfo *info;
1783- gboolean is_folder;
1784-
1785- closure = data;
1786- closure->num_selected++;
1787-
1788- gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter);
1789-
1790- info = _gtk_file_system_model_get_info (closure->impl->browse_files_model, &child_iter);
1791- is_folder = info ? gtk_file_info_get_is_folder (info) : FALSE;
1792-
1793- closure->all_folders = closure->all_folders && is_folder;
1794- closure->all_files = closure->all_files && !is_folder;
1795-}
1796-
1797-/* Checks whether the selected items in the file list are all files or all folders */
1798-static void
1799-selection_check (GtkFileChooserDefault *impl,
1800- gint *num_selected,
1801- gboolean *all_files,
1802- gboolean *all_folders)
1803-{
1804- struct selection_check_closure closure;
1805- GtkTreeSelection *selection;
1806-
1807- closure.impl = impl;
1808- closure.num_selected = 0;
1809- closure.all_files = TRUE;
1810- closure.all_folders = TRUE;
1811-
1812- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
1813- gtk_tree_selection_selected_foreach (selection,
1814- selection_check_foreach_cb,
1815- &closure);
1816-
1817- g_assert (closure.num_selected == 0 || !(closure.all_files && closure.all_folders));
1818-
1819- if (num_selected)
1820- *num_selected = closure.num_selected;
1821-
1822- if (all_files)
1823- *all_files = closure.all_files;
1824-
1825- if (all_folders)
1826- *all_folders = closure.all_folders;
1827-}
1828-
1829-struct get_selected_path_closure {
1830- GtkFileChooserDefault *impl;
1831- const GtkFilePath *path;
1832-};
1833-
1834-static void
1835-get_selected_path_foreach_cb (GtkTreeModel *model,
1836- GtkTreePath *path,
1837- GtkTreeIter *iter,
1838- gpointer data)
1839-{
1840- struct get_selected_path_closure *closure;
1841- GtkTreeIter child_iter;
1842-
1843- closure = data;
1844-
1845- gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter);
1846- closure->path = _gtk_file_system_model_get_path (closure->impl->browse_files_model, &child_iter);
1847-}
1848-
1849-/* Returns a selected path from the file list */
1850-static const GtkFilePath *
1851-get_selected_path (GtkFileChooserDefault *impl)
1852-{
1853- struct get_selected_path_closure closure;
1854- GtkTreeSelection *selection;
1855-
1856- closure.impl = impl;
1857- closure.path = NULL;
1858-
1859- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
1860- gtk_tree_selection_selected_foreach (selection,
1861- get_selected_path_foreach_cb,
1862- &closure);
1863-
1864- return closure.path;
1865-}
1866-
1867-typedef struct {
1868- GtkFileChooserDefault *impl;
1869- gchar *tip;
1870-} UpdateTooltipData;
1871-
1872-static void
1873-update_tooltip (GtkTreeModel *model,
1874- GtkTreePath *path,
1875- GtkTreeIter *iter,
1876- gpointer data)
1877-{
1878- UpdateTooltipData *udata = data;
1879- GtkTreeIter child_iter;
1880- const GtkFileInfo *info;
1881-
1882- if (udata->tip == NULL)
1883- {
1884- gtk_tree_model_sort_convert_iter_to_child_iter (udata->impl->sort_model,
1885- &child_iter,
1886- iter);
1887-
1888- info = _gtk_file_system_model_get_info (udata->impl->browse_files_model, &child_iter);
1889- udata->tip = g_strdup_printf (_("Add the folder '%s' to the bookmarks"),
1890- gtk_file_info_get_display_name (info));
1891- }
1892-}
1893-
1894-
1895-/* Sensitize the "add bookmark" button if all the selected items are folders, or
1896- * if there are no selected items *and* the current folder is not in the
1897- * bookmarks list. De-sensitize the button otherwise.
1898- */
1899-static void
1900-bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl)
1901-{
1902- gint num_selected;
1903- gboolean all_folders;
1904- gboolean active;
1905- gchar *tip;
1906-
1907- selection_check (impl, &num_selected, NULL, &all_folders);
1908-
1909- if (num_selected == 0)
1910- active = (impl->current_folder != NULL) && (shortcut_find_position (impl, impl->current_folder) == -1);
1911- else if (num_selected == 1)
1912- {
1913- const GtkFilePath *path;
1914-
1915- path = get_selected_path (impl);
1916- active = all_folders && (shortcut_find_position (impl, path) == -1);
1917- }
1918- else
1919- active = all_folders;
1920-
1921- gtk_widget_set_sensitive (impl->browse_shortcuts_add_button, active);
1922-
1923- if (impl->browse_files_popup_menu_add_shortcut_item)
1924- gtk_widget_set_sensitive (impl->browse_files_popup_menu_add_shortcut_item,
1925- (num_selected == 0) ? FALSE : active);
1926-
1927- if (active)
1928- {
1929- if (num_selected == 0)
1930- tip = g_strdup_printf (_("Add the current folder to the bookmarks"));
1931- else if (num_selected > 1)
1932- tip = g_strdup_printf (_("Add the selected folders to the bookmarks"));
1933- else
1934- {
1935- GtkTreeSelection *selection;
1936- UpdateTooltipData data;
1937-
1938- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
1939- data.impl = impl;
1940- data.tip = NULL;
1941- gtk_tree_selection_selected_foreach (selection, update_tooltip, &data);
1942- tip = data.tip;
1943-
1944- }
1945- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_add_button, tip, NULL);
1946- g_free (tip);
1947- }
1948-}
1949-
1950-/* Sets the sensitivity of the "remove bookmark" button depending on whether a
1951- * bookmark row is selected in the shortcuts tree.
1952- */
1953-static void
1954-bookmarks_check_remove_sensitivity (GtkFileChooserDefault *impl)
1955-{
1956- GtkTreeIter iter;
1957- gboolean removable = FALSE;
1958- gchar *name = NULL;
1959-
1960- if (shortcuts_get_selected (impl, &iter))
1961- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
1962- SHORTCUTS_COL_REMOVABLE, &removable,
1963- SHORTCUTS_COL_NAME, &name,
1964- -1);
1965-
1966- gtk_widget_set_sensitive (impl->browse_shortcuts_remove_button, removable);
1967-
1968- if (removable)
1969- {
1970- gchar *tip;
1971-
1972- tip = g_strdup_printf (_("Remove the bookmark '%s'"), name);
1973- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button,
1974- tip, NULL);
1975- g_free (tip);
1976- }
1977-
1978- g_free (name);
1979-}
1980-
1981-/* GtkWidget::drag-begin handler for the shortcuts list. */
1982-static void
1983-shortcuts_drag_begin_cb (GtkWidget *widget,
1984- GdkDragContext *context,
1985- GtkFileChooserDefault *impl)
1986-{
1987-#if 0
1988- impl->shortcuts_drag_context = g_object_ref (context);
1989-#endif
1990-}
1991-
1992-#if 0
1993-/* Removes the idle handler for outside drags */
1994-static void
1995-shortcuts_cancel_drag_outside_idle (GtkFileChooserDefault *impl)
1996-{
1997- if (!impl->shortcuts_drag_outside_idle)
1998- return;
1999-
2000- g_source_destroy (impl->shortcuts_drag_outside_idle);
2001- impl->shortcuts_drag_outside_idle = NULL;
2002-}
2003-#endif
2004-
2005-/* GtkWidget::drag-end handler for the shortcuts list. */
2006-static void
2007-shortcuts_drag_end_cb (GtkWidget *widget,
2008- GdkDragContext *context,
2009- GtkFileChooserDefault *impl)
2010-{
2011-#if 0
2012- g_object_unref (impl->shortcuts_drag_context);
2013-
2014- shortcuts_cancel_drag_outside_idle (impl);
2015-
2016- if (!impl->shortcuts_drag_outside)
2017- return;
2018-
2019- gtk_button_clicked (GTK_BUTTON (impl->browse_shortcuts_remove_button));
2020-
2021- impl->shortcuts_drag_outside = FALSE;
2022-#endif
2023-}
2024-
2025-/* GtkWidget::drag-data-delete handler for the shortcuts list. */
2026-static void
2027-shortcuts_drag_data_delete_cb (GtkWidget *widget,
2028- GdkDragContext *context,
2029- GtkFileChooserDefault *impl)
2030-{
2031- g_signal_stop_emission_by_name (widget, "drag-data-delete");
2032-}
2033-
2034-#if 0
2035-/* Creates a suitable drag cursor to indicate that the selected bookmark will be
2036- * deleted or not.
2037- */
2038-static void
2039-shortcuts_drag_set_delete_cursor (GtkFileChooserDefault *impl,
2040- gboolean delete)
2041-{
2042- GtkTreeView *tree_view;
2043- GtkTreeIter iter;
2044- GtkTreePath *path;
2045- GdkPixmap *row_pixmap;
2046- GdkBitmap *mask;
2047- int row_pixmap_y;
2048- int cell_y;
2049-
2050- tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view);
2051-
2052- /* Find the selected path and get its drag pixmap */
2053-
2054- if (!shortcuts_get_selected (impl, &iter))
2055- g_assert_not_reached ();
2056-
2057- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
2058-
2059- row_pixmap = gtk_tree_view_create_row_drag_icon (tree_view, path);
2060- gtk_tree_path_free (path);
2061-
2062- mask = NULL;
2063- row_pixmap_y = 0;
2064-
2065- if (delete)
2066- {
2067- GdkPixbuf *pixbuf;
2068-
2069- pixbuf = gtk_widget_render_icon (impl->browse_shortcuts_tree_view,
2070- GTK_STOCK_DELETE,
2071- GTK_ICON_SIZE_DND,
2072- NULL);
2073- if (pixbuf)
2074- {
2075- GdkPixmap *composite;
2076- int row_pixmap_width, row_pixmap_height;
2077- int pixbuf_width, pixbuf_height;
2078- int composite_width, composite_height;
2079- int pixbuf_x, pixbuf_y;
2080- GdkGC *gc, *mask_gc;
2081- GdkColor color;
2082- GdkBitmap *pixbuf_mask;
2083-
2084- /* Create pixmap and mask for composite image */
2085-
2086- gdk_drawable_get_size (row_pixmap, &row_pixmap_width, &row_pixmap_height);
2087- pixbuf_width = gdk_pixbuf_get_width (pixbuf);
2088- pixbuf_height = gdk_pixbuf_get_height (pixbuf);
2089-
2090- composite_width = MAX (row_pixmap_width, pixbuf_width);
2091- composite_height = MAX (row_pixmap_height, pixbuf_height);
2092-
2093- row_pixmap_y = (composite_height - row_pixmap_height) / 2;
2094-
2095- if (gtk_widget_get_direction (impl->browse_shortcuts_tree_view) == GTK_TEXT_DIR_RTL)
2096- pixbuf_x = 0;
2097- else
2098- pixbuf_x = composite_width - pixbuf_width;
2099-
2100- pixbuf_y = (composite_height - pixbuf_height) / 2;
2101-
2102- composite = gdk_pixmap_new (row_pixmap, composite_width, composite_height, -1);
2103- gc = gdk_gc_new (composite);
2104-
2105- mask = gdk_pixmap_new (row_pixmap, composite_width, composite_height, 1);
2106- mask_gc = gdk_gc_new (mask);
2107- color.pixel = 0;
2108- gdk_gc_set_foreground (mask_gc, &color);
2109- gdk_draw_rectangle (mask, mask_gc, TRUE, 0, 0, composite_width, composite_height);
2110-
2111- color.red = 0xffff;
2112- color.green = 0xffff;
2113- color.blue = 0xffff;
2114- gdk_gc_set_rgb_fg_color (gc, &color);
2115- gdk_draw_rectangle (composite, gc, TRUE, 0, 0, composite_width, composite_height);
2116-
2117- /* Composite the row pixmap and the pixbuf */
2118-
2119- gdk_pixbuf_render_pixmap_and_mask_for_colormap
2120- (pixbuf,
2121- gtk_widget_get_colormap (impl->browse_shortcuts_tree_view),
2122- NULL, &pixbuf_mask, 128);
2123- gdk_draw_drawable (mask, mask_gc, pixbuf_mask,
2124- 0, 0,
2125- pixbuf_x, pixbuf_y,
2126- pixbuf_width, pixbuf_height);
2127- g_object_unref (pixbuf_mask);
2128-
2129- gdk_draw_drawable (composite, gc, row_pixmap,
2130- 0, 0,
2131- 0, row_pixmap_y,
2132- row_pixmap_width, row_pixmap_height);
2133- color.pixel = 1;
2134- gdk_gc_set_foreground (mask_gc, &color);
2135- gdk_draw_rectangle (mask, mask_gc, TRUE, 0, row_pixmap_y, row_pixmap_width, row_pixmap_height);
2136-
2137- gdk_draw_pixbuf (composite, gc, pixbuf,
2138- 0, 0,
2139- pixbuf_x, pixbuf_y,
2140- pixbuf_width, pixbuf_height,
2141- GDK_RGB_DITHER_MAX,
2142- 0, 0);
2143-
2144- g_object_unref (pixbuf);
2145- g_object_unref (row_pixmap);
2146-
2147- row_pixmap = composite;
2148- }
2149- }
2150-
2151- /* The hotspot offsets here are copied from gtk_tree_view_drag_begin(), ugh */
2152-
2153- gtk_tree_view_get_path_at_pos (tree_view,
2154- tree_view->priv->press_start_x,
2155- tree_view->priv->press_start_y,
2156- NULL,
2157- NULL,
2158- NULL,
2159- &cell_y);
2160-
2161- gtk_drag_set_icon_pixmap (impl->shortcuts_drag_context,
2162- gdk_drawable_get_colormap (row_pixmap),
2163- row_pixmap,
2164- mask,
2165- tree_view->priv->press_start_x + 1,
2166- row_pixmap_y + cell_y + 1);
2167-
2168- g_object_unref (row_pixmap);
2169- if (mask)
2170- g_object_unref (mask);
2171-}
2172-
2173-/* We set the delete cursor and the shortcuts_drag_outside flag in an idle
2174- * handler so that we can tell apart the drag_leave event that comes right
2175- * before a drag_drop, from a normal drag_leave. We don't want to set the
2176- * cursor nor the flag in the latter case.
2177- */
2178-static gboolean
2179-shortcuts_drag_outside_idle_cb (GtkFileChooserDefault *impl)
2180-{
2181- GDK_THREADS_ENTER ();
2182-
2183- shortcuts_drag_set_delete_cursor (impl, TRUE);
2184- impl->shortcuts_drag_outside = TRUE;
2185-
2186- shortcuts_cancel_drag_outside_idle (impl);
2187-
2188- GDK_THREADS_LEAVE ();
2189-
2190- return FALSE;
2191-}
2192-#endif
2193-
2194-/* GtkWidget::drag-leave handler for the shortcuts list. We unhighlight the
2195- * drop position.
2196- */
2197-static void
2198-shortcuts_drag_leave_cb (GtkWidget *widget,
2199- GdkDragContext *context,
2200- guint time_,
2201- GtkFileChooserDefault *impl)
2202-{
2203-#if 0
2204- if (gtk_drag_get_source_widget (context) == widget && !impl->shortcuts_drag_outside_idle)
2205- {
2206- impl->shortcuts_drag_outside_idle = g_idle_source_new ();
2207- g_source_set_closure (impl->shortcuts_drag_outside_idle,
2208- g_cclosure_new_object (G_CALLBACK (shortcuts_drag_outside_idle_cb),
2209- G_OBJECT (impl)));
2210- g_source_attach (impl->shortcuts_drag_outside_idle, NULL);
2211- }
2212-#endif
2213-
2214- gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
2215- NULL,
2216- GTK_TREE_VIEW_DROP_BEFORE);
2217-
2218- g_signal_stop_emission_by_name (widget, "drag-leave");
2219-}
2220-
2221-/* Computes the appropriate row and position for dropping */
2222-static void
2223-shortcuts_compute_drop_position (GtkFileChooserDefault *impl,
2224- int x,
2225- int y,
2226- GtkTreePath **path,
2227- GtkTreeViewDropPosition *pos)
2228-{
2229- GtkTreeView *tree_view;
2230- GtkTreeViewColumn *column;
2231- int cell_y;
2232- GdkRectangle cell;
2233- int row;
2234- int bookmarks_index;
2235-
2236- tree_view = GTK_TREE_VIEW (impl->browse_shortcuts_tree_view);
2237-
2238- bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS);
2239-
2240- if (!gtk_tree_view_get_path_at_pos (tree_view,
2241- x,
2242- y - TREE_VIEW_HEADER_HEIGHT (tree_view),
2243- path,
2244- &column,
2245- NULL,
2246- &cell_y))
2247- {
2248- row = bookmarks_index + impl->num_bookmarks - 1;
2249- *path = gtk_tree_path_new_from_indices (row, -1);
2250- *pos = GTK_TREE_VIEW_DROP_AFTER;
2251- return;
2252- }
2253-
2254- row = *gtk_tree_path_get_indices (*path);
2255- gtk_tree_view_get_background_area (tree_view, *path, column, &cell);
2256- gtk_tree_path_free (*path);
2257-
2258- if (row < bookmarks_index)
2259- {
2260- row = bookmarks_index;
2261- *pos = GTK_TREE_VIEW_DROP_BEFORE;
2262- }
2263- else if (row > bookmarks_index + impl->num_bookmarks - 1)
2264- {
2265- row = bookmarks_index + impl->num_bookmarks - 1;
2266- *pos = GTK_TREE_VIEW_DROP_AFTER;
2267- }
2268- else
2269- {
2270- if (cell_y < cell.height / 2)
2271- *pos = GTK_TREE_VIEW_DROP_BEFORE;
2272- else
2273- *pos = GTK_TREE_VIEW_DROP_AFTER;
2274- }
2275-
2276- *path = gtk_tree_path_new_from_indices (row, -1);
2277-}
2278-
2279-/* GtkWidget::drag-motion handler for the shortcuts list. We basically
2280- * implement the destination side of DnD by hand, due to limitations in
2281- * GtkTreeView's DnD API.
2282- */
2283-static gboolean
2284-shortcuts_drag_motion_cb (GtkWidget *widget,
2285- GdkDragContext *context,
2286- gint x,
2287- gint y,
2288- guint time_,
2289- GtkFileChooserDefault *impl)
2290-{
2291- GtkTreePath *path;
2292- GtkTreeViewDropPosition pos;
2293- GdkDragAction action;
2294-
2295-#if 0
2296- if (gtk_drag_get_source_widget (context) == widget)
2297- {
2298- shortcuts_cancel_drag_outside_idle (impl);
2299-
2300- if (impl->shortcuts_drag_outside)
2301- {
2302- shortcuts_drag_set_delete_cursor (impl, FALSE);
2303- impl->shortcuts_drag_outside = FALSE;
2304- }
2305- }
2306-#endif
2307-
2308- if (context->suggested_action == GDK_ACTION_COPY || (context->actions & GDK_ACTION_COPY) != 0)
2309- action = GDK_ACTION_COPY;
2310- else if (context->suggested_action == GDK_ACTION_MOVE || (context->actions & GDK_ACTION_MOVE) != 0)
2311- action = GDK_ACTION_MOVE;
2312- else
2313- {
2314- action = 0;
2315- goto out;
2316- }
2317-
2318- shortcuts_compute_drop_position (impl, x, y, &path, &pos);
2319- gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), path, pos);
2320- gtk_tree_path_free (path);
2321-
2322- out:
2323-
2324- g_signal_stop_emission_by_name (widget, "drag-motion");
2325-
2326- if (action != 0)
2327- {
2328- gdk_drag_status (context, action, time_);
2329- return TRUE;
2330- }
2331- else
2332- return FALSE;
2333-}
2334-
2335-/* GtkWidget::drag-drop handler for the shortcuts list. */
2336-static gboolean
2337-shortcuts_drag_drop_cb (GtkWidget *widget,
2338- GdkDragContext *context,
2339- gint x,
2340- gint y,
2341- guint time_,
2342- GtkFileChooserDefault *impl)
2343-{
2344-#if 0
2345- shortcuts_cancel_drag_outside_idle (impl);
2346-#endif
2347-
2348- g_signal_stop_emission_by_name (widget, "drag-drop");
2349- return TRUE;
2350-}
2351-
2352-/* Parses a "text/uri-list" string and inserts its URIs as bookmarks */
2353-static void
2354-shortcuts_drop_uris (GtkFileChooserDefault *impl,
2355- const char *data,
2356- int position)
2357-{
2358- gchar **uris;
2359- gint i;
2360-
2361- uris = g_uri_list_extract_uris (data);
2362-
2363- for (i = 0; uris[i]; i++)
2364- {
2365- char *uri;
2366- GtkFilePath *path;
2367-
2368- uri = uris[i];
2369- path = gtk_file_system_uri_to_path (impl->file_system, uri);
2370-
2371- if (path)
2372- {
2373- if (shortcuts_add_bookmark_from_path (impl, path, position))
2374- position++;
2375-
2376- gtk_file_path_free (path);
2377- }
2378- else
2379- {
2380- GError *error;
2381-
2382- g_set_error (&error,
2383- GTK_FILE_CHOOSER_ERROR,
2384- GTK_FILE_CHOOSER_ERROR_BAD_FILENAME,
2385- _("Could not add a bookmark for '%s' "
2386- "because it is an invalid path name."),
2387- uri);
2388- error_adding_bookmark_dialog (impl, path, error);
2389- }
2390- }
2391-
2392- g_strfreev (uris);
2393-}
2394-
2395-/* Reorders the selected bookmark to the specified position */
2396-static void
2397-shortcuts_reorder (GtkFileChooserDefault *impl,
2398- int new_position)
2399-{
2400- GtkTreeIter iter;
2401- gpointer col_data;
2402- gboolean is_volume;
2403- GtkTreePath *path;
2404- int old_position;
2405- int bookmarks_index;
2406- const GtkFilePath *file_path;
2407- GtkFilePath *file_path_copy;
2408- GError *error;
2409-
2410- /* Get the selected path */
2411-
2412- if (!shortcuts_get_selected (impl, &iter))
2413- g_assert_not_reached ();
2414-
2415- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->shortcuts_model), &iter);
2416- old_position = *gtk_tree_path_get_indices (path);
2417- gtk_tree_path_free (path);
2418-
2419- bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS);
2420- old_position -= bookmarks_index;
2421- g_assert (old_position >= 0 && old_position < impl->num_bookmarks);
2422-
2423- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
2424- SHORTCUTS_COL_DATA, &col_data,
2425- SHORTCUTS_COL_IS_VOLUME, &is_volume,
2426- -1);
2427- g_assert (col_data != NULL);
2428- g_assert (!is_volume);
2429-
2430- file_path = col_data;
2431- file_path_copy = gtk_file_path_copy (file_path); /* removal below will free file_path, so we need a copy */
2432-
2433- /* Remove the path from the old position and insert it in the new one */
2434-
2435- if (new_position > old_position)
2436- new_position--;
2437-
2438- if (old_position == new_position)
2439- goto out;
2440-
2441- error = NULL;
2442- if (gtk_file_system_remove_bookmark (impl->file_system, file_path_copy, &error))
2443- shortcuts_add_bookmark_from_path (impl, file_path_copy, new_position);
2444- else
2445- error_adding_bookmark_dialog (impl, file_path_copy, error);
2446-
2447- out:
2448-
2449- gtk_file_path_free (file_path_copy);
2450-}
2451-
2452-/* Callback used when we get the drag data for the bookmarks list. We add the
2453- * received URIs as bookmarks if they are folders.
2454- */
2455-static void
2456-shortcuts_drag_data_received_cb (GtkWidget *widget,
2457- GdkDragContext *context,
2458- gint x,
2459- gint y,
2460- GtkSelectionData *selection_data,
2461- guint info,
2462- guint time_,
2463- gpointer data)
2464-{
2465- GtkFileChooserDefault *impl;
2466- GtkTreePath *tree_path;
2467- GtkTreeViewDropPosition tree_pos;
2468- int position;
2469- int bookmarks_index;
2470-
2471- impl = GTK_FILE_CHOOSER_DEFAULT (data);
2472-
2473- /* Compute position */
2474-
2475- bookmarks_index = shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS);
2476-
2477- shortcuts_compute_drop_position (impl, x, y, &tree_path, &tree_pos);
2478- position = *gtk_tree_path_get_indices (tree_path);
2479- gtk_tree_path_free (tree_path);
2480-
2481- if (tree_pos == GTK_TREE_VIEW_DROP_AFTER)
2482- position++;
2483-
2484- g_assert (position >= bookmarks_index);
2485- position -= bookmarks_index;
2486-
2487- if (selection_data->target == gdk_atom_intern ("text/uri-list", FALSE))
2488- shortcuts_drop_uris (impl, selection_data->data, position);
2489- else if (selection_data->target == gdk_atom_intern ("GTK_TREE_MODEL_ROW", FALSE))
2490- shortcuts_reorder (impl, position);
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
2497- g_signal_stop_emission_by_name (widget, "drag-data-received");
2498+ if (new_text)
2499+ impl->edited_new_text = g_strdup (new_text);
2500 }
2501
2502-/* Callback used when the selection in the shortcuts tree changes */
2503+/* Callback used from the text cell renderer when the new folder is named */
2504 static void
2505-shortcuts_selection_changed_cb (GtkTreeSelection *selection,
2506- GtkFileChooserDefault *impl)
2507-{
2508- bookmarks_check_remove_sensitivity (impl);
2509-}
2510-
2511-static gboolean
2512-shortcuts_row_separator_func (GtkTreeModel *model,
2513- GtkTreeIter *iter,
2514- gpointer data)
2515+renderer_edited_cb (GtkCellRendererText *cell_renderer_text,
2516+ const gchar *path,
2517+ const gchar *new_text,
2518+ GtkFileChooserDefault *impl)
2519 {
2520- gint column = GPOINTER_TO_INT (data);
2521- gchar *text;
2522-
2523- gtk_tree_model_get (model, iter, column, &text, -1);
2524-
2525- if (!text)
2526- return TRUE;
2527-
2528- g_free (text);
2529-
2530- return FALSE;
2531+ /* work around bug #154921 */
2532+ g_object_set (cell_renderer_text,
2533+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
2534+ queue_edited_idle (impl, new_text);
2535 }
2536
2537-/* Since GtkTreeView has a keybinding attached to '/', we need to catch
2538- * keypresses before the TreeView gets them.
2539+/* Callback used from the text cell renderer when the new folder edition gets
2540+ * canceled.
2541 */
2542-static gboolean
2543-tree_view_keybinding_cb (GtkWidget *tree_view,
2544- GdkEventKey *event,
2545- GtkFileChooserDefault *impl)
2546+static void
2547+renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
2548+ GtkFileChooserDefault *impl)
2549 {
2550- if (event->keyval == GDK_slash &&
2551- ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ())))
2552- {
2553- location_popup_handler (impl, "/");
2554- return TRUE;
2555- }
2556-
2557- return FALSE;
2558+ /* work around bug #154921 */
2559+ g_object_set (cell_renderer_text,
2560+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
2561+ queue_edited_idle (impl, NULL);
2562 }
2563
2564-
2565-/* Creates the widgets for the shortcuts and bookmarks tree */
2566+/* Creates the widgets for the filter combo box */
2567 static GtkWidget *
2568-shortcuts_list_create (GtkFileChooserDefault *impl)
2569+filter_create (GtkFileChooserDefault *impl)
2570 {
2571- GtkWidget *swin;
2572- GtkTreeSelection *selection;
2573- GtkTreeViewColumn *column;
2574- GtkCellRenderer *renderer;
2575-
2576- /* Scrolled window */
2577-
2578- swin = gtk_scrolled_window_new (NULL, NULL);
2579- gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (swin),
2580- GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC);
2581- gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (swin),
2582- GTK_SHADOW_IN);
2583- gtk_widget_show (swin);
2584-
2585- /* Tree */
2586-
2587- impl->browse_shortcuts_tree_view = gtk_tree_view_new ();
2588- g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event",
2589- G_CALLBACK (tree_view_keybinding_cb), impl);
2590- atk_object_set_name (gtk_widget_get_accessible (impl->browse_shortcuts_tree_view), _("Shortcuts"));
2591- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), FALSE);
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
2596- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), impl->shortcuts_filter_model);
2597+ return impl->filter_combo;
2598+}
2599
2600- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
2601- GDK_BUTTON1_MASK,
2602- shortcuts_source_targets,
2603- num_shortcuts_source_targets,
2604- GDK_ACTION_MOVE);
2605-
2606- gtk_drag_dest_set (impl->browse_shortcuts_tree_view,
2607- GTK_DEST_DEFAULT_ALL,
2608- shortcuts_dest_targets,
2609- num_shortcuts_dest_targets,
2610- GDK_ACTION_COPY | GDK_ACTION_MOVE);
2611+struct selection_check_closure {
2612+ GtkFileChooserDefault *impl;
2613+ int num_selected;
2614+ gboolean all_files;
2615+ gboolean all_folders;
2616+};
2617
2618- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
2619- gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
2620- gtk_tree_selection_set_select_function (selection,
2621- shortcuts_select_func,
2622- impl, NULL);
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
2635- g_signal_connect (selection, "changed",
2636- G_CALLBACK (shortcuts_selection_changed_cb), impl);
2637+ closure = data;
2638+ closure->num_selected++;
2639
2640- g_signal_connect (impl->browse_shortcuts_tree_view, "row-activated",
2641- G_CALLBACK (shortcuts_row_activated_cb), impl);
2642+ gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter);
2643
2644- g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event",
2645- G_CALLBACK (shortcuts_key_press_event_cb), impl);
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
2649- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-begin",
2650- G_CALLBACK (shortcuts_drag_begin_cb), impl);
2651- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-end",
2652- G_CALLBACK (shortcuts_drag_end_cb), impl);
2653- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-delete",
2654- G_CALLBACK (shortcuts_drag_data_delete_cb), impl);
2655-
2656- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-leave",
2657- G_CALLBACK (shortcuts_drag_leave_cb), impl);
2658- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-motion",
2659- G_CALLBACK (shortcuts_drag_motion_cb), impl);
2660- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-drop",
2661- G_CALLBACK (shortcuts_drag_drop_cb), impl);
2662- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-received",
2663- G_CALLBACK (shortcuts_drag_data_received_cb), impl);
2664+ closure->all_folders = closure->all_folders && is_folder;
2665+ closure->all_files = closure->all_files && !is_folder;
2666+}
2667
2668- gtk_container_add (GTK_CONTAINER (swin), impl->browse_shortcuts_tree_view);
2669- gtk_widget_show (impl->browse_shortcuts_tree_view);
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
2680- /* Column */
2681+ closure.impl = impl;
2682+ closure.num_selected = 0;
2683+ closure.all_files = TRUE;
2684+ closure.all_folders = TRUE;
2685
2686- column = gtk_tree_view_column_new ();
2687- gtk_tree_view_column_set_title (column, _("Folder"));
2688+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
2689+ gtk_tree_selection_selected_foreach (selection,
2690+ selection_check_foreach_cb,
2691+ &closure);
2692
2693- renderer = gtk_cell_renderer_pixbuf_new ();
2694- gtk_tree_view_column_pack_start (column, renderer, FALSE);
2695- gtk_tree_view_column_set_attributes (column, renderer,
2696- "pixbuf", SHORTCUTS_COL_PIXBUF,
2697- "visible", SHORTCUTS_COL_PIXBUF_VISIBLE,
2698- NULL);
2699+ g_assert (closure.num_selected == 0 || !(closure.all_files && closure.all_folders));
2700
2701- renderer = gtk_cell_renderer_text_new ();
2702- gtk_tree_view_column_pack_start (column, renderer, TRUE);
2703- gtk_tree_view_column_set_attributes (column, renderer,
2704- "text", SHORTCUTS_COL_NAME,
2705- NULL);
2706-
2707- gtk_tree_view_set_row_separator_func (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
2708- shortcuts_row_separator_func,
2709- GINT_TO_POINTER (SHORTCUTS_COL_NAME),
2710- NULL);
2711+ if (num_selected)
2712+ *num_selected = closure.num_selected;
2713
2714- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), column);
2715+ if (all_files)
2716+ *all_files = closure.all_files;
2717
2718- return swin;
2719+ if (all_folders)
2720+ *all_folders = closure.all_folders;
2721 }
2722
2723-/* Creates the widgets for the shortcuts/bookmarks pane */
2724-static GtkWidget *
2725-shortcuts_pane_create (GtkFileChooserDefault *impl,
2726- GtkSizeGroup *size_group)
2727-{
2728- GtkWidget *vbox;
2729- GtkWidget *hbox;
2730- GtkWidget *widget;
2731-
2732- vbox = gtk_vbox_new (FALSE, 6);
2733- gtk_widget_show (vbox);
2734-
2735- /* Shortcuts tree */
2736-
2737- widget = shortcuts_list_create (impl);
2738- gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
2739-
2740- /* Box for buttons */
2741-
2742- hbox = gtk_hbox_new (TRUE, 6);
2743- gtk_size_group_add_widget (size_group, hbox);
2744- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
2745- gtk_widget_show (hbox);
2746+struct get_selected_path_closure {
2747+ GtkFileChooserDefault *impl;
2748+ const GtkFilePath *path;
2749+};
2750
2751- /* Add bookmark button */
2752+/* Returns a selected path from the file list */
2753
2754- impl->browse_shortcuts_add_button = button_new (impl,
2755- _("_Add"),
2756- GTK_STOCK_ADD,
2757- FALSE,
2758- TRUE,
2759- G_CALLBACK (add_bookmark_button_clicked_cb));
2760- gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_add_button, TRUE, TRUE, 0);
2761- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_add_button,
2762- _("Add the selected folder to the bookmarks"), NULL);
2763-
2764- /* Remove bookmark button */
2765-
2766- impl->browse_shortcuts_remove_button = button_new (impl,
2767- _("_Remove"),
2768- GTK_STOCK_REMOVE,
2769- FALSE,
2770- TRUE,
2771- G_CALLBACK (remove_bookmark_button_clicked_cb));
2772- gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_remove_button, TRUE, TRUE, 0);
2773- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button,
2774- _("Remove the selected bookmark"), NULL);
2775+typedef struct {
2776+ GtkFileChooserDefault *impl;
2777+ gchar *tip;
2778+} UpdateTooltipData;
2779
2780- return vbox;
2781-}
2782
2783 /* Handles key press events on the file list, so that we can trap Enter to
2784 * activate the default button on our own. Also, checks to see if '/' has been
2785@@ -3026,14 +1085,11 @@
2786 gpointer data)
2787 {
2788 GtkFileChooserDefault *impl;
2789- int modifiers;
2790
2791 impl = (GtkFileChooserDefault *) data;
2792-
2793- modifiers = gtk_accelerator_get_default_mod_mask ();
2794
2795 if (event->keyval == GDK_slash &&
2796- ! (event->state & (~GDK_SHIFT_MASK & modifiers)))
2797+ ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ())))
2798 {
2799 location_popup_handler (impl, "/");
2800 return TRUE;
2801@@ -3043,7 +1099,6 @@
2802 || event->keyval == GDK_ISO_Enter
2803 || event->keyval == GDK_KP_Enter
2804 || event->keyval == GDK_space)
2805- && ((event->state && modifiers) == 0)
2806 && !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
2807 impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
2808 {
2809@@ -3063,37 +1118,7 @@
2810 return FALSE;
2811 }
2812
2813-/* Callback used when the file list's popup menu is detached */
2814-static void
2815-popup_menu_detach_cb (GtkWidget *attach_widget,
2816- GtkMenu *menu)
2817-{
2818- GtkFileChooserDefault *impl;
2819-
2820- impl = g_object_get_data (G_OBJECT (attach_widget), "GtkFileChooserDefault");
2821- g_assert (GTK_IS_FILE_CHOOSER_DEFAULT (impl));
2822-
2823- impl->browse_files_popup_menu = NULL;
2824- impl->browse_files_popup_menu_add_shortcut_item = NULL;
2825- impl->browse_files_popup_menu_hidden_files_item = NULL;
2826-}
2827-
2828-/* Callback used when the "Add to Shortcuts" menu item is activated */
2829-static void
2830-add_to_shortcuts_cb (GtkMenuItem *item,
2831- GtkFileChooserDefault *impl)
2832-{
2833- bookmarks_add_selected_folder (impl);
2834-}
2835-
2836-/* Callback used when the "Open Location" menu item is activated */
2837-static void
2838-open_location_cb (GtkMenuItem *item,
2839- GtkFileChooserDefault *impl)
2840-{
2841- location_popup_handler (impl, "");
2842-}
2843-
2844+#if 0
2845 /* Callback used when the "Show Hidden Files" menu item is toggled */
2846 static void
2847 show_hidden_toggled_cb (GtkCheckMenuItem *item,
2848@@ -3103,145 +1128,7 @@
2849 "show-hidden", gtk_check_menu_item_get_active (item),
2850 NULL);
2851 }
2852-
2853-/* Constructs the popup menu for the file list if needed */
2854-static void
2855-file_list_build_popup_menu (GtkFileChooserDefault *impl)
2856-{
2857- GtkWidget *item;
2858-
2859- if (impl->browse_files_popup_menu)
2860- return;
2861-
2862- impl->browse_files_popup_menu = gtk_menu_new ();
2863- gtk_menu_attach_to_widget (GTK_MENU (impl->browse_files_popup_menu),
2864- impl->browse_files_tree_view,
2865- popup_menu_detach_cb);
2866-
2867- item = gtk_image_menu_item_new_with_mnemonic (_("_Add to Shortcuts"));
2868- impl->browse_files_popup_menu_add_shortcut_item = item;
2869- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
2870- gtk_image_new_from_stock (GTK_STOCK_ADD, GTK_ICON_SIZE_MENU));
2871- gtk_widget_set_sensitive (item, FALSE);
2872- g_signal_connect (item, "activate",
2873- G_CALLBACK (add_to_shortcuts_cb), impl);
2874- gtk_widget_show (item);
2875- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
2876-
2877- item = gtk_image_menu_item_new_with_mnemonic (_("Open _Location"));
2878- gtk_image_menu_item_set_image (GTK_IMAGE_MENU_ITEM (item),
2879- gtk_image_new_from_stock (GTK_STOCK_OPEN, GTK_ICON_SIZE_MENU));
2880- g_signal_connect (item, "activate",
2881- G_CALLBACK (open_location_cb), impl);
2882- gtk_widget_show (item);
2883- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
2884-
2885- item = gtk_separator_menu_item_new ();
2886- gtk_widget_show (item);
2887- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
2888-
2889- item = gtk_check_menu_item_new_with_mnemonic (_("Show _Hidden Files"));
2890- impl->browse_files_popup_menu_hidden_files_item = item;
2891- g_signal_connect (item, "toggled",
2892- G_CALLBACK (show_hidden_toggled_cb), impl);
2893- gtk_widget_show (item);
2894- gtk_menu_shell_append (GTK_MENU_SHELL (impl->browse_files_popup_menu), item);
2895-}
2896-
2897-/* Updates the popup menu for the file list, creating it if necessary */
2898-static void
2899-file_list_update_popup_menu (GtkFileChooserDefault *impl)
2900-{
2901- file_list_build_popup_menu (impl);
2902-
2903- /* The sensitivity of the Add to Shortcuts item is set in
2904- * bookmarks_check_add_sensitivity()
2905- */
2906-
2907- g_signal_handlers_block_by_func (impl->browse_files_popup_menu_hidden_files_item,
2908- G_CALLBACK (show_hidden_toggled_cb), impl);
2909- gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (impl->browse_files_popup_menu_hidden_files_item),
2910- impl->show_hidden);
2911- g_signal_handlers_unblock_by_func (impl->browse_files_popup_menu_hidden_files_item,
2912- G_CALLBACK (show_hidden_toggled_cb), impl);
2913-}
2914-
2915-static void
2916-popup_position_func (GtkMenu *menu,
2917- gint *x,
2918- gint *y,
2919- gboolean *push_in,
2920- gpointer user_data)
2921-{
2922- GtkWidget *widget = GTK_WIDGET (user_data);
2923- GdkScreen *screen = gtk_widget_get_screen (widget);
2924- GtkRequisition req;
2925- gint monitor_num;
2926- GdkRectangle monitor;
2927-
2928- g_return_if_fail (GTK_WIDGET_REALIZED (widget));
2929-
2930- gdk_window_get_origin (widget->window, x, y);
2931-
2932- gtk_widget_size_request (GTK_WIDGET (menu), &req);
2933-
2934- *x += (widget->allocation.width - req.width) / 2;
2935- *y += (widget->allocation.height - req.height) / 2;
2936-
2937- monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y);
2938- gtk_menu_set_monitor (menu, monitor_num);
2939- gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
2940-
2941- *x = CLAMP (*x, monitor.x, monitor.x + MAX (0, monitor.width - req.width));
2942- *y = CLAMP (*y, monitor.y, monitor.y + MAX (0, monitor.height - req.height));
2943-
2944- *push_in = FALSE;
2945-}
2946-
2947-static void
2948-file_list_popup_menu (GtkFileChooserDefault *impl,
2949- GdkEventButton *event)
2950-{
2951- file_list_update_popup_menu (impl);
2952- if (event)
2953- gtk_menu_popup (GTK_MENU (impl->browse_files_popup_menu),
2954- NULL, NULL, NULL, NULL,
2955- event->button, event->time);
2956- else
2957- {
2958- gtk_menu_popup (GTK_MENU (impl->browse_files_popup_menu),
2959- NULL, NULL,
2960- popup_position_func, impl->browse_files_tree_view,
2961- 0, GDK_CURRENT_TIME);
2962- gtk_menu_shell_select_first (GTK_MENU_SHELL (impl->browse_files_popup_menu),
2963- FALSE);
2964- }
2965-
2966-}
2967-
2968-/* Callback used for the GtkWidget::popup-menu signal of the file list */
2969-static gboolean
2970-list_popup_menu_cb (GtkWidget *widget,
2971- GtkFileChooserDefault *impl)
2972-{
2973- file_list_popup_menu (impl, NULL);
2974- return TRUE;
2975-}
2976-
2977-/* Callback used when a button is pressed on the file list. We trap button 3 to
2978- * bring up a popup menu.
2979- */
2980-static gboolean
2981-list_button_press_event_cb (GtkWidget *widget,
2982- GdkEventButton *event,
2983- GtkFileChooserDefault *impl)
2984-{
2985- if (event->button != 3)
2986- return FALSE;
2987-
2988- file_list_popup_menu (impl, event);
2989- return TRUE;
2990-}
2991+#endif
2992
2993 /* Creates the widgets for the file list */
2994 static GtkWidget *
2995@@ -3272,11 +1159,7 @@
2996 G_CALLBACK (list_row_activated), impl);
2997 g_signal_connect (impl->browse_files_tree_view, "key-press-event",
2998 G_CALLBACK (trap_activate_cb), impl);
2999- g_signal_connect (impl->browse_files_tree_view, "popup-menu",
3000- G_CALLBACK (list_popup_menu_cb), impl);
3001- g_signal_connect (impl->browse_files_tree_view, "button-press-event",
3002- G_CALLBACK (list_button_press_event_cb), impl);
3003-
3004+
3005 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
3006 gtk_tree_selection_set_select_function (selection,
3007 list_select_func,
3008@@ -3346,70 +1229,163 @@
3009 return swin;
3010 }
3011
3012-static GtkWidget *
3013-create_path_bar (GtkFileChooserDefault *impl)
3014+static void
3015+up_button_clicked_cb (GtkButton *button, gpointer data)
3016 {
3017- GtkWidget *path_bar;
3018-
3019- path_bar = g_object_new (GTK_TYPE_PATH_BAR, NULL);
3020- _gtk_path_bar_set_file_system (GTK_PATH_BAR (path_bar), impl->file_system);
3021-
3022- return path_bar;
3023+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (data);
3024+ up_folder_handler (impl);
3025 }
3026
3027 static void
3028-set_filter_tooltip (GtkWidget *widget,
3029- gpointer data)
3030+volume_button_clicked_cb (GtkButton *button, gpointer data)
3031 {
3032- GtkTooltips *tooltips = (GtkTooltips *)data;
3033-
3034- if (GTK_IS_BUTTON (widget))
3035- gtk_tooltips_set_tip (tooltips, widget,
3036- _("Select which types of files are shown"),
3037- NULL);
3038+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (data);
3039+ GtkFilePath * path = g_object_get_data (G_OBJECT (button), "file-path");
3040+
3041+ change_folder_and_display_error (impl, path);
3042 }
3043
3044-static void
3045-realize_filter_combo (GtkWidget *combo,
3046- gpointer data)
3047+static GtkWidget *
3048+create_bar (GtkFileChooserDefault *impl)
3049 {
3050- GtkFileChooserDefault *impl = (GtkFileChooserDefault *)data;
3051+ GSList *list, *l;
3052+ int n;
3053+ GtkWidget *bar = gtk_hbox_new (FALSE, DEFAULT_SPACING);
3054+ GtkWidget *img;
3055+
3056+ /* first the Up button */
3057+ img = gtk_image_new_from_stock (GTK_STOCK_GO_UP, GTK_ICON_SIZE_BUTTON);
3058+ gtk_widget_show (img);
3059+
3060+ impl->up_button = gtk_button_new ();
3061+ gtk_container_add (GTK_CONTAINER (impl->up_button), img);
3062+ gtk_widget_show (impl->up_button);
3063+ gtk_widget_set_sensitive (impl->up_button, FALSE);
3064+ gtk_button_set_focus_on_click (GTK_BUTTON (impl->up_button), FALSE);
3065+
3066+ g_signal_connect (impl->up_button, "clicked",
3067+ G_CALLBACK (up_button_clicked_cb), impl);
3068+ gtk_box_pack_start (GTK_BOX(bar), impl->up_button, FALSE, FALSE, 0);
3069+
3070+ impl->num_volumes = 0;
3071+ list = gtk_file_system_list_volumes (impl->file_system);
3072+
3073+ n = 0;
3074+
3075+ for (l = list; l; l = l->next, n++)
3076+ {
3077+ GtkFileSystemVolume *volume;
3078+ GdkPixbuf *pixbuf;
3079+ GtkWidget *button;
3080+ GtkWidget *image;
3081+ GtkFilePath *base_path;
3082+ gchar * file_name = NULL;
3083+
3084+ volume = l->data;
3085+ base_path =
3086+ gtk_file_system_volume_get_base_path (impl->file_system, volume);
3087+
3088+ if (impl->local_only)
3089+ {
3090+ gboolean is_local =
3091+ gtk_file_system_path_is_local (impl->file_system, base_path);
3092+
3093+ if (!is_local)
3094+ {
3095+ gtk_file_path_free (base_path);
3096+ gtk_file_system_volume_free (impl->file_system, volume);
3097+ continue;
3098+ }
3099+ }
3100+
3101+#if 0
3102+ label_copy =
3103+ gtk_file_system_volume_get_display_name (impl->file_system, volume);
3104+#endif
3105+ pixbuf =
3106+ gtk_file_system_volume_render_icon (impl->file_system, volume,
3107+ GTK_WIDGET (impl),
3108+ impl->icon_size, NULL);
3109+
3110+ button = gtk_button_new ();
3111+ image = gtk_image_new_from_pixbuf (pixbuf);
3112+ g_object_unref (G_OBJECT (pixbuf));
3113+ gtk_container_add (GTK_CONTAINER (button), image);
3114+ gtk_button_set_focus_on_click (GTK_BUTTON (button), FALSE);
3115+
3116+ file_name =
3117+ gtk_file_system_path_to_filename (impl->file_system, base_path);
3118+
3119+ if (file_name && impl->root_folder &&
3120+ strcmp (file_name, impl->root_folder) &&
3121+ !strncmp (file_name, impl->root_folder, strlen (file_name)))
3122+ {
3123+ /* The base path is below the root folder; we replace it with
3124+ * the root folder
3125+ */
3126+ gtk_file_path_free (base_path);
3127+ base_path = gtk_file_system_filename_to_path (impl->file_system,
3128+ impl->root_folder);
3129+ }
3130+
3131+ g_free (file_name);
3132+
3133+ gtk_widget_show_all (button);
3134+
3135+ g_object_set_data (G_OBJECT (button), "file-path", base_path);
3136
3137- gtk_container_forall (GTK_CONTAINER (combo),
3138- set_filter_tooltip,
3139- impl->tooltips);
3140+ g_signal_connect (button, "clicked",
3141+ G_CALLBACK (volume_button_clicked_cb), impl);
3142+
3143+ gtk_box_pack_start (GTK_BOX(bar), button, FALSE, FALSE, 0);
3144+ }
3145+
3146+ impl->num_volumes = n;
3147+ g_slist_free (list);
3148+
3149+ gtk_widget_show (bar);
3150+
3151+ return bar;
3152 }
3153
3154 /* Creates the widgets for the files/folders pane */
3155 static GtkWidget *
3156-file_pane_create (GtkFileChooserDefault *impl,
3157- GtkSizeGroup *size_group)
3158+file_pane_create (GtkFileChooserDefault *impl)
3159 {
3160 GtkWidget *vbox;
3161 GtkWidget *hbox;
3162 GtkWidget *widget;
3163-
3164- vbox = gtk_vbox_new (FALSE, 6);
3165+ vbox = gtk_vbox_new (FALSE, DEFAULT_SPACING);
3166 gtk_widget_show (vbox);
3167
3168- /* The path bar and 'Create Folder' button */
3169- hbox = gtk_hbox_new (FALSE, 12);
3170+ /* The volume bar and 'Create Folder' button */
3171+ hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING);
3172 gtk_widget_show (hbox);
3173- impl->browse_path_bar = create_path_bar (impl);
3174- g_signal_connect (impl->browse_path_bar, "path-clicked", G_CALLBACK (path_bar_clicked), impl);
3175- gtk_widget_show_all (impl->browse_path_bar);
3176- gtk_box_pack_start (GTK_BOX (hbox), impl->browse_path_bar, TRUE, TRUE, 0);
3177+ impl->bar = create_bar (impl);
3178+ gtk_widget_show_all (impl->bar);
3179+ gtk_box_pack_start (GTK_BOX (hbox), impl->bar, TRUE, TRUE, 0);
3180
3181 /* Create Folder */
3182- impl->browse_new_folder_button = gtk_button_new_with_mnemonic (_("Create Fo_lder"));
3183+ widget = gtk_image_new_from_icon_name ("folder-new", GTK_ICON_SIZE_BUTTON);
3184+ gtk_widget_show (widget);
3185+ impl->browse_new_folder_button = gtk_button_new ();
3186+ gtk_container_add (GTK_CONTAINER (impl->browse_new_folder_button), widget);
3187+ gtk_button_set_focus_on_click (GTK_BUTTON (impl->browse_new_folder_button),
3188+ FALSE);
3189+
3190 g_signal_connect (impl->browse_new_folder_button, "clicked",
3191 G_CALLBACK (new_folder_button_clicked), impl);
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+
3198 gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
3199
3200- /* Box for lists and preview */
3201+ /* Box for lists */
3202
3203- hbox = gtk_hbox_new (FALSE, PREVIEW_HBOX_SPACING);
3204+ hbox = gtk_hbox_new (FALSE, LIST_HBOX_SPACING);
3205 gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
3206 gtk_widget_show (hbox);
3207
3208@@ -3418,157 +1394,37 @@
3209 widget = create_file_list (impl);
3210 gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
3211
3212- /* Preview */
3213-
3214- impl->preview_box = gtk_vbox_new (FALSE, 12);
3215- gtk_box_pack_start (GTK_BOX (hbox), impl->preview_box, FALSE, FALSE, 0);
3216- /* Don't show preview box initially */
3217-
3218- /* Filter combo */
3219-
3220- impl->filter_combo_hbox = gtk_hbox_new (FALSE, 12);
3221-
3222- widget = filter_create (impl);
3223-
3224- g_signal_connect (widget, "realize",
3225- G_CALLBACK (realize_filter_combo), impl);
3226-
3227- gtk_widget_show (widget);
3228- gtk_box_pack_end (GTK_BOX (impl->filter_combo_hbox), widget, FALSE, FALSE, 0);
3229-
3230- gtk_size_group_add_widget (size_group, impl->filter_combo_hbox);
3231- gtk_box_pack_end (GTK_BOX (vbox), impl->filter_combo_hbox, FALSE, FALSE, 0);
3232-
3233 return vbox;
3234 }
3235-/* Callback used when the "Browse for more folders" expander is toggled */
3236-static void
3237-expander_changed_cb (GtkExpander *expander,
3238- GParamSpec *pspec,
3239- GtkFileChooserDefault *impl)
3240-{
3241- update_appearance (impl);
3242-}
3243-
3244-/* Callback used when the selection changes in the save folder combo box */
3245-static void
3246-save_folder_combo_changed_cb (GtkComboBox *combo,
3247- GtkFileChooserDefault *impl)
3248-{
3249- GtkTreeIter iter;
3250-
3251- if (impl->changing_folder)
3252- return;
3253-
3254- if (gtk_combo_box_get_active_iter (combo, &iter))
3255- shortcuts_activate_iter (impl, &iter);
3256-}
3257-
3258-/* Creates the combo box with the save folders */
3259-static GtkWidget *
3260-save_folder_combo_create (GtkFileChooserDefault *impl)
3261-{
3262- GtkWidget *combo;
3263- GtkCellRenderer *cell;
3264-
3265- combo = g_object_new (GTK_TYPE_COMBO_BOX,
3266- "model", impl->shortcuts_model,
3267- "focus-on-click", FALSE,
3268- NULL);
3269- gtk_widget_show (combo);
3270-
3271- cell = gtk_cell_renderer_pixbuf_new ();
3272- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, FALSE);
3273- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell,
3274- "pixbuf", SHORTCUTS_COL_PIXBUF,
3275- "visible", SHORTCUTS_COL_PIXBUF_VISIBLE,
3276- "sensitive", SHORTCUTS_COL_PIXBUF_VISIBLE,
3277- NULL);
3278-
3279- cell = gtk_cell_renderer_text_new ();
3280- gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), cell, TRUE);
3281- gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), cell,
3282- "text", SHORTCUTS_COL_NAME,
3283- "sensitive", SHORTCUTS_COL_PIXBUF_VISIBLE,
3284- NULL);
3285-
3286- gtk_combo_box_set_row_separator_func (GTK_COMBO_BOX (combo),
3287- shortcuts_row_separator_func,
3288- GINT_TO_POINTER (SHORTCUTS_COL_NAME),
3289- NULL);
3290-
3291- g_signal_connect (combo, "changed",
3292- G_CALLBACK (save_folder_combo_changed_cb), impl);
3293-
3294- return combo;
3295-}
3296
3297 /* Creates the widgets specific to Save mode */
3298 static GtkWidget *
3299 save_widgets_create (GtkFileChooserDefault *impl)
3300 {
3301 GtkWidget *vbox;
3302- GtkWidget *table;
3303+ GtkWidget *hbox;
3304 GtkWidget *widget;
3305- GtkWidget *alignment;
3306
3307- vbox = gtk_vbox_new (FALSE, 12);
3308-
3309- table = gtk_table_new (2, 2, FALSE);
3310- gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0);
3311- gtk_widget_show (table);
3312- gtk_table_set_row_spacings (GTK_TABLE (table), 12);
3313- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
3314-
3315- /* Name entry */
3316-
3317- widget = gtk_label_new_with_mnemonic (_("_Name:"));
3318+ vbox = gtk_vbox_new (FALSE, 0);
3319+ hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING);
3320+
3321+ widget = gtk_label_new (_("Name:"));
3322 gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5);
3323- gtk_table_attach (GTK_TABLE (table), widget,
3324- 0, 1, 0, 1,
3325- GTK_FILL, GTK_FILL,
3326- 0, 0);
3327+ gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
3328 gtk_widget_show (widget);
3329
3330 impl->save_file_name_entry = _gtk_file_chooser_entry_new (TRUE);
3331 _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
3332 impl->file_system);
3333- gtk_entry_set_width_chars (GTK_ENTRY (impl->save_file_name_entry), 45);
3334+/* gtk_entry_set_width_chars (GTK_ENTRY (impl->save_file_name_entry), 45); */
3335 gtk_entry_set_activates_default (GTK_ENTRY (impl->save_file_name_entry), TRUE);
3336- gtk_table_attach (GTK_TABLE (table), impl->save_file_name_entry,
3337- 1, 2, 0, 1,
3338- GTK_EXPAND | GTK_FILL, 0,
3339- 0, 0);
3340+ gtk_box_pack_start (GTK_BOX (hbox), impl->save_file_name_entry,
3341+ TRUE, TRUE, 0);
3342 gtk_widget_show (impl->save_file_name_entry);
3343- gtk_label_set_mnemonic_widget (GTK_LABEL (widget), impl->save_file_name_entry);
3344-
3345- /* Folder combo */
3346- impl->save_folder_label = gtk_label_new (NULL);
3347- gtk_misc_set_alignment (GTK_MISC (impl->save_folder_label), 0.0, 0.5);
3348- gtk_table_attach (GTK_TABLE (table), impl->save_folder_label,
3349- 0, 1, 1, 2,
3350- GTK_FILL, GTK_FILL,
3351- 0, 0);
3352- gtk_widget_show (impl->save_folder_label);
3353-
3354- impl->save_folder_combo = save_folder_combo_create (impl);
3355- gtk_table_attach (GTK_TABLE (table), impl->save_folder_combo,
3356- 1, 2, 1, 2,
3357- GTK_EXPAND | GTK_FILL, GTK_FILL,
3358- 0, 0);
3359- gtk_label_set_mnemonic_widget (GTK_LABEL (impl->save_folder_label), impl->save_folder_combo);
3360-
3361- /* Expander */
3362- alignment = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
3363- gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0);
3364-
3365- impl->save_expander = gtk_expander_new_with_mnemonic (_("_Browse for other folders"));
3366- gtk_container_add (GTK_CONTAINER (alignment), impl->save_expander);
3367- g_signal_connect (impl->save_expander, "notify::expanded",
3368- G_CALLBACK (expander_changed_cb),
3369- impl);
3370- gtk_widget_show_all (alignment);
3371
3372+ gtk_widget_show (hbox);
3373+ gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
3374+
3375 return vbox;
3376 }
3377
3378@@ -3576,29 +1432,11 @@
3379 static GtkWidget *
3380 browse_widgets_create (GtkFileChooserDefault *impl)
3381 {
3382- GtkWidget *vbox;
3383- GtkWidget *hpaned;
3384 GtkWidget *widget;
3385- GtkSizeGroup *size_group;
3386
3387- /* size group is used by the [+][-] buttons and the filter combo */
3388- size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
3389- vbox = gtk_vbox_new (FALSE, 12);
3390-
3391- /* Paned widget */
3392- hpaned = gtk_hpaned_new ();
3393- gtk_widget_show (hpaned);
3394- gtk_paned_set_position (GTK_PANED (hpaned), 200); /* FIXME: this sucks */
3395- gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
3396-
3397- widget = shortcuts_pane_create (impl, size_group);
3398- gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE);
3399- widget = file_pane_create (impl, size_group);
3400- gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE);
3401+ widget = file_pane_create (impl);
3402
3403- g_object_unref (size_group);
3404-
3405- return vbox;
3406+ return widget;
3407 }
3408
3409 static GObject*
3410@@ -3618,56 +1456,20 @@
3411
3412 gtk_widget_push_composite_child ();
3413
3414- /* Shortcuts model */
3415-
3416- shortcuts_model_create (impl);
3417-
3418- /* Widgets for Save mode */
3419- impl->save_widgets = save_widgets_create (impl);
3420- gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
3421-
3422 /* The browse widgets */
3423 impl->browse_widgets = browse_widgets_create (impl);
3424 gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets, TRUE, TRUE, 0);
3425
3426- /* Alignment to hold extra widget */
3427- impl->extra_align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
3428- gtk_box_pack_start (GTK_BOX (impl), impl->extra_align, FALSE, FALSE, 0);
3429-
3430+ /* Widgets for Save mode */
3431+ impl->save_widgets = save_widgets_create (impl);
3432+ gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
3433+
3434 gtk_widget_pop_composite_child ();
3435 update_appearance (impl);
3436
3437 return object;
3438 }
3439
3440-/* Sets the extra_widget by packing it in the appropriate place */
3441-static void
3442-set_extra_widget (GtkFileChooserDefault *impl,
3443- GtkWidget *extra_widget)
3444-{
3445- if (extra_widget)
3446- {
3447- g_object_ref (extra_widget);
3448- /* FIXME: is this right ? */
3449- gtk_widget_show (extra_widget);
3450- }
3451-
3452- if (impl->extra_widget)
3453- {
3454- gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
3455- g_object_unref (impl->extra_widget);
3456- }
3457-
3458- impl->extra_widget = extra_widget;
3459- if (impl->extra_widget)
3460- {
3461- gtk_container_add (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
3462- gtk_widget_show (impl->extra_align);
3463- }
3464- else
3465- gtk_widget_hide (impl->extra_align);
3466-}
3467-
3468 static void
3469 set_local_only (GtkFileChooserDefault *impl,
3470 gboolean local_only)
3471@@ -3676,12 +1478,6 @@
3472 {
3473 impl->local_only = local_only;
3474
3475- if (impl->shortcuts_model && impl->file_system)
3476- {
3477- shortcuts_add_volumes (impl);
3478- shortcuts_add_bookmarks (impl);
3479- }
3480-
3481 if (local_only &&
3482 !gtk_file_system_path_is_local (impl->file_system, impl->current_folder))
3483 {
3484@@ -3708,18 +1504,7 @@
3485 volumes_changed_cb (GtkFileSystem *file_system,
3486 GtkFileChooserDefault *impl)
3487 {
3488- shortcuts_add_volumes (impl);
3489-}
3490-
3491-/* Callback used when the set of bookmarks changes in the file system */
3492-static void
3493-bookmarks_changed_cb (GtkFileSystem *file_system,
3494- GtkFileChooserDefault *impl)
3495-{
3496- shortcuts_add_bookmarks (impl);
3497-
3498- bookmarks_check_add_sensitivity (impl);
3499- bookmarks_check_remove_sensitivity (impl);
3500+ /* FIXME -- not needed */
3501 }
3502
3503 /* Sets the file chooser to multiple selection mode */
3504@@ -3741,8 +1526,6 @@
3505
3506 impl->select_multiple = select_multiple;
3507 g_object_notify (G_OBJECT (impl), "select-multiple");
3508-
3509- check_preview_change (impl);
3510 }
3511
3512 static void
3513@@ -3753,8 +1536,6 @@
3514 {
3515 g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id);
3516 impl->volumes_changed_id = 0;
3517- g_signal_handler_disconnect (impl->file_system, impl->bookmarks_changed_id);
3518- impl->bookmarks_changed_id = 0;
3519 g_object_unref (impl->file_system);
3520 }
3521
3522@@ -3790,9 +1571,6 @@
3523 impl->volumes_changed_id = g_signal_connect (impl->file_system, "volumes-changed",
3524 G_CALLBACK (volumes_changed_cb),
3525 impl);
3526- impl->bookmarks_changed_id = g_signal_connect (impl->file_system, "bookmarks-changed",
3527- G_CALLBACK (bookmarks_changed_cb),
3528- impl);
3529 }
3530 }
3531
3532@@ -3807,30 +1585,8 @@
3533 if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
3534 impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
3535 {
3536- const char *text;
3537-
3538 gtk_widget_show (impl->save_widgets);
3539-
3540- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
3541- text = _("Save in _folder:");
3542- else
3543- text = _("Create in _folder:");
3544-
3545- gtk_label_set_text_with_mnemonic (GTK_LABEL (impl->save_folder_label), text);
3546-
3547- if (gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander)))
3548- {
3549- gtk_widget_set_sensitive (impl->save_folder_label, FALSE);
3550- gtk_widget_set_sensitive (impl->save_folder_combo, FALSE);
3551- gtk_widget_show (impl->browse_widgets);
3552- }
3553- else
3554- {
3555- gtk_widget_set_sensitive (impl->save_folder_label, TRUE);
3556- gtk_widget_set_sensitive (impl->save_folder_combo, TRUE);
3557- gtk_widget_hide (impl->browse_widgets);
3558- }
3559-
3560+ gtk_widget_show (impl->browse_widgets);
3561 gtk_widget_show (impl->browse_new_folder_button);
3562
3563 if (impl->select_multiple)
3564@@ -3844,6 +1600,7 @@
3565 impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
3566 {
3567 gtk_widget_hide (impl->save_widgets);
3568+ gtk_widget_hide (impl->browse_new_folder_button);
3569 gtk_widget_show (impl->browse_widgets);
3570 }
3571
3572@@ -3876,12 +1633,9 @@
3573 {
3574 gtk_file_chooser_default_unselect_all (GTK_FILE_CHOOSER (impl));
3575
3576- if ((action == GTK_FILE_CHOOSER_ACTION_SAVE || action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
3577- && impl->select_multiple)
3578+ if (action == GTK_FILE_CHOOSER_ACTION_SAVE && impl->select_multiple)
3579 {
3580- g_warning ("Tried to change the file chooser action to SAVE or CREATE_FOLDER, but "
3581- "this is not allowed in multiple selection mode. Resetting the file chooser "
3582- "to single selection mode.");
3583+ g_warning ("Multiple selection mode is not allowed in Save mode");
3584 set_select_multiple (impl, FALSE, TRUE);
3585 }
3586 impl->action = action;
3587@@ -3902,29 +1656,12 @@
3588 case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY:
3589 set_local_only (impl, g_value_get_boolean (value));
3590 break;
3591- case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET:
3592- set_preview_widget (impl, g_value_get_object (value));
3593- break;
3594- case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
3595- impl->preview_widget_active = g_value_get_boolean (value);
3596- update_preview_widget_visibility (impl);
3597- break;
3598- case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
3599- impl->use_preview_label = g_value_get_boolean (value);
3600- update_preview_widget_visibility (impl);
3601- break;
3602- case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET:
3603- set_extra_widget (impl, g_value_get_object (value));
3604- break;
3605 case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
3606 {
3607 gboolean select_multiple = g_value_get_boolean (value);
3608- if ((impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
3609- && select_multiple)
3610+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE && select_multiple)
3611 {
3612- g_warning ("Tried to set the file chooser to multiple selection mode, but this is "
3613- "not allowed in SAVE or CREATE_FOLDER modes. Ignoring the change and "
3614- "leaving the file chooser in single selection mode.");
3615+ g_warning ("Multiple selection mode is not allowed in Save mode");
3616 return;
3617 }
3618
3619@@ -3943,6 +1680,19 @@
3620 }
3621 }
3622 break;
3623+ case GTK_FILE_CHOOSER_PROP_ROOT_FOLDER:
3624+ {
3625+ impl->root_folder = g_strdup (g_value_get_string (value));
3626+ }
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+
3636 default:
3637 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
3638 break;
3639@@ -3968,24 +1718,30 @@
3640 case GTK_FILE_CHOOSER_PROP_LOCAL_ONLY:
3641 g_value_set_boolean (value, impl->local_only);
3642 break;
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:
3655- g_value_set_object (value, impl->preview_widget);
3656+ g_value_set_object (value, NULL);
3657 break;
3658 case GTK_FILE_CHOOSER_PROP_PREVIEW_WIDGET_ACTIVE:
3659- g_value_set_boolean (value, impl->preview_widget_active);
3660+ g_value_set_boolean (value, FALSE);
3661 break;
3662 case GTK_FILE_CHOOSER_PROP_USE_PREVIEW_LABEL:
3663- g_value_set_boolean (value, impl->use_preview_label);
3664+ g_value_set_boolean (value, FALSE);
3665 break;
3666 case GTK_FILE_CHOOSER_PROP_EXTRA_WIDGET:
3667- g_value_set_object (value, impl->extra_widget);
3668- break;
3669- case GTK_FILE_CHOOSER_PROP_SELECT_MULTIPLE:
3670- g_value_set_boolean (value, impl->select_multiple);
3671- break;
3672- case GTK_FILE_CHOOSER_PROP_SHOW_HIDDEN:
3673- g_value_set_boolean (value, impl->show_hidden);
3674+ g_value_set_object (value, NULL);
3675 break;
3676+
3677 default:
3678 G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
3679 break;
3680@@ -4013,12 +1769,6 @@
3681 {
3682 GtkFileChooserDefault *impl = (GtkFileChooserDefault *) object;
3683
3684- if (impl->extra_widget)
3685- {
3686- g_object_unref (impl->extra_widget);
3687- impl->extra_widget = NULL;
3688- }
3689-
3690 remove_settings_signal (impl, gtk_widget_get_screen (GTK_WIDGET (impl)));
3691
3692 G_OBJECT_CLASS (parent_class)->dispose (object);
3693@@ -4031,12 +1781,7 @@
3694 static void
3695 gtk_file_chooser_default_show_all (GtkWidget *widget)
3696 {
3697- GtkFileChooserDefault *impl = (GtkFileChooserDefault *) widget;
3698-
3699 gtk_widget_show (widget);
3700-
3701- if (impl->extra_widget)
3702- gtk_widget_show_all (impl->extra_widget);
3703 }
3704
3705 /* Handler for GtkWindow::set-focus; this is where we save the last-focused
3706@@ -4095,7 +1840,6 @@
3707 else
3708 impl->icon_size = FALLBACK_ICON_SIZE;
3709
3710- shortcuts_reload_icons (impl);
3711 gtk_widget_queue_resize (impl->browse_files_tree_view);
3712 }
3713
3714@@ -4231,8 +1975,6 @@
3715 pending_select_paths_store_selection (impl);
3716 change_folder_and_display_error (impl, impl->current_folder);
3717 }
3718-
3719- bookmarks_changed_cb (impl->file_system, impl);
3720 }
3721
3722 static gboolean
3723@@ -4519,18 +2261,21 @@
3724 GtkFileFolder *folder;
3725 gboolean success;
3726 gboolean have_hidden;
3727- gboolean have_filtered;
3728
3729 if (!only_one_path && !paths)
3730 return TRUE;
3731
3732+#ifdef GTK26
3733 folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_HIDDEN, error);
3734+#else
3735+ folder = gtk_file_system_get_folder (impl->file_system, parent_path, GTK_FILE_INFO_IS_HIDDEN, NULL, NULL);
3736+#endif
3737+
3738 if (!folder)
3739 return FALSE;
3740
3741 success = FALSE;
3742 have_hidden = FALSE;
3743- have_filtered = FALSE;
3744
3745 if (only_one_path)
3746 {
3747@@ -4541,7 +2286,6 @@
3748 {
3749 success = TRUE;
3750 have_hidden = gtk_file_info_get_is_hidden (info);
3751- have_filtered = get_is_file_filtered (impl, only_one_path, info);
3752 gtk_file_info_free (info);
3753 }
3754 }
3755@@ -4563,12 +2307,9 @@
3756 if (!have_hidden)
3757 have_hidden = gtk_file_info_get_is_hidden (info);
3758
3759- if (!have_filtered)
3760- have_filtered = get_is_file_filtered (impl, path, info);
3761-
3762 gtk_file_info_free (info);
3763
3764- if (have_hidden && have_filtered)
3765+ if (have_hidden)
3766 break; /* we now have all the information we need */
3767 }
3768 }
3769@@ -4584,9 +2325,6 @@
3770 if (have_hidden)
3771 g_object_set (impl, "show-hidden", TRUE, NULL);
3772
3773- if (have_filtered)
3774- set_current_filter (impl, NULL);
3775-
3776 if (only_one_path)
3777 _gtk_file_system_model_path_do (impl->browse_files_model, only_one_path, select_func, impl);
3778 else
3779@@ -4629,13 +2367,11 @@
3780 * that case, the chooser's selection should be what the caller expects,
3781 * as the user can't see that something else got selected. See bug #165264.
3782 *
3783- * Also, we don't select the first file if we are not in OPEN mode. Doing
3784- * so would change the contents of the filename entry for SAVE or
3785- * CREATE_FOLDER, which is undesired; in SELECT_FOLDER, we don't want to
3786- * select a *different* folder from the one into which the user just
3787- * navigated.
3788+ * Also, we don't select the first file if we are in SAVE or CREATE_FOLDER
3789+ * modes. Doing so would change the contents of the filename entry.
3790 */
3791- if (GTK_WIDGET_MAPPED (impl) && impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
3792+ if (GTK_WIDGET_MAPPED (impl)
3793+ && !(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
3794 browse_files_select_first_row (impl);
3795 }
3796
3797@@ -4725,19 +2461,15 @@
3798 const GtkFileInfo *info;
3799 GtkTreeIter iter;
3800 GtkTreeIter child_iter;
3801- gboolean change_entry;
3802
3803- if (!(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
3804+ if (impl->action != GTK_FILE_CHOOSER_ACTION_SAVE)
3805 return;
3806
3807 g_assert (!impl->select_multiple);
3808 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
3809
3810 if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
3811- {
3812- _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), "");
3813- return;
3814- }
3815+ return;
3816
3817 gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model,
3818 &child_iter,
3819@@ -4745,12 +2477,7 @@
3820
3821 info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
3822
3823- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
3824- change_entry = !gtk_file_info_get_is_folder (info); /* We don't want the name to change when clicking on a folder... */
3825- else
3826- change_entry = TRUE; /* ... unless we are in CREATE_FOLDER mode */
3827-
3828- if (change_entry)
3829+ if (!gtk_file_info_get_is_folder (info))
3830 _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
3831 gtk_file_info_get_display_name (info));
3832 }
3833@@ -4780,9 +2507,6 @@
3834 if (!check_is_folder (impl->file_system, path, error))
3835 return FALSE;
3836
3837- if (!_gtk_path_bar_set_path (GTK_PATH_BAR (impl->browse_path_bar), path, error))
3838- return FALSE;
3839-
3840 if (impl->current_folder != path)
3841 {
3842 if (impl->current_folder)
3843@@ -4791,17 +2515,6 @@
3844 impl->current_folder = gtk_file_path_copy (path);
3845 }
3846
3847- /* Update the widgets that may trigger a folder change themselves. */
3848-
3849- if (!impl->changing_folder)
3850- {
3851- impl->changing_folder = TRUE;
3852-
3853- shortcuts_update_current_folder (impl);
3854-
3855- impl->changing_folder = FALSE;
3856- }
3857-
3858 /* Set the folder on the save entry */
3859
3860 _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry),
3861@@ -4815,13 +2528,7 @@
3862
3863 /* Refresh controls */
3864
3865- shortcuts_find_current_folder (impl);
3866-
3867 g_signal_emit_by_name (impl, "current-folder-changed", 0);
3868-
3869- check_preview_change (impl);
3870- bookmarks_check_add_sensitivity (impl);
3871-
3872 g_signal_emit_by_name (impl, "selection-changed", 0);
3873
3874 return result;
3875@@ -4844,7 +2551,6 @@
3876 g_return_if_fail (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
3877 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
3878
3879- pending_select_paths_free (impl);
3880 _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry), name);
3881 }
3882
3883@@ -4983,24 +2689,13 @@
3884 GtkTreeSelection *selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
3885
3886 gtk_tree_selection_unselect_all (selection);
3887- pending_select_paths_free (impl);
3888 }
3889
3890-/* Checks whether the filename entry for the Save modes contains a well-formed filename.
3891- *
3892- * is_well_formed_ret - whether what the user typed passes gkt_file_system_make_path()
3893- *
3894- * is_empty_ret - whether the file entry is totally empty
3895- *
3896- * is_file_part_empty_ret - whether the file part is empty (will be if user types "foobar/", and
3897- * the path will be "$cwd/foobar")
3898- */
3899-static void
3900+/* Checks whether the filename entry for the Save modes contains a valid filename */
3901+static GtkFilePath *
3902 check_save_entry (GtkFileChooserDefault *impl,
3903- GtkFilePath **path_ret,
3904- gboolean *is_well_formed_ret,
3905- gboolean *is_empty_ret,
3906- gboolean *is_file_part_empty_ret)
3907+ gboolean *is_valid,
3908+ gboolean *is_empty)
3909 {
3910 GtkFileChooserEntry *chooser_entry;
3911 const GtkFilePath *current_folder;
3912@@ -5013,31 +2708,17 @@
3913
3914 chooser_entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry);
3915
3916- if (strlen (gtk_entry_get_text (GTK_ENTRY (chooser_entry))) == 0)
3917- {
3918- *path_ret = NULL;
3919- *is_well_formed_ret = TRUE;
3920- *is_empty_ret = TRUE;
3921- *is_file_part_empty_ret = TRUE;
3922-
3923- return;
3924- }
3925-
3926- *is_empty_ret = FALSE;
3927-
3928 current_folder = _gtk_file_chooser_entry_get_current_folder (chooser_entry);
3929 file_part = _gtk_file_chooser_entry_get_file_part (chooser_entry);
3930
3931 if (!file_part || file_part[0] == '\0')
3932 {
3933- *path_ret = gtk_file_path_copy (current_folder);
3934- *is_well_formed_ret = TRUE;
3935- *is_file_part_empty_ret = TRUE;
3936-
3937- return;
3938+ *is_valid = FALSE;
3939+ *is_empty = TRUE;
3940+ return NULL;
3941 }
3942
3943- *is_file_part_empty_ret = FALSE;
3944+ *is_empty = FALSE;
3945
3946 error = NULL;
3947 path = gtk_file_system_make_path (impl->file_system, current_folder, file_part, &error);
3948@@ -5045,14 +2726,12 @@
3949 if (!path)
3950 {
3951 error_building_filename_dialog (impl, current_folder, file_part, error);
3952- *path_ret = NULL;
3953- *is_well_formed_ret = FALSE;
3954-
3955- return;
3956+ *is_valid = FALSE;
3957+ return NULL;
3958 }
3959
3960- *path_ret = path;
3961- *is_well_formed_ret = TRUE;
3962+ *is_valid = TRUE;
3963+ return path;
3964 }
3965
3966 struct get_paths_closure {
3967@@ -5098,21 +2777,11 @@
3968 if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
3969 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
3970 {
3971- gboolean is_well_formed, is_empty, is_file_part_empty;
3972+ gboolean is_valid, is_empty;
3973
3974- check_save_entry (impl, &info.path_from_entry, &is_well_formed, &is_empty, &is_file_part_empty);
3975-
3976- if (!is_well_formed)
3977+ info.path_from_entry = check_save_entry (impl, &is_valid, &is_empty);
3978+ if (!is_valid && !is_empty)
3979 return NULL;
3980-
3981- if (!is_empty)
3982- {
3983- if (is_file_part_empty && impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
3984- {
3985- gtk_file_path_free (info.path_from_entry);
3986- return NULL;
3987- }
3988- }
3989 }
3990
3991 if (!info.path_from_entry || impl->select_multiple)
3992@@ -5137,17 +2806,6 @@
3993 return g_slist_reverse (info.result);
3994 }
3995
3996-static GtkFilePath *
3997-gtk_file_chooser_default_get_preview_path (GtkFileChooser *chooser)
3998-{
3999- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4000-
4001- if (impl->preview_path)
4002- return gtk_file_path_copy (impl->preview_path);
4003- else
4004- return NULL;
4005-}
4006-
4007 static GtkFileSystem *
4008 gtk_file_chooser_default_get_file_system (GtkFileChooser *chooser)
4009 {
4010@@ -5162,9 +2820,9 @@
4011 gboolean show)
4012 {
4013 if (show)
4014- gtk_widget_show (impl->filter_combo_hbox);
4015+ gtk_widget_show (impl->filter_combo);
4016 else
4017- gtk_widget_hide (impl->filter_combo_hbox);
4018+ gtk_widget_hide (impl->filter_combo);
4019 }
4020
4021 static void
4022@@ -5174,6 +2832,8 @@
4023 GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4024 const gchar *name;
4025
4026+ g_debug ("adding filter");
4027+
4028 if (g_slist_find (impl->filters, filter))
4029 {
4030 g_warning ("gtk_file_chooser_add_filter() called on filter already in list\n");
4031@@ -5215,165 +2875,31 @@
4032
4033 impl->filters = g_slist_remove (impl->filters, filter);
4034
4035- if (filter == impl->current_filter)
4036- {
4037- if (impl->filters)
4038- set_current_filter (impl, impl->filters->data);
4039- else
4040- set_current_filter (impl, NULL);
4041- }
4042-
4043- /* Remove row from the combo box */
4044- model = gtk_combo_box_get_model (GTK_COMBO_BOX (impl->filter_combo));
4045- gtk_tree_model_iter_nth_child (model, &iter, NULL, filter_index);
4046- gtk_list_store_remove (GTK_LIST_STORE (model), &iter);
4047-
4048- g_object_unref (filter);
4049-
4050- if (!impl->filters)
4051- show_filters (impl, FALSE);
4052-}
4053-
4054-static GSList *
4055-gtk_file_chooser_default_list_filters (GtkFileChooser *chooser)
4056-{
4057- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4058-
4059- return g_slist_copy (impl->filters);
4060-}
4061-
4062-/* Returns the position in the shortcuts tree where the nth specified shortcut would appear */
4063-static int
4064-shortcuts_get_pos_for_shortcut_folder (GtkFileChooserDefault *impl,
4065- int pos)
4066-{
4067- return pos + shortcuts_get_index (impl, SHORTCUTS_SHORTCUTS);
4068-}
4069-
4070-static gboolean
4071-gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
4072- const GtkFilePath *path,
4073- GError **error)
4074-{
4075- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4076- gboolean result;
4077- int pos;
4078-
4079- /* Test validity of path here. */
4080- if (!check_is_folder (impl->file_system, path, error))
4081- return FALSE;
4082-
4083- pos = shortcuts_get_pos_for_shortcut_folder (impl, impl->num_shortcuts);
4084-
4085- result = shortcuts_insert_path (impl, pos, FALSE, NULL, path, NULL, FALSE, error);
4086-
4087- if (result)
4088- impl->num_shortcuts++;
4089-
4090- if (impl->shortcuts_filter_model)
4091- gtk_tree_model_filter_refilter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model));
4092-
4093- return result;
4094-}
4095-
4096-static gboolean
4097-gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser,
4098- const GtkFilePath *path,
4099- GError **error)
4100-{
4101- GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4102- int pos;
4103- GtkTreeIter iter;
4104- char *uri;
4105- int i;
4106-
4107- if (impl->num_shortcuts == 0)
4108- goto out;
4109-
4110- pos = shortcuts_get_pos_for_shortcut_folder (impl, 0);
4111- if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos))
4112- g_assert_not_reached ();
4113-
4114- for (i = 0; i < impl->num_shortcuts; i++)
4115- {
4116- gpointer col_data;
4117- gboolean is_volume;
4118- GtkFilePath *shortcut;
4119-
4120- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
4121- SHORTCUTS_COL_DATA, &col_data,
4122- SHORTCUTS_COL_IS_VOLUME, &is_volume,
4123- -1);
4124- g_assert (col_data != NULL);
4125- g_assert (!is_volume);
4126-
4127- shortcut = col_data;
4128- if (gtk_file_path_compare (shortcut, path) == 0)
4129- {
4130- shortcuts_remove_rows (impl, pos + i, 1);
4131- impl->num_shortcuts--;
4132- return TRUE;
4133- }
4134-
4135- if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
4136- g_assert_not_reached ();
4137+ if (filter == impl->current_filter)
4138+ {
4139+ if (impl->filters)
4140+ set_current_filter (impl, impl->filters->data);
4141+ else
4142+ set_current_filter (impl, NULL);
4143 }
4144
4145- out:
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
4151- uri = gtk_file_system_path_to_uri (impl->file_system, path);
4152- g_set_error (error,
4153- GTK_FILE_CHOOSER_ERROR,
4154- GTK_FILE_CHOOSER_ERROR_NONEXISTENT,
4155- _("Shortcut %s does not exist"),
4156- uri);
4157- g_free (uri);
4158+ g_object_unref (filter);
4159
4160- return FALSE;
4161+ if (!impl->filters)
4162+ show_filters (impl, FALSE);
4163 }
4164
4165 static GSList *
4166-gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
4167+gtk_file_chooser_default_list_filters (GtkFileChooser *chooser)
4168 {
4169 GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (chooser);
4170- int pos;
4171- GtkTreeIter iter;
4172- int i;
4173- GSList *list;
4174
4175- if (impl->num_shortcuts == 0)
4176- return NULL;
4177-
4178- pos = shortcuts_get_pos_for_shortcut_folder (impl, 0);
4179- if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos))
4180- g_assert_not_reached ();
4181-
4182- list = NULL;
4183-
4184- for (i = 0; i < impl->num_shortcuts; i++)
4185- {
4186- gpointer col_data;
4187- gboolean is_volume;
4188- GtkFilePath *shortcut;
4189-
4190- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), &iter,
4191- SHORTCUTS_COL_DATA, &col_data,
4192- SHORTCUTS_COL_IS_VOLUME, &is_volume,
4193- -1);
4194- g_assert (col_data != NULL);
4195- g_assert (!is_volume);
4196-
4197- shortcut = col_data;
4198- list = g_slist_prepend (list, gtk_file_path_copy (shortcut));
4199-
4200- if (i != impl->num_shortcuts - 1)
4201- {
4202- if (!gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
4203- g_assert_not_reached ();
4204- }
4205- }
4206-
4207- return g_slist_reverse (list);
4208+ return g_slist_copy (impl->filters);
4209 }
4210
4211 /* Guesses a size based upon font sizes */
4212@@ -5386,7 +2912,6 @@
4213 gint default_width, default_height;
4214 int font_size;
4215 GtkRequisition req;
4216- GtkRequisition preview_req;
4217
4218 g_assert (widget->style != NULL);
4219 impl = GTK_FILE_CHOOSER_DEFAULT (widget);
4220@@ -5400,12 +2925,7 @@
4221 /* Use at least the requisition size not including the preview widget */
4222 gtk_widget_size_request (widget, &req);
4223
4224- if (impl->preview_widget_active && impl->preview_widget)
4225- gtk_widget_size_request (impl->preview_box, &preview_req);
4226- else
4227- preview_req.width = 0;
4228-
4229- default_width = MAX (default_width, (req.width - (preview_req.width + PREVIEW_HBOX_SPACING)));
4230+ default_width = MAX (default_width, (req.width - (LIST_HBOX_SPACING)));
4231 default_height = MAX (default_height, req.height);
4232
4233 *width = default_width;
4234@@ -5423,8 +2943,6 @@
4235
4236 find_good_size_from_style (GTK_WIDGET (chooser_embed), default_width, default_height);
4237
4238- if (impl->preview_widget_active && impl->preview_widget)
4239- *default_width += impl->preview_box->requisition.width + PREVIEW_HBOX_SPACING;
4240 }
4241
4242 static void
4243@@ -5441,16 +2959,6 @@
4244
4245 *resize_horizontally = TRUE;
4246 *resize_vertically = TRUE;
4247-
4248- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
4249- impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
4250- {
4251- if (! gtk_expander_get_expanded (GTK_EXPANDER (impl->save_expander)))
4252- {
4253- *resize_horizontally = FALSE;
4254- *resize_vertically = FALSE;
4255- }
4256- }
4257 }
4258
4259 struct switch_folder_closure {
4260@@ -5517,84 +3025,49 @@
4261
4262 if (current_focus == impl->browse_files_tree_view)
4263 {
4264- /* The following array encodes what we do based on the impl->action and the
4265- * number of files selected.
4266- */
4267- typedef enum {
4268- NOOP, /* Do nothing (don't respond) */
4269- RESPOND, /* Respond immediately */
4270- RESPOND_OR_SWITCH, /* Respond immediately if the selected item is a file; switch to it if it is a folder */
4271- ALL_FILES, /* Respond only if everything selected is a file */
4272- ALL_FOLDERS, /* Respond only if everything selected is a folder */
4273- SAVE_ENTRY, /* Go to the code for handling the save entry */
4274- NOT_REACHED /* Sanity check */
4275- } ActionToTake;
4276- static const ActionToTake what_to_do[4][3] = {
4277- /* 0 selected 1 selected many selected */
4278- /* ACTION_OPEN */ { NOOP, RESPOND_OR_SWITCH, ALL_FILES },
4279- /* ACTION_SAVE */ { SAVE_ENTRY, RESPOND_OR_SWITCH, NOT_REACHED },
4280- /* ACTION_SELECT_FOLDER */ { RESPOND, ALL_FOLDERS, ALL_FOLDERS },
4281- /* ACTION_CREATE_FOLDER */ { SAVE_ENTRY, ALL_FOLDERS, NOT_REACHED }
4282- };
4283-
4284 int num_selected;
4285 gboolean all_files, all_folders;
4286- int k;
4287- ActionToTake action;
4288
4289 file_list:
4290
4291- g_assert (impl->action >= GTK_FILE_CHOOSER_ACTION_OPEN && impl->action <= GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
4292-
4293 selection_check (impl, &num_selected, &all_files, &all_folders);
4294
4295- if (num_selected > 2)
4296- k = 2;
4297- else
4298- k = num_selected;
4299-
4300- action = what_to_do [impl->action] [k];
4301-
4302- switch (action)
4303+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
4304 {
4305- case NOOP:
4306- return FALSE;
4307-
4308- case RESPOND:
4309- return TRUE;
4310-
4311- case RESPOND_OR_SWITCH:
4312- g_assert (num_selected == 1);
4313-
4314- if (all_folders)
4315+ if (num_selected != 1)
4316+ return TRUE; /* zero means current folder; more than one means use the whole selection */
4317+ else if (current_focus != impl->browse_files_tree_view)
4318 {
4319- switch_to_selected_folder (impl);
4320- return FALSE;
4321+ /* a single folder is selected and a button was clicked */
4322+ switch_to_selected_folder (impl);
4323+ return TRUE;
4324 }
4325- else
4326- return TRUE;
4327-
4328- case ALL_FILES:
4329- return all_files;
4330-
4331- case ALL_FOLDERS:
4332- return all_folders;
4333+ }
4334
4335- case SAVE_ENTRY:
4336- goto save_entry;
4337+ if (num_selected == 0)
4338+ {
4339+ if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
4340+ || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
4341+ goto save_entry; /* it makes sense to use the typed name */
4342+ else
4343+ return FALSE;
4344+ }
4345
4346- default:
4347- g_assert_not_reached ();
4348+ if (num_selected == 1 && all_folders)
4349+ {
4350+ switch_to_selected_folder (impl);
4351+ return FALSE;
4352 }
4353+ else
4354+ return all_files;
4355 }
4356 else if (current_focus == impl->save_file_name_entry)
4357 {
4358 GtkFilePath *path;
4359- gboolean is_well_formed, is_empty, is_file_part_empty;
4360+ gboolean is_valid, is_empty;
4361 gboolean is_folder;
4362 gboolean retval;
4363- GtkFileChooserEntry *entry;
4364- GError *error;
4365+ GtkFileChooserEntry *entry;
4366
4367 save_entry:
4368
4369@@ -5602,103 +3075,39 @@
4370 || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER);
4371
4372 entry = GTK_FILE_CHOOSER_ENTRY (impl->save_file_name_entry);
4373- check_save_entry (impl, &path, &is_well_formed, &is_empty, &is_file_part_empty);
4374+ path = check_save_entry (impl, &is_valid, &is_empty);
4375
4376- if (is_empty || !is_well_formed)
4377+ if (!is_empty && !is_valid)
4378 return FALSE;
4379
4380- g_assert (path != NULL);
4381-
4382- error = NULL;
4383- is_folder = check_is_folder (impl->file_system, path, &error);
4384+ if (is_empty)
4385+ path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry));
4386+
4387+ is_folder = check_is_folder (impl->file_system, path, NULL);
4388 if (is_folder)
4389 {
4390- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
4391- {
4392- _gtk_file_chooser_entry_set_file_part (entry, "");
4393- change_folder_and_display_error (impl, path);
4394- retval = FALSE;
4395- }
4396- else /* GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER */
4397- {
4398- /* The folder already exists, so we do not need to create it.
4399- * Just respond to terminate the dialog.
4400- */
4401- retval = TRUE;
4402- }
4403+ _gtk_file_chooser_entry_set_file_part (entry, "");
4404+ change_folder_and_display_error (impl, path);
4405+ retval = FALSE;
4406 }
4407 else
4408 {
4409- if (impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER
4410- && g_error_matches (error, GTK_FILE_SYSTEM_ERROR, GTK_FILE_SYSTEM_ERROR_NOT_FOLDER))
4411+ /* check that everything up to the last component exists */
4412+ gtk_file_path_free (path);
4413+ path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry));
4414+ is_folder = check_is_folder (impl->file_system, path, NULL);
4415+ if (!is_folder)
4416 {
4417- /* Oops, the user typed the name of an existing path which is not a folder */
4418- error_creating_folder_over_existing_file_dialog (impl, path, error);
4419- error = NULL; /* as it will be freed below for the general case */
4420+ change_folder_and_display_error (impl, path);
4421 retval = FALSE;
4422 }
4423 else
4424- {
4425- GtkFilePath *parent_path;
4426-
4427- /* check that everything up to the last component exists */
4428-
4429- parent_path = gtk_file_path_copy (_gtk_file_chooser_entry_get_current_folder (entry));
4430- is_folder = check_is_folder (impl->file_system, parent_path, NULL);
4431- if (is_folder)
4432- {
4433- if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE)
4434- retval = TRUE;
4435- else /* GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER */
4436- {
4437- GError *create_error;
4438-
4439- create_error = NULL;
4440- if (gtk_file_system_create_folder (impl->file_system, path, &create_error))
4441- retval = TRUE;
4442- else
4443- {
4444- error_creating_folder_dialog (impl, path, create_error);
4445- retval = FALSE;
4446- }
4447- }
4448- }
4449- else
4450- {
4451- /* This will display an error, which is what we want */
4452- change_folder_and_display_error (impl, parent_path);
4453- retval = FALSE;
4454- }
4455-
4456- gtk_file_path_free (parent_path);
4457- }
4458-
4459- if (error != NULL)
4460- g_error_free (error);
4461+ retval = TRUE;
4462 }
4463
4464 gtk_file_path_free (path);
4465 return retval;
4466 }
4467- else if (impl->toplevel_last_focus_widget == impl->browse_shortcuts_tree_view)
4468- {
4469- /* The focus is on a dialog's action area button, *and* the widget that
4470- * was focused immediately before it is the shortcuts list. Switch to the
4471- * selected shortcut and tell the caller not to respond.
4472- */
4473- GtkTreeIter iter;
4474-
4475- if (shortcuts_get_selected (impl, &iter))
4476- {
4477- shortcuts_activate_iter (impl, &iter);
4478-
4479- gtk_widget_grab_focus (impl->browse_files_tree_view);
4480- }
4481- else
4482- goto file_list;
4483-
4484- return FALSE;
4485- }
4486 else if (impl->toplevel_last_focus_widget == impl->browse_files_tree_view)
4487 {
4488 /* The focus is on a dialog's action area button, *and* the widget that
4489@@ -5786,199 +3195,6 @@
4490 set_current_filter (impl, new_filter);
4491 }
4492
4493-static void
4494-check_preview_change (GtkFileChooserDefault *impl)
4495-{
4496- GtkTreePath *cursor_path;
4497- const GtkFilePath *new_path;
4498- const GtkFileInfo *new_info;
4499-
4500- gtk_tree_view_get_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view), &cursor_path, NULL);
4501- if (cursor_path && impl->sort_model)
4502- {
4503- GtkTreeIter iter;
4504- GtkTreeIter child_iter;
4505-
4506- gtk_tree_model_get_iter (GTK_TREE_MODEL (impl->sort_model), &iter, cursor_path);
4507- gtk_tree_path_free (cursor_path);
4508-
4509- gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model, &child_iter, &iter);
4510-
4511- new_path = _gtk_file_system_model_get_path (impl->browse_files_model, &child_iter);
4512- new_info = _gtk_file_system_model_get_info (impl->browse_files_model, &child_iter);
4513- }
4514- else
4515- {
4516- new_path = NULL;
4517- new_info = NULL;
4518- }
4519-
4520- if (new_path != impl->preview_path &&
4521- !(new_path && impl->preview_path &&
4522- gtk_file_path_compare (new_path, impl->preview_path) == 0))
4523- {
4524- if (impl->preview_path)
4525- {
4526- gtk_file_path_free (impl->preview_path);
4527- g_free (impl->preview_display_name);
4528- }
4529-
4530- if (new_path)
4531- {
4532- impl->preview_path = gtk_file_path_copy (new_path);
4533- impl->preview_display_name = g_strdup (gtk_file_info_get_display_name (new_info));
4534- }
4535- else
4536- {
4537- impl->preview_path = NULL;
4538- impl->preview_display_name = NULL;
4539- }
4540-
4541- if (impl->use_preview_label && impl->preview_label)
4542- gtk_label_set_text (GTK_LABEL (impl->preview_label), impl->preview_display_name);
4543-
4544- g_signal_emit_by_name (impl, "update-preview");
4545- }
4546-}
4547-
4548-/* Activates a volume by mounting it if necessary and then switching to its
4549- * base path.
4550- */
4551-static void
4552-shortcuts_activate_volume (GtkFileChooserDefault *impl,
4553- GtkFileSystemVolume *volume)
4554-{
4555- GtkFilePath *path;
4556-
4557- /* We ref the file chooser since volume_mount() may run a main loop, and the
4558- * user could close the file chooser window in the meantime.
4559- */
4560- g_object_ref (impl);
4561-
4562- if (!gtk_file_system_volume_get_is_mounted (impl->file_system, volume))
4563- {
4564- GError *error;
4565- gboolean result;
4566-
4567- set_busy_cursor (impl, TRUE);
4568-
4569- error = NULL;
4570- result = gtk_file_system_volume_mount (impl->file_system, volume, &error);
4571-
4572- if (!result)
4573- {
4574- char *msg;
4575-
4576- msg = g_strdup_printf (_("Could not mount %s"),
4577- gtk_file_system_volume_get_display_name (impl->file_system, volume));
4578- error_message (impl, msg, error->message);
4579- g_free (msg);
4580- g_error_free (error);
4581- }
4582-
4583- set_busy_cursor (impl, FALSE);
4584-
4585- if (!result)
4586- goto out;
4587- }
4588-
4589- path = gtk_file_system_volume_get_base_path (impl->file_system, volume);
4590- change_folder_and_display_error (impl, path);
4591- gtk_file_path_free (path);
4592-
4593- out:
4594-
4595- g_object_unref (impl);
4596-}
4597-
4598-/* Opens the folder or volume at the specified iter in the shortcuts model */
4599-static void
4600-shortcuts_activate_iter (GtkFileChooserDefault *impl,
4601- GtkTreeIter *iter)
4602-{
4603- gpointer col_data;
4604- gboolean is_volume;
4605-
4606- gtk_tree_model_get (GTK_TREE_MODEL (impl->shortcuts_model), iter,
4607- SHORTCUTS_COL_DATA, &col_data,
4608- SHORTCUTS_COL_IS_VOLUME, &is_volume,
4609- -1);
4610-
4611- if (!col_data)
4612- return; /* We are on a separator */
4613-
4614- if (is_volume)
4615- {
4616- GtkFileSystemVolume *volume;
4617-
4618- volume = col_data;
4619-
4620- shortcuts_activate_volume (impl, volume);
4621- }
4622- else
4623- {
4624- const GtkFilePath *file_path;
4625-
4626- file_path = col_data;
4627- change_folder_and_display_error (impl, file_path);
4628- }
4629-}
4630-
4631-/* Callback used when a row in the shortcuts list is activated */
4632-static void
4633-shortcuts_row_activated_cb (GtkTreeView *tree_view,
4634- GtkTreePath *path,
4635- GtkTreeViewColumn *column,
4636- GtkFileChooserDefault *impl)
4637-{
4638- GtkTreeIter iter;
4639- GtkTreeIter child_iter;
4640-
4641- if (!gtk_tree_model_get_iter (impl->shortcuts_filter_model, &iter, path))
4642- return;
4643-
4644- gtk_tree_model_filter_convert_iter_to_child_iter (GTK_TREE_MODEL_FILTER (impl->shortcuts_filter_model),
4645- &child_iter,
4646- &iter);
4647- shortcuts_activate_iter (impl, &child_iter);
4648-
4649- gtk_widget_grab_focus (impl->browse_files_tree_view);
4650-}
4651-
4652-/* Handler for GtkWidget::key-press-event on the shortcuts list */
4653-static gboolean
4654-shortcuts_key_press_event_cb (GtkWidget *widget,
4655- GdkEventKey *event,
4656- GtkFileChooserDefault *impl)
4657-{
4658- guint modifiers;
4659-
4660- modifiers = gtk_accelerator_get_default_mod_mask ();
4661-
4662- if ((event->keyval == GDK_BackSpace
4663- || event->keyval == GDK_Delete
4664- || event->keyval == GDK_KP_Delete)
4665- && (event->state & modifiers) == 0)
4666- {
4667- remove_selected_bookmarks (impl);
4668- return TRUE;
4669- }
4670-
4671- return FALSE;
4672-}
4673-
4674-static gboolean
4675-shortcuts_select_func (GtkTreeSelection *selection,
4676- GtkTreeModel *model,
4677- GtkTreePath *path,
4678- gboolean path_currently_selected,
4679- gpointer data)
4680-{
4681- GtkFileChooserDefault *impl = data;
4682-
4683- return (*gtk_tree_path_get_indices (path) != shortcuts_get_index (impl, SHORTCUTS_BOOKMARKS_SEPARATOR));
4684-}
4685-
4686 static gboolean
4687 list_select_func (GtkTreeSelection *selection,
4688 GtkTreeModel *model,
4689@@ -6022,7 +3238,7 @@
4690 g_assert (!impl->select_multiple);
4691 selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
4692 if (!gtk_tree_selection_get_selected (selection, NULL, &iter))
4693- goto out; /* normal processing */
4694+ return;
4695
4696 gtk_tree_model_sort_convert_iter_to_child_iter (impl->sort_model,
4697 &child_iter,
4698@@ -6033,11 +3249,7 @@
4699 return; /* We are on the editable row for New Folder */
4700 }
4701
4702- out:
4703-
4704 update_chooser_entry (impl);
4705- check_preview_change (impl);
4706- bookmarks_check_add_sensitivity (impl);
4707
4708 g_signal_emit_by_name (impl, "selection-changed", 0);
4709 }
4710@@ -6074,23 +3286,6 @@
4711 g_signal_emit_by_name (impl, "file-activated");
4712 }
4713
4714-static void
4715-path_bar_clicked (GtkPathBar *path_bar,
4716- GtkFilePath *file_path,
4717- gboolean child_is_hidden,
4718- GtkFileChooserDefault *impl)
4719-{
4720- if (!change_folder_and_display_error (impl, file_path))
4721- return;
4722-
4723- /* Say we have "/foo/bar/[.baz]" and the user clicks on "bar". We should then
4724- * show hidden files so that ".baz" appears in the file list, as it will still
4725- * be shown in the path bar: "/foo/[bar]/.baz"
4726- */
4727- if (child_is_hidden)
4728- g_object_set (impl, "show-hidden", TRUE, NULL);
4729-}
4730-
4731 static const GtkFileInfo *
4732 get_list_file_info (GtkFileChooserDefault *impl,
4733 GtkTreeIter *iter)
4734@@ -6257,33 +3452,31 @@
4735
4736 time_mtime = gtk_file_info_get_modification_time (info);
4737
4738- if (time_mtime == 0)
4739- strcpy (buf, _("Unknown"));
4740- else
4741- {
4742- g_date_set_time (&mtime, (GTime) time_mtime);
4743+#ifdef GTK26
4744+ g_date_set_time (&mtime, (GTime) time_mtime);
4745+#else
4746+ g_date_set_time_t (&mtime, time_mtime);
4747+#endif
4748+ time_now = (GTime ) time (NULL);
4749+ g_date_set_time (&now, (GTime) time_now);
4750
4751- time_now = (GTime ) time (NULL);
4752- g_date_set_time (&now, (GTime) time_now);
4753+ days_diff = g_date_get_julian (&now) - g_date_get_julian (&mtime);
4754
4755- days_diff = g_date_get_julian (&now) - g_date_get_julian (&mtime);
4756+ if (days_diff == 0)
4757+ strcpy (buf, _("Today"));
4758+ else if (days_diff == 1)
4759+ strcpy (buf, _("Yesterday"));
4760+ else
4761+ {
4762+ char *format;
4763
4764- if (days_diff == 0)
4765- strcpy (buf, _("Today"));
4766- else if (days_diff == 1)
4767- strcpy (buf, _("Yesterday"));
4768+ if (days_diff > 1 && days_diff < 7)
4769+ format = "%A"; /* Days from last week */
4770 else
4771- {
4772- char *format;
4773+ format = "%x"; /* Any other date */
4774
4775- if (days_diff > 1 && days_diff < 7)
4776- format = "%A"; /* Days from last week */
4777- else
4778- format = "%x"; /* Any other date */
4779-
4780- if (g_date_strftime (buf, sizeof (buf), format, &mtime) == 0)
4781- strcpy (buf, _("Unknown"));
4782- }
4783+ if (g_date_strftime (buf, sizeof (buf), format, &mtime) == 0)
4784+ strcpy (buf, _("Unknown"));
4785 }
4786
4787 if (impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
4788@@ -6376,8 +3569,11 @@
4789 */
4790
4791 error = NULL;
4792+#ifdef GTK26
4793 folder = gtk_file_system_get_folder (impl->file_system, folder_path, GTK_FILE_INFO_IS_FOLDER, &error);
4794-
4795+#else
4796+ folder = gtk_file_system_get_folder (impl->file_system, folder_path, GTK_FILE_INFO_IS_FOLDER, NULL, NULL);
4797+#endif
4798 if (!folder)
4799 {
4800 error_getting_info_dialog (impl, folder_path, error);
4801@@ -6487,8 +3683,8 @@
4802 accept_stock, GTK_RESPONSE_ACCEPT,
4803 NULL);
4804 gtk_window_set_default_size (GTK_WINDOW (dialog), 300, -1);
4805- gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
4806- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2);
4807+ gtk_container_set_border_width (GTK_CONTAINER (dialog), DEFAULT_SPACING);
4808+ gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), DEFAULT_SPACING);
4809 gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_ACCEPT);
4810
4811 gtk_dialog_set_alternative_button_order (GTK_DIALOG (dialog),
4812@@ -6496,17 +3692,16 @@
4813 GTK_RESPONSE_CANCEL,
4814 -1);
4815
4816- hbox = gtk_hbox_new (FALSE, 12);
4817+ hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING);
4818 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 0);
4819 gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
4820
4821- label = gtk_label_new_with_mnemonic (_("_Location:"));
4822+ label = gtk_label_new (_("Location:"));
4823 gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
4824
4825 entry = location_entry_create (impl, path);
4826
4827 gtk_box_pack_start (GTK_BOX (hbox), entry, TRUE, TRUE, 0);
4828- gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry);
4829
4830 /* Run */
4831
4832@@ -6555,115 +3750,68 @@
4833 static void
4834 up_folder_handler (GtkFileChooserDefault *impl)
4835 {
4836+ GtkFilePath * parent;
4837 pending_select_paths_add (impl, impl->current_folder);
4838- _gtk_path_bar_up (GTK_PATH_BAR (impl->browse_path_bar));
4839+
4840+ if (gtk_file_system_get_parent (impl->file_system, impl->current_folder,
4841+ &parent, NULL) && parent)
4842+ {
4843+ impl->path_history = g_slist_prepend (impl->path_history,
4844+ gtk_file_path_copy (impl->current_folder));
4845+
4846+ change_folder_and_display_error (impl, parent);
4847+ gtk_file_path_free (parent);
4848+ }
4849 }
4850
4851 /* Handler for the "down-folder" keybinding signal */
4852 static void
4853 down_folder_handler (GtkFileChooserDefault *impl)
4854 {
4855- _gtk_path_bar_down (GTK_PATH_BAR (impl->browse_path_bar));
4856+ if (impl->path_history)
4857+ {
4858+ const GtkFilePath * path = impl->path_history->data;
4859+
4860+ change_folder_and_display_error (impl, path);
4861+ impl->path_history = g_slist_remove (impl->path_history, path);
4862+ gtk_file_path_free (path);
4863+ }
4864 }
4865
4866 /* Handler for the "home-folder" keybinding signal */
4867 static void
4868 home_folder_handler (GtkFileChooserDefault *impl)
4869 {
4870- int pos;
4871- GtkTreeIter iter;
4872-
4873- if (!impl->has_home)
4874- return; /* Should we put up an error dialog? */
4875-
4876- pos = shortcuts_get_index (impl, SHORTCUTS_HOME);
4877- if (!gtk_tree_model_iter_nth_child (GTK_TREE_MODEL (impl->shortcuts_model), &iter, NULL, pos))
4878- g_assert_not_reached ();
4879-
4880- shortcuts_activate_iter (impl, &iter);
4881-}
4882-
4883-
4884-
4885-/* Drag and drop interfaces */
4886-
4887-static void
4888-_shortcuts_model_filter_class_init (ShortcutsModelFilterClass *class)
4889-{
4890 }
4891
4892-static void
4893-_shortcuts_model_filter_init (ShortcutsModelFilter *model)
4894+static GtkFilePath *
4895+gtk_file_chooser_default_get_preview_path (GtkFileChooser *chooser)
4896 {
4897- model->impl = NULL;
4898+ return NULL;
4899 }
4900
4901-/* GtkTreeDragSource::row_draggable implementation for the shortcuts filter model */
4902 static gboolean
4903-shortcuts_model_filter_row_draggable (GtkTreeDragSource *drag_source,
4904- GtkTreePath *path)
4905+gtk_file_chooser_default_add_shortcut_folder (GtkFileChooser *chooser,
4906+ const GtkFilePath *path,
4907+ GError **error)
4908 {
4909- ShortcutsModelFilter *model;
4910- int pos;
4911- int bookmarks_pos;
4912-
4913- model = SHORTCUTS_MODEL_FILTER (drag_source);
4914-
4915- pos = *gtk_tree_path_get_indices (path);
4916- bookmarks_pos = shortcuts_get_index (model->impl, SHORTCUTS_BOOKMARKS);
4917-
4918- return (pos >= bookmarks_pos && pos < bookmarks_pos + model->impl->num_bookmarks);
4919+ return FALSE;
4920 }
4921
4922-/* GtkTreeDragSource::drag_data_get implementation for the shortcuts filter model */
4923 static gboolean
4924-shortcuts_model_filter_drag_data_get (GtkTreeDragSource *drag_source,
4925- GtkTreePath *path,
4926- GtkSelectionData *selection_data)
4927-{
4928- ShortcutsModelFilter *model;
4929-
4930- model = SHORTCUTS_MODEL_FILTER (drag_source);
4931-
4932- /* FIXME */
4933-
4934- return FALSE;
4935-}
4936-
4937-/* Fill the GtkTreeDragSourceIface vtable */
4938-static void
4939-shortcuts_model_filter_drag_source_iface_init (GtkTreeDragSourceIface *iface)
4940+gtk_file_chooser_default_remove_shortcut_folder (GtkFileChooser *chooser,
4941+ const GtkFilePath *path,
4942+ GError **error)
4943 {
4944- iface->row_draggable = shortcuts_model_filter_row_draggable;
4945- iface->drag_data_get = shortcuts_model_filter_drag_data_get;
4946+ return TRUE;
4947 }
4948
4949-#if 0
4950-/* Fill the GtkTreeDragDestIface vtable */
4951-static void
4952-shortcuts_model_filter_drag_dest_iface_init (GtkTreeDragDestIface *iface)
4953+static GSList *
4954+gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser)
4955 {
4956- iface->drag_data_received = shortcuts_model_filter_drag_data_received;
4957- iface->row_drop_possible = shortcuts_model_filter_row_drop_possible;
4958+ return NULL;
4959 }
4960-#endif
4961
4962-static GtkTreeModel *
4963-shortcuts_model_filter_new (GtkFileChooserDefault *impl,
4964- GtkTreeModel *child_model,
4965- GtkTreePath *root)
4966-{
4967- ShortcutsModelFilter *model;
4968-
4969- model = g_object_new (SHORTCUTS_MODEL_FILTER_TYPE,
4970- "child_model", child_model,
4971- "virtual_root", root,
4972- NULL);
4973-
4974- model->impl = impl;
4975-
4976- return GTK_TREE_MODEL (model);
4977-}
4978
4979 #define __GTK_FILE_CHOOSER_DEFAULT_C__
4980 #include "gtkaliasdef.c"
diff --git a/meta/packages/gtk+/gtk+-2.6.8/filechooser-respect-style.patch b/meta/packages/gtk+/gtk+-2.6.8/filechooser-respect-style.patch
deleted file mode 100644
index 76c66a7d2a..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/filechooser-respect-style.patch
+++ /dev/null
@@ -1,77 +0,0 @@
1--- gtk+-2.6.8/gtk/gtkfilechooserdialog.c.orig 2007-02-09 12:18:25.000000000 +0000
2+++ gtk+-2.6.8/gtk/gtkfilechooserdialog.c 2007-02-09 12:18:25.000000000 +0000
3@@ -62,8 +62,6 @@
4
5 static void gtk_file_chooser_dialog_map (GtkWidget *widget);
6 static void gtk_file_chooser_dialog_unmap (GtkWidget *widget);
7-static void gtk_file_chooser_dialog_style_set (GtkWidget *widget,
8- GtkStyle *previous_style);
9
10 static void response_cb (GtkDialog *dialog,
11 gint response_id);
12@@ -122,7 +120,6 @@
13
14 widget_class->map = gtk_file_chooser_dialog_map;
15 widget_class->unmap = gtk_file_chooser_dialog_unmap;
16- widget_class->style_set = gtk_file_chooser_dialog_style_set;
17
18 _gtk_file_chooser_install_properties (gobject_class);
19
20@@ -135,13 +132,19 @@
21 GtkFileChooserDialogPrivate *priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
22 GTK_TYPE_FILE_CHOOSER_DIALOG,
23 GtkFileChooserDialogPrivate);
24+
25+ GtkDialog *fc_dialog = GTK_DIALOG (dialog);
26+
27 dialog->priv = priv;
28 dialog->priv->default_width = -1;
29 dialog->priv->default_height = -1;
30 dialog->priv->resize_horizontally = TRUE;
31 dialog->priv->resize_vertically = TRUE;
32
33- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
34+ gtk_dialog_set_has_separator (fc_dialog, FALSE);
35+ gtk_container_set_border_width (GTK_CONTAINER (fc_dialog), 5);
36+ gtk_box_set_spacing (GTK_BOX (fc_dialog->vbox), 2); /* 2 * 5 + 2 = 12 */
37+ gtk_container_set_border_width (GTK_CONTAINER (fc_dialog->action_area), 5);
38
39 /* We do a signal connection here rather than overriding the method in
40 * class_init because GtkDialog::response is a RUN_LAST signal. We want *our*
41@@ -394,6 +397,7 @@
42 g_signal_connect (priv->widget, "default-size-changed",
43 G_CALLBACK (file_chooser_widget_default_size_changed), object);
44
45+ gtk_container_set_border_width (GTK_CONTAINER (priv->widget), 5);
46 gtk_box_pack_start (GTK_BOX (GTK_DIALOG (object)->vbox), priv->widget, TRUE, TRUE, 0);
47
48 gtk_widget_show (priv->widget);
49@@ -522,28 +526,6 @@
50 gtk_widget_unmap (priv->widget);
51 }
52
53-static void
54-gtk_file_chooser_dialog_style_set (GtkWidget *widget,
55- GtkStyle *previous_style)
56-{
57- GtkDialog *dialog;
58-
59- if (GTK_WIDGET_CLASS (parent_class)->style_set)
60- GTK_WIDGET_CLASS (parent_class)->style_set (widget, previous_style);
61-
62- dialog = GTK_DIALOG (widget);
63-
64- /* Override the style properties with HIG-compliant spacings. Ugh.
65- * http://developer.gnome.org/projects/gup/hig/1.0/layout.html#layout-dialogs
66- * http://developer.gnome.org/projects/gup/hig/1.0/windows.html#alert-spacing
67- */
68-
69- gtk_container_set_border_width (GTK_CONTAINER (dialog->vbox), 12);
70- gtk_box_set_spacing (GTK_BOX (dialog->vbox), 24);
71-
72- gtk_container_set_border_width (GTK_CONTAINER (dialog->action_area), 0);
73- gtk_box_set_spacing (GTK_BOX (dialog->action_area), 6);
74-}
75
76 /* GtkDialog::response handler */
77 static void
diff --git a/meta/packages/gtk+/gtk+-2.6.8/filesystem-volumes.patch b/meta/packages/gtk+/gtk+-2.6.8/filesystem-volumes.patch
deleted file mode 100644
index 4386d83ee9..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/filesystem-volumes.patch
+++ /dev/null
@@ -1,182 +0,0 @@
1--- gtk+-2.6.8/gtk/gtkfilesystemunix.c.orig 2007-02-08 12:01:19.000000000 +0000
2+++ gtk+-2.6.8/gtk/gtkfilesystemunix.c 2007-02-08 12:01:19.000000000 +0000
3@@ -33,6 +33,7 @@
4 #include <errno.h>
5 #include <string.h>
6 #include <sys/stat.h>
7+#include <sys/statvfs.h>
8 #include <sys/types.h>
9 #include <pwd.h>
10 #ifdef HAVE_UNISTD_H
11@@ -358,7 +359,49 @@
12 static GSList *
13 gtk_file_system_unix_list_volumes (GtkFileSystem *file_system)
14 {
15- return g_slist_append (NULL, get_root_volume ());
16+ struct statvfs stv;
17+ struct stat st;
18+ GSList * l = g_slist_append (NULL, get_root_volume ());
19+
20+ if (!statvfs ("/.", &stv))
21+ {
22+ fsblkcnt_t root_blocks = stv.f_blocks;
23+ fsfilcnt_t root_files = stv.f_files;
24+
25+ GDir * dir;
26+ if ((dir = g_dir_open ("/media", 0, NULL)) != NULL)
27+ {
28+ const gchar * name;
29+ while ((name = g_dir_read_name (dir)) != NULL)
30+ {
31+ gchar * abs_name = g_strconcat ("/media/", name, NULL);
32+
33+ if (!stat (abs_name, &st) && S_ISDIR (st.st_mode))
34+ {
35+ gchar * dot = g_strconcat (abs_name, "/.", NULL);
36+ if (!statvfs (dot, &stv) &&
37+ (stv.f_blocks != root_blocks ||
38+ stv.f_files != root_files))
39+ {
40+ GtkFilePath * path =
41+ gtk_file_system_filename_to_path (file_system,
42+ abs_name);
43+
44+ if (path)
45+ l = g_slist_append (l, path);
46+ }
47+
48+ g_free (dot);
49+ }
50+
51+ g_free (abs_name);
52+ }
53+
54+ g_dir_close (dir);
55+ }
56+ }
57+
58+ return l;
59 }
60
61 static GtkFileSystemVolume *
62@@ -375,10 +418,15 @@
63
64 len = strlen (filename);
65
66- if (len > 1 && filename[len - 1] == '/')
67- return g_strndup (filename, len - 1);
68- else
69- return g_memdup (filename, len + 1);
70+ if (len > 1)
71+ {
72+ gchar *c = g_utf8_prev_char (filename + len);
73+
74+ if (c && *c == '/')
75+ return g_strndup (filename, len - 1);
76+ }
77+
78+ return g_memdup (filename, len + 1);
79 }
80
81 static GtkFileFolder *
82@@ -590,7 +638,7 @@
83 gtk_file_system_unix_volume_get_base_path (GtkFileSystem *file_system,
84 GtkFileSystemVolume *volume)
85 {
86- return gtk_file_path_new_dup ("/");
87+ return gtk_file_path_copy ((GtkFilePath*)volume);
88 }
89
90 static gboolean
91@@ -616,7 +664,32 @@
92 gtk_file_system_unix_volume_get_display_name (GtkFileSystem *file_system,
93 GtkFileSystemVolume *volume)
94 {
95- return g_strdup (_("Filesystem")); /* Same as Nautilus */
96+ gchar * slash;
97+ gchar * path;
98+ gchar * c;
99+
100+ g_return_val_if_fail (file_system && volume, NULL);
101+
102+ path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume);
103+
104+ g_return_val_if_fail (path && *path, NULL);
105+
106+ if (path[0] == '/' && !path[1])
107+ return g_strdup (_("Filesystem")); /* Same as Nautilus */
108+
109+ /* Now the media volumes */
110+ /* strip trailing / if any */
111+ c = g_utf8_prev_char (path + strlen(path));
112+
113+ if (*c == '/')
114+ *c = 0;
115+
116+ slash = g_utf8_strrchr (path, -1, '/');
117+
118+ if (!slash)
119+ return g_strdup (path);
120+
121+ return g_strdup (slash + 1);
122 }
123
124 static IconType
125@@ -787,11 +860,54 @@
126 GError **error)
127 {
128 GdkPixbuf *pixbuf;
129+ gchar * slash;
130+ gchar * path;
131+ gchar * c;
132+ const gchar * id = NULL;
133+
134+ g_return_val_if_fail (file_system && volume, NULL);
135+
136+ path = gtk_file_system_path_to_filename (file_system, (GtkFilePath*) volume);
137
138- pixbuf = get_cached_icon (widget, "gnome-fs-blockdev", pixel_size);
139- if (pixbuf)
140- return pixbuf;
141+ g_return_val_if_fail (path && *path, NULL);
142+
143+ if (path[0] == '/' && !path[1])
144+ id = "gnome-fs-blockdev";
145+ else
146+ {
147+ /* Now the media volumes */
148+ /* strip trailing / if any */
149+ c = g_utf8_prev_char (path + strlen(path));
150+
151+ if (*c == '/')
152+ *c = 0;
153+
154+ slash = g_utf8_strrchr (path, -1, '/');
155
156+ if (slash)
157+ {
158+ slash++;
159+
160+ if (!strcmp (slash, "card"))
161+ id = "gnome-dev-media-sdmmc";
162+ else if (!strcmp (slash, "cf"))
163+ id = "gnome-dev-media-cf";
164+ else if (!strncmp (slash, "mmc", 3))
165+ id = "gnome-dev-media-sdmmc";
166+ else if (!strcmp (slash, "usbhdd"))
167+ id = "gnome-dev-removable-usb";
168+ else
169+ id = "gnome-dev-removable";
170+ }
171+ }
172+
173+ if (id)
174+ {
175+ pixbuf = get_cached_icon (widget, id, pixel_size);
176+ if (pixbuf)
177+ return pixbuf;
178+ }
179+
180 pixbuf = get_fallback_icon (widget, ICON_BLOCK_DEVICE, error);
181 g_assert (pixbuf != NULL);
182
diff --git a/meta/packages/gtk+/gtk+-2.6.8/gtk+-handhelds.patch b/meta/packages/gtk+/gtk+-2.6.8/gtk+-handhelds.patch
deleted file mode 100644
index 2c5fc39d23..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/gtk+-handhelds.patch
+++ /dev/null
@@ -1,186 +0,0 @@
1--- gtk+-2.4.1/gtk/gtkcalendar.c 2004-03-06 14:37:26.000000000 +1100
2+++ gtk+-2.4.1/gtk/gtkcalendar.c 2004-05-26 14:58:57.000000000 +1000
3@@ -340,6 +340,9 @@
4 static void gtk_calendar_select_and_focus_day (GtkCalendar *calendar,
5 guint day);
6
7+static void gtk_calendar_do_select_day (GtkCalendar *calendar,
8+ guint day);
9+
10 static void gtk_calendar_paint_arrow (GtkWidget *widget,
11 guint arrow);
12 static void gtk_calendar_paint_day_num (GtkWidget *widget,
13@@ -861,13 +864,13 @@
14 if (month_len < calendar->selected_day)
15 {
16 calendar->selected_day = 0;
17- gtk_calendar_select_day (calendar, month_len);
18+ gtk_calendar_do_select_day (calendar, month_len);
19 }
20 else
21 {
22 if (calendar->selected_day < 0)
23 calendar->selected_day = calendar->selected_day + 1 + month_length[leap (calendar->year)][calendar->month + 1];
24- gtk_calendar_select_day (calendar, calendar->selected_day);
25+ gtk_calendar_do_select_day (calendar, calendar->selected_day);
26 }
27
28 gtk_widget_queue_draw (GTK_WIDGET (calendar));
29@@ -908,10 +911,10 @@
30 if (month_len < calendar->selected_day)
31 {
32 calendar->selected_day = 0;
33- gtk_calendar_select_day (calendar, month_len);
34+ gtk_calendar_do_select_day (calendar, month_len);
35 }
36 else
37- gtk_calendar_select_day (calendar, calendar->selected_day);
38+ gtk_calendar_do_select_day (calendar, calendar->selected_day);
39
40 gtk_widget_queue_draw (GTK_WIDGET (calendar));
41 gtk_calendar_thaw (calendar);
42@@ -939,10 +942,10 @@
43 if (month_len < calendar->selected_day)
44 {
45 calendar->selected_day = 0;
46- gtk_calendar_select_day (calendar, month_len);
47+ gtk_calendar_do_select_day (calendar, month_len);
48 }
49 else
50- gtk_calendar_select_day (calendar, calendar->selected_day);
51+ gtk_calendar_do_select_day (calendar, calendar->selected_day);
52
53 gtk_widget_queue_draw (GTK_WIDGET (calendar));
54 gtk_calendar_thaw (calendar);
55@@ -974,10 +977,10 @@
56 if (month_len < calendar->selected_day)
57 {
58 calendar->selected_day = 0;
59- gtk_calendar_select_day (calendar, month_len);
60+ gtk_calendar_do_select_day (calendar, month_len);
61 }
62 else
63- gtk_calendar_select_day (calendar, calendar->selected_day);
64+ gtk_calendar_do_select_day (calendar, calendar->selected_day);
65
66 gtk_widget_queue_draw (GTK_WIDGET (calendar));
67 gtk_calendar_thaw (calendar);
68@@ -2480,9 +2483,9 @@
69 return TRUE;
70 }
71
72-void
73-gtk_calendar_select_day (GtkCalendar *calendar,
74- guint day)
75+static void
76+gtk_calendar_do_select_day (GtkCalendar *calendar,
77+ guint day)
78 {
79 g_return_if_fail (GTK_IS_CALENDAR (calendar));
80 g_return_if_fail (day <= 31);
81@@ -2499,6 +2502,13 @@
82 if (GTK_WIDGET_DRAWABLE (GTK_WIDGET (calendar)))
83 gtk_calendar_paint_day_num (GTK_WIDGET (calendar), selected_day);
84 }
85+}
86+
87+void
88+gtk_calendar_select_day (GtkCalendar *calendar,
89+ guint day)
90+{
91+ gtk_calendar_do_select_day (calendar, day);
92
93 calendar->selected_day = day;
94
95--- gtk+-2.4.1/gtk/gtkentry.c 2004-04-22 08:08:08.000000000 +1000
96+++ gtk+-2.4.1/gtk/gtkentry.c 2004-05-26 14:52:17.000000000 +1000
97@@ -557,6 +557,15 @@
98 0.0,
99 G_PARAM_READABLE | G_PARAM_WRITABLE));
100
101+ gtk_widget_class_install_style_property (widget_class,
102+ g_param_spec_int ("min_width",
103+ _("Minimum width"),
104+ _("Minimum width of the entry field"),
105+ 0,
106+ G_MAXINT,
107+ MIN_ENTRY_WIDTH,
108+ G_PARAM_READABLE));
109+
110 signals[POPULATE_POPUP] =
111 g_signal_new ("populate_popup",
112 G_OBJECT_CLASS_TYPE (gobject_class),
113@@ -1124,7 +1133,7 @@
114 {
115 GtkEntry *entry = GTK_ENTRY (widget);
116 PangoFontMetrics *metrics;
117- gint xborder, yborder;
118+ gint xborder, yborder, min_width;
119 PangoContext *context;
120
121 gtk_widget_ensure_style (widget);
122@@ -1140,9 +1149,11 @@
123
124 xborder += INNER_BORDER;
125 yborder += INNER_BORDER;
126-
127+
128+ gtk_widget_style_get (widget, "min_width", &min_width, NULL);
129+
130 if (entry->width_chars < 0)
131- requisition->width = MIN_ENTRY_WIDTH + xborder * 2;
132+ requisition->width = min_width + xborder * 2;
133 else
134 {
135 gint char_width = pango_font_metrics_get_approximate_char_width (metrics);
136--- gtk+-2.4.1/gtk/gtkrange.c 2004-03-06 14:38:08.000000000 +1100
137+++ gtk+-2.4.1/gtk/gtkrange.c 2004-05-26 14:52:17.000000000 +1000
138@@ -180,6 +180,7 @@
139 static GtkWidgetClass *parent_class = NULL;
140 static guint signals[LAST_SIGNAL];
141
142+static GdkAtom recognize_protocols_atom, atom_atom;
143
144 GType
145 gtk_range_get_type (void)
146@@ -220,6 +221,9 @@
147 object_class = (GtkObjectClass*) class;
148 widget_class = (GtkWidgetClass*) class;
149
150+ recognize_protocols_atom = gdk_atom_intern ("RECOGNIZE_PROTOCOLS", FALSE);
151+ atom_atom = gdk_atom_intern ("ATOM", FALSE);
152+
153 parent_class = g_type_class_peek_parent (class);
154
155 gobject_class->set_property = gtk_range_set_property;
156@@ -815,6 +819,12 @@
157 &attributes, attributes_mask);
158 gdk_window_set_user_data (range->event_window, range);
159
160+ gdk_property_change (range->event_window,
161+ recognize_protocols_atom,
162+ atom_atom,
163+ 32, GDK_PROP_MODE_REPLACE,
164+ NULL, 0);
165+
166 widget->style = gtk_style_attach (widget->style, widget->window);
167 }
168
169@@ -1186,7 +1196,7 @@
170
171 /* ignore presses when we're already doing something else. */
172 if (range->layout->grab_location != MOUSE_OUTSIDE)
173- return FALSE;
174+ return TRUE;
175
176 range->layout->mouse_x = event->x;
177 range->layout->mouse_y = event->y;
178@@ -1364,7 +1374,7 @@
179 return TRUE;
180 }
181
182- return FALSE;
183+ return TRUE;
184 }
185
186 /**
diff --git a/meta/packages/gtk+/gtk+-2.6.8/gtklabel-resize-patch b/meta/packages/gtk+/gtk+-2.6.8/gtklabel-resize-patch
deleted file mode 100644
index df29656343..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/gtklabel-resize-patch
+++ /dev/null
@@ -1,10 +0,0 @@
1--- gtk+-2.4.3/gtk/gtklabel.c~ 2004-06-11 13:50:34.000000000 +0100
2+++ gtk+-2.4.3/gtk/gtklabel.c 2004-07-05 13:33:57.000000000 +0100
3@@ -1623,6 +1623,7 @@
4
5 /* We have to clear the layout, fonts etc. may have changed */
6 gtk_label_clear_layout (label);
7+ gtk_widget_queue_resize (GTK_WIDGET (label));
8 }
9
10 static void
diff --git a/meta/packages/gtk+/gtk+-2.6.8/hardcoded_libtool.patch b/meta/packages/gtk+/gtk+-2.6.8/hardcoded_libtool.patch
deleted file mode 100644
index b2afddcc61..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/hardcoded_libtool.patch
+++ /dev/null
@@ -1,29 +0,0 @@
1--- gtk+-2.6.0/configure.in.old 2005-01-01 16:23:45.000000000 +0000
2+++ gtk+-2.6.0/configure.in 2005-01-01 16:24:03.000000000 +0000
3@@ -360,7 +360,7 @@
4 AC_MSG_CHECKING([Whether to write dependencies into .pc files])
5 case $enable_explicit_deps in
6 auto)
7- deplib_check_method=`(./libtool --config; echo eval echo \\$deplib_check_method) | sh`
8+ deplib_check_method=`($host_alias-libtool --config; echo eval echo \\$deplib_check_method) | sh`
9 if test "X$deplib_check_method" = Xnone || test "x$enable_static" = xyes ; then
10 enable_explicit_deps=yes
11 else
12@@ -688,7 +688,7 @@
13 dnl Now we check to see if our libtool supports shared lib deps
14 dnl (in a rather ugly way even)
15 if $dynworks; then
16- pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} ./libtool --config"
17+ pixbuf_libtool_config="${CONFIG_SHELL-/bin/sh} $host_alias-libtool --config"
18 pixbuf_deplibs_check=`$pixbuf_libtool_config | \
19 grep '^[[a-z_]]*check[[a-z_]]*_method=[['\''"]]' | \
20 sed 's/.*[['\''"]]\(.*\)[['\''"]]$/\1/'`
21@@ -1512,7 +1512,7 @@
22 #
23 # We are using gmodule-no-export now, but I'm leaving the stripping
24 # code in place for now, since pango and atk still require gmodule.
25-export_dynamic=`(./libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
26+export_dynamic=`($host_alias-libtool --config; echo eval echo \\$export_dynamic_flag_spec) | sh`
27 if test -n "$export_dynamic"; then
28 GDK_PIXBUF_DEP_LIBS=`echo $GDK_PIXBUF_DEP_LIBS | sed -e "s/$export_dynamic//"`
29 GDK_PIXBUF_XLIB_DEP_LIBS=`echo $GDK_PIXBUF_XLIB_DEP_LIBS | sed -e "s/$export_dynamic//"`
diff --git a/meta/packages/gtk+/gtk+-2.6.8/menu-deactivate.patch b/meta/packages/gtk+/gtk+-2.6.8/menu-deactivate.patch
deleted file mode 100644
index 29e665fbf3..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/menu-deactivate.patch
+++ /dev/null
@@ -1,50 +0,0 @@
1--- gtk+-2.4.4/gtk/gtkmenushell.c.old Thu Aug 26 23:45:28 2004
2+++ gtk+-2.4.4/gtk/gtkmenushell.c Fri Aug 27 00:13:33 2004
3@@ -37,7 +37,7 @@
4 #include "gtktearoffmenuitem.h"
5 #include "gtkwindow.h"
6
7-#define MENU_SHELL_TIMEOUT 500
8+#define MENU_SHELL_TIMEOUT 2000
9
10 enum {
11 DEACTIVATE,
12@@ -156,6 +156,7 @@
13 static GtkContainerClass *parent_class = NULL;
14 static guint menu_shell_signals[LAST_SIGNAL] = { 0 };
15
16+static int last_crossing_time;
17
18 GType
19 gtk_menu_shell_get_type (void)
20@@ -418,6 +419,7 @@
21 gtk_grab_add (GTK_WIDGET (menu_shell));
22 menu_shell->have_grab = TRUE;
23 menu_shell->active = TRUE;
24+ last_crossing_time = 0;
25 }
26 }
27
28@@ -545,6 +547,13 @@
29 menu_shell->activate_time = 0;
30 deactivate = FALSE;
31 }
32+
33+ if (last_crossing_time != 0
34+ && ((event->time - last_crossing_time) < 500))
35+ {
36+ last_crossing_time = 0;
37+ deactivate = FALSE;
38+ }
39
40 if (deactivate)
41 {
42@@ -597,6 +606,8 @@
43 if (menu_shell->active)
44 {
45 menu_item = gtk_get_event_widget ((GdkEvent*) event);
46+
47+ last_crossing_time = event->time;
48
49 if (!menu_item ||
50 (GTK_IS_MENU_ITEM (menu_item) &&
diff --git a/meta/packages/gtk+/gtk+-2.6.8/no-demos.patch b/meta/packages/gtk+/gtk+-2.6.8/no-demos.patch
deleted file mode 100644
index 2f10a30dda..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/no-demos.patch
+++ /dev/null
@@ -1,10 +0,0 @@
1--- gtk+-2.4.1/Makefile.am~ 2004-01-17 22:15:56.000000000 +0000
2+++ gtk+-2.4.1/Makefile.am 2004-05-08 12:25:32.000000000 +0100
3@@ -1,6 +1,6 @@
4 ## Makefile.am for GTK+
5
6-SRC_SUBDIRS = gdk-pixbuf gdk gtk modules demos tests contrib
7+SRC_SUBDIRS = gdk-pixbuf gdk gtk modules tests contrib
8 SUBDIRS = po po-properties $(SRC_SUBDIRS) docs build m4macros
9
10 # require automake 1.4
diff --git a/meta/packages/gtk+/gtk+-2.6.8/no-deprecation.patch b/meta/packages/gtk+/gtk+-2.6.8/no-deprecation.patch
deleted file mode 100644
index 045c566b3a..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/no-deprecation.patch
+++ /dev/null
@@ -1,334 +0,0 @@
1diff -ru gtk+-2.6.8.orig/contrib/gdk-pixbuf-xlib/Makefile.am gtk+-2.6.8/contrib/gdk-pixbuf-xlib/Makefile.am
2--- gtk+-2.6.8.orig/contrib/gdk-pixbuf-xlib/Makefile.am 2004-03-03 20:53:23.000000000 +0000
3+++ gtk+-2.6.8/contrib/gdk-pixbuf-xlib/Makefile.am 2006-04-19 12:47:16.000000000 +0100
4@@ -4,7 +4,6 @@
5 -I$(top_srcdir) -I$(top_builddir) \
6 -I$(top_srcdir)/gdk-pixbuf \
7 -I$(top_srcdir)/contrib \
8- -DG_DISABLE_DEPRECATED \
9 -DGDK_PIXBUF_DISABLE_DEPRECATED \
10 $(GDK_PIXBUF_XLIB_DEP_CFLAGS)
11
12Only in gtk+-2.6.8/contrib/gdk-pixbuf-xlib: Makefile.am~
13diff -ru gtk+-2.6.8.orig/contrib/gdk-pixbuf-xlib/Makefile.in gtk+-2.6.8/contrib/gdk-pixbuf-xlib/Makefile.in
14--- gtk+-2.6.8.orig/contrib/gdk-pixbuf-xlib/Makefile.in 2005-06-15 20:57:33.000000000 +0100
15+++ gtk+-2.6.8/contrib/gdk-pixbuf-xlib/Makefile.in 2006-04-19 12:48:10.000000000 +0100
16@@ -290,7 +290,6 @@
17 -I$(top_srcdir) -I$(top_builddir) \
18 -I$(top_srcdir)/gdk-pixbuf \
19 -I$(top_srcdir)/contrib \
20- -DG_DISABLE_DEPRECATED \
21 -DGDK_PIXBUF_DISABLE_DEPRECATED \
22 $(GDK_PIXBUF_XLIB_DEP_CFLAGS)
23
24Only in gtk+-2.6.8/contrib/gdk-pixbuf-xlib: Makefile.in~
25diff -ru gtk+-2.6.8.orig/demos/gtk-demo/Makefile.am gtk+-2.6.8/demos/gtk-demo/Makefile.am
26--- gtk+-2.6.8.orig/demos/gtk-demo/Makefile.am 2005-05-25 07:48:28.000000000 +0100
27+++ gtk+-2.6.8/demos/gtk-demo/Makefile.am 2006-04-19 12:47:11.000000000 +0100
28@@ -35,7 +35,6 @@
29 -DDEMOCODEDIR="\"$(democodedir)\"" \
30 -I$(top_srcdir) \
31 -I$(top_builddir)/gdk \
32- -DG_DISABLE_DEPRECATED \
33 -DGDK_PIXBUF_DISABLE_DEPRECATED \
34 -DGDK_DISABLE_DEPRECATED \
35 -DGTK_DISABLE_DEPRECATED \
36Only in gtk+-2.6.8/demos/gtk-demo: Makefile.am~
37diff -ru gtk+-2.6.8.orig/demos/gtk-demo/Makefile.in gtk+-2.6.8/demos/gtk-demo/Makefile.in
38--- gtk+-2.6.8.orig/demos/gtk-demo/Makefile.in 2005-06-15 20:57:34.000000000 +0100
39+++ gtk+-2.6.8/demos/gtk-demo/Makefile.in 2006-04-19 12:48:06.000000000 +0100
40@@ -319,7 +319,6 @@
41 -DDEMOCODEDIR="\"$(democodedir)\"" \
42 -I$(top_srcdir) \
43 -I$(top_builddir)/gdk \
44- -DG_DISABLE_DEPRECATED \
45 -DGDK_PIXBUF_DISABLE_DEPRECATED \
46 -DGDK_DISABLE_DEPRECATED \
47 -DGTK_DISABLE_DEPRECATED \
48Only in gtk+-2.6.8/demos/gtk-demo: Makefile.in~
49diff -ru gtk+-2.6.8.orig/demos/Makefile.am gtk+-2.6.8/demos/Makefile.am
50--- gtk+-2.6.8.orig/demos/Makefile.am 2003-06-06 01:52:19.000000000 +0100
51+++ gtk+-2.6.8/demos/Makefile.am 2006-04-19 12:47:13.000000000 +0100
52@@ -5,7 +5,6 @@
53 INCLUDES = \
54 -I$(top_srcdir) \
55 -I$(top_builddir)/gdk \
56- -DG_DISABLE_DEPRECATED \
57 -DGDK_PIXBUF_DISABLE_DEPRECATED \
58 -DGDK_DISABLE_DEPRECATED \
59 -DGTK_DISABLE_DEPRECATED \
60Only in gtk+-2.6.8/demos: Makefile.am~
61diff -ru gtk+-2.6.8.orig/demos/Makefile.in gtk+-2.6.8/demos/Makefile.in
62--- gtk+-2.6.8.orig/demos/Makefile.in 2005-06-15 20:57:33.000000000 +0100
63+++ gtk+-2.6.8/demos/Makefile.in 2006-04-19 12:48:08.000000000 +0100
64@@ -291,7 +291,6 @@
65 INCLUDES = \
66 -I$(top_srcdir) \
67 -I$(top_builddir)/gdk \
68- -DG_DISABLE_DEPRECATED \
69 -DGDK_PIXBUF_DISABLE_DEPRECATED \
70 -DGDK_DISABLE_DEPRECATED \
71 -DGTK_DISABLE_DEPRECATED \
72Only in gtk+-2.6.8/demos: Makefile.in~
73diff -ru gtk+-2.6.8.orig/gdk/linux-fb/Makefile.am gtk+-2.6.8/gdk/linux-fb/Makefile.am
74--- gtk+-2.6.8.orig/gdk/linux-fb/Makefile.am 2003-12-10 13:49:53.000000000 +0000
75+++ gtk+-2.6.8/gdk/linux-fb/Makefile.am 2006-04-19 12:47:02.000000000 +0100
76@@ -15,7 +15,6 @@
77 -I$(top_srcdir) \
78 -I$(top_srcdir)/gdk \
79 -I$(top_builddir)/gdk \
80- -DG_DISABLE_DEPRECATED \
81 -DGDK_PIXBUF_DISABLE_DEPRECATED \
82 $(GDK_DEP_CFLAGS) \
83 $(GTK_DEBUG_FLAGS)
84Only in gtk+-2.6.8/gdk/linux-fb: Makefile.am~
85diff -ru gtk+-2.6.8.orig/gdk/linux-fb/Makefile.in gtk+-2.6.8/gdk/linux-fb/Makefile.in
86--- gtk+-2.6.8.orig/gdk/linux-fb/Makefile.in 2005-06-15 20:57:38.000000000 +0100
87+++ gtk+-2.6.8/gdk/linux-fb/Makefile.in 2006-04-19 12:48:01.000000000 +0100
88@@ -297,7 +297,6 @@
89 -I$(top_srcdir) \
90 -I$(top_srcdir)/gdk \
91 -I$(top_builddir)/gdk \
92- -DG_DISABLE_DEPRECATED \
93 -DGDK_PIXBUF_DISABLE_DEPRECATED \
94 $(GDK_DEP_CFLAGS) \
95 $(GTK_DEBUG_FLAGS)
96Only in gtk+-2.6.8/gdk/linux-fb: Makefile.in~
97diff -ru gtk+-2.6.8.orig/gdk/Makefile.am gtk+-2.6.8/gdk/Makefile.am
98--- gtk+-2.6.8.orig/gdk/Makefile.am 2005-04-09 06:58:54.000000000 +0100
99+++ gtk+-2.6.8/gdk/Makefile.am 2006-04-19 12:47:05.000000000 +0100
100@@ -19,7 +19,6 @@
101 -I$(top_srcdir) \
102 -I$(top_builddir)/gdk \
103 -I$(top_srcdir)/gdk-pixbuf \
104- -DG_DISABLE_DEPRECATED \
105 -DGDK_PIXBUF_DISABLE_DEPRECATED \
106 -DGDK_DISABLE_DEPRECATED \
107 $(GTK_DEBUG_FLAGS) \
108Only in gtk+-2.6.8/gdk: Makefile.am~
109diff -ru gtk+-2.6.8.orig/gdk/Makefile.in gtk+-2.6.8/gdk/Makefile.in
110--- gtk+-2.6.8.orig/gdk/Makefile.in 2005-06-15 20:57:38.000000000 +0100
111+++ gtk+-2.6.8/gdk/Makefile.in 2006-04-19 12:48:04.000000000 +0100
112@@ -307,7 +307,6 @@
113 -I$(top_srcdir) \
114 -I$(top_builddir)/gdk \
115 -I$(top_srcdir)/gdk-pixbuf \
116- -DG_DISABLE_DEPRECATED \
117 -DGDK_PIXBUF_DISABLE_DEPRECATED \
118 -DGDK_DISABLE_DEPRECATED \
119 $(GTK_DEBUG_FLAGS) \
120Only in gtk+-2.6.8/gdk: Makefile.in~
121diff -ru gtk+-2.6.8.orig/gdk/x11/Makefile.am gtk+-2.6.8/gdk/x11/Makefile.am
122--- gtk+-2.6.8.orig/gdk/x11/Makefile.am 2003-12-10 13:49:57.000000000 +0000
123+++ gtk+-2.6.8/gdk/x11/Makefile.am 2006-04-19 12:46:59.000000000 +0100
124@@ -8,7 +8,6 @@
125 -I$(top_srcdir) \
126 -I$(top_srcdir)/gdk \
127 -I$(top_builddir)/gdk \
128- -DG_DISABLE_DEPRECATED \
129 -DGDK_PIXBUF_DISABLE_DEPRECATED \
130 -DGDK_DISABLE_DEPRECATED \
131 $(GTK_DEBUG_FLAGS) \
132Only in gtk+-2.6.8/gdk/x11: Makefile.am~
133diff -ru gtk+-2.6.8.orig/gdk/x11/Makefile.in gtk+-2.6.8/gdk/x11/Makefile.in
134--- gtk+-2.6.8.orig/gdk/x11/Makefile.in 2005-06-15 20:57:39.000000000 +0100
135+++ gtk+-2.6.8/gdk/x11/Makefile.in 2006-04-19 12:47:59.000000000 +0100
136@@ -295,7 +295,6 @@
137 -I$(top_srcdir) \
138 -I$(top_srcdir)/gdk \
139 -I$(top_builddir)/gdk \
140- -DG_DISABLE_DEPRECATED \
141 -DGDK_PIXBUF_DISABLE_DEPRECATED \
142 -DGDK_DISABLE_DEPRECATED \
143 $(GTK_DEBUG_FLAGS) \
144Only in gtk+-2.6.8/gdk/x11: Makefile.in~
145diff -ru gtk+-2.6.8.orig/gdk-pixbuf/Makefile.am gtk+-2.6.8/gdk-pixbuf/Makefile.am
146--- gtk+-2.6.8.orig/gdk-pixbuf/Makefile.am 2005-04-29 18:53:58.000000000 +0100
147+++ gtk+-2.6.8/gdk-pixbuf/Makefile.am 2006-04-19 12:47:35.000000000 +0100
148@@ -279,7 +279,6 @@
149 -DGTK_SYSCONFDIR=\"$(sysconfdir)\" \
150 -DGTK_VERSION=\"$(GTK_VERSION)\" \
151 -DGTK_BINARY_VERSION=\"$(GTK_BINARY_VERSION)\" \
152- -DG_DISABLE_DEPRECATED \
153 -DGDK_PIXBUF_DISABLE_DEPRECATED \
154 -DGTK_PREFIX=\"$(prefix)\" \
155 $(INCLUDED_LOADER_DEFINE) \
156Only in gtk+-2.6.8/gdk-pixbuf: Makefile.am~
157diff -ru gtk+-2.6.8.orig/gdk-pixbuf/Makefile.in gtk+-2.6.8/gdk-pixbuf/Makefile.in
158--- gtk+-2.6.8.orig/gdk-pixbuf/Makefile.in 2005-06-15 20:57:37.000000000 +0100
159+++ gtk+-2.6.8/gdk-pixbuf/Makefile.in 2006-04-19 12:48:47.000000000 +0100
160@@ -509,7 +509,6 @@
161 -DGTK_SYSCONFDIR=\"$(sysconfdir)\" \
162 -DGTK_VERSION=\"$(GTK_VERSION)\" \
163 -DGTK_BINARY_VERSION=\"$(GTK_BINARY_VERSION)\" \
164- -DG_DISABLE_DEPRECATED \
165 -DGDK_PIXBUF_DISABLE_DEPRECATED \
166 -DGTK_PREFIX=\"$(prefix)\" \
167 $(INCLUDED_LOADER_DEFINE) \
168Only in gtk+-2.6.8/gdk-pixbuf: Makefile.in~
169diff -ru gtk+-2.6.8.orig/gdk-pixbuf/pixops/Makefile.am gtk+-2.6.8/gdk-pixbuf/pixops/Makefile.am
170--- gtk+-2.6.8.orig/gdk-pixbuf/pixops/Makefile.am 2003-05-06 22:54:28.000000000 +0100
171+++ gtk+-2.6.8/gdk-pixbuf/pixops/Makefile.am 2006-04-19 12:47:29.000000000 +0100
172@@ -4,7 +4,6 @@
173 -I$(top_srcdir) -I$(top_builddir) \
174 $(GTK_DEBUG_FLAGS) \
175 $(GDK_PIXBUF_DEP_CFLAGS) \
176- -DG_DISABLE_DEPRECATED \
177 -DGDK_PIXBUF_DISABLE_DEPRECATED
178
179 noinst_PROGRAMS = timescale
180Only in gtk+-2.6.8/gdk-pixbuf/pixops: Makefile.am~
181diff -ru gtk+-2.6.8.orig/gdk-pixbuf/pixops/Makefile.in gtk+-2.6.8/gdk-pixbuf/pixops/Makefile.in
182--- gtk+-2.6.8.orig/gdk-pixbuf/pixops/Makefile.in 2005-06-15 20:57:37.000000000 +0100
183+++ gtk+-2.6.8/gdk-pixbuf/pixops/Makefile.in 2006-04-19 12:48:44.000000000 +0100
184@@ -290,7 +290,6 @@
185 -I$(top_srcdir) -I$(top_builddir) \
186 $(GTK_DEBUG_FLAGS) \
187 $(GDK_PIXBUF_DEP_CFLAGS) \
188- -DG_DISABLE_DEPRECATED \
189 -DGDK_PIXBUF_DISABLE_DEPRECATED
190
191
192Only in gtk+-2.6.8/gdk-pixbuf/pixops: Makefile.in~
193diff -ru gtk+-2.6.8.orig/gtk/Makefile.am gtk+-2.6.8/gtk/Makefile.am
194--- gtk+-2.6.8.orig/gtk/Makefile.am 2005-04-29 18:53:57.000000000 +0100
195+++ gtk+-2.6.8/gtk/Makefile.am 2006-04-19 12:47:27.000000000 +0100
196@@ -22,7 +22,6 @@
197 -I$(top_srcdir) -I../gdk \
198 -I$(top_srcdir)/gdk \
199 -I$(top_srcdir)/gdk-pixbuf -I../gdk-pixbuf \
200- -DG_DISABLE_DEPRECATED \
201 -DGDK_PIXBUF_DISABLE_DEPRECATED \
202 -DGDK_DISABLE_DEPRECATED \
203 -DGTK_DISABLE_DEPRECATED \
204Only in gtk+-2.6.8/gtk: Makefile.am~
205diff -ru gtk+-2.6.8.orig/gtk/Makefile.in gtk+-2.6.8/gtk/Makefile.in
206--- gtk+-2.6.8.orig/gtk/Makefile.in 2005-06-15 20:57:39.000000000 +0100
207+++ gtk+-2.6.8/gtk/Makefile.in 2006-04-19 12:48:41.000000000 +0100
208@@ -311,7 +311,6 @@
209 -I$(top_srcdir) -I../gdk \
210 -I$(top_srcdir)/gdk \
211 -I$(top_srcdir)/gdk-pixbuf -I../gdk-pixbuf \
212- -DG_DISABLE_DEPRECATED \
213 -DGDK_PIXBUF_DISABLE_DEPRECATED \
214 -DGDK_DISABLE_DEPRECATED \
215 -DGTK_DISABLE_DEPRECATED \
216Only in gtk+-2.6.8/gtk: Makefile.in~
217diff -ru gtk+-2.6.8.orig/gtk/theme-bits/Makefile.am gtk+-2.6.8/gtk/theme-bits/Makefile.am
218--- gtk+-2.6.8.orig/gtk/theme-bits/Makefile.am 2003-05-06 22:55:40.000000000 +0100
219+++ gtk+-2.6.8/gtk/theme-bits/Makefile.am 2006-04-19 12:47:21.000000000 +0100
220@@ -1,5 +1,4 @@
221 INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
222- -DG_DISABLE_DEPRECATED \
223 -DGDK_PIXBUF_DISABLE_DEPRECATED \
224 $(GDK_PIXBUF_DEP_CFLAGS)
225
226Only in gtk+-2.6.8/gtk/theme-bits: Makefile.am~
227diff -ru gtk+-2.6.8.orig/gtk/theme-bits/Makefile.in gtk+-2.6.8/gtk/theme-bits/Makefile.in
228--- gtk+-2.6.8.orig/gtk/theme-bits/Makefile.in 2005-06-15 20:57:40.000000000 +0100
229+++ gtk+-2.6.8/gtk/theme-bits/Makefile.in 2006-04-19 12:48:39.000000000 +0100
230@@ -285,7 +285,6 @@
231 sysconfdir = @sysconfdir@
232 target_alias = @target_alias@
233 INCLUDES = -I$(top_srcdir) -I$(top_builddir) \
234- -DG_DISABLE_DEPRECATED \
235 -DGDK_PIXBUF_DISABLE_DEPRECATED \
236 $(GDK_PIXBUF_DEP_CFLAGS)
237
238Only in gtk+-2.6.8/gtk/theme-bits: Makefile.in~
239diff -ru gtk+-2.6.8.orig/modules/engines/ms-windows/Makefile.am gtk+-2.6.8/modules/engines/ms-windows/Makefile.am
240--- gtk+-2.6.8.orig/modules/engines/ms-windows/Makefile.am 2005-06-04 21:10:11.000000000 +0100
241+++ gtk+-2.6.8/modules/engines/ms-windows/Makefile.am 2006-04-19 12:47:40.000000000 +0100
242@@ -6,7 +6,6 @@
243 -I$(top_srcdir) \
244 -I$(top_srcdir)/gdk \
245 -I$(top_builddir)/gdk \
246- -DG_DISABLE_DEPRECATED \
247 -DGDK_PIXBUF_DISABLE_DEPRECATED \
248 -DGDK_DISABLE_DEPRECATED \
249 $(GTK_DEP_CFLAGS)
250Only in gtk+-2.6.8/modules/engines/ms-windows: Makefile.am~
251diff -ru gtk+-2.6.8.orig/modules/engines/ms-windows/Makefile.in gtk+-2.6.8/modules/engines/ms-windows/Makefile.in
252--- gtk+-2.6.8.orig/modules/engines/ms-windows/Makefile.in 2005-06-15 20:57:41.000000000 +0100
253+++ gtk+-2.6.8/modules/engines/ms-windows/Makefile.in 2006-04-19 12:48:51.000000000 +0100
254@@ -292,7 +292,6 @@
255 -I$(top_srcdir) \
256 -I$(top_srcdir)/gdk \
257 -I$(top_builddir)/gdk \
258- -DG_DISABLE_DEPRECATED \
259 -DGDK_PIXBUF_DISABLE_DEPRECATED \
260 -DGDK_DISABLE_DEPRECATED \
261 $(GTK_DEP_CFLAGS)
262Only in gtk+-2.6.8/modules/engines/ms-windows: Makefile.in~
263diff -ru gtk+-2.6.8.orig/modules/engines/pixbuf/Makefile.am gtk+-2.6.8/modules/engines/pixbuf/Makefile.am
264--- gtk+-2.6.8.orig/modules/engines/pixbuf/Makefile.am 2004-11-28 17:21:06.000000000 +0000
265+++ gtk+-2.6.8/modules/engines/pixbuf/Makefile.am 2006-04-19 12:47:38.000000000 +0100
266@@ -6,7 +6,6 @@
267 -I$(top_srcdir) \
268 -I$(top_srcdir)/gdk \
269 -I$(top_builddir)/gdk \
270- -DG_DISABLE_DEPRECATED \
271 -DGDK_PIXBUF_DISABLE_DEPRECATED \
272 -DGDK_DISABLE_DEPRECATED \
273 $(GTK_DEP_CFLAGS)
274Only in gtk+-2.6.8/modules/engines/pixbuf: Makefile.am~
275diff -ru gtk+-2.6.8.orig/modules/engines/pixbuf/Makefile.in gtk+-2.6.8/modules/engines/pixbuf/Makefile.in
276--- gtk+-2.6.8.orig/modules/engines/pixbuf/Makefile.in 2005-06-15 20:57:41.000000000 +0100
277+++ gtk+-2.6.8/modules/engines/pixbuf/Makefile.in 2006-04-19 12:48:49.000000000 +0100
278@@ -290,7 +290,6 @@
279 -I$(top_srcdir) \
280 -I$(top_srcdir)/gdk \
281 -I$(top_builddir)/gdk \
282- -DG_DISABLE_DEPRECATED \
283 -DGDK_PIXBUF_DISABLE_DEPRECATED \
284 -DGDK_DISABLE_DEPRECATED \
285 $(GTK_DEP_CFLAGS)
286Only in gtk+-2.6.8/modules/engines/pixbuf: Makefile.in~
287diff -ru gtk+-2.6.8.orig/modules/input/Makefile.am gtk+-2.6.8/modules/input/Makefile.am
288--- gtk+-2.6.8.orig/modules/input/Makefile.am 2005-06-04 23:10:04.000000000 +0100
289+++ gtk+-2.6.8/modules/input/Makefile.am 2006-04-19 12:47:43.000000000 +0100
290@@ -8,7 +8,6 @@
291 -I$(top_srcdir) \
292 -I$(top_srcdir)/gdk \
293 -I$(top_builddir)/gdk \
294- -DG_DISABLE_DEPRECATED \
295 -DGDK_PIXBUF_DISABLE_DEPRECATED \
296 -DGDK_DISABLE_DEPRECATED \
297 -DGTK_DISABLE_DEPRECATED \
298Only in gtk+-2.6.8/modules/input: Makefile.am~
299diff -ru gtk+-2.6.8.orig/modules/input/Makefile.in gtk+-2.6.8/modules/input/Makefile.in
300--- gtk+-2.6.8.orig/modules/input/Makefile.in 2005-06-15 20:57:42.000000000 +0100
301+++ gtk+-2.6.8/modules/input/Makefile.in 2006-04-19 12:48:53.000000000 +0100
302@@ -291,7 +291,6 @@
303 -I$(top_srcdir) \
304 -I$(top_srcdir)/gdk \
305 -I$(top_builddir)/gdk \
306- -DG_DISABLE_DEPRECATED \
307 -DGDK_PIXBUF_DISABLE_DEPRECATED \
308 -DGDK_DISABLE_DEPRECATED \
309 -DGTK_DISABLE_DEPRECATED \
310Only in gtk+-2.6.8/modules/input: Makefile.in~
311diff -ru gtk+-2.6.8.orig/tests/Makefile.am gtk+-2.6.8/tests/Makefile.am
312--- gtk+-2.6.8.orig/tests/Makefile.am 2004-11-12 15:26:07.000000000 +0000
313+++ gtk+-2.6.8/tests/Makefile.am 2006-04-19 12:47:19.000000000 +0100
314@@ -4,7 +4,6 @@
315 -I$(top_srcdir) \
316 -I$(top_builddir)/gdk \
317 -I$(top_srcdir)/gdk \
318- -DG_DISABLE_DEPRECATED \
319 -DGDK_PIXBUF_DISABLE_DEPRECATED \
320 -DGDK_DISABLE_DEPRECATED \
321 -DGTK_DISABLE_DEPRECATED \
322Only in gtk+-2.6.8/tests: Makefile.am~
323diff -ru gtk+-2.6.8.orig/tests/Makefile.in gtk+-2.6.8/tests/Makefile.in
324--- gtk+-2.6.8.orig/tests/Makefile.in 2005-06-15 20:57:42.000000000 +0100
325+++ gtk+-2.6.8/tests/Makefile.in 2006-04-19 12:48:20.000000000 +0100
326@@ -289,7 +289,6 @@
327 -I$(top_srcdir) \
328 -I$(top_builddir)/gdk \
329 -I$(top_srcdir)/gdk \
330- -DG_DISABLE_DEPRECATED \
331 -DGDK_PIXBUF_DISABLE_DEPRECATED \
332 -DGDK_DISABLE_DEPRECATED \
333 -DGTK_DISABLE_DEPRECATED \
334Only in gtk+-2.6.8/tests: Makefile.in~
diff --git a/meta/packages/gtk+/gtk+-2.6.8/no-xwc.patch b/meta/packages/gtk+/gtk+-2.6.8/no-xwc.patch
deleted file mode 100644
index affb4a303e..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/no-xwc.patch
+++ /dev/null
@@ -1,151 +0,0 @@
1diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c
2--- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c 2004-11-30 14:57:14 +00:00
3+++ gtk+-2.6.0/gdk/x11/gdkdrawable-x11.c 2005-01-02 15:38:06 +00:00
4@@ -576,12 +576,14 @@
5 GDK_GC_GET_XGC (gc), x, y, (XChar2b *) text, text_length / 2);
6 }
7 }
8+#ifdef HAVE_XWC
9 else if (font->type == GDK_FONT_FONTSET)
10 {
11 XFontSet fontset = (XFontSet) GDK_FONT_XFONT (font);
12 XmbDrawString (xdisplay, impl->xid,
13 fontset, GDK_GC_GET_XGC (gc), x, y, text, text_length);
14 }
15+#endif
16 else
17 g_error("undefined font type\n");
18 }
19@@ -613,6 +615,7 @@
20 GDK_GC_GET_XGC (gc), x, y, text_8bit, text_length);
21 g_free (text_8bit);
22 }
23+#ifdef HAVE_XWC
24 else if (font->type == GDK_FONT_FONTSET)
25 {
26 if (sizeof(GdkWChar) == sizeof(wchar_t))
27@@ -633,6 +636,7 @@
28 g_free (text_wchar);
29 }
30 }
31+#endif
32 else
33 g_error("undefined font type\n");
34 }
35diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkfont-x11.c gtk+-2.6.0/gdk/x11/gdkfont-x11.c
36--- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkfont-x11.c 2004-08-26 01:23:46 +01:00
37+++ gtk+-2.6.0/gdk/x11/gdkfont-x11.c 2005-01-02 15:45:39 +00:00
38@@ -525,10 +525,12 @@
39 width = XTextWidth16 (xfont, (XChar2b *) text, text_length / 2);
40 }
41 break;
42+#ifdef HAVE_XWC
43 case GDK_FONT_FONTSET:
44 fontset = (XFontSet) private->xfont;
45 width = XmbTextEscapement (fontset, text, text_length);
46 break;
47+#endif
48 default:
49 width = 0;
50 }
51@@ -578,6 +580,7 @@
52 width = 0;
53 }
54 break;
55+#ifdef HAVE_XWC
56 case GDK_FONT_FONTSET:
57 if (sizeof(GdkWChar) == sizeof(wchar_t))
58 {
59@@ -595,6 +598,7 @@
60 g_free (text_wchar);
61 }
62 break;
63+#endif
64 default:
65 width = 0;
66 }
67@@ -667,6 +671,7 @@
68 if (descent)
69 *descent = overall.descent;
70 break;
71+#ifdef HAVE_XWC
72 case GDK_FONT_FONTSET:
73 fontset = (XFontSet) private->xfont;
74 XmbTextExtents (fontset, text, text_length, &ink, &logical);
75@@ -681,6 +686,7 @@
76 if (descent)
77 *descent = ink.y + ink.height;
78 break;
79+#endif
80 }
81
82 }
83@@ -753,6 +759,7 @@
84 *descent = overall.descent;
85 break;
86 }
87+#ifdef HAVE_XWC
88 case GDK_FONT_FONTSET:
89 fontset = (XFontSet) private->xfont;
90
91@@ -780,6 +787,7 @@
92 if (descent)
93 *descent = ink.y + ink.height;
94 break;
95+#endif
96 }
97
98 }
99diff -urNd ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkim-x11.c gtk+-2.6.0/gdk/x11/gdkim-x11.c
100--- ../gtk+-2.6.0-r2/gtk+-2.6.0/gdk/x11/gdkim-x11.c 2004-11-17 00:55:10 +00:00
101+++ gtk+-2.6.0/gdk/x11/gdkim-x11.c 2005-01-02 15:42:04 +00:00
102@@ -48,6 +48,7 @@
103 void
104 _gdk_x11_initialize_locale (void)
105 {
106+#ifdef HAVE_XWC
107 wchar_t result;
108 gchar *current_locale;
109 static char *last_locale = NULL;
110@@ -93,7 +94,8 @@
111 GDK_NOTE (XIM,
112 g_message ("%s multi-byte string functions.",
113 gdk_use_mb ? "Using" : "Not using"));
114-
115+#endif
116+
117 return;
118 }
119
120@@ -136,6 +138,7 @@
121 {
122 gchar *mbstr;
123
124+#ifdef HAVE_XWC
125 if (gdk_use_mb)
126 {
127 GdkDisplay *display = find_a_display ();
128@@ -178,6 +181,7 @@
129 XFree (tpr.value);
130 }
131 else
132+#endif
133 {
134 gint length = 0;
135 gint i;
136@@ -210,6 +214,7 @@
137 gint
138 gdk_mbstowcs (GdkWChar *dest, const gchar *src, gint dest_max)
139 {
140+#ifdef HAVE_XWC
141 if (gdk_use_mb)
142 {
143 GdkDisplay *display = find_a_display ();
144@@ -242,6 +247,7 @@
145 return len_cpy;
146 }
147 else
148+#endif
149 {
150 gint i;
151
diff --git a/meta/packages/gtk+/gtk+-2.6.8/scroll-timings.patch b/meta/packages/gtk+/gtk+-2.6.8/scroll-timings.patch
deleted file mode 100644
index a38b21dcc2..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/scroll-timings.patch
+++ /dev/null
@@ -1,15 +0,0 @@
1--- gtk+-2.4.4/gtk/gtkrange.c~ 2004-08-23 01:50:22.000000000 +0100
2+++ gtk+-2.4.4/gtk/gtkrange.c 2004-08-27 15:48:49.000000000 +0100
3@@ -35,9 +35,9 @@
4 #include "gtkintl.h"
5 #include "gtkscrollbar.h"
6
7-#define SCROLL_INITIAL_DELAY 250 /* must hold button this long before ... */
8-#define SCROLL_LATER_DELAY 100 /* ... it starts repeating at this rate */
9-#define UPDATE_DELAY 300 /* Delay for queued update */
10+#define SCROLL_INITIAL_DELAY 500 /* must hold button this long before ... */
11+#define SCROLL_LATER_DELAY 200 /* ... it starts repeating at this rate */
12+#define UPDATE_DELAY 1000 /* Delay for queued update */
13
14 enum {
15 PROP_0,
diff --git a/meta/packages/gtk+/gtk+-2.6.8/smaller-filechooser.patch b/meta/packages/gtk+/gtk+-2.6.8/smaller-filechooser.patch
deleted file mode 100644
index 3c6f7217e5..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/smaller-filechooser.patch
+++ /dev/null
@@ -1,47 +0,0 @@
1Index: gtkfilechooserdefault.c
2===================================================================
3RCS file: /cvs/gnome/gtk+/gtk/gtkfilechooserdefault.c,v
4retrieving revision 1.240.2.25
5diff -u -p -r1.240.2.25 gtkfilechooserdefault.c
6--- gtk+/gtk/gtkfilechooserdefault.c 7 Jul 2005 17:14:09 -0000 1.240.2.25
7+++ gtk+/gtk/gtkfilechooserdefault.c 27 Oct 2006 14:22:28 -0000
8@@ -3728,6 +3728,7 @@ browse_widgets_create (GtkFileChooserDef
9 GtkWidget *vbox;
10 GtkWidget *hpaned;
11 GtkWidget *widget;
12+ GtkWidget *shortcuts_pane;
13 GtkSizeGroup *size_group;
14
15 /* size group is used by the [+][-] buttons and the filter combo */
16@@ -3740,12 +3741,29 @@ browse_widgets_create (GtkFileChooserDef
17 gtk_paned_set_position (GTK_PANED (hpaned), 200); /* FIXME: this sucks */
18 gtk_box_pack_start (GTK_BOX (vbox), hpaned, TRUE, TRUE, 0);
19
20- widget = shortcuts_pane_create (impl, size_group);
21- gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE);
22+ shortcuts_pane = shortcuts_pane_create (impl, size_group);
23+ gtk_paned_pack1 (GTK_PANED (hpaned), shortcuts_pane, FALSE, FALSE);
24 widget = file_pane_create (impl, size_group);
25 gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE);
26
27 g_object_unref (size_group);
28+
29+
30+ /* remove excess baggage from the filechooser for small displays */
31+
32+ /* get the columns in the tree view and remove the last column (should be Modified column) */
33+ GList *column_list;
34+ column_list = gtk_tree_view_get_columns (GTK_TREE_VIEW (impl->browse_files_tree_view));
35+ gtk_tree_view_remove_column (GTK_TREE_VIEW (impl->browse_files_tree_view), (g_list_last (column_list))->data);
36+ g_list_free (column_list);
37+
38+ /* hide the tree view headers */
39+ gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_files_tree_view), FALSE);
40+
41+ /* hide the shortcuts pane */
42+ gtk_widget_hide (GTK_WIDGET (shortcuts_pane));
43+
44+
45
46 return vbox;
47 }
diff --git a/meta/packages/gtk+/gtk+-2.6.8/spinbutton.patch b/meta/packages/gtk+/gtk+-2.6.8/spinbutton.patch
deleted file mode 100644
index 8ad7507af0..0000000000
--- a/meta/packages/gtk+/gtk+-2.6.8/spinbutton.patch
+++ /dev/null
@@ -1,128 +0,0 @@
1--- gtk+-2.4.3/gtk/gtkspinbutton.c.old 2004-04-22 14:49:27.000000000 +0100
2+++ gtk+-2.4.3/gtk/gtkspinbutton.c 2004-06-30 21:48:18.000000000 +0100
3@@ -733,7 +733,7 @@
4
5 spin = GTK_SPIN_BUTTON (widget);
6 arrow_size = spin_button_get_arrow_size (spin);
7- panel_width = arrow_size + 2 * widget->style->xthickness;
8+ panel_width = (2 * arrow_size) + 4 * widget->style->xthickness;
9
10 widget->allocation = *allocation;
11
12@@ -866,19 +866,16 @@
13 {
14 width = spin_button_get_arrow_size (spin_button) + 2 * widget->style->xthickness;
15
16+ y = widget->style->ythickness;
17+ height = widget->requisition.height - (2 * y);
18+
19 if (arrow_type == GTK_ARROW_UP)
20 {
21 x = 0;
22- y = 0;
23-
24- height = widget->requisition.height / 2;
25 }
26 else
27 {
28- x = 0;
29- y = widget->requisition.height / 2;
30-
31- height = (widget->requisition.height + 1) / 2;
32+ x = width;
33 }
34
35 if (spin_button_at_limit (spin_button, arrow_type))
36@@ -908,32 +905,17 @@
37 shadow_type = GTK_SHADOW_OUT;
38 }
39 }
40-
41+
42 gtk_paint_box (widget->style, spin_button->panel,
43 state_type, shadow_type,
44 NULL, widget,
45- (arrow_type == GTK_ARROW_UP)? "spinbutton_up" : "spinbutton_down",
46+ NULL,
47 x, y, width, height);
48
49 height = widget->requisition.height;
50
51- if (arrow_type == GTK_ARROW_DOWN)
52- {
53- y = height / 2;
54- height = height - y - 2;
55- }
56- else
57- {
58- y = 2;
59- height = height / 2 - 2;
60- }
61-
62 width -= 3;
63-
64- if (widget && gtk_widget_get_direction (widget) == GTK_TEXT_DIR_RTL)
65- x = 2;
66- else
67- x = 1;
68+ height -= 3;
69
70 w = width / 2;
71 w -= w % 2 - 1; /* force odd */
72@@ -1108,7 +1090,7 @@
73 if (GTK_ENTRY (widget)->editable)
74 gtk_spin_button_update (spin);
75
76- if (event->y <= widget->requisition.height / 2)
77+ if (event->x <= (spin_button_get_arrow_size (spin) + widget->style->xthickness))
78 {
79 if (event->button == 1)
80 start_spinning (spin, GTK_ARROW_UP, spin->adjustment->step_increment);
81@@ -1143,44 +1125,11 @@
82
83 arrow_size = spin_button_get_arrow_size (spin);
84
85- if (event->button == spin->button)
86- {
87- int click_child = spin->click_child;
88+ gtk_spin_button_stop_spinning (spin);
89
90- gtk_spin_button_stop_spinning (spin);
91-
92- if (event->button == 3)
93- {
94- if (event->y >= 0 && event->x >= 0 &&
95- event->y <= widget->requisition.height &&
96- event->x <= arrow_size + 2 * widget->style->xthickness)
97- {
98- if (click_child == GTK_ARROW_UP &&
99- event->y <= widget->requisition.height / 2)
100- {
101- gdouble diff;
102-
103- diff = spin->adjustment->upper - spin->adjustment->value;
104- if (diff > EPSILON)
105- gtk_spin_button_real_spin (spin, diff);
106- }
107- else if (click_child == GTK_ARROW_DOWN &&
108- event->y > widget->requisition.height / 2)
109- {
110- gdouble diff;
111-
112- diff = spin->adjustment->value - spin->adjustment->lower;
113- if (diff > EPSILON)
114- gtk_spin_button_real_spin (spin, -diff);
115- }
116- }
117- }
118- spin_button_redraw (spin);
119+ spin_button_redraw (spin);
120
121- return TRUE;
122- }
123- else
124- return GTK_WIDGET_CLASS (parent_class)->button_release_event (widget, event);
125+ return TRUE;
126 }
127
128 static gint
diff --git a/meta/packages/gtk+/gtk+_2.6.8.bb b/meta/packages/gtk+/gtk+_2.6.8.bb
deleted file mode 100644
index 76d35e3782..0000000000
--- a/meta/packages/gtk+/gtk+_2.6.8.bb
+++ /dev/null
@@ -1,95 +0,0 @@
1LICENSE = "LGPL"
2DESCRIPTION = "GTK+ is a multi-platform toolkit for creating graphical user interfaces. Offering a complete \
3set of widgets, GTK+ is suitable for projects ranging from small one-off projects to complete application suites."
4HOMEPAGE = "http://www.gtk.org"
5SECTION = "libs"
6PRIORITY = "optional"
7DEPENDS = "glib-2.0 pango atk jpeg libpng libxext libxcursor gtk-doc libgcrypt"
8PR = "r5"
9
10SRC_URI = "ftp://ftp.gtk.org/pub/gtk/v2.6/gtk+-${PV}.tar.bz2 \
11 file://no-demos.patch;patch=1 \
12 file://no-xwc.patch;patch=1 \
13 file://automake-lossage.patch;patch=1 \
14 file://gtk+-handhelds.patch;patch=1 \
15 file://hardcoded_libtool.patch;patch=1 \
16 file://disable-tooltips.patch;patch=1 \
17 file://gtklabel-resize-patch;patch=1 \
18 file://menu-deactivate.patch;patch=1 \
19 file://scroll-timings.patch;patch=1 \
20 file://no-deprecation.patch;patch=1 \
21 file://filesystem-volumes.patch;patch=1 \
22 file://filechooser-respect-style.patch;patch=1 \
23 file://filechooser-default.patch;patch=1 \
24 "
25
26inherit autotools pkgconfig
27
28FILES_${PN} = "${bindir}/gdk-pixbuf-query-loaders \
29 ${bindir}/gtk-query-immodules-2.0 \
30 ${bindir}/gtk-update-icon-cache \
31 ${libdir}/lib*.so.* \
32 ${datadir}/themes ${sysconfdir} \
33 ${libdir}/gtk-2.0/${LIBV}/engines/libpixmap.so"
34FILES_${PN}-dev += " \
35 ${datadir}/gtk-2.0/include \
36 ${libdir}/gtk-2.0/include \
37 ${libdir}/gtk-2.0/${LIBV}/loaders/*.la \
38 ${libdir}/gtk-2.0/${LIBV}/immodules/*.la \
39 ${libdir}/gtk-2.0/${LIBV}/engines/*.la \
40 ${bindir}/gdk-pixbuf-csource"
41FILES_${PN}-dbg += " \
42 ${libdir}/gtk-2.0/${LIBV}/loaders/.debug/* \
43 ${libdir}/gtk-2.0/${LIBV}/immodules/.debug/* \
44 ${libdir}/gtk-2.0/${LIBV}/engines/.debug/*"
45
46RRECOMMENDS_linux_${PN} = "glibc-gconv-iso8859-1"
47
48EXTRA_OECONF = "--without-libtiff --disable-xkb --disable-glibtest --enable-display-migration"
49# --disable-cruft
50
51LIBV = "2.4.0"
52LEAD_SONAME = "libgtk-x11*"
53
54do_stage () {
55 oe_libinstall -so -C gtk libgtk-x11-2.0 ${STAGING_LIBDIR}
56 oe_libinstall -so -C gdk libgdk-x11-2.0 ${STAGING_LIBDIR}
57 oe_libinstall -so -C contrib/gdk-pixbuf-xlib libgdk_pixbuf_xlib-2.0 ${STAGING_LIBDIR}
58 oe_libinstall -so -C gdk-pixbuf libgdk_pixbuf-2.0 ${STAGING_LIBDIR}
59
60 autotools_stage_includes
61
62 mkdir -p ${STAGING_LIBDIR}/gtk-2.0/include
63 install -m 0644 gdk/gdkconfig.h ${STAGING_LIBDIR}/gtk-2.0/include/gdkconfig.h
64
65 install -m 0644 m4macros/gtk-2.0.m4 ${STAGING_DATADIR}/aclocal/
66}
67
68do_install_append () {
69 install -d ${D}${sysconfdir}/gtk-2.0
70}
71
72postinst_prologue() {
73if [ "x$D" != "x" ]; then
74 exit 1
75fi
76
77}
78
79PACKAGES_DYNAMIC = "gdk-pixbuf-loader-* gtk-immodule-*"
80
81python populate_packages_prepend () {
82 import os.path
83
84 prologue = bb.data.getVar("postinst_prologue", d, 1)
85
86 gtk_libdir = bb.data.expand('${libdir}/gtk-2.0/${LIBV}', d)
87 loaders_root = os.path.join(gtk_libdir, 'loaders')
88 immodules_root = os.path.join(gtk_libdir, 'immodules')
89
90 do_split_packages(d, loaders_root, '^libpixbufloader-(.*)\.so$', 'gdk-pixbuf-loader-%s', 'GDK pixbuf loader for %s', prologue + 'gdk-pixbuf-query-loaders > /etc/gtk-2.0/gdk-pixbuf.loaders')
91 do_split_packages(d, immodules_root, '^im-(.*)\.so$', 'gtk-immodule-%s', 'GTK input module for %s', prologue + 'gtk-query-immodules-2.0 > /etc/gtk-2.0/gtk.immodules')
92
93 if (bb.data.getVar('DEBIAN_NAMES', d, 1)):
94 bb.data.setVar('PKG_${PN}', 'libgtk-2.0', d)
95}