diff options
author | Federico Mena Quintero <federico@ximian.com> | 2004-03-15 06:51:58 +0000 |
---|---|---|
committer | Federico Mena Quintero <federico@src.gnome.org> | 2004-03-15 06:51:58 +0000 |
commit | f956e3ae0a5611382a54840bb520640c0816d42d (patch) | |
tree | ed479331d70bbce8fe5d16bb95cebd04b5ce50af /gtk | |
parent | 0abde2290492bde06a77ab152879a081276fcc15 (diff) | |
download | gtk+-f956e3ae0a5611382a54840bb520640c0816d42d.tar.gz |
Renamed from shortcuts_unselect_all(); now selects the row that
2004-03-15 Federico Mena Quintero <federico@ximian.com>
* gtk/gtkfilechooserdefault.c (shortcuts_find_current_folder):
Renamed from shortcuts_unselect_all(); now selects the row that
corresponds to the current folder, if any. Fixes #135916.
* gtk/gtkpathbar.h: Added prototypes for _gtk_path_bar_up() and
_gtk_path_bar_down().
Diffstat (limited to 'gtk')
-rw-r--r-- | gtk/gtkfilechooserdefault.c | 20 | ||||
-rw-r--r-- | gtk/gtkpathbar.h | 2 |
2 files changed, 18 insertions, 4 deletions
diff --git a/gtk/gtkfilechooserdefault.c b/gtk/gtkfilechooserdefault.c index 0c712f2155..14014180e2 100644 --- a/gtk/gtkfilechooserdefault.c +++ b/gtk/gtkfilechooserdefault.c @@ -887,14 +887,26 @@ shortcuts_reload_icons (GtkFileChooserDefault *impl) } while (gtk_tree_model_iter_next (GTK_TREE_MODEL (impl->shortcuts_model),&iter)); } -/* Clears the selection in the shortcuts tree */ +/* If a shortcut corresponds to the current folder, selects it */ static void -shortcuts_unselect_all (GtkFileChooserDefault *impl) +shortcuts_find_current_folder (GtkFileChooserDefault *impl) { GtkTreeSelection *selection; + int pos; + GtkTreePath *path; selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (impl->browse_shortcuts_tree_view)); - gtk_tree_selection_unselect_all (selection); + + pos = shortcut_find_position (impl, impl->current_folder); + if (pos == -1) + { + 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); } /* Returns whether a path is a folder */ @@ -3708,7 +3720,7 @@ gtk_file_chooser_default_set_current_folder (GtkFileChooser *chooser, /* Refresh controls */ - shortcuts_unselect_all (impl); + shortcuts_find_current_folder (impl); g_signal_emit_by_name (impl, "current-folder-changed", 0); diff --git a/gtk/gtkpathbar.h b/gtk/gtkpathbar.h index 1fbcdd4574..d34fc7aa5e 100644 --- a/gtk/gtkpathbar.h +++ b/gtk/gtkpathbar.h @@ -75,6 +75,8 @@ void _gtk_path_bar_set_file_system (GtkPathBar *path_bar, gboolean _gtk_path_bar_set_path (GtkPathBar *path_bar, const GtkFilePath *file_path, GError **error); +void _gtk_path_bar_up (GtkPathBar *path_bar); +void _gtk_path_bar_down (GtkPathBar *path_bar); G_END_DECLS |