Menu item to visit the selected files in recent-files mode

This will take you to the file's folder and select the file in question.
The menu item is only available in Recently-used and Search modes, so that
you can go from files in them to the 'normal' browsing mode.
Signed-off-by: default avatarFederico Mena Quintero <>
parent 668287b9
......@@ -3894,7 +3894,28 @@ copy_file_location_cb (GtkMenuItem *item,
/* Callback used when the "Show Hidden Files" menu item is toggled */
/* Callback used when the "Visit this file" menu item is activated */
static void
visit_file_cb (GtkMenuItem *item,
GtkFileChooserDefault *impl)
GSList *files;
files = search_get_selected_files (impl);
/* Sigh, just use the first one */
if (files)
GFile *file = files->data;
gtk_file_chooser_default_select_file (impl, file, NULL); /* NULL-GError */
g_slist_foreach (files, (GFunc) g_object_unref, NULL);
g_slist_free (files);
/* callback used when the "Show Hidden Files" menu item is toggled */
static void
show_hidden_toggled_cb (GtkCheckMenuItem *item,
GtkFileChooserDefault *impl)
......@@ -4147,6 +4168,9 @@ file_list_build_popup_menu (GtkFileChooserDefault *impl)
impl->browse_files_popup_menu_visit_file_item = file_list_add_image_menu_item (impl, GTK_STOCK_DIRECTORY, _("_Visit this file"),
G_CALLBACK (visit_file_cb));
impl->browse_files_popup_menu_copy_file_location_item = file_list_add_image_menu_item (impl, GTK_STOCK_COPY, _("_Copy file's location"),
G_CALLBACK (copy_file_location_cb));
......@@ -4173,12 +4197,13 @@ file_list_update_popup_menu (GtkFileChooserDefault *impl)
file_list_build_popup_menu (impl);
/* The sensitivity of the Add to Bookmarks item is set in
* bookmarks_check_add_sensitivity()
/* 'Visit this file' */
gtk_widget_set_visible (impl->browse_files_popup_menu_visit_file_item, (impl->operation_mode != OPERATION_MODE_BROWSE));
/* 'Show Hidden Files' */
g_signal_handlers_block_by_func (impl->browse_files_popup_menu_hidden_files_item,
G_CALLBACK (show_hidden_toggled_cb), impl);
......@@ -181,6 +181,7 @@ struct _GtkFileChooserDefault
GtkWidget *browse_files_popup_menu_hidden_files_item;
GtkWidget *browse_files_popup_menu_size_column_item;
GtkWidget *browse_files_popup_menu_copy_file_location_item;
GtkWidget *browse_files_popup_menu_visit_file_item;
GtkWidget *browse_new_folder_button;
GtkWidget *browse_path_bar_hbox;
GtkSizeGroup *browse_path_bar_size_group;
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment