[evince/unmessify-my-pdfs: 2/3] Implement the 'Open Containing Folder' command
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [evince/unmessify-my-pdfs: 2/3] Implement the 'Open Containing Folder' command
- Date: Mon, 13 Sep 2010 17:14:56 +0000 (UTC)
commit 5d42af6c195aa3d17047afbaeec438009fcf17ce
Author: Federico Mena Quintero <federico novell com>
Date: Thu Aug 19 16:04:43 2010 -0500
Implement the 'Open Containing Folder' command
Nautilus doesn't seem to like
nautilus file:///home/foo/Downloads/foo.pdf
these days; it complains that foo.pdf is not a folder.
So, we just launch the default handler for the file's parent folder.
When that bug in Nautilus is fixed, maybe we can go back
to spawning it directly.
Signed-off-by: Federico Mena Quintero <federico novell com>
shell/ev-window.c | 38 +++++++++++++++++++++++++++++++++++++-
1 files changed, 37 insertions(+), 1 deletions(-)
---
diff --git a/shell/ev-window.c b/shell/ev-window.c
index 40fb700..46c41a9 100644
--- a/shell/ev-window.c
+++ b/shell/ev-window.c
@@ -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 *
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]