summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
Diffstat (limited to 'meta')
-rw-r--r--meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch887
-rw-r--r--meta/packages/gtk+/gtk+_2.6.10.bb4
-rw-r--r--meta/packages/gtk+/gtk+_2.6.8.bb2
3 files changed, 261 insertions, 632 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch b/meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch
index fa2dfb4843..46931f7de9 100644
--- a/meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch
+++ b/meta/packages/gtk+/gtk+-2.6.10/filechooser-default.patch
@@ -1,5 +1,11 @@
---- gtk+-2.6.8/gtk/gtkfilechooserdefault.c.orig 2007-02-09 18:37:47.000000000 +0000
-+++ gtk+-2.6.8/gtk/gtkfilechooserdefault.c 2007-02-09 18:37:47.000000000 +0000
+---
+ gtk/gtkfilechooserdefault.c | 3689 ++++----------------------------------------
+ 1 file changed, 415 insertions(+), 3274 deletions(-)
+
+Index: gtk+-2.6.10/gtk/gtkfilechooserdefault.c
+===================================================================
+--- gtk+-2.6.10.orig/gtk/gtkfilechooserdefault.c 2007-06-08 09:29:24.000000000 +0100
++++ gtk+-2.6.10/gtk/gtkfilechooserdefault.c 2007-06-08 11:08:41.000000000 +0100
@@ -31,7 +31,6 @@
#include "gtkcombobox.h"
#include "gtkentry.h"
@@ -40,7 +46,7 @@
#define MAX_LOADING_TIME 500
-@@ -109,63 +112,38 @@
+@@ -109,63 +112,38 @@ struct _GtkFileChooserDefault
/* Save mode widgets */
GtkWidget *save_widgets;
@@ -110,7 +116,7 @@
GtkTreeViewColumn *list_name_column;
GtkCellRenderer *list_name_renderer;
-@@ -179,25 +157,15 @@
+@@ -179,25 +157,15 @@ struct _GtkFileChooserDefault
gulong toplevel_set_focus_id;
GtkWidget *toplevel_last_focus_widget;
@@ -138,7 +144,7 @@
};
/* Signal IDs */
-@@ -211,17 +179,6 @@
+@@ -211,17 +179,6 @@ enum {
static guint signals[LAST_SIGNAL] = { 0 };
@@ -156,7 +162,7 @@
/* Column numbers for the file list */
enum {
FILE_LIST_COL_NAME,
-@@ -236,23 +193,6 @@
+@@ -236,23 +193,6 @@ enum {
TEXT_URI_LIST
};
@@ -180,9 +186,9 @@
/* Target types for DnD from the file list */
static const GtkTargetEntry file_list_source_targets[] = {
{ "text/uri-list", 0, TEXT_URI_LIST }
-@@ -261,22 +201,10 @@
- static const int num_file_list_source_targets = (sizeof (file_list_source_targets)
- / sizeof (file_list_source_targets[0]));
+@@ -270,22 +210,10 @@ static const int num_file_list_dest_targ
+ / sizeof (file_list_dest_targets[0]));
+
-/* Interesting places in the shortcuts bar */
-typedef enum {
@@ -204,7 +210,7 @@
#define NUM_LINES 40
#define NUM_CHARS 60
-@@ -335,7 +263,6 @@
+@@ -348,7 +276,6 @@ static gboolean gtk_file_chooser_d
const GtkFilePath *path,
GError **error);
static GSList * gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser);
@@ -212,7 +218,7 @@
static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
gint *default_width,
gint *default_height);
-@@ -352,37 +279,11 @@
+@@ -365,37 +292,11 @@ static void down_folder_handler (GtkF
static void home_folder_handler (GtkFileChooserDefault *impl);
static void update_appearance (GtkFileChooserDefault *impl);
@@ -252,7 +258,7 @@
static gboolean list_select_func (GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
-@@ -401,16 +302,6 @@
+@@ -414,16 +315,6 @@ static void select_func (GtkFileSystemMo
GtkTreeIter *iter,
gpointer user_data);
@@ -269,7 +275,7 @@
static void list_icon_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
-@@ -441,36 +332,6 @@
+@@ -455,36 +346,6 @@ static void browse_files_center_selected
static GObjectClass *parent_class;
@@ -306,7 +312,7 @@
GType
_gtk_file_chooser_default_get_type (void)
-@@ -520,6 +381,11 @@
+@@ -534,6 +395,11 @@ _gtk_file_chooser_default_get_type (void
return file_chooser_default_type;
}
@@ -318,7 +324,7 @@
static void
gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
{
-@@ -617,6 +483,14 @@
+@@ -631,6 +497,14 @@ gtk_file_chooser_default_class_init (Gtk
"home-folder",
0);
@@ -333,7 +339,7 @@
_gtk_file_chooser_install_properties (gobject_class);
gtk_settings_install_property (g_param_spec_string ("gtk-file-chooser-backend",
-@@ -634,7 +508,6 @@
+@@ -648,7 +522,6 @@ gtk_file_chooser_default_iface_init (Gtk
iface->select_all = gtk_file_chooser_default_select_all;
iface->unselect_all = gtk_file_chooser_default_unselect_all;
iface->get_paths = gtk_file_chooser_default_get_paths;
@@ -341,7 +347,7 @@
iface->get_file_system = gtk_file_chooser_default_get_file_system;
iface->set_current_folder = gtk_file_chooser_default_set_current_folder;
iface->get_current_folder = gtk_file_chooser_default_get_current_folder;
-@@ -642,9 +515,12 @@
+@@ -656,9 +529,12 @@ gtk_file_chooser_default_iface_init (Gtk
iface->add_filter = gtk_file_chooser_default_add_filter;
iface->remove_filter = gtk_file_chooser_default_remove_filter;
iface->list_filters = gtk_file_chooser_default_list_filters;
@@ -355,7 +361,7 @@
}
static void
-@@ -659,71 +535,22 @@
+@@ -673,71 +549,22 @@ static void
gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
{
impl->local_only = TRUE;
@@ -377,7 +383,7 @@
g_object_ref (impl->tooltips);
gtk_object_sink (GTK_OBJECT (impl->tooltips));
-}
-
+-
-/* Frees the data columns for the specified iter in the shortcuts model*/
-static void
-shortcuts_free_row_data (GtkFileChooserDefault *impl,
@@ -414,7 +420,7 @@
-shortcuts_free (GtkFileChooserDefault *impl)
-{
- GtkTreeIter iter;
--
+
- if (!impl->shortcuts_model)
- return;
-
@@ -432,7 +438,7 @@
}
static void
-@@ -743,6 +570,7 @@
+@@ -757,6 +584,7 @@ pending_select_paths_free (GtkFileChoose
impl->pending_select_paths = NULL;
}
@@ -440,7 +446,7 @@
static void
pending_select_paths_add (GtkFileChooserDefault *impl,
const GtkFilePath *path)
-@@ -782,20 +610,30 @@
+@@ -796,20 +624,30 @@ pending_select_paths_store_selection (Gt
}
static void
@@ -455,7 +461,8 @@
+ for (l = impl->path_history; l; l = l->next)
+ {
+ GtkFilePath *path;
-+
+
+- shortcuts_free (impl);
+ path = l->data;
+ gtk_file_path_free (path);
+ }
@@ -463,8 +470,7 @@
+ g_slist_free (impl->path_history);
+ impl->path_history = NULL;
+}
-
-- shortcuts_free (impl);
++
+static void
+gtk_file_chooser_default_finalize (GObject *object)
+{
@@ -478,7 +484,7 @@
g_object_unref (impl->file_system);
for (l = impl->filters; l; l = l->next)
-@@ -816,11 +654,9 @@
+@@ -830,11 +668,9 @@ gtk_file_chooser_default_finalize (GObje
if (impl->current_folder)
gtk_file_path_free (impl->current_folder);
@@ -492,7 +498,7 @@
load_remove_timer (impl);
/* Free all the Models we have */
-@@ -830,12 +666,12 @@
+@@ -844,12 +680,12 @@ gtk_file_chooser_default_finalize (GObje
if (impl->sort_model)
g_object_unref (impl->sort_model);
@@ -507,7 +513,7 @@
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-@@ -916,28 +752,6 @@
+@@ -930,28 +766,6 @@ error_getting_info_dialog (GtkFileChoose
path, error);
}
@@ -536,7 +542,7 @@
/* Shows an error dialog about not being able to create a folder */
static void
error_creating_folder_dialog (GtkFileChooserDefault *impl,
-@@ -949,21 +763,6 @@
+@@ -963,21 +777,6 @@ error_creating_folder_dialog (GtkFileCho
path, error);
}
@@ -558,7 +564,7 @@
/* Shows an error dialog about not being able to create a filename */
static void
error_building_filename_dialog (GtkFileChooserDefault *impl,
-@@ -993,6 +792,7 @@
+@@ -1007,6 +806,7 @@ change_folder_and_display_error (GtkFile
GError *error;
gboolean result;
GtkFilePath *path_copy;
@@ -566,7 +572,7 @@
/* We copy the path because of this case:
*
-@@ -1005,6 +805,29 @@
+@@ -1019,6 +819,29 @@ change_folder_and_display_error (GtkFile
path_copy = gtk_file_path_copy (path);
@@ -594,9 +600,9 @@
+
+
error = NULL;
- result = _gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), path_copy, &error);
+ result = gtk_file_chooser_default_update_current_folder (GTK_FILE_CHOOSER (impl), path_copy, TRUE, &error);
-@@ -1012,2009 +835,245 @@
+@@ -1026,189 +849,11 @@ change_folder_and_display_error (GtkFile
error_changing_folder_dialog (impl, path_copy, error);
gtk_file_path_free (path_copy);
@@ -636,16 +642,11 @@
-
- g_signal_emit_by_name (impl, "default-size-changed");
-}
-
+-
-static void
-set_preview_widget (GtkFileChooserDefault *impl,
- GtkWidget *preview_widget)
-+/* Returns whether a path is a folder */
-+static gboolean
-+check_is_folder (GtkFileSystem *file_system,
-+ const GtkFilePath *path,
-+ GError **error)
- {
+-{
- if (preview_widget == impl->preview_widget)
- return;
-
@@ -662,36 +663,19 @@
- impl->preview_widget,
- (impl->use_preview_label && impl->preview_label) ? 1 : 0);
- }
-+ GtkFileFolder *folder;
-+#ifdef GTK26
-+ folder = gtk_file_system_get_folder (file_system, path, 0, error);
-+#else
-+ folder = gtk_file_system_get_folder (file_system, path, 0, NULL, NULL);
-+#endif
-+ if (!folder)
-+ return FALSE;
-
+-
- update_preview_widget_visibility (impl);
-+ g_object_unref (folder);
-+ return TRUE;
- }
-
+-}
+-
-/* Re-reads all the icons for the shortcuts, used when the theme changes */
-+
-+/* Callback used when the "New Folder" button is clicked */
- static void
+-static void
-shortcuts_reload_icons (GtkFileChooserDefault *impl)
-+new_folder_button_clicked (GtkButton *button,
-+ GtkFileChooserDefault *impl)
- {
- GtkTreeIter iter;
-+ GtkTreePath *path;
-
+-{
+- GtkTreeIter iter;
+-
- if (!gtk_tree_model_get_iter_first (GTK_TREE_MODEL (impl->shortcuts_model), &iter))
- return;
-+ if (!impl->browse_files_model)
-+ return; /* FIXME: this sucks. Disable the New Folder button or something. */
-
+-
- do {
- gpointer data;
- gboolean is_volume;
@@ -703,16 +687,13 @@
- SHORTCUTS_COL_IS_VOLUME, &is_volume,
- SHORTCUTS_COL_PIXBUF_VISIBLE, &pixbuf_visible,
- -1);
-+ /* Prevent button from being clicked twice */
-+ gtk_widget_set_sensitive (impl->browse_new_folder_button, FALSE);
-
+-
- if (pixbuf_visible && data)
- {
- if (is_volume)
- {
- GtkFileSystemVolume *volume;
-+ _gtk_file_system_model_add_editable (impl->browse_files_model, &iter);
-
+-
- volume = data;
- pixbuf = gtk_file_system_volume_render_icon (impl->file_system, volume, GTK_WIDGET (impl),
- impl->icon_size, NULL);
@@ -720,21 +701,12 @@
- else
- {
- const GtkFilePath *path;
-+ path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->browse_files_model), &iter);
-+ gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->browse_files_tree_view),
-+ path, impl->list_name_column,
-+ FALSE, 0.0, 0.0);
-
+-
- path = data;
- pixbuf = gtk_file_system_render_icon (impl->file_system, path, GTK_WIDGET (impl),
- impl->icon_size, NULL);
- }
-+ g_object_set (impl->list_name_renderer, "editable", TRUE, NULL);
-+ gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view),
-+ path,
-+ impl->list_name_column,
-+ TRUE);
-
+-
- gtk_list_store_set (impl->shortcuts_model, &iter,
- SHORTCUTS_COL_PIXBUF, pixbuf,
- -1);
@@ -742,86 +714,38 @@
- g_object_unref (pixbuf);
- }
- } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter));
-+ gtk_tree_path_free (path);
- }
-
+-}
+-
-static void
-shortcuts_find_folder (GtkFileChooserDefault *impl,
- GtkFilePath *folder)
-+/* Idle handler for creating a new folder after editing its name cell, or for
-+ * canceling the editing.
-+ */
-+static gboolean
-+edited_idle_cb (GtkFileChooserDefault *impl)
- {
+-{
- GtkTreeSelection *selection;
- int pos;
- GtkTreePath *path;
-+ GDK_THREADS_ENTER ();
-+
-+ g_source_destroy (impl->edited_idle);
-+ impl->edited_idle = NULL;
-
+-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
-+ _gtk_file_system_model_remove_editable (impl->browse_files_model);
-+ g_object_set (impl->list_name_renderer, "editable", FALSE, NULL);
-+
-+ gtk_widget_set_sensitive (impl->browse_new_folder_button, TRUE);
-
+-
- g_assert (folder != NULL);
- pos = shortcut_find_position (impl, folder);
- if (pos == -1)
-+ if (impl->edited_new_text) /* not cancelled? */
- {
+- {
- gtk_tree_selection_unselect_all (selection);
- return;
-+ GError *error;
-+ GtkFilePath *file_path;
-+
-+ error = NULL;
-+ file_path = gtk_file_system_make_path (impl->file_system, impl->current_folder, impl->edited_new_text,
-+ &error);
-+ if (file_path)
-+ {
-+ error = NULL;
-+#ifdef GTK26
-+ if (gtk_file_system_create_folder (impl->file_system, file_path, &error))
-+#else
-+ if (gtk_file_system_create_folder (impl->file_system, file_path, NULL, NULL))
-+#endif
-+ change_folder_and_display_error (impl, file_path);
-+ else
-+ error_creating_folder_dialog (impl, file_path, error);
-+
-+ gtk_file_path_free (file_path);
-+ }
-+ else
-+ error_creating_folder_dialog (impl, file_path, error);
-+
-+ g_free (impl->edited_new_text);
-+ impl->edited_new_text = NULL;
- }
-
+- }
+-
- path = gtk_tree_path_new_from_indices (pos, -1);
- gtk_tree_selection_select_path (selection, path);
- gtk_tree_path_free (path);
-+ GDK_THREADS_LEAVE ();
-+
-+ return FALSE;
- }
-
+-}
+-
-/* If a shortcut corresponds to the current folder, selects it */
- static void
+-static void
-shortcuts_find_current_folder (GtkFileChooserDefault *impl)
-+queue_edited_idle (GtkFileChooserDefault *impl,
-+ const gchar *new_text)
- {
+-{
- shortcuts_find_folder (impl, impl->current_folder);
-}
-+ /* We create the folder in an idle handler so that we don't modify the tree
-+ * just now.
-+ */
-
+-
-/* Convenience function to get the display name and icon info for a path */
-static GtkFileInfo *
-get_file_info (GtkFileSystem *file_system,
@@ -853,9 +777,7 @@
- out:
- if (parent_path)
- gtk_file_path_free (parent_path);
-+ g_assert (!impl->edited_idle);
-+ g_assert (!impl->edited_new_text);
-
+-
- if (tmp)
- {
- g_set_error (error,
@@ -869,23 +791,26 @@
-
- return info;
-}
+
+ /* Returns whether a path is a folder */
+ static gboolean
+@@ -1217,8 +862,11 @@ check_is_folder (GtkFileSystem *fil
+ GError **error)
+ {
+ GtkFileFolder *folder;
-
--/* Returns whether a path is a folder */
--static gboolean
--check_is_folder (GtkFileSystem *file_system,
-- const GtkFilePath *path,
-- GError **error)
--{
-- GtkFileFolder *folder;
--
-- folder = gtk_file_system_get_folder (file_system, path, 0, error);
-- if (!folder)
-- return FALSE;
--
-- g_object_unref (folder);
-- return TRUE;
--}
--
++#ifdef GTK26
+ folder = gtk_file_system_get_folder (file_system, path, 0, error);
++#else
++ folder = gtk_file_system_get_folder (file_system, path, 0, NULL, NULL);
++#endif
+ if (!folder)
+ return FALSE;
+
+@@ -1226,515 +874,6 @@ check_is_folder (GtkFileSystem *fil
+ return TRUE;
+ }
+
-/* Inserts a path in the shortcuts tree, making a copy of it; alternatively,
- * inserts a volume. A position of -1 indicates the end of the tree.
- */
@@ -1395,143 +1320,33 @@
- impl,
- NULL);
-}
--
--/* Callback used when the "New Folder" button is clicked */
--static void
--new_folder_button_clicked (GtkButton *button,
-- GtkFileChooserDefault *impl)
--{
-- GtkTreeIter iter;
-- GtkTreePath *path;
--
-- if (!impl->browse_files_model)
-- return; /* FIXME: this sucks. Disable the New Folder button or something. */
--
-- /* Prevent button from being clicked twice */
-- gtk_widget_set_sensitive (impl->browse_new_folder_button, FALSE);
--
-- _gtk_file_system_model_add_editable (impl->browse_files_model, &iter);
--
-- path = gtk_tree_model_get_path (GTK_TREE_MODEL (impl->browse_files_model), &iter);
-- gtk_tree_view_scroll_to_cell (GTK_TREE_VIEW (impl->browse_files_tree_view),
-- path, impl->list_name_column,
-- FALSE, 0.0, 0.0);
--
-- g_object_set (impl->list_name_renderer, "editable", TRUE, NULL);
-- gtk_tree_view_set_cursor (GTK_TREE_VIEW (impl->browse_files_tree_view),
-- path,
-- impl->list_name_column,
-- TRUE);
--
-- gtk_tree_path_free (path);
--}
--
--/* Idle handler for creating a new folder after editing its name cell, or for
-- * canceling the editing.
-- */
--static gboolean
--edited_idle_cb (GtkFileChooserDefault *impl)
--{
-- GDK_THREADS_ENTER ();
--
-- g_source_destroy (impl->edited_idle);
-- impl->edited_idle = NULL;
--
-- _gtk_file_system_model_remove_editable (impl->browse_files_model);
-- g_object_set (impl->list_name_renderer, "editable", FALSE, NULL);
--
-- gtk_widget_set_sensitive (impl->browse_new_folder_button, TRUE);
--
-- if (impl->edited_new_text) /* not cancelled? */
-- {
-- GError *error;
-- GtkFilePath *file_path;
--
-- error = NULL;
-- file_path = gtk_file_system_make_path (impl->file_system, impl->current_folder, impl->edited_new_text,
-- &error);
-- if (file_path)
-- {
-- error = NULL;
-- if (gtk_file_system_create_folder (impl->file_system, file_path, &error))
-- change_folder_and_display_error (impl, file_path);
-- else
-- error_creating_folder_dialog (impl, file_path, error);
--
-- gtk_file_path_free (file_path);
-- }
-- else
-- error_creating_folder_dialog (impl, file_path, error);
--
-- g_free (impl->edited_new_text);
-- impl->edited_new_text = NULL;
-- }
--
-- GDK_THREADS_LEAVE ();
--
-- return FALSE;
--}
--
--static void
--queue_edited_idle (GtkFileChooserDefault *impl,
-- const gchar *new_text)
--{
-- /* We create the folder in an idle handler so that we don't modify the tree
-- * just now.
-- */
--
-- g_assert (!impl->edited_idle);
-- g_assert (!impl->edited_new_text);
--
-- impl->edited_idle = g_idle_source_new ();
-- g_source_set_closure (impl->edited_idle,
-- g_cclosure_new_object (G_CALLBACK (edited_idle_cb),
-- G_OBJECT (impl)));
-- g_source_attach (impl->edited_idle, NULL);
--
-- if (new_text)
-- impl->edited_new_text = g_strdup (new_text);
--}
--
--/* Callback used from the text cell renderer when the new folder is named */
--static void
--renderer_edited_cb (GtkCellRendererText *cell_renderer_text,
-- const gchar *path,
-- const gchar *new_text,
-- GtkFileChooserDefault *impl)
--{
-- /* work around bug #154921 */
-- g_object_set (cell_renderer_text,
-- "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
-- queue_edited_idle (impl, new_text);
--}
--
--/* Callback used from the text cell renderer when the new folder edition gets
-- * canceled.
-- */
--static void
--renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
-- GtkFileChooserDefault *impl)
--{
-- /* work around bug #154921 */
-- g_object_set (cell_renderer_text,
-- "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
-- queue_edited_idle (impl, NULL);
--}
--
--/* Creates the widgets for the filter combo box */
--static GtkWidget *
--filter_create (GtkFileChooserDefault *impl)
--{
-- impl->filter_combo = gtk_combo_box_new_text ();
+
+ /* Callback used when the "New Folder" button is clicked */
+ static void
+@@ -1793,7 +932,11 @@ edited_idle_cb (GtkFileChooserDefault *i
+ if (file_path)
+ {
+ error = NULL;
++#ifdef GTK26
+ if (gtk_file_system_create_folder (impl->file_system, file_path, &error))
++#else
++ if (gtk_file_system_create_folder (impl->file_system, file_path, NULL, NULL))
++#endif
+ change_folder_and_display_error (impl, file_path);
+ else
+ error_creating_folder_dialog (impl, file_path, error);
+@@ -1864,245 +1007,12 @@ static GtkWidget *
+ filter_create (GtkFileChooserDefault *impl)
+ {
+ impl->filter_combo = gtk_combo_box_new_text ();
- gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE);
-
-- g_signal_connect (impl->filter_combo, "changed",
-- G_CALLBACK (filter_combo_changed), impl);
--
-- return impl->filter_combo;
--}
--
+ g_signal_connect (impl->filter_combo, "changed",
+ G_CALLBACK (filter_combo_changed), impl);
+
+ return impl->filter_combo;
+ }
+
-static GtkWidget *
-button_new (GtkFileChooserDefault *impl,
- const char *text,
@@ -1763,74 +1578,13 @@
- remove_selected_bookmarks (impl);
-}
-
--struct selection_check_closure {
-- GtkFileChooserDefault *impl;
-- int num_selected;
-- gboolean all_files;
-- gboolean all_folders;
--};
--
--/* Used from gtk_tree_selection_selected_foreach() */
--static void
--selection_check_foreach_cb (GtkTreeModel *model,
-- GtkTreePath *path,
-- GtkTreeIter *iter,
-- gpointer data)
--{
-- struct selection_check_closure *closure;
-- GtkTreeIter child_iter;
-- const GtkFileInfo *info;
-- gboolean is_folder;
--
-- closure = data;
-- closure->num_selected++;
--
-- gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter);
--
-- info = _gtk_file_system_model_get_info (closure->impl->browse_files_model, &child_iter);
-- is_folder = info ? gtk_file_info_get_is_folder (info) : FALSE;
--
-- closure->all_folders = closure->all_folders && is_folder;
-- closure->all_files = closure->all_files && !is_folder;
--}
--
--/* Checks whether the selected items in the file list are all files or all folders */
--static void
--selection_check (GtkFileChooserDefault *impl,
-- gint *num_selected,
-- gboolean *all_files,
-- gboolean *all_folders)
--{
-- struct selection_check_closure closure;
-- GtkTreeSelection *selection;
--
-- closure.impl = impl;
-- closure.num_selected = 0;
-- closure.all_files = TRUE;
-- closure.all_folders = TRUE;
--
-- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
-- gtk_tree_selection_selected_foreach (selection,
-- selection_check_foreach_cb,
-- &closure);
--
-- g_assert (closure.num_selected == 0 || !(closure.all_files && closure.all_folders));
--
-- if (num_selected)
-- *num_selected = closure.num_selected;
--
-- if (all_files)
-- *all_files = closure.all_files;
--
-- if (all_folders)
-- *all_folders = closure.all_folders;
--}
--
--struct get_selected_path_closure {
-- GtkFileChooserDefault *impl;
-- const GtkFilePath *path;
--};
--
+ struct selection_check_closure {
+ GtkFileChooserDefault *impl;
+ int num_selected;
+@@ -2171,864 +1081,13 @@ struct get_selected_path_closure {
+ const GtkFilePath *path;
+ };
+
-static void
-get_selected_path_foreach_cb (GtkTreeModel *model,
- GtkTreePath *path,
@@ -1846,7 +1600,7 @@
- closure->path = _gtk_file_system_model_get_path (closure->impl->browse_files_model, &child_iter);
-}
-
--/* Returns a selected path from the file list */
+ /* Returns a selected path from the file list */
-static const GtkFilePath *
-get_selected_path (GtkFileChooserDefault *impl)
-{
@@ -1863,12 +1617,12 @@
-
- return closure.path;
-}
--
--typedef struct {
-- GtkFileChooserDefault *impl;
-- gchar *tip;
--} UpdateTooltipData;
--
+
+ typedef struct {
+ GtkFileChooserDefault *impl;
+ gchar *tip;
+ } UpdateTooltipData;
+
-static void
-update_tooltip (GtkTreeModel *model,
- GtkTreePath *path,
@@ -2488,20 +2242,12 @@
- shortcuts_drop_uris (impl, selection_data->data, position);
- else if (selection_data->target == gdk_atom_intern ("GTK_TREE_MODEL_ROW", FALSE))
- shortcuts_reorder (impl, position);
-+ impl->edited_idle = g_idle_source_new ();
-+ g_source_set_closure (impl->edited_idle,
-+ g_cclosure_new_object (G_CALLBACK (edited_idle_cb),
-+ G_OBJECT (impl)));
-+ g_source_attach (impl->edited_idle, NULL);
-
+-
- g_signal_stop_emission_by_name (widget, "drag-data-received");
-+ if (new_text)
-+ impl->edited_new_text = g_strdup (new_text);
- }
-
+-}
+-
-/* Callback used when the selection in the shortcuts tree changes */
-+/* Callback used from the text cell renderer when the new folder is named */
- static void
+-static void
-shortcuts_selection_changed_cb (GtkTreeSelection *selection,
- GtkFileChooserDefault *impl)
-{
@@ -2512,11 +2258,7 @@
-shortcuts_row_separator_func (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-+renderer_edited_cb (GtkCellRendererText *cell_renderer_text,
-+ const gchar *path,
-+ const gchar *new_text,
-+ GtkFileChooserDefault *impl)
- {
+-{
- gint column = GPOINTER_TO_INT (data);
- gchar *text;
-
@@ -2528,25 +2270,16 @@
- g_free (text);
-
- return FALSE;
-+ /* work around bug #154921 */
-+ g_object_set (cell_renderer_text,
-+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
-+ queue_edited_idle (impl, new_text);
- }
-
+-}
+-
-/* Since GtkTreeView has a keybinding attached to '/', we need to catch
- * keypresses before the TreeView gets them.
-+/* Callback used from the text cell renderer when the new folder edition gets
-+ * canceled.
- */
+- */
-static gboolean
-tree_view_keybinding_cb (GtkWidget *tree_view,
- GdkEventKey *event,
- GtkFileChooserDefault *impl)
-+static void
-+renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
-+ GtkFileChooserDefault *impl)
- {
+-{
- if (event->keyval == GDK_slash &&
- ! (event->state & (~GDK_SHIFT_MASK & gtk_accelerator_get_default_mod_mask ())))
- {
@@ -2555,19 +2288,13 @@
- }
-
- return FALSE;
-+ /* work around bug #154921 */
-+ g_object_set (cell_renderer_text,
-+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
-+ queue_edited_idle (impl, NULL);
- }
-
+-}
+-
-
-/* Creates the widgets for the shortcuts and bookmarks tree */
-+/* Creates the widgets for the filter combo box */
- static GtkWidget *
+-static GtkWidget *
-shortcuts_list_create (GtkFileChooserDefault *impl)
-+filter_create (GtkFileChooserDefault *impl)
- {
+-{
- GtkWidget *swin;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
@@ -2589,14 +2316,9 @@
- G_CALLBACK (tree_view_keybinding_cb), impl);
- atk_object_set_name (gtk_widget_get_accessible (impl->browse_shortcuts_tree_view), _("Shortcuts"));
- gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), FALSE);
-+ impl->filter_combo = gtk_combo_box_new_text ();
-+ g_signal_connect (impl->filter_combo, "changed",
-+ G_CALLBACK (filter_combo_changed), impl);
-
+-
- gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), impl->shortcuts_filter_model);
-+ return impl->filter_combo;
-+}
-
+-
- gtk_tree_view_enable_model_drag_source (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
- GDK_BUTTON1_MASK,
- shortcuts_source_targets,
@@ -2608,44 +2330,22 @@
- shortcuts_dest_targets,
- num_shortcuts_dest_targets,
- GDK_ACTION_COPY | GDK_ACTION_MOVE);
-+struct selection_check_closure {
-+ GtkFileChooserDefault *impl;
-+ int num_selected;
-+ gboolean all_files;
-+ gboolean all_folders;
-+};
-
+-
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
- gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE);
- gtk_tree_selection_set_select_function (selection,
- shortcuts_select_func,
- impl, NULL);
-+/* Used from gtk_tree_selection_selected_foreach() */
-+static void
-+selection_check_foreach_cb (GtkTreeModel *model,
-+ GtkTreePath *path,
-+ GtkTreeIter *iter,
-+ gpointer data)
-+{
-+ struct selection_check_closure *closure;
-+ GtkTreeIter child_iter;
-+ const GtkFileInfo *info;
-+ gboolean is_folder;
-
+-
- g_signal_connect (selection, "changed",
- G_CALLBACK (shortcuts_selection_changed_cb), impl);
-+ closure = data;
-+ closure->num_selected++;
-
+-
- g_signal_connect (impl->browse_shortcuts_tree_view, "row-activated",
- G_CALLBACK (shortcuts_row_activated_cb), impl);
-+ gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter);
-
+-
- g_signal_connect (impl->browse_shortcuts_tree_view, "key-press-event",
- G_CALLBACK (shortcuts_key_press_event_cb), impl);
-+ info = _gtk_file_system_model_get_info (closure->impl->browse_files_model, &child_iter);
-+ is_folder = info ? gtk_file_info_get_is_folder (info) : FALSE;
-
+-
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-begin",
- G_CALLBACK (shortcuts_drag_begin_cb), impl);
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-end",
@@ -2661,43 +2361,22 @@
- G_CALLBACK (shortcuts_drag_drop_cb), impl);
- g_signal_connect (impl->browse_shortcuts_tree_view, "drag-data-received",
- G_CALLBACK (shortcuts_drag_data_received_cb), impl);
-+ closure->all_folders = closure->all_folders && is_folder;
-+ closure->all_files = closure->all_files && !is_folder;
-+}
-
+-
- gtk_container_add (GTK_CONTAINER (swin), impl->browse_shortcuts_tree_view);
- gtk_widget_show (impl->browse_shortcuts_tree_view);
-+/* Checks whether the selected items in the file list are all files or all folders */
-+static void
-+selection_check (GtkFileChooserDefault *impl,
-+ gint *num_selected,
-+ gboolean *all_files,
-+ gboolean *all_folders)
-+{
-+ struct selection_check_closure closure;
-+ GtkTreeSelection *selection;
-
+-
- /* Column */
-+ closure.impl = impl;
-+ closure.num_selected = 0;
-+ closure.all_files = TRUE;
-+ closure.all_folders = TRUE;
-
+-
- column = gtk_tree_view_column_new ();
- gtk_tree_view_column_set_title (column, _("Folder"));
-+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
-+ gtk_tree_selection_selected_foreach (selection,
-+ selection_check_foreach_cb,
-+ &closure);
-
+-
- renderer = gtk_cell_renderer_pixbuf_new ();
- gtk_tree_view_column_pack_start (column, renderer, FALSE);
- gtk_tree_view_column_set_attributes (column, renderer,
- "pixbuf", SHORTCUTS_COL_PIXBUF,
- "visible", SHORTCUTS_COL_PIXBUF_VISIBLE,
- NULL);
-+ g_assert (closure.num_selected == 0 || !(closure.all_files && closure.all_folders));
-
+-
- renderer = gtk_cell_renderer_text_new ();
- gtk_tree_view_column_pack_start (column, renderer, TRUE);
- gtk_tree_view_column_set_attributes (column, renderer,
@@ -2708,18 +2387,12 @@
- shortcuts_row_separator_func,
- GINT_TO_POINTER (SHORTCUTS_COL_NAME),
- NULL);
-+ if (num_selected)
-+ *num_selected = closure.num_selected;
-
+-
- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), column);
-+ if (all_files)
-+ *all_files = closure.all_files;
-
+-
- return swin;
-+ if (all_folders)
-+ *all_folders = closure.all_folders;
- }
-
+-}
+-
-/* Creates the widgets for the shortcuts/bookmarks pane */
-static GtkWidget *
-shortcuts_pane_create (GtkFileChooserDefault *impl,
@@ -2743,14 +2416,9 @@
- gtk_size_group_add_widget (size_group, hbox);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-+struct get_selected_path_closure {
-+ GtkFileChooserDefault *impl;
-+ const GtkFilePath *path;
-+};
-
+-
- /* Add bookmark button */
-+/* Returns a selected path from the file list */
-
+-
- impl->browse_shortcuts_add_button = button_new (impl,
- _("_Add"),
- GTK_STOCK_ADD,
@@ -2772,17 +2440,13 @@
- gtk_box_pack_start (GTK_BOX (hbox), impl->browse_shortcuts_remove_button, TRUE, TRUE, 0);
- gtk_tooltips_set_tip (impl->tooltips, impl->browse_shortcuts_remove_button,
- _("Remove the selected bookmark"), NULL);
-+typedef struct {
-+ GtkFileChooserDefault *impl;
-+ gchar *tip;
-+} UpdateTooltipData;
-
+-
- return vbox;
-}
/* Handles key press events on the file list, so that we can trap Enter to
* activate the default button on our own. Also, checks to see if '/' has been
-@@ -3026,14 +1085,11 @@
+@@ -3040,14 +1099,11 @@ trap_activate_cb (GtkWidget *widget,
gpointer data)
{
GtkFileChooserDefault *impl;
@@ -2798,7 +2462,7 @@
{
location_popup_handler (impl, "/");
return TRUE;
-@@ -3043,7 +1099,6 @@
+@@ -3057,7 +1113,6 @@ trap_activate_cb (GtkWidget *widget,
|| event->keyval == GDK_ISO_Enter
|| event->keyval == GDK_KP_Enter
|| event->keyval == GDK_space)
@@ -2806,7 +2470,7 @@
&& !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
{
-@@ -3063,37 +1118,7 @@
+@@ -3077,37 +1132,7 @@ trap_activate_cb (GtkWidget *widget,
return FALSE;
}
@@ -2845,9 +2509,9 @@
/* Callback used when the "Show Hidden Files" menu item is toggled */
static void
show_hidden_toggled_cb (GtkCheckMenuItem *item,
-@@ -3103,145 +1128,7 @@
- "show-hidden", gtk_check_menu_item_get_active (item),
- NULL);
+@@ -3238,145 +1263,7 @@ file_list_drag_motion_cb (GtkWidget
+ g_signal_stop_emission_by_name (widget, "drag-motion");
+ return TRUE;
}
-
-/* Constructs the popup menu for the file list if needed */
@@ -2992,7 +2656,7 @@
/* Creates the widgets for the file li