@@ -2953,6 +2953,54 @@ eom_window_cmd_save_as (GtkAction *action, gpointer user_data)
29532953 eom_job_queue_add_job (priv -> save_job );
29542954}
29552955
2956+ static void
2957+ eom_window_cmd_open_containing_folder (GtkAction * action , gpointer user_data )
2958+ {
2959+ EomWindow * window = EOM_WINDOW (user_data );
2960+ EomWindowPrivate * priv ;
2961+
2962+ GtkWidget * eom_window_widget ;
2963+
2964+ GFile * file ;
2965+ GFile * parent = NULL ;
2966+
2967+ eom_window_widget = GTK_WIDGET (window );
2968+ priv = window -> priv ;
2969+
2970+ g_return_if_fail (priv -> image != NULL );
2971+
2972+ file = eom_image_get_file (priv -> image );
2973+
2974+ if (file ) {
2975+ parent = g_file_get_parent (file );
2976+ g_object_unref (file );
2977+ }
2978+
2979+ if (parent ) {
2980+ char * parent_uri ;
2981+
2982+ parent_uri = g_file_get_uri (parent );
2983+ if (parent_uri ) {
2984+ GdkScreen * screen ;
2985+ guint32 timestamp ;
2986+ GError * error ;
2987+
2988+ screen = gtk_widget_get_screen (eom_window_widget );
2989+ timestamp = gtk_get_current_event_time ();
2990+
2991+ error = NULL ;
2992+ if (!gtk_show_uri (screen , parent_uri , timestamp , & error )) {
2993+ eom_debug_message (DEBUG_WINDOW , "Could not open the containing folder" );
2994+ g_error_free (error );
2995+ }
2996+
2997+ g_free (parent_uri );
2998+ }
2999+
3000+ g_object_unref (parent );
3001+ }
3002+ }
3003+
29563004static void
29573005eom_window_cmd_print (GtkAction * action , gpointer user_data )
29583006{
@@ -3651,6 +3699,9 @@ static const GtkActionEntry action_entries_image[] = {
36513699 { "ImageSaveAs" , "document-save-as" , N_ ("Save _As…" ), "<control><shift>s" ,
36523700 N_ ("Save the selected images with a different name" ),
36533701 G_CALLBACK (eom_window_cmd_save_as ) },
3702+ { "ImageOpenContainingFolder" , GTK_STOCK_DIRECTORY , N_ ("Open Containing _Folder" ), NULL ,
3703+ N_ ("Show the folder which contains this file in the file manager" ),
3704+ G_CALLBACK (eom_window_cmd_open_containing_folder ) },
36543705 { "ImagePrint" , "document-print" , N_ ("_Print…" ), "<control>p" ,
36553706 N_ ("Print the selected image" ),
36563707 G_CALLBACK (eom_window_cmd_print ) },
@@ -3824,6 +3875,9 @@ set_action_properties (GtkActionGroup *window_group,
38243875 action = gtk_action_group_get_action (image_group , "EditRotate270" );
38253876 g_object_set (action , "short_label" , _ ("Left" ), NULL );
38263877
3878+ action = gtk_action_group_get_action (image_group , "ImageOpenContainingFolder" );
3879+ g_object_set (action , "short_label" , _ ("Open Folder" ), NULL );
3880+
38273881 action = gtk_action_group_get_action (image_group , "ViewZoomIn" );
38283882 g_object_set (action , "short_label" , _ ("In" ), NULL );
38293883
0 commit comments