summaryrefslogtreecommitdiff
path: root/meta
diff options
context:
space:
mode:
authorTomas Frydrych <tf@openedhand.com>2007-02-09 18:18:44 +0000
committerTomas Frydrych <tf@openedhand.com>2007-02-09 18:18:44 +0000
commit91d6da983316dc9b9f09cb44091c0c81e8a679ac (patch)
treeae979560a6e8dfe05748415624b6245893ba4c9a /meta
parent19d07794eed15aad348bb6c8b4514936b49a421a (diff)
downloadopenembedded-core-91d6da983316dc9b9f09cb44091c0c81e8a679ac.tar.gz
openembedded-core-91d6da983316dc9b9f09cb44091c0c81e8a679ac.tar.bz2
openembedded-core-91d6da983316dc9b9f09cb44091c0c81e8a679ac.zip
added filter selector
git-svn-id: https://svn.o-hand.com/repos/poky/trunk@1267 311d38ba-8fff-0310-9ca6-ca027cbcb966
Diffstat (limited to 'meta')
-rw-r--r--meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch990
-rw-r--r--meta/packages/gtk+/gtk+_2.6.8.bb2
2 files changed, 410 insertions, 582 deletions
diff --git a/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch b/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch
index d4534212a0..fa2dfb4843 100644
--- a/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch
+++ b/meta/packages/gtk+/gtk+-2.6.8/filechooser-default.patch
@@ -1,5 +1,5 @@
---- gtk+-2.6.8/gtk/gtkfilechooserdefault.c.orig 2007-02-09 12:28:31.000000000 +0000
-+++ gtk+-2.6.8/gtk/gtkfilechooserdefault.c 2007-02-09 12:28:31.000000000 +0000
+--- 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
@@ -31,7 +31,6 @@
#include "gtkcombobox.h"
#include "gtkentry.h"
@@ -40,7 +40,7 @@
#define MAX_LOADING_TIME 500
-@@ -109,63 +112,33 @@
+@@ -109,63 +112,38 @@
/* Save mode widgets */
GtkWidget *save_widgets;
@@ -68,7 +68,7 @@
GtkFileSystemModel *browse_files_model;
- GtkWidget *filter_combo_hbox;
-- GtkWidget *filter_combo;
+ GtkWidget *filter_combo;
- GtkWidget *preview_box;
- GtkWidget *preview_label;
- GtkWidget *preview_widget;
@@ -78,6 +78,7 @@
- GtkListStore *shortcuts_model;
- GtkTreeModel *shortcuts_filter_model;
-
++
GtkTreeModelSort *sort_model;
LoadState load_state;
@@ -85,11 +86,11 @@
GSList *pending_select_paths;
-
-- GtkFileFilter *current_filter;
-- GSList *filters;
--
+ GSList * path_history;
+
+ GtkFileFilter *current_filter;
+ GSList *filters;
+
GtkTooltips *tooltips;
- gboolean has_home;
@@ -109,7 +110,7 @@
GtkTreeViewColumn *list_name_column;
GtkCellRenderer *list_name_renderer;
-@@ -179,25 +152,15 @@
+@@ -179,25 +157,15 @@
gulong toplevel_set_focus_id;
GtkWidget *toplevel_last_focus_widget;
@@ -137,7 +138,7 @@
};
/* Signal IDs */
-@@ -211,17 +174,6 @@
+@@ -211,17 +179,6 @@
static guint signals[LAST_SIGNAL] = { 0 };
@@ -155,7 +156,7 @@
/* Column numbers for the file list */
enum {
FILE_LIST_COL_NAME,
-@@ -236,23 +188,6 @@
+@@ -236,23 +193,6 @@
TEXT_URI_LIST
};
@@ -179,7 +180,7 @@
/* Target types for DnD from the file list */
static const GtkTargetEntry file_list_source_targets[] = {
{ "text/uri-list", 0, TEXT_URI_LIST }
-@@ -261,22 +196,10 @@
+@@ -261,22 +201,10 @@
static const int num_file_list_source_targets = (sizeof (file_list_source_targets)
/ sizeof (file_list_source_targets[0]));
@@ -203,7 +204,7 @@
#define NUM_LINES 40
#define NUM_CHARS 60
-@@ -335,7 +258,6 @@
+@@ -335,7 +263,6 @@
const GtkFilePath *path,
GError **error);
static GSList * gtk_file_chooser_default_list_shortcut_folders (GtkFileChooser *chooser);
@@ -211,7 +212,7 @@
static void gtk_file_chooser_default_get_default_size (GtkFileChooserEmbed *chooser_embed,
gint *default_width,
gint *default_height);
-@@ -352,37 +274,6 @@
+@@ -352,37 +279,11 @@
static void home_folder_handler (GtkFileChooserDefault *impl);
static void update_appearance (GtkFileChooserDefault *impl);
@@ -219,8 +220,8 @@
- GtkFileFilter *filter);
-static void check_preview_change (GtkFileChooserDefault *impl);
-
--static void filter_combo_changed (GtkComboBox *combo_box,
-- GtkFileChooserDefault *impl);
+ static void filter_combo_changed (GtkComboBox *combo_box,
+ GtkFileChooserDefault *impl);
-static void shortcuts_row_activated_cb (GtkTreeView *tree_view,
- GtkTreePath *path,
- GtkTreeViewColumn *column,
@@ -245,11 +246,13 @@
- const GtkFilePath *path);
-
-static void bookmarks_check_add_sensitivity (GtkFileChooserDefault *impl);
--
+
++static void set_current_filter (GtkFileChooserDefault *impl,
++ GtkFileFilter *filter);
static gboolean list_select_func (GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
-@@ -401,16 +292,6 @@
+@@ -401,16 +302,6 @@
GtkTreeIter *iter,
gpointer user_data);
@@ -266,7 +269,7 @@
static void list_icon_data_func (GtkTreeViewColumn *tree_column,
GtkCellRenderer *cell,
GtkTreeModel *tree_model,
-@@ -441,36 +322,6 @@
+@@ -441,36 +332,6 @@
static GObjectClass *parent_class;
@@ -303,7 +306,7 @@
GType
_gtk_file_chooser_default_get_type (void)
-@@ -520,6 +371,11 @@
+@@ -520,6 +381,11 @@
return file_chooser_default_type;
}
@@ -315,7 +318,7 @@
static void
gtk_file_chooser_default_class_init (GtkFileChooserDefaultClass *class)
{
-@@ -617,6 +473,14 @@
+@@ -617,6 +483,14 @@
"home-folder",
0);
@@ -330,7 +333,7 @@
_gtk_file_chooser_install_properties (gobject_class);
gtk_settings_install_property (g_param_spec_string ("gtk-file-chooser-backend",
-@@ -634,17 +498,19 @@
+@@ -634,7 +508,6 @@
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;
@@ -338,13 +341,13 @@
iface->get_file_system = gtk_file_chooser_default_get_file_system;
iface->set_current_folder = gtk_file_chooser_default_set_current_folder;
iface->get_current_folder = gtk_file_chooser_default_get_current_folder;
- iface->set_current_name = gtk_file_chooser_default_set_current_name;
-+
-+ /* these are only stubs */
-+ iface->get_preview_path = gtk_file_chooser_default_get_preview_path;
+@@ -642,9 +515,12 @@
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;
++
++ /* these are only stubs */
++ iface->get_preview_path = gtk_file_chooser_default_get_preview_path;
iface->add_shortcut_folder = gtk_file_chooser_default_add_shortcut_folder;
iface->remove_shortcut_folder = gtk_file_chooser_default_remove_shortcut_folder;
- iface->list_shortcut_folders = gtk_file_chooser_default_list_shortcut_folders;
@@ -352,7 +355,7 @@
}
static void
-@@ -659,71 +525,22 @@
+@@ -659,71 +535,22 @@
gtk_file_chooser_default_init (GtkFileChooserDefault *impl)
{
impl->local_only = TRUE;
@@ -374,7 +377,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,
@@ -421,7 +424,7 @@
- shortcuts_free_row_data (impl, &iter);
- }
- while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model), &iter));
-
+-
- g_object_unref (impl->shortcuts_model);
- impl->shortcuts_model = NULL;
+ if (!impl->root_folder)
@@ -429,7 +432,7 @@
}
static void
-@@ -743,6 +560,7 @@
+@@ -743,6 +570,7 @@
impl->pending_select_paths = NULL;
}
@@ -437,7 +440,7 @@
static void
pending_select_paths_add (GtkFileChooserDefault *impl,
const GtkFilePath *path)
-@@ -782,45 +600,40 @@
+@@ -782,20 +610,30 @@
}
static void
@@ -465,6 +468,7 @@
+static void
+gtk_file_chooser_default_finalize (GObject *object)
+{
++ GSList *l;
+ GtkFileChooserDefault *impl = GTK_FILE_CHOOSER_DEFAULT (object);
g_signal_handler_disconnect (impl->file_system, impl->volumes_changed_id);
@@ -473,21 +477,8 @@
- impl->bookmarks_changed_id = 0;
g_object_unref (impl->file_system);
-- for (l = impl->filters; l; l = l->next)
-- {
-- GtkFileFilter *filter;
--
-- filter = GTK_FILE_FILTER (l->data);
-- g_object_unref (filter);
-- }
-- g_slist_free (impl->filters);
--
-- if (impl->current_filter)
-- g_object_unref (impl->current_filter);
--
- if (impl->current_volume_path)
- gtk_file_path_free (impl->current_volume_path);
-
+ for (l = impl->filters; l; l = l->next)
+@@ -816,11 +654,9 @@
if (impl->current_folder)
gtk_file_path_free (impl->current_folder);
@@ -501,7 +492,7 @@
load_remove_timer (impl);
/* Free all the Models we have */
-@@ -830,12 +643,12 @@
+@@ -830,12 +666,12 @@
if (impl->sort_model)
g_object_unref (impl->sort_model);
@@ -516,7 +507,7 @@
G_OBJECT_CLASS (parent_class)->finalize (object);
}
-@@ -916,28 +729,6 @@
+@@ -916,28 +752,6 @@
path, error);
}
@@ -545,7 +536,7 @@
/* Shows an error dialog about not being able to create a folder */
static void
error_creating_folder_dialog (GtkFileChooserDefault *impl,
-@@ -949,21 +740,6 @@
+@@ -949,21 +763,6 @@
path, error);
}
@@ -567,7 +558,7 @@
/* Shows an error dialog about not being able to create a filename */
static void
error_building_filename_dialog (GtkFileChooserDefault *impl,
-@@ -993,6 +769,7 @@
+@@ -993,6 +792,7 @@
GError *error;
gboolean result;
GtkFilePath *path_copy;
@@ -575,7 +566,7 @@
/* We copy the path because of this case:
*
-@@ -1005,6 +782,29 @@
+@@ -1005,6 +805,29 @@
path_copy = gtk_file_path_copy (path);
@@ -605,7 +596,7 @@
error = NULL;
result = _gtk_file_chooser_set_current_folder_path (GTK_FILE_CHOOSER (impl), path_copy, &error);
-@@ -1012,2009 +812,234 @@
+@@ -1012,2009 +835,245 @@
error_changing_folder_dialog (impl, path_copy, error);
gtk_file_path_free (path_copy);
@@ -770,11 +761,11 @@
+
+ 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);
- 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);
@@ -784,21 +775,9 @@
{
- gtk_tree_selection_unselect_all (selection);
- return;
-- }
--
-- path = gtk_tree_path_new_from_indices (pos, -1);
-- gtk_tree_selection_select_path (selection, path);
-- gtk_tree_path_free (path);
--}
+ GError *error;
+ GtkFilePath *file_path;
-
--/* If a shortcut corresponds to the current folder, selects it */
--static void
--shortcuts_find_current_folder (GtkFileChooserDefault *impl)
--{
-- shortcuts_find_folder (impl, impl->current_folder);
--}
++
+ error = NULL;
+ file_path = gtk_file_system_make_path (impl->file_system, impl->current_folder, impl->edited_new_text,
+ &error);
@@ -813,6 +792,35 @@
+ 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
+-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 *
@@ -845,10 +853,8 @@
- out:
- if (parent_path)
- gtk_file_path_free (parent_path);
-+ gtk_file_path_free (file_path);
-+ }
-+ else
-+ error_creating_folder_dialog (impl, file_path, error);
++ g_assert (!impl->edited_idle);
++ g_assert (!impl->edited_new_text);
- if (tmp)
- {
@@ -859,16 +865,11 @@
- gtk_file_path_get_string (path),
- tmp->message);
- g_error_free (tmp);
-+ g_free (impl->edited_new_text);
-+ impl->edited_new_text = NULL;
- }
-
+- }
+-
- return info;
-+ GDK_THREADS_LEAVE ();
-+
-+ return FALSE;
- }
-
+-}
+-
-/* Returns whether a path is a folder */
-static gboolean
-check_is_folder (GtkFileSystem *file_system,
@@ -2034,7 +2035,7 @@
-/* Creates a suitable drag cursor to indicate that the selected bookmark will be
- * deleted or not.
- */
- static void
+-static void
-shortcuts_drag_set_delete_cursor (GtkFileChooserDefault *impl,
- gboolean delete)
-{
@@ -2176,9 +2177,7 @@
- */
-static gboolean
-shortcuts_drag_outside_idle_cb (GtkFileChooserDefault *impl)
-+queue_edited_idle (GtkFileChooserDefault *impl,
-+ const gchar *new_text)
- {
+-{
- GDK_THREADS_ENTER ();
-
- shortcuts_drag_set_delete_cursor (impl, TRUE);
@@ -2191,10 +2190,7 @@
- return FALSE;
-}
-#endif
-+ /* We create the folder in an idle handler so that we don't modify the tree
-+ * just now.
-+ */
-
+-
-/* GtkWidget::drag-leave handler for the shortcuts list. We unhighlight the
- * drop position.
- */
@@ -2214,36 +2210,22 @@
- g_source_attach (impl->shortcuts_drag_outside_idle, NULL);
- }
-#endif
-+ g_assert (!impl->edited_idle);
-+ g_assert (!impl->edited_new_text);
-
+-
- gtk_tree_view_set_drag_dest_row (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view),
- NULL,
- GTK_TREE_VIEW_DROP_BEFORE);
-+ 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-leave");
-+ if (new_text)
-+ impl->edited_new_text = g_strdup (new_text);
- }
-
+-}
+-
-/* Computes the appropriate row and position for dropping */
-+/* Callback used from the text cell renderer when the new folder is named */
- static void
+-static void
-shortcuts_compute_drop_position (GtkFileChooserDefault *impl,
- int x,
- int y,
- GtkTreePath **path,
- GtkTreeViewDropPosition *pos)
-+renderer_edited_cb (GtkCellRendererText *cell_renderer_text,
-+ const gchar *path,
-+ const gchar *new_text,
-+ GtkFileChooserDefault *impl)
- {
+-{
- GtkTreeView *tree_view;
- GtkTreeViewColumn *column;
- int cell_y;
@@ -2292,18 +2274,12 @@
- }
-
- *path = gtk_tree_path_new_from_indices (row, -1);
-+ /* work around bug #154921 */
-+ g_object_set (cell_renderer_text,
-+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
-+ queue_edited_idle (impl, new_text);
- }
-
+-}
+-
-/* GtkWidget::drag-motion handler for the shortcuts list. We basically
- * implement the destination side of DnD by hand, due to limitations in
- * GtkTreeView's DnD API.
-+/* Callback used from the text cell renderer when the new folder edition gets
-+ * canceled.
- */
+- */
-static gboolean
-shortcuts_drag_motion_cb (GtkWidget *widget,
- GdkDragContext *context,
@@ -2417,12 +2393,10 @@
-}
-
-/* Reorders the selected bookmark to the specified position */
- static void
+-static void
-shortcuts_reorder (GtkFileChooserDefault *impl,
- int new_position)
-+renderer_editing_canceled_cb (GtkCellRendererText *cell_renderer_text,
-+ GtkFileChooserDefault *impl)
- {
+-{
- GtkTreeIter iter;
- gpointer col_data;
- gboolean is_volume;
@@ -2473,12 +2447,8 @@
- out:
-
- gtk_file_path_free (file_path_copy);
-+ /* work around bug #154921 */
-+ g_object_set (cell_renderer_text,
-+ "mode", GTK_CELL_RENDERER_MODE_INERT, NULL);
-+ queue_edited_idle (impl, NULL);
- }
-
+-}
+-
-/* Callback used when we get the drag data for the bookmarks list. We add the
- * received URIs as bookmarks if they are folders.
- */
@@ -2492,8 +2462,7 @@
- guint time_,
- gpointer data)
-{
-+struct selection_check_closure {
- GtkFileChooserDefault *impl;
+- GtkFileChooserDefault *impl;
- GtkTreePath *tree_path;
- GtkTreeViewDropPosition tree_pos;
- int position;
@@ -2519,12 +2488,20 @@
- 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 */
--static void
++/* Callback used from the text cell renderer when the new folder is named */
+ static void
-shortcuts_selection_changed_cb (GtkTreeSelection *selection,
- GtkFileChooserDefault *impl)
-{
@@ -2535,7 +2512,11 @@
-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;
-
@@ -2547,16 +2528,25 @@
- 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 ())))
- {
@@ -2565,13 +2555,19 @@
- }
-
- 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 */
--static GtkWidget *
++/* Creates the widgets for the filter combo box */
+ static GtkWidget *
-shortcuts_list_create (GtkFileChooserDefault *impl)
--{
++filter_create (GtkFileChooserDefault *impl)
+ {
- GtkWidget *swin;
- GtkTreeSelection *selection;
- GtkTreeViewColumn *column;
@@ -2593,9 +2589,14 @@
- 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,
@@ -2607,22 +2608,44 @@
- 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",
@@ -2638,29 +2661,34 @@
- 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 */
-+ int num_selected;
-+ gboolean all_files;
-+ gboolean all_folders;
-+};
++ 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"));
-+/* 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;
++ 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);
@@ -2668,8 +2696,7 @@
- "pixbuf", SHORTCUTS_COL_PIXBUF,
- "visible", SHORTCUTS_COL_PIXBUF_VISIBLE,
- NULL);
-+ closure = data;
-+ closure->num_selected++;
++ 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);
@@ -2681,72 +2708,49 @@
- shortcuts_row_separator_func,
- GINT_TO_POINTER (SHORTCUTS_COL_NAME),
- NULL);
-+ gtk_tree_model_sort_convert_iter_to_child_iter (closure->impl->sort_model, &child_iter, iter);
++ if (num_selected)
++ *num_selected = closure.num_selected;
- gtk_tree_view_append_column (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view), column);
-+ 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;
++ if (all_files)
++ *all_files = closure.all_files;
- return swin;
-+ closure->all_folders = closure->all_folders && is_folder;
-+ closure->all_files = closure->all_files && !is_folder;
++ if (all_folders)
++ *all_folders = closure.all_folders;
}
-/* Creates the widgets for the shortcuts/bookmarks pane */
-static GtkWidget *
-shortcuts_pane_create (GtkFileChooserDefault *impl,
- GtkSizeGroup *size_group)
-+/* 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)
- {
+-{
- GtkWidget *vbox;
- GtkWidget *hbox;
- GtkWidget *widget;
-+ struct selection_check_closure closure;
-+ GtkTreeSelection *selection;
-
+-
- vbox = gtk_vbox_new (FALSE, 6);
- gtk_widget_show (vbox);
-+ 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);
-
+-
- /* Shortcuts tree */
-+ g_assert (closure.num_selected == 0 || !(closure.all_files && closure.all_folders));
-
+-
- widget = shortcuts_list_create (impl);
- gtk_box_pack_start (GTK_BOX (vbox), widget, TRUE, TRUE, 0);
-+ if (num_selected)
-+ *num_selected = closure.num_selected;
-
+-
- /* Box for buttons */
-+ if (all_files)
-+ *all_files = closure.all_files;
-
+-
- hbox = gtk_hbox_new (TRUE, 6);
- gtk_size_group_add_widget (size_group, hbox);
- gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- gtk_widget_show (hbox);
-+ if (all_folders)
-+ *all_folders = closure.all_folders;
-+}
-
-- /* Add bookmark button */
+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,
@@ -2768,8 +2772,6 @@
- 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);
-+/* Returns a selected path from the file list */
-+
+typedef struct {
+ GtkFileChooserDefault *impl;
+ gchar *tip;
@@ -2780,7 +2782,7 @@
/* 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 +1051,11 @@
+@@ -3026,14 +1085,11 @@
gpointer data)
{
GtkFileChooserDefault *impl;
@@ -2796,7 +2798,7 @@
{
location_popup_handler (impl, "/");
return TRUE;
-@@ -3043,7 +1065,6 @@
+@@ -3043,7 +1099,6 @@
|| event->keyval == GDK_ISO_Enter
|| event->keyval == GDK_KP_Enter
|| event->keyval == GDK_space)
@@ -2804,7 +2806,7 @@
&& !(impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER ||
impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
{
-@@ -3063,37 +1084,7 @@
+@@ -3063,37 +1118,7 @@
return FALSE;
}
@@ -2843,7 +2845,7 @@
/* Callback used when the "Show Hidden Files" menu item is toggled */
static void
show_hidden_toggled_cb (GtkCheckMenuItem *item,
-@@ -3103,145 +1094,7 @@
+@@ -3103,145 +1128,7 @@
"show-hidden", gtk_check_menu_item_get_active (item),
NULL);
}
@@ -2990,7 +2992,7 @@
/* Creates the widgets for the file list */
static GtkWidget *
-@@ -3272,11 +1125,7 @@
+@@ -3272,11 +1159,7 @@
G_CALLBACK (list_row_activated), impl);
g_signal_connect (impl->browse_files_tree_view, "key-press-event",
G_CALLBACK (trap_activate_cb), impl);
@@ -3003,7 +3005,7 @@
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_files_tree_view));
gtk_tree_selection_set_select_function (selection,
list_select_func,
-@@ -3346,70 +1195,158 @@
+@@ -3346,70 +1229,163 @@
return swin;
}
@@ -3131,16 +3133,16 @@
+ gtk_widget_show_all (button);
+
+ g_object_set_data (G_OBJECT (button), "file-path", base_path);
-+
+
+- gtk_container_forall (GTK_CONTAINER (combo),
+- set_filter_tooltip,
+- impl->tooltips);
+ g_signal_connect (button, "clicked",
+ G_CALLBACK (volume_button_clicked_cb), impl);
+
+ gtk_box_pack_start (GTK_BOX(bar), button, FALSE, FALSE, 0);
+ }
-
-- gtk_container_forall (GTK_CONTAINER (combo),
-- set_filter_tooltip,
-- impl->tooltips);
++
+ impl->num_volumes = n;
+ g_slist_free (list);
+
@@ -3188,6 +3190,11 @@
g_signal_connect (impl->browse_new_folder_button, "clicked",
G_CALLBACK (new_folder_button_clicked), impl);
gtk_box_pack_end (GTK_BOX (hbox), impl->browse_new_folder_button, FALSE, FALSE, 0);
++
++ widget = filter_create (impl);
++ gtk_widget_hide (widget);
++ gtk_box_pack_end (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
++
gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0);
- /* Box for lists and preview */
@@ -3198,7 +3205,7 @@
gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
-@@ -3418,157 +1355,37 @@
+@@ -3418,157 +1394,37 @@
widget = create_file_list (impl);
gtk_box_pack_start (GTK_BOX (hbox), widget, TRUE, TRUE, 0);
@@ -3296,7 +3303,7 @@
+ GtkWidget *hbox;
GtkWidget *widget;
- GtkWidget *alignment;
--
+
- vbox = gtk_vbox_new (FALSE, 12);
-
- table = gtk_table_new (2, 2, FALSE);
@@ -3306,7 +3313,7 @@
- gtk_table_set_col_spacings (GTK_TABLE (table), 12);
-
- /* Name entry */
-
+-
- widget = gtk_label_new_with_mnemonic (_("_Name:"));
+ vbox = gtk_vbox_new (FALSE, 0);
+ hbox = gtk_hbox_new (FALSE, DEFAULT_SPACING);
@@ -3368,7 +3375,7 @@
return vbox;
}
-@@ -3576,29 +1393,11 @@
+@@ -3576,29 +1432,11 @@
static GtkWidget *
browse_widgets_create (GtkFileChooserDefault *impl)
{
@@ -3376,7 +3383,7 @@
- GtkWidget *hpaned;
GtkWidget *widget;
- GtkSizeGroup *size_group;
--
+
- /* size group is used by the [+][-] buttons and the filter combo */
- size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
- vbox = gtk_vbox_new (FALSE, 12);
@@ -3391,16 +3398,16 @@
- gtk_paned_pack1 (GTK_PANED (hpaned), widget, FALSE, FALSE);
- widget = file_pane_create (impl, size_group);
- gtk_paned_pack2 (GTK_PANED (hpaned), widget, TRUE, FALSE);
-
-- g_object_unref (size_group);
+ widget = file_pane_create (impl);
+- g_object_unref (size_group);
+-
- return vbox;
+ return widget;
}
static GObject*
-@@ -3618,54 +1417,18 @@
+@@ -3618,56 +1456,20 @@
gtk_widget_push_composite_child ();
@@ -3420,12 +3427,16 @@
- impl->extra_align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
- gtk_box_pack_start (GTK_BOX (impl), impl->extra_align, FALSE, FALSE, 0);
-
-- gtk_widget_pop_composite_child ();
-- update_appearance (impl);
--
-- return object;
--}
--
++ /* Widgets for Save mode */
++ impl->save_widgets = save_widgets_create (impl);
++ gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
++
+ gtk_widget_pop_composite_child ();
+ update_appearance (impl);
+
+ return object;
+ }
+
-/* Sets the extra_widget by packing it in the appropriate place */
-static void
-set_extra_widget (GtkFileChooserDefault *impl,
@@ -3443,13 +3454,7 @@
- gtk_container_remove (GTK_CONTAINER (impl->extra_align), impl->extra_widget);
- g_object_unref (impl->extra_widget);
- }
-+ /* Widgets for Save mode */
-+ impl->save_widgets = save_widgets_create (impl);
-+ gtk_box_pack_start (GTK_BOX (impl), impl->save_widgets, FALSE, FALSE, 0);
-+
-+ gtk_widget_pop_composite_child ();
-+ update_appearance (impl);
-
+-
- impl->extra_widget = extra_widget;
- if (impl->extra_widget)
- {
@@ -3458,11 +3463,12 @@
- }
- else
- gtk_widget_hide (impl->extra_align);
-+ return object;
- }
-
+-}
+-
static void
-@@ -3676,12 +1439,6 @@
+ set_local_only (GtkFileChooserDefault *impl,
+ gboolean local_only)</