forked from AuroraMiddleware/gtk
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: Federico Mena Quintero <federico@gnome.org>
This commit is contained in:
parent
668287b940
commit
2476d35142
@ -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_tree_view,
|
||||
popup_menu_detach_cb);
|
||||
|
||||
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);
|
||||
|
||||
/* FIXME - handle OPERATION_MODE_SEARCH and OPERATION_MODE_RECENT */
|
||||
|
||||
/* 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;
|
||||
|
Loading…
Reference in New Issue
Block a user