summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarlos Garcia Campos <carlosgc@gnome.org>2009-08-05 20:20:05 +0200
committerCarlos Garcia Campos <carlosgc@gnome.org>2009-08-07 09:42:03 +0200
commitc775906e4a1bf45e5c9dc4a810b1ca15d0235d97 (patch)
treefc3cf0ecea404ca399484899461e3e1f107065c8
parentd468aee5d980d41fceb6deecd5a0319b2ca0d87b (diff)
downloadgdk-pixbuf-c775906e4a1bf45e5c9dc4a810b1ca15d0235d97.tar.gz
Add gtk_print_operation_get_n_pages_to_print()
It returns the number of pages that will be printed to allow tracking the progress of a print operation. Fixes bgo#582964.
-rw-r--r--gtk/gtkprintoperation.c56
-rw-r--r--gtk/gtkprintoperation.h1
2 files changed, 56 insertions, 1 deletions
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index 4933b2fcc..93751ba5e 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -72,7 +72,8 @@ enum
PROP_CUSTOM_TAB_LABEL,
PROP_EMBED_PAGE_SETUP,
PROP_HAS_SELECTION,
- PROP_SUPPORT_SELECTION
+ PROP_SUPPORT_SELECTION,
+ PROP_N_PAGES_TO_PRINT
};
static guint signals[LAST_SIGNAL] = { 0 };
@@ -401,6 +402,9 @@ gtk_print_operation_get_property (GObject *object,
case PROP_SUPPORT_SELECTION:
g_value_set_boolean (value, priv->support_selection);
break;
+ case PROP_N_PAGES_TO_PRINT:
+ g_value_set_int (value, priv->nr_of_pages_to_print);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1266,6 +1270,30 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class)
P_("TRUE if page setup combos are embedded in GtkPrintDialog"),
FALSE,
GTK_PARAM_READWRITE));
+ /**
+ * GtkPrintOperation:n-pages-to-print:
+ *
+ * The number of pages that will be printed.
+ *
+ * Note that this value is set during print preparation phase
+ * (%GTK_PRINT_STATUS_PREPARING), so this value should never be
+ * get before the data generation phase (%GTK_PRINT_STATUS_GENERATING_DATA).
+ * You can connect to the #GtkPrintOperation::status-changed signal
+ * and call gtk_print_operation_get_n_pages_to_print() when
+ * print status is %GTK_PRINT_STATUS_GENERATING_DATA.
+ * This is typically used to track the progress of print operation.
+ *
+ * Since: 2.18
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_N_PAGES_TO_PRINT,
+ g_param_spec_int ("n-pages-to-print",
+ P_("Number of Pages To Print"),
+ P_("The number of pages that will be printed."),
+ -1,
+ G_MAXINT,
+ -1,
+ GTK_PARAM_READABLE));
}
/**
@@ -3189,5 +3217,31 @@ gtk_print_operation_get_has_selection (GtkPrintOperation *op)
return op->priv->has_selection;
}
+/**
+ * gtk_print_operation_get_n_pages_to_print:
+ * @op: a #GtkPrintOperation
+ *
+ * Returns the number of pages that will be printed.
+ *
+ * Note that this value is set during print preparation phase
+ * (%GTK_PRINT_STATUS_PREPARING), so this function should never be
+ * called before the data generation phase (%GTK_PRINT_STATUS_GENERATING_DATA).
+ * You can connect to the #GtkPrintOperation::status-changed signal
+ * and call gtk_print_operation_get_n_pages_to_print() when
+ * print status is %GTK_PRINT_STATUS_GENERATING_DATA.
+ * This is typically used to track the progress of print operation.
+ *
+ * Returns: the number of pages that will be printed
+ *
+ * Since: 2.18
+ **/
+gint
+gtk_print_operation_get_n_pages_to_print (GtkPrintOperation *op)
+{
+ g_return_if_fail (GTK_IS_PRINT_OPERATION (op));
+
+ return op->priv->nr_of_pages_to_print;
+}
+
#define __GTK_PRINT_OPERATION_C__
#include "gtkaliasdef.c"
diff --git a/gtk/gtkprintoperation.h b/gtk/gtkprintoperation.h
index 7ac38d4c2..ef9a2879f 100644
--- a/gtk/gtkprintoperation.h
+++ b/gtk/gtkprintoperation.h
@@ -187,6 +187,7 @@ gboolean gtk_print_operation_get_has_selection (GtkPrintOper
void gtk_print_operation_set_embed_page_setup (GtkPrintOperation *op,
gboolean embed);
gboolean gtk_print_operation_get_embed_page_setup (GtkPrintOperation *op);
+gint gtk_print_operation_get_n_pages_to_print (GtkPrintOperation *op);
GtkPageSetup *gtk_print_run_page_setup_dialog (GtkWindow *parent,
GtkPageSetup *page_setup,