summaryrefslogtreecommitdiff
path: root/gtk/gtkprintoperation.c
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2007-04-24 20:16:35 +0000
committerMatthias Clasen <matthiasc@src.gnome.org>2007-04-24 20:16:35 +0000
commit8f409578f267f4da34ffe57c26032acc6706bde7 (patch)
tree92479da91e0d856901a1df7883934ecfa61e74e8 /gtk/gtkprintoperation.c
parent18a9c78bf36be6e6c84a7fa8259b9daa4e8eb96f (diff)
downloadgtk+-8f409578f267f4da34ffe57c26032acc6706bde7.tar.gz
Parse half-open ranges like -2 or 3-, and be a bit more liberal about
2007-04-24 Matthias Clasen <mclasen@redhat.com> * gtk/gtkprintunixdialog.c (dialog_get_page_ranges): Parse half-open ranges like -2 or 3-, and be a bit more liberal about whitespace. (dialog_set_page_ranges): Support half-open ranges. * gtk/gtkprintoperation.c (print_pages_idle): Substitute the number of pages in half-open ranges. (preview_iface_is_selected): Support half-open ranges here, too. svn path=/trunk/; revision=17627
Diffstat (limited to 'gtk/gtkprintoperation.c')
-rw-r--r--gtk/gtkprintoperation.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index 2440a1dd71..e1189d762f 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -214,7 +214,7 @@ preview_iface_is_selected (GtkPrintOperationPreview *preview,
for (i = 0; i < priv->num_page_ranges; i++)
{
if (page_nr >= priv->page_ranges[i].start &&
- page_nr <= priv->page_ranges[i].end)
+ (page_nr <= priv->page_ranges[i].end || page_ranges[i].end == -1)
return TRUE;
}
return FALSE;
@@ -2018,6 +2018,7 @@ print_pages_idle (gpointer user_data)
GtkPrintOperationPrivate *priv;
GtkPageSetup *page_setup;
gboolean done = FALSE;
+ gint i;
data = (PrintPagesData*)user_data;
priv = data->op->priv;
@@ -2067,6 +2068,9 @@ print_pages_idle (gpointer user_data)
{
data->ranges = priv->page_ranges;
data->num_ranges = priv->num_page_ranges;
+ for (i = 0; i < data->num_ranges; i++)
+ if (data->ranges[i].end == -1)
+ data->ranges[i].end = priv->nr_of_pages - 1;
}
else if (priv->print_pages == GTK_PRINT_PAGES_CURRENT &&
priv->current_page != -1)