r30006 - in /desktop/unstable/gtk+2.0/debian: changelog patches/066_filechooser-recent-folders.patch patches/series
biebl at users.alioth.debian.org
biebl at users.alioth.debian.org
Wed Oct 5 17:24:34 UTC 2011
Author: biebl
Date: Wed Oct 5 17:24:34 2011
New Revision: 30006
URL: http://svn.debian.org/wsvn/pkg-gnome/?sc=1&rev=30006
Log:
* debian/patches/066_filechooser-recent-folders.patch
- Cherry-pick fixes from the upstream filechooser-recent-folder-2-24
branch. Closes: #640544, #640466, #644222
Added:
desktop/unstable/gtk+2.0/debian/patches/066_filechooser-recent-folders.patch
Modified:
desktop/unstable/gtk+2.0/debian/changelog
desktop/unstable/gtk+2.0/debian/patches/series
Modified: desktop/unstable/gtk+2.0/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gtk%2B2.0/debian/changelog?rev=30006&op=diff
==============================================================================
--- desktop/unstable/gtk+2.0/debian/changelog [utf-8] (original)
+++ desktop/unstable/gtk+2.0/debian/changelog [utf-8] Wed Oct 5 17:24:34 2011
@@ -8,6 +8,9 @@
accessibility module from the new multiarch location. Closes: #636536
* Refresh patches.
* Add support for tracker 0.12 and prefer it over 0.10. Closes: #643943
+ * debian/patches/066_filechooser-recent-folders.patch
+ - Cherry-pick fixes from the upstream filechooser-recent-folder-2-24
+ branch. Closes: #640544, #640466, #644222
-- Michael Biebl <biebl at debian.org> Wed, 05 Oct 2011 11:11:48 +0200
Added: desktop/unstable/gtk+2.0/debian/patches/066_filechooser-recent-folders.patch
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gtk%2B2.0/debian/patches/066_filechooser-recent-folders.patch?rev=30006&op=file
==============================================================================
--- desktop/unstable/gtk+2.0/debian/patches/066_filechooser-recent-folders.patch (added)
+++ desktop/unstable/gtk+2.0/debian/patches/066_filechooser-recent-folders.patch [utf-8] Wed Oct 5 17:24:34 2011
@@ -1,0 +1,973 @@
+From bcec52f8dcaf3b04167ed0fcfe47db04acfb5c57 Mon Sep 17 00:00:00 2001
+From: Federico Mena Quintero <federico at gnome.org>
+Date: Tue, 26 Jul 2011 16:00:35 -0500
+Subject: [PATCH] Rename stop_operation() to operation_mode_stop()
+
+We'll now prefix functions to change the impl->operation_mode with 'operation_mode',
+for clarity.
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Remove duplicated code from *_switch_to_browse_mode()
+
+That code indeed lives in operation_mode_stop(), so use it instead of
+having inlined duplicates.
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Centralize changing the operation mode in operation_mode_set()
+
+This will be the central function to switch operation modes: stop searches or the recent-files
+process; switch widgets, etc.
+
+We factor out the common code from recent_switch_to_browse_mode() and search_switch_to_browse_mode(),
+and remove those functions. All the code that switched modes by hand now calls
+the central operation_mode_set().
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Make operation_mode_set() handle SEARCH and RECENT modes as well
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Move the widgets above the hpaned to their own box
+
+This way we can re-create the contents of that box easily without disrupting
+the rest of the file chooser.
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Discard the search widgets in a separate function
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Only unset the entry's contents if the entry exists
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Create the location_entry in a single function
+
+We had duplicated code to create the entry in two cases, for Open and for Save modes.
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Remove the unused, initial-text logic from the location entry
+
+Years ago, when the location entry only appeared in a popup window, it used to appear
+populated with the current folder's path. We had some logic to do this, but since now
+the location entry appears in the main dialog, we can do away with that old code.
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Switch to OPERATION_MODE_BROWSE when switching to volume or file shortcuts
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Set the location mode when changing the operation mode
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Don't sort the recent-items by hand
+
+The mtime from GtkRecentManager may not the same as the file's actual
+mtime, so the final result could appear unsorted to the user. Instead,
+we will let the view do the sorting.
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+Load and populate the recent-items in a single pass
+
+There's no real asynchronicity going on, anyway, so let's do both within
+a single iteration of the idle handler.
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+bgo#657186 - Sort the recent-files list in newest-to-oldest order
+
+Otherwise it's not very useful... :)
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+
+bgo#657949 - [filechooser] Don't ellipsize filter names for 2.24
+
+That only works well in 3.0, where the natural-sizing code works to get us a good default size
+for the filters drop-down.
+
+bgo#658600 - Don't try to focus the location entry in Recent-files mode
+
+We don't ever start up in Search mode, so we don't need an extra check for that mode, yet.
+
+Signed-off-by: Federico Mena Quintero <federico at gnome.org>
+---
+ gtk/gtkfilechooserdefault.c | 563 ++++++++++++++++---------------------------
+ gtk/gtkfilechooserprivate.h | 1 +
+ 2 files changed, 208 insertions(+), 356 deletions(-)
+
+Index: gtk+-2.24.6/gtk/gtkfilechooserdefault.c
+===================================================================
+--- gtk+-2.24.6.orig/gtk/gtkfilechooserdefault.c 2011-08-17 19:38:42.000000000 +0200
++++ gtk+-2.24.6/gtk/gtkfilechooserdefault.c 2011-10-05 19:20:47.260436939 +0200
+@@ -401,22 +401,23 @@
+
+ static void stop_loading_and_clear_list_model (GtkFileChooserDefault *impl,
+ gboolean remove_from_treeview);
++
++static void search_setup_widgets (GtkFileChooserDefault *impl);
+ static void search_stop_searching (GtkFileChooserDefault *impl,
+ gboolean remove_query);
+ static void search_clear_model (GtkFileChooserDefault *impl,
+ gboolean remove_from_treeview);
+ static gboolean search_should_respond (GtkFileChooserDefault *impl);
+-static void search_switch_to_browse_mode (GtkFileChooserDefault *impl);
+ static GSList *search_get_selected_files (GtkFileChooserDefault *impl);
+ static void search_entry_activate_cb (GtkEntry *entry,
+ gpointer data);
+ static void settings_load (GtkFileChooserDefault *impl);
+
++static void recent_start_loading (GtkFileChooserDefault *impl);
+ static void recent_stop_loading (GtkFileChooserDefault *impl);
+ static void recent_clear_model (GtkFileChooserDefault *impl,
+ gboolean remove_from_treeview);
+ static gboolean recent_should_respond (GtkFileChooserDefault *impl);
+-static void recent_switch_to_browse_mode (GtkFileChooserDefault *impl);
+ static GSList * recent_get_selected_files (GtkFileChooserDefault *impl);
+ static void set_file_system_backend (GtkFileChooserDefault *impl);
+ static void unset_file_system_backend (GtkFileChooserDefault *impl);
+@@ -2322,23 +2323,9 @@
+ static GtkWidget *
+ filter_create (GtkFileChooserDefault *impl)
+ {
+- GtkCellRenderer *cell;
+- GList *cells;
+-
+ impl->filter_combo = gtk_combo_box_text_new ();
+ gtk_combo_box_set_focus_on_click (GTK_COMBO_BOX (impl->filter_combo), FALSE);
+
+- /* Get the combo's text renderer and set ellipsize parameters */
+- cells = gtk_cell_layout_get_cells (GTK_CELL_LAYOUT (impl->filter_combo));
+- g_assert (cells);
+- cell = cells->data;
+-
+- g_object_set (G_OBJECT (cell),
+- "ellipsize", PANGO_ELLIPSIZE_END,
+- NULL);
+-
+- g_list_free (cells);
+-
+ g_signal_connect (impl->filter_combo, "changed",
+ G_CALLBACK (filter_combo_changed), impl);
+
+@@ -3692,7 +3679,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
+- * pressed. See comment by tree_view_keybinding_cb() for more details.
++ * pressed.
+ */
+ static gboolean
+ browse_files_key_press_event_cb (GtkWidget *widget,
+@@ -4130,7 +4117,9 @@
+ gint model_column;
+ } ColumnMap;
+
+-/* Sets the sort column IDs for the file list based on the operation mode */
++/* Sets the sort column IDs for the file list; needs to be done whenever we
++ * change the model on the treeview.
++ */
+ static void
+ file_list_set_sort_column_ids (GtkFileChooserDefault *impl)
+ {
+@@ -4368,6 +4357,20 @@
+ return vbox;
+ }
+
++static void
++location_entry_create (GtkFileChooserDefault *impl)
++{
++ if (!impl->location_entry)
++ impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
++
++ _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
++ impl->file_system);
++ _gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->local_only);
++ _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
++ gtk_entry_set_width_chars (GTK_ENTRY (impl->location_entry), 45);
++ gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
++}
++
+ /* Creates the widgets specific to Save mode */
+ static void
+ save_widgets_create (GtkFileChooserDefault *impl)
+@@ -4400,12 +4403,7 @@
+
+ /* Location entry */
+
+- impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
+- _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
+- impl->file_system);
+- _gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->local_only);
+- gtk_entry_set_width_chars (GTK_ENTRY (impl->location_entry), 45);
+- gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
++ location_entry_create (impl);
+ gtk_table_attach (GTK_TABLE (impl->save_widgets_table), impl->location_entry,
+ 1, 2, 0, 1,
+ GTK_EXPAND | GTK_FILL, 0,
+@@ -4457,53 +4455,6 @@
+ gtk_widget_hide (impl->location_entry_box);
+ }
+
+-/* Sets the full path of the current folder as the text in the location entry. */
+-static void
+-location_entry_set_initial_text (GtkFileChooserDefault *impl)
+-{
+- gchar *text, *filename;
+-
+- if (!impl->current_folder)
+- return;
+-
+- filename = g_file_get_path (impl->current_folder);
+-
+- if (filename)
+- {
+- text = g_filename_to_utf8 (filename, -1, NULL, NULL, NULL);
+- g_free (filename);
+- }
+- else
+- text = g_file_get_uri (impl->current_folder);
+-
+- if (text)
+- {
+- gboolean need_slash;
+- int len;
+-
+- len = strlen (text);
+- need_slash = (text[len - 1] != G_DIR_SEPARATOR);
+-
+- if (need_slash)
+- {
+- char *slash_text;
+-
+- slash_text = g_new (char, len + 2);
+- strcpy (slash_text, text);
+- slash_text[len] = G_DIR_SEPARATOR;
+- slash_text[len + 1] = 0;
+-
+- g_free (text);
+- text = slash_text;
+- }
+-
+- _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), text);
+- g_free (text);
+- }
+-
+- g_free (filename);
+-}
+-
+ /* Turns on the location entry. Can be called even if we are already in that
+ * mode.
+ */
+@@ -4519,7 +4470,10 @@
+ return;
+
+ if (impl->location_entry)
+- gtk_widget_destroy (impl->location_entry);
++ {
++ gtk_widget_destroy (impl->location_entry);
++ impl->location_entry = NULL;
++ }
+
+ /* Box */
+
+@@ -4527,19 +4481,13 @@
+
+ /* Entry */
+
+- impl->location_entry = _gtk_file_chooser_entry_new (TRUE);
+- _gtk_file_chooser_entry_set_file_system (GTK_FILE_CHOOSER_ENTRY (impl->location_entry),
+- impl->file_system);
+- gtk_entry_set_activates_default (GTK_ENTRY (impl->location_entry), TRUE);
+- _gtk_file_chooser_entry_set_action (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->action);
+-
++ location_entry_create (impl);
+ gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_entry, TRUE, TRUE, 0);
+ gtk_label_set_mnemonic_widget (GTK_LABEL (impl->location_label), impl->location_entry);
+
+ /* Configure the entry */
+
+ _gtk_file_chooser_entry_set_base_folder (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->current_folder);
+- _gtk_file_chooser_entry_set_local_only (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), impl->local_only);
+
+ /* Done */
+
+@@ -4892,9 +4840,13 @@
+ GtkWidget *widget;
+ GtkSizeGroup *size_group;
+
+- /* size group is used by the scrolled windows of the panes */
+- size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
+ impl->browse_widgets_box = gtk_vbox_new (FALSE, 12);
++ gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets_box, TRUE, TRUE, 0);
++ gtk_widget_show (impl->browse_widgets_box);
++
++ impl->browse_header_box = gtk_vbox_new (FALSE, 12);
++ gtk_box_pack_start (GTK_BOX (impl->browse_widgets_box), impl->browse_header_box, FALSE, FALSE, 0);
++ gtk_widget_show (impl->browse_header_box);
+
+ /* Path bar, info bar, and their respective machinery - the browse_path_bar_hbox will get packed elsewhere */
+ path_bar_widgets_create (impl);
+@@ -4902,12 +4854,15 @@
+ /* Box for the location label and entry */
+
+ impl->location_entry_box = gtk_hbox_new (FALSE, 12);
+- gtk_box_pack_start (GTK_BOX (impl->browse_widgets_box), impl->location_entry_box, FALSE, FALSE, 0);
++ gtk_box_pack_start (GTK_BOX (impl->browse_header_box), impl->location_entry_box, FALSE, FALSE, 0);
+
+ impl->location_label = gtk_label_new_with_mnemonic (_("_Location:"));
+ gtk_widget_show (impl->location_label);
+ gtk_box_pack_start (GTK_BOX (impl->location_entry_box), impl->location_label, FALSE, FALSE, 0);
+
++ /* size group is used by the scrolled windows of the panes */
++ size_group = gtk_size_group_new (GTK_SIZE_GROUP_VERTICAL);
++
+ /* Paned widget */
+ hpaned = gtk_hpaned_new ();
+ gtk_widget_show (hpaned);
+@@ -4945,7 +4900,6 @@
+
+ /* The browse widgets */
+ browse_widgets_create (impl);
+- gtk_box_pack_start (GTK_BOX (impl), impl->browse_widgets_box, TRUE, TRUE, 0);
+
+ /* Alignment to hold extra widget */
+ impl->extra_align = gtk_alignment_new (0.0, 0.5, 1.0, 1.0);
+@@ -5116,8 +5070,8 @@
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN
+ || impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ {
+- gtk_box_pack_start (GTK_BOX (impl->browse_widgets_box), impl->browse_path_bar_hbox, FALSE, FALSE, 0);
+- gtk_box_reorder_child (GTK_BOX (impl->browse_widgets_box), impl->browse_path_bar_hbox, 0);
++ gtk_box_pack_start (GTK_BOX (impl->browse_header_box), impl->browse_path_bar_hbox, FALSE, FALSE, 0);
++ gtk_box_reorder_child (GTK_BOX (impl->browse_header_box), impl->browse_path_bar_hbox, 0);
+ }
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+@@ -5199,6 +5153,140 @@
+ path_bar_set_mode (impl, mode);
+ }
+
++static void
++operation_mode_discard_search_widgets (GtkFileChooserDefault *impl)
++{
++ if (impl->search_hbox)
++ {
++ gtk_widget_destroy (impl->search_hbox);
++
++ impl->search_hbox = NULL;
++ impl->search_entry = NULL;
++ }
++}
++
++/* Stops running operations like populating the browse model, searches, and the recent-files model */
++static void
++operation_mode_stop (GtkFileChooserDefault *impl, OperationMode mode)
++{
++ switch (mode)
++ {
++ case OPERATION_MODE_BROWSE:
++ stop_loading_and_clear_list_model (impl, TRUE);
++ break;
++
++ case OPERATION_MODE_SEARCH:
++ search_stop_searching (impl, FALSE);
++ search_clear_model (impl, TRUE);
++
++ operation_mode_discard_search_widgets (impl);
++ break;
++
++ case OPERATION_MODE_RECENT:
++ recent_stop_loading (impl);
++ recent_clear_model (impl, TRUE);
++ break;
++
++ default:
++ g_assert_not_reached ();
++ }
++}
++
++static void
++operation_mode_set_browse (GtkFileChooserDefault *impl)
++{
++ path_bar_update (impl);
++
++ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
++ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
++ {
++ gtk_widget_show (impl->location_button);
++ location_mode_set (impl, impl->location_mode, TRUE);
++
++ if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
++ gtk_widget_show (impl->location_entry_box);
++ }
++}
++
++static void
++operation_mode_set_search (GtkFileChooserDefault *impl)
++{
++ g_assert (impl->search_hbox == NULL);
++ g_assert (impl->search_entry == NULL);
++ g_assert (impl->search_model == NULL);
++
++ search_setup_widgets (impl);
++}
++
++static void
++operation_mode_set_recent (GtkFileChooserDefault *impl)
++{
++ path_bar_update (impl);
++
++ /* Hide the location widgets temporarily */
++ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
++ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
++ {
++ gtk_widget_hide (impl->location_button);
++ gtk_widget_hide (impl->location_entry_box);
++ }
++
++ recent_start_loading (impl);
++}
++
++/* Sometimes we need to frob the selection in the shortcuts list manually */
++static void
++shortcuts_select_item_without_activating (GtkFileChooserDefault *impl, int pos)
++{
++ GtkTreeSelection *selection;
++ GtkTreePath *path;
++
++ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
++
++ g_signal_handlers_block_by_func (selection, G_CALLBACK (shortcuts_selection_changed_cb), impl);
++
++ path = gtk_tree_path_new_from_indices (pos, -1);
++ gtk_tree_selection_select_path (selection, path);
++ gtk_tree_path_free (path);
++
++ g_signal_handlers_unblock_by_func (selection, G_CALLBACK (shortcuts_selection_changed_cb), impl);
++}
++
++static void
++operation_mode_set (GtkFileChooserDefault *impl, OperationMode mode)
++{
++ ShortcutsIndex shortcut_to_select;
++
++ operation_mode_stop (impl, impl->operation_mode);
++
++ impl->operation_mode = mode;
++
++ switch (impl->operation_mode)
++ {
++ case OPERATION_MODE_BROWSE:
++ operation_mode_set_browse (impl);
++ shortcut_to_select = SHORTCUTS_CURRENT_FOLDER;
++ break;
++
++ case OPERATION_MODE_SEARCH:
++ operation_mode_set_search (impl);
++ shortcut_to_select = SHORTCUTS_SEARCH;
++ break;
++
++ case OPERATION_MODE_RECENT:
++ operation_mode_set_recent (impl);
++ shortcut_to_select = SHORTCUTS_RECENT;
++ break;
++
++ default:
++ g_assert_not_reached ();
++ return;
++ }
++
++ if (shortcut_to_select != SHORTCUTS_CURRENT_FOLDER)
++ shortcuts_select_item_without_activating (impl, shortcuts_get_index (impl, shortcut_to_select));
++}
++
+ /* This function is basically a do_all function.
+ *
+ * It sets the visibility on all the widgets based on the current state, and
+@@ -5236,7 +5324,6 @@
+ {
+ gtk_widget_show (impl->location_button);
+ save_widgets_destroy (impl);
+- gtk_widget_show (impl->browse_widgets_box);
+ location_mode_set (impl, impl->location_mode, TRUE);
+ }
+
+@@ -6070,6 +6157,7 @@
+ gtk_tree_view_columns_autosize (GTK_TREE_VIEW (impl->browse_files_tree_view));
+ gtk_tree_view_set_search_column (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ MODEL_COL_NAME);
++ file_list_set_sort_column_ids (impl);
+ set_sort_column (impl);
+ profile_msg (" gtk_tree_view_set_model end", NULL);
+ impl->list_sort_ascending = TRUE;
+@@ -7095,17 +7183,7 @@
+
+ g_object_ref (file);
+
+- switch (impl->operation_mode)
+- {
+- case OPERATION_MODE_SEARCH:
+- search_switch_to_browse_mode (impl);
+- break;
+- case OPERATION_MODE_RECENT:
+- recent_switch_to_browse_mode (impl);
+- break;
+- case OPERATION_MODE_BROWSE:
+- break;
+- }
++ operation_mode_set (impl, OPERATION_MODE_BROWSE);
+
+ if (impl->local_only && !g_file_is_native (file))
+ {
+@@ -8747,7 +8825,8 @@
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ {
+- if (impl->location_mode == LOCATION_MODE_PATH_BAR)
++ if (impl->location_mode == LOCATION_MODE_PATH_BAR
++ || impl->operation_mode == OPERATION_MODE_RECENT)
+ widget = impl->browse_files_tree_view;
+ else
+ widget = impl->location_entry;
+@@ -8865,6 +8944,7 @@
+ */
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->search_model));
++ file_list_set_sort_column_ids (impl);
+ #endif
+
+ /* FMQ: if search was empty, say that we got no hits */
+@@ -8934,34 +9014,6 @@
+ }
+ }
+
+-/* Stops any pending searches, clears the file list, and switches back to OPERATION_MODE_BROWSE */
+-static void
+-search_switch_to_browse_mode (GtkFileChooserDefault *impl)
+-{
+- g_assert (impl->operation_mode != OPERATION_MODE_BROWSE);
+-
+- search_stop_searching (impl, FALSE);
+- search_clear_model (impl, TRUE);
+-
+- gtk_widget_destroy (impl->search_hbox);
+- impl->search_hbox = NULL;
+- impl->search_entry = NULL;
+-
+- impl->operation_mode = OPERATION_MODE_BROWSE;
+- path_bar_update (impl);
+-
+- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+- {
+- gtk_widget_show (impl->location_button);
+-
+- if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+- gtk_widget_show (impl->location_entry_box);
+- }
+-
+- file_list_set_sort_column_ids (impl);
+-}
+-
+ /* Creates the search_model and puts it in the tree view */
+ static void
+ search_setup_model (GtkFileChooserDefault *impl)
+@@ -8992,6 +9044,7 @@
+ */
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->search_model));
++ file_list_set_sort_column_ids (impl);
+ }
+
+ /* Creates a new query with the specified text and launches it */
+@@ -9141,79 +9194,6 @@
+ /* FMQ: hide the filter combo? */
+ }
+
+-/* Stops running operations like populating the browse model, searches, and the recent-files model */
+-static void
+-stop_operation (GtkFileChooserDefault *impl, OperationMode mode)
+-{
+- switch (mode)
+- {
+- case OPERATION_MODE_BROWSE:
+- stop_loading_and_clear_list_model (impl, TRUE);
+- break;
+-
+- case OPERATION_MODE_SEARCH:
+- search_stop_searching (impl, FALSE);
+- search_clear_model (impl, TRUE);
+-
+- gtk_widget_destroy (impl->search_hbox);
+- impl->search_hbox = NULL;
+- impl->search_entry = NULL;
+- break;
+-
+- case OPERATION_MODE_RECENT:
+- recent_stop_loading (impl);
+- recent_clear_model (impl, TRUE);
+- break;
+- }
+-}
+-
+-/* Sometimes we need to frob the selection in the shortcuts list manually */
+-static void
+-shortcuts_select_item_without_activating (GtkFileChooserDefault *impl, int pos)
+-{
+- GtkTreeSelection *selection;
+- GtkTreePath *path;
+-
+- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view));
+-
+- g_signal_handlers_block_by_func (selection, G_CALLBACK (shortcuts_selection_changed_cb), impl);
+-
+- path = gtk_tree_path_new_from_indices (pos, -1);
+- gtk_tree_selection_select_path (selection, path);
+- gtk_tree_path_free (path);
+-
+- g_signal_handlers_unblock_by_func (selection, G_CALLBACK (shortcuts_selection_changed_cb), impl);
+-}
+-
+-/* Main entry point to the searching functions; this gets called when the user
+- * activates the Search shortcut.
+- */
+-static void
+-search_activate (GtkFileChooserDefault *impl)
+-{
+- OperationMode previous_mode;
+-
+- if (impl->operation_mode == OPERATION_MODE_SEARCH)
+- {
+- focus_search_entry_in_idle (impl);
+- return;
+- }
+-
+- previous_mode = impl->operation_mode;
+- impl->operation_mode = OPERATION_MODE_SEARCH;
+-
+- shortcuts_select_item_without_activating (impl, shortcuts_get_index (impl, SHORTCUTS_SEARCH));
+-
+- stop_operation (impl, previous_mode);
+-
+- g_assert (impl->search_hbox == NULL);
+- g_assert (impl->search_entry == NULL);
+- g_assert (impl->search_model == NULL);
+-
+- search_setup_widgets (impl);
+- file_list_set_sort_column_ids (impl);
+-}
+-
+ /*
+ * Recent files support
+ */
+@@ -9246,34 +9226,6 @@
+ }
+ }
+
+-/* Stops any pending load, clears the file list, and switches
+- * back to OPERATION_MODE_BROWSE
+- */
+-static void
+-recent_switch_to_browse_mode (GtkFileChooserDefault *impl)
+-{
+- g_assert (impl->operation_mode != OPERATION_MODE_BROWSE);
+-
+- recent_stop_loading (impl);
+- recent_clear_model (impl, TRUE);
+-
+- impl->operation_mode = OPERATION_MODE_BROWSE;
+- path_bar_update (impl);
+-
+- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+- {
+- gtk_widget_show (impl->location_button);
+-
+- if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+- gtk_widget_show (impl->location_entry_box);
+- }
+-
+- gtk_tree_view_column_set_visible (impl->list_size_column, impl->show_size_column);
+-
+- file_list_set_sort_column_ids (impl);
+-}
+-
+ static void
+ recent_setup_model (GtkFileChooserDefault *impl)
+ {
+@@ -9304,7 +9256,6 @@
+ {
+ GtkFileChooserDefault *impl;
+ GList *items;
+- guint needs_sorting : 1;
+ } RecentLoadData;
+
+ static void
+@@ -9315,6 +9266,8 @@
+
+ gtk_tree_view_set_model (GTK_TREE_VIEW (impl->browse_files_tree_view),
+ GTK_TREE_MODEL (impl->recent_model));
++ file_list_set_sort_column_ids (impl);
++ gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (impl->recent_model), MODEL_COL_MTIME, GTK_SORT_DESCENDING);
+
+ set_busy_cursor (impl, FALSE);
+
+@@ -9324,16 +9277,6 @@
+ }
+
+ static gint
+-recent_sort_mru (gconstpointer a,
+- gconstpointer b)
+-{
+- GtkRecentInfo *info_a = (GtkRecentInfo *) a;
+- GtkRecentInfo *info_b = (GtkRecentInfo *) b;
+-
+- return (gtk_recent_info_get_modified (info_b) - gtk_recent_info_get_modified (info_a));
+-}
+-
+-static gint
+ get_recent_files_limit (GtkWidget *widget)
+ {
+ GtkSettings *settings;
+@@ -9408,32 +9351,18 @@
+ if (!impl->recent_manager)
+ return FALSE;
+
+- /* first iteration: load all the items */
++ load_data->items = gtk_recent_manager_get_items (impl->recent_manager);
+ if (!load_data->items)
+- {
+- load_data->items = gtk_recent_manager_get_items (impl->recent_manager);
+- if (!load_data->items)
+- return FALSE;
+-
+- load_data->needs_sorting = TRUE;
+-
+- return TRUE;
+- }
+-
+- /* second iteration: MRU sorting and clamping, and populating the model */
+- if (load_data->needs_sorting)
+- {
+- load_data->items = g_list_sort (load_data->items, recent_sort_mru);
++ return FALSE;
+
+- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
+- populate_model_with_recent_items (impl, load_data->items);
+- else
+- populate_model_with_folders (impl, load_data->items);
++ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN)
++ populate_model_with_recent_items (impl, load_data->items);
++ else
++ populate_model_with_folders (impl, load_data->items);
+
+- g_list_foreach (load_data->items, (GFunc) gtk_recent_info_unref, NULL);
+- g_list_free (load_data->items);
+- load_data->items = NULL;
+- }
++ g_list_foreach (load_data->items, (GFunc) gtk_recent_info_unref, NULL);
++ g_list_free (load_data->items);
++ load_data->items = NULL;
+
+ return FALSE;
+ }
+@@ -9453,7 +9382,6 @@
+ load_data = g_new (RecentLoadData, 1);
+ load_data->impl = impl;
+ load_data->items = NULL;
+- load_data->needs_sorting = TRUE;
+
+ /* begin lazy loading the recent files into the model */
+ impl->load_recent_id = gdk_threads_add_idle_full (G_PRIORITY_HIGH_IDLE + 30,
+@@ -9507,45 +9435,6 @@
+ return (gtk_tree_selection_count_selected_rows (selection) != 0);
+ }
+
+-/* Hide the location widgets temporarily */
+-static void
+-recent_hide_entry (GtkFileChooserDefault *impl)
+-{
+- path_bar_update (impl);
+-
+- /* Hide the location widgets temporarily */
+- if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+- impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+- {
+- gtk_widget_hide (impl->location_button);
+- gtk_widget_hide (impl->location_entry_box);
+- }
+-}
+-
+-/* Main entry point to the recent files functions; this gets called when
+- * the user activates the Recently Used shortcut.
+- */
+-static void
+-recent_activate (GtkFileChooserDefault *impl)
+-{
+- OperationMode previous_mode;
+-
+- if (impl->operation_mode == OPERATION_MODE_RECENT)
+- return;
+-
+- previous_mode = impl->operation_mode;
+- impl->operation_mode = OPERATION_MODE_RECENT;
+-
+- shortcuts_select_item_without_activating (impl, shortcuts_get_index (impl, SHORTCUTS_RECENT));
+-
+- stop_operation (impl, previous_mode);
+-
+- recent_hide_entry (impl);
+-
+- file_list_set_sort_column_ids (impl);
+- recent_start_loading (impl);
+-}
+-
+ static void
+ set_current_filter (GtkFileChooserDefault *impl,
+ GtkFileFilter *filter)
+@@ -9719,17 +9608,7 @@
+ {
+ GFile *file;
+
+- switch (impl->operation_mode)
+- {
+- case OPERATION_MODE_BROWSE:
+- break;
+- case OPERATION_MODE_SEARCH:
+- search_switch_to_browse_mode (impl);
+- break;
+- case OPERATION_MODE_RECENT:
+- recent_switch_to_browse_mode (impl);
+- break;
+- }
++ operation_mode_set (impl, OPERATION_MODE_BROWSE);
+
+ /* We ref the file chooser since volume_mount() may run a main loop, and the
+ * user could close the file chooser window in the meantime.
+@@ -9836,7 +9715,10 @@
+ gpointer col_data;
+ ShortcutType shortcut_type;
+
+- if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY
++ /* In the Save modes, we want to preserve what the uesr typed in the filename
++ * entry, so that he may choose another folder without erasing his typed name.
++ */
++ if (impl->location_entry
+ && !(impl->action == GTK_FILE_CHOOSER_ACTION_SAVE
+ || impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER))
+ _gtk_file_chooser_entry_set_file_part (GTK_FILE_CHOOSER_ENTRY (impl->location_entry), "");
+@@ -9860,6 +9742,8 @@
+
+ volume = col_data;
+
++ operation_mode_set (impl, OPERATION_MODE_BROWSE);
++
+ shortcuts_activate_volume (impl, volume);
+ }
+ else if (shortcut_type == SHORTCUT_TYPE_FILE)
+@@ -9867,6 +9751,8 @@
+ struct ShortcutsActivateData *data;
+ GtkFileSystemVolume *volume;
+
++ operation_mode_set (impl, OPERATION_MODE_BROWSE);
++
+ volume = _gtk_file_system_get_volume_for_file (impl->file_system, col_data);
+
+ data = g_new0 (struct ShortcutsActivateData, 1);
+@@ -9898,11 +9784,11 @@
+ }
+ else if (shortcut_type == SHORTCUT_TYPE_SEARCH)
+ {
+- search_activate (impl);
++ operation_mode_set (impl, OPERATION_MODE_SEARCH);
+ }
+ else if (shortcut_type == SHORTCUT_TYPE_RECENT)
+ {
+- recent_activate (impl);
++ operation_mode_set (impl, OPERATION_MODE_RECENT);
+ }
+ }
+
+@@ -10163,21 +10049,9 @@
+ if (impl->operation_mode != OPERATION_MODE_BROWSE)
+ {
+ GtkWidget *widget_to_focus;
+-
+- /* This will give us the location widgets back */
+- switch (impl->operation_mode)
+- {
+- case OPERATION_MODE_SEARCH:
+- search_switch_to_browse_mode (impl);
+- break;
+- case OPERATION_MODE_RECENT:
+- recent_switch_to_browse_mode (impl);
+- break;
+- case OPERATION_MODE_BROWSE:
+- g_assert_not_reached ();
+- break;
+- }
+
++ operation_mode_set (impl, OPERATION_MODE_BROWSE);
++
+ if (impl->current_folder)
+ change_folder_and_display_error (impl, impl->current_folder, FALSE);
+
+@@ -10193,34 +10067,11 @@
+ if (impl->action == GTK_FILE_CHOOSER_ACTION_OPEN ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_SELECT_FOLDER)
+ {
+- LocationMode new_mode;
+-
+- if (path != NULL)
+- {
+- /* since the user typed something, we unconditionally want to turn on the entry */
+- new_mode = LOCATION_MODE_FILENAME_ENTRY;
+- }
+- else if (impl->location_mode == LOCATION_MODE_PATH_BAR)
+- new_mode = LOCATION_MODE_FILENAME_ENTRY;
+- else if (impl->location_mode == LOCATION_MODE_FILENAME_ENTRY)
+- new_mode = LOCATION_MODE_PATH_BAR;
+- else
+- {
+- g_assert_not_reached ();
+- return;
+- }
++ if (!path)
++ return;
+
+- location_mode_set (impl, new_mode, TRUE);
+- if (new_mode == LOCATION_MODE_FILENAME_ENTRY)
+- {
+- if (path != NULL)
+- location_set_user_text (impl, path);
+- else
+- {
+- location_entry_set_initial_text (impl);
+- gtk_editable_select_region (GTK_EDITABLE (impl->location_entry), 0, -1);
+- }
+- }
++ location_mode_set (impl, LOCATION_MODE_FILENAME_ENTRY, TRUE);
++ location_set_user_text (impl, path);
+ }
+ else if (impl->action == GTK_FILE_CHOOSER_ACTION_SAVE ||
+ impl->action == GTK_FILE_CHOOSER_ACTION_CREATE_FOLDER)
+Index: gtk+-2.24.6/gtk/gtkfilechooserprivate.h
+===================================================================
+--- gtk+-2.24.6.orig/gtk/gtkfilechooserprivate.h 2011-10-05 19:20:32.636620787 +0200
++++ gtk+-2.24.6/gtk/gtkfilechooserprivate.h 2011-10-05 19:20:47.260436939 +0200
+@@ -176,6 +176,7 @@
+
+ /* The file browsing widgets */
+ GtkWidget *browse_widgets_box;
++ GtkWidget *browse_header_box;
+ GtkWidget *browse_shortcuts_tree_view;
+ GtkWidget *browse_shortcuts_add_button;
+ GtkWidget *browse_shortcuts_remove_button;
Modified: desktop/unstable/gtk+2.0/debian/patches/series
URL: http://svn.debian.org/wsvn/pkg-gnome/desktop/unstable/gtk%2B2.0/debian/patches/series?rev=30006&op=diff
==============================================================================
--- desktop/unstable/gtk+2.0/debian/patches/series [utf-8] (original)
+++ desktop/unstable/gtk+2.0/debian/patches/series [utf-8] Wed Oct 5 17:24:34 2011
@@ -13,4 +13,5 @@
061_use_pdf_as_default_printing_standard.patch
064_gir_build_workaround.patch
065_tracker.patch
+066_filechooser-recent-folders.patch
098_multiarch_module_path.patch
More information about the pkg-gnome-commits
mailing list