X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;ds=inline;f=shell%2Fev-window.c;h=9aa3926be42b9ba7571af35c0473c980ea391cfb;hb=fce2c9921a8f2d3de4341c7970b443835244332e;hp=e1f223e727d5c0b1a2bf28180156d83a704a245d;hpb=a3e68aa381fd1566049a50b26b59ce8e8612f9f7;p=evince.git diff --git a/shell/ev-window.c b/shell/ev-window.c index e1f223e7..9aa3926b 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -895,6 +895,13 @@ view_selection_changed_cb (EvView *view, ev_view_get_has_selection (view)); } +static void +view_layers_changed_cb (EvView *view, + EvWindow *window) +{ + ev_sidebar_layers_update_layers_state (EV_SIDEBAR_LAYERS (window->priv->sidebar_layers)); +} + static void ev_window_page_changed_cb (EvWindow *ev_window, gint old_page, @@ -1530,7 +1537,9 @@ ev_window_load_job_cb (EvJob *job, if (!ev_job_is_failed (job)) { ev_document_model_set_document (ev_window->priv->model, document); +#ifdef ENABLE_DBUS ev_window_emit_doc_loaded (ev_window); +#endif setup_chrome_from_metadata (ev_window); update_chrome_actions (ev_window); setup_document_from_metadata (ev_window); @@ -2864,6 +2873,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) { @@ -5408,6 +5459,9 @@ static const GtkActionEntry entries[] = { { "FileSaveAs", GTK_STOCK_SAVE_AS, N_("_Save a Copy…"), "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…"), "P", N_("Print this document"), G_CALLBACK (ev_window_cmd_file_print) }, @@ -5718,6 +5772,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*/ @@ -6956,6 +7014,9 @@ ev_window_init (EvWindow *ev_window) g_signal_connect_object (ev_window->priv->view, "annot-added", G_CALLBACK (view_annot_added), ev_window, 0); + g_signal_connect_object (ev_window->priv->view, "layers-changed", + G_CALLBACK (view_layers_changed_cb), + ev_window, 0); #ifdef ENABLE_DBUS g_signal_connect_swapped (ev_window->priv->view, "sync-source", G_CALLBACK (ev_window_sync_source),