]> www.fi.muni.cz Git - evince.git/blobdiff - shell/ev-window.c
Implement the 'Open Containing Folder' command
[evince.git] / shell / ev-window.c
index 40fb7000c155e79009d2dc1a173c676c98b03cd3..46c41a903f24b01fbced628fa73690d688e40e48 100644 (file)
@@ -2865,7 +2865,43 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
 static void
 ev_window_cmd_open_containing_folder (GtkAction *action, EvWindow *ev_window)
 {
-       /* FIXME */
+       GtkWidget *ev_window_widget;
+       GFile *file;
+       GFile *parent;
+
+       ev_window_widget = GTK_WIDGET (ev_window);
+
+       file = g_file_new_for_uri (ev_window->priv->uri);
+       parent = g_file_get_parent (file);
+
+       if (parent) {
+               char *parent_uri;
+
+               parent_uri = g_file_get_uri (parent);
+               if (parent_uri) {
+                       GdkScreen *screen;
+                       guint32 timestamp;
+                       GError *error;
+
+                       screen = gtk_widget_get_screen (ev_window_widget);
+                       timestamp = gtk_get_current_event_time ();
+
+                       error = NULL;
+                       if (!gtk_show_uri (screen, parent_uri, timestamp, &error)) {
+                               ev_window_error_message (ev_window, error, _("Could not open the containing folder"));
+                               g_error_free (error);
+                       }
+
+                       g_free (parent_uri);
+               }
+       }
+
+       if (file)
+               g_object_unref (file);
+
+       if (parent)
+               g_object_unref (parent);
+       
 }
 
 static GKeyFile *