[gedit/wip/printing-enhancements] print-preview: begin support of selected pages to print
- From: Sébastien Wilmet <swilmet src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gedit/wip/printing-enhancements] print-preview: begin support of selected pages to print
- Date: Sun, 28 Jun 2015 16:55:23 +0000 (UTC)
commit 1750f7232ca87c32b560ec310427fc1cc47abd36
Author: Sébastien Wilmet <swilmet gnome org>
Date: Sun Jun 28 18:51:20 2015 +0200
print-preview: begin support of selected pages to print
gedit/gedit-print-preview.c | 32 +++++++++++++++++++++++++++++++-
1 files changed, 31 insertions(+), 1 deletions(-)
---
diff --git a/gedit/gedit-print-preview.c b/gedit/gedit-print-preview.c
index a74dddd..444eea6 100644
--- a/gedit/gedit-print-preview.c
+++ b/gedit/gedit-print-preview.c
@@ -355,6 +355,26 @@ prev_button_clicked (GtkWidget *button,
gdk_event_free (event);
}
+/* Skip unselected pages. */
+static gboolean
+adjust_nth_page_forward (GeditPrintPreview *preview,
+ gint *page)
+{
+ gint n_pages = get_n_pages (preview);
+ gint new_page;
+
+ for (new_page = *page; new_page < n_pages; new_page++)
+ {
+ if (gtk_print_operation_preview_is_selected (preview->gtk_preview, new_page))
+ {
+ *page = new_page;
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
static void
next_button_clicked (GtkWidget *button,
GeditPrintPreview *preview)
@@ -371,7 +391,17 @@ next_button_clicked (GtkWidget *button,
}
else
{
- page = preview->cur_page + preview->n_columns;
+ gint i;
+
+ page = preview->cur_page;
+ for (i = 0; i < preview->n_columns; i++)
+ {
+ page++;
+ if (!adjust_nth_page_forward (preview, &page))
+ {
+ break;
+ }
+ }
}
goto_page (preview, MIN (page, n_pages - 1));
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]