]> www.fi.muni.cz Git - evince.git/commitdiff
Merge branch 'unmessify-my-pdfs' - bgo#627443 - Add an 'Open containing folder' command
authorFederico Mena Quintero <federico@novell.com>
Mon, 13 Sep 2010 19:41:34 +0000 (14:41 -0500)
committerFederico Mena Quintero <federico@novell.com>
Mon, 13 Sep 2010 19:41:43 +0000 (14:41 -0500)
data/evince-toolbar.xml
data/evince-ui.xml
shell/ev-window.c

index b87bf717764779658aa8f48e568baba0162dcc32..1779edfdd308fb0727cee5e20fbc30b3dc4397c0 100644 (file)
@@ -4,6 +4,7 @@
     <toolitem name="FileOpenRecent"/>
     <toolitem name="FilePrint"/>
     <toolitem name="FileSaveAs"/>
+    <toolitem name="FileOpenContainingFolder"/>
     <toolitem name="ViewContinuous"/>
     <toolitem name="ViewDual"/>
     <toolitem name="ViewInvertedColors"/>
@@ -35,5 +36,7 @@
     <toolitem name="PageSelector"/>
     <separator/>
     <toolitem name="ViewZoom"/>
+    <separator/>
+    <toolitem name="FileOpenContainingFolder"/>
  </toolbar>
 </toolbars>
index f8e750db6cb7409429a8a9dee1492f45769e0509..8067546680d259a471db0f2ed55d3b3c5cf3c630 100644 (file)
@@ -4,6 +4,7 @@
       <menuitem name="FileOpenMenu" action="FileOpen"/>
       <menuitem name="FileOpenCopyMenu" action="FileOpenCopy"/>
       <menuitem name="FileSaveAsMenu" action="FileSaveAs"/>
+      <menuitem name="FileOpenContainingFolderMenu" action="FileOpenContainingFolder"/>
       <separator/>
       <menuitem name="FilePrintMenu" action="FilePrint"/>
       <separator/>
@@ -86,6 +87,7 @@
     <menuitem name="SaveAttachmentAs" action="SaveAttachmentAs"/>
     <separator/>
     <menuitem name="AnnotProperties" action="AnnotProperties"/>
+    <menuitem name="FileOpenContainingFolder" action="FileOpenContainingFolder"/>
   </popup>
 
   <popup name="AttachmentPopup" action="AttachmentPopupAction">
index 32db0ef2b83b23a4041e147b5ff5c008ffcc8f96..ce43ab072b16a512735556248af9b89f3da9cefb 100644 (file)
@@ -2866,6 +2866,48 @@ ev_window_cmd_save_as (GtkAction *action, EvWindow *ev_window)
        gtk_widget_show (fc);
 }
 
+static void
+ev_window_cmd_open_containing_folder (GtkAction *action, EvWindow *ev_window)
+{
+       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 *
 get_print_settings_file (void)
 {
@@ -5410,6 +5452,9 @@ static const GtkActionEntry entries[] = {
                { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("_Save a Copy…"), "<control>S",
          N_("Save a copy of the current document"),
          G_CALLBACK (ev_window_cmd_save_as) },
+       { "FileOpenContainingFolder", GTK_STOCK_DIRECTORY, N_("Open Containing _Folder"), NULL,
+         N_("Show the folder which contains this file in the file manager"),
+         G_CALLBACK (ev_window_cmd_open_containing_folder) },
        { "FilePrint", GTK_STOCK_PRINT, N_("_Print…"), "<control>P",
          N_("Print this document"),
          G_CALLBACK (ev_window_cmd_file_print) },
@@ -5720,6 +5765,10 @@ set_action_properties (GtkActionGroup *action_group)
 {
        GtkAction *action;
 
+       action = gtk_action_group_get_action (action_group, "FileOpenContainingFolder");
+       /*translators: this is the label for toolbar button*/
+       g_object_set (action, "short_label", _("Open Folder"), NULL);
+
        action = gtk_action_group_get_action (action_group, "GoPreviousPage");
        g_object_set (action, "is-important", TRUE, NULL);
        /*translators: this is the label for toolbar button*/