diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/ephy-window.c | 6 | ||||
-rwxr-xr-x | src/ppview-toolbar.c | 32 |
2 files changed, 30 insertions, 8 deletions
diff --git a/src/ephy-window.c b/src/ephy-window.c index 41944f37b..59ff4e30e 100644 --- a/src/ephy-window.c +++ b/src/ephy-window.c @@ -1064,6 +1064,12 @@ show_embed_popup (EphyWindow *window, EphyTab *tab, EphyEmbedEvent *event) GtkWidget *widget; EphyEmbedEventType type; + /* Do not show the menu in print preview mode */ + if (window->priv->chrome_mask & EMBED_CHROME_PPVIEWTOOLBARON) + { + return; + } + ephy_embed_event_get_property (event, "framed_page", &value); framed = g_value_get_int (value); diff --git a/src/ppview-toolbar.c b/src/ppview-toolbar.c index 922b54a15..d08dbdece 100755 --- a/src/ppview-toolbar.c +++ b/src/ppview-toolbar.c @@ -256,6 +256,7 @@ ppview_toolbar_init (PPViewToolbar *t) t->priv->window = NULL; t->priv->ui_merge = NULL; + t->priv->current_page = 1; for (i = 0; i < n_entries; i++) { @@ -336,6 +337,21 @@ toolbar_cmd_ppv_goto_last (EggMenuMerge *merge, toolbar_update_sensitivity (t); } +static int +clamp_page_limits (PPViewToolbar *t, int page) +{ + EphyWindow *window = t->priv->window; + EphyEmbed *embed; + int pages; + + embed = ephy_window_get_active_embed (window); + g_return_val_if_fail (embed != NULL, -1); + + ephy_embed_print_preview_num_pages (embed, &pages); + + return CLAMP (page, 1, pages); +} + static void toolbar_cmd_ppv_go_back (EggMenuMerge *merge, PPViewToolbar *t) @@ -346,11 +362,11 @@ toolbar_cmd_ppv_go_back (EggMenuMerge *merge, embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); - ephy_embed_print_preview_navigate (embed, - PRINTPREVIEW_PREV_PAGE, - 0); + t->priv->current_page = clamp_page_limits (t, t->priv->current_page - 1); - t->priv->current_page --; + ephy_embed_print_preview_navigate (embed, + PRINTPREVIEW_GOTO_PAGENUM, + t->priv->current_page); toolbar_update_sensitivity (t); } @@ -365,11 +381,11 @@ toolbar_cmd_ppv_go_forward (EggMenuMerge *merge, embed = ephy_window_get_active_embed (window); g_return_if_fail (embed != NULL); - ephy_embed_print_preview_navigate (embed, - PRINTPREVIEW_NEXT_PAGE, - 0); + t->priv->current_page = clamp_page_limits (t, t->priv->current_page + 1); - t->priv->current_page ++; + ephy_embed_print_preview_navigate (embed, + PRINTPREVIEW_GOTO_PAGENUM, + t->priv->current_page); toolbar_update_sensitivity (t); } |