X-Git-Url: https://www.fi.muni.cz/~kas/git//home/kas/public_html/git/?a=blobdiff_plain;f=shell%2Fev-window.c;h=013ae3d36654d9dfc9b1278932388dcafa1de709;hb=3128a9b34c8f2d7fd3894e2e478ed824418b1d27;hp=af8a83f364a151a68652b221a8b2ab3d84b244fa;hpb=4f8bc8db98020835d2c4d39c902a296b784cf030;p=evince.git diff --git a/shell/ev-window.c b/shell/ev-window.c index af8a83f3..013ae3d3 100644 --- a/shell/ev-window.c +++ b/shell/ev-window.c @@ -1466,8 +1466,15 @@ ev_window_set_document (EvWindow *ev_window, EvDocument *document) } if (EV_WINDOW_IS_PRESENTATION (ev_window)) { + gint current_page; + + current_page = ev_view_presentation_get_current_page ( + EV_VIEW_PRESENTATION (ev_window->priv->presentation_view)); gtk_widget_destroy (ev_window->priv->presentation_view); ev_window->priv->presentation_view = NULL; + + /* Update the model with the current presentation page */ + ev_document_model_set_page (ev_window->priv->model, current_page); ev_window_run_presentation (ev_window); } @@ -4023,12 +4030,15 @@ ev_window_stop_presentation (EvWindow *window, gboolean unfullscreen_window) { guint current_page; + guint rotation; if (!EV_WINDOW_IS_PRESENTATION (window)) return; current_page = ev_view_presentation_get_current_page (EV_VIEW_PRESENTATION (window->priv->presentation_view)); ev_document_model_set_page (window->priv->model, current_page); + rotation = ev_view_presentation_get_rotation (EV_VIEW_PRESENTATION (window->priv->presentation_view)); + ev_document_model_set_rotation (window->priv->model, rotation); gtk_container_remove (GTK_CONTAINER (window->priv->main_box), window->priv->presentation_view); @@ -4200,17 +4210,33 @@ ev_window_set_page_mode (EvWindow *window, static void ev_window_cmd_edit_rotate_left (GtkAction *action, EvWindow *ev_window) { - gint rotation = ev_document_model_get_rotation (ev_window->priv->model); + gint rotation; + + if (EV_WINDOW_IS_PRESENTATION (ev_window)) { + rotation = ev_view_presentation_get_rotation (EV_VIEW_PRESENTATION (ev_window->priv->presentation_view)); + ev_view_presentation_set_rotation (EV_VIEW_PRESENTATION (ev_window->priv->presentation_view), + rotation - 90); + } else { + rotation = ev_document_model_get_rotation (ev_window->priv->model); - ev_document_model_set_rotation (ev_window->priv->model, rotation - 90); + ev_document_model_set_rotation (ev_window->priv->model, rotation - 90); + } } static void ev_window_cmd_edit_rotate_right (GtkAction *action, EvWindow *ev_window) { - gint rotation = ev_document_model_get_rotation (ev_window->priv->model); + gint rotation; - ev_document_model_set_rotation (ev_window->priv->model, rotation + 90); + if (EV_WINDOW_IS_PRESENTATION (ev_window)) { + rotation = ev_view_presentation_get_rotation (EV_VIEW_PRESENTATION (ev_window->priv->presentation_view)); + ev_view_presentation_set_rotation (EV_VIEW_PRESENTATION (ev_window->priv->presentation_view), + rotation + 90); + } else { + rotation = ev_document_model_get_rotation (ev_window->priv->model); + + ev_document_model_set_rotation (ev_window->priv->model, rotation + 90); + } } static void @@ -4268,7 +4294,7 @@ ev_window_cmd_edit_toolbar (GtkAction *action, EvWindow *ev_window) gtk_container_set_border_width (GTK_CONTAINER (editor), 5); gtk_box_set_spacing (GTK_BOX (EGG_TOOLBAR_EDITOR (editor)), 5); - gtk_container_add (GTK_CONTAINER (content_area), editor); + gtk_box_pack_start (GTK_BOX (content_area), editor, TRUE, TRUE, 0); egg_editable_toolbar_set_edit_mode (toolbar, TRUE); @@ -6300,6 +6326,30 @@ ev_view_popup_cmd_copy_link_address (GtkAction *action, EvWindow *window) ev_action); } +static GFile * +create_file_from_uri_for_format (const gchar *uri, + GdkPixbufFormat *format) +{ + GFile *target_file; + gchar **extensions; + gchar *uri_extension; + gint i; + + extensions = gdk_pixbuf_format_get_extensions (format); + for (i = 0; extensions[i]; i++) { + if (g_str_has_suffix (uri, extensions[i])) { + g_strfreev (extensions); + return g_file_new_for_uri (uri); + } + } + + uri_extension = g_strconcat (uri, ".", extensions[0], NULL); + target_file = g_file_new_for_uri (uri_extension); + g_free (uri_extension); + g_strfreev (extensions); + + return target_file; +} static void image_save_dialog_response_cb (GtkWidget *fc, @@ -6311,7 +6361,6 @@ image_save_dialog_response_cb (GtkWidget *fc, GError *error = NULL; GdkPixbuf *pixbuf; gchar *uri; - gchar **extensions; gchar *filename; gchar *file_format; GdkPixbufFormat *format; @@ -6349,19 +6398,9 @@ image_save_dialog_response_cb (GtkWidget *fc, return; } - extensions = gdk_pixbuf_format_get_extensions (format); - if (!g_str_has_suffix (uri, extensions[0])) { - gchar *uri_extension; - - uri_extension = g_strconcat (uri, ".", extensions[0], NULL); - target_file = g_file_new_for_uri (uri_extension); - g_free (uri_extension); - } else { - target_file = g_file_new_for_uri (uri); - } - g_strfreev (extensions); + target_file = create_file_from_uri_for_format (uri, format); g_free (uri); - + is_native = g_file_is_native (target_file); if (is_native) { filename = g_file_get_path (target_file); @@ -6689,9 +6728,15 @@ ev_window_media_player_key_pressed (EvWindow *window, if (strcmp (key, "Play") == 0) { ev_window_run_presentation (window); } else if (strcmp (key, "Previous") == 0) { - ev_window_cmd_go_previous_page (NULL, window); + if (EV_WINDOW_IS_PRESENTATION (window)) + ev_view_presentation_previous_page (EV_VIEW_PRESENTATION (window->priv->presentation_view)); + else + ev_window_cmd_go_previous_page (NULL, window); } else if (strcmp (key, "Next") == 0) { - ev_window_cmd_go_next_page (NULL, window); + if (EV_WINDOW_IS_PRESENTATION (window)) + ev_view_presentation_next_page (EV_VIEW_PRESENTATION (window->priv->presentation_view)); + else + ev_window_cmd_go_next_page (NULL, window); } else if (strcmp (key, "FastForward") == 0) { ev_window_cmd_go_last_page (NULL, window); } else if (strcmp (key, "Rewind") == 0) {