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.
This commit is contained in:
@ -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"
|
||||
|
@ -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,
|
||||
|
Reference in New Issue
Block a user