summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFederico Mena Quintero <federico@gnome.org>2011-06-28 17:24:53 -0500
committerFederico Mena Quintero <federico@gnome.org>2011-06-28 18:43:18 -0500
commitfc562d8052311da71676f31f56c63490ba72caf4 (patch)
tree7be8c83ae7db737374824736b89710210be23fe5
parentecdc08e2ec4f883fc79554d98a979218bdb6a98a (diff)
downloadgtk+-fc562d8052311da71676f31f56c63490ba72caf4.tar.gz
Actually highlight the 'recently used' and 'search' items in the shortcuts bar
They weren't being selected in the shortcuts bar when those modes were activated programmatically, instead of through the user selecting them from the user interface.
-rw-r--r--gtk/gtkfilechooserdefault.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c
index e45f8d3dbc..dc05c5d9bc 100644
--- a/gtk/gtkfilechooserdefault.c
+++ b/gtk/gtkfilechooserdefault.c
@@ -8896,6 +8896,24 @@ stop_operation (GtkFileChooserDefault *impl, OperationMode mode)
}
}
+/* 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.
*/
@@ -8913,6 +8931,8 @@ search_activate (GtkFileChooserDefault *impl)
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);
@@ -9272,6 +9292,8 @@ recent_activate (GtkFileChooserDefault *impl)
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);