diff options
author | Marek Kasik <mkasik@redhat.com> | 2009-07-10 11:28:31 +0200 |
---|---|---|
committer | Marek Kasik <mkasik@redhat.com> | 2009-07-10 11:28:31 +0200 |
commit | 0ef74c936f7a5b36a66ea828506b4b44e25a1998 (patch) | |
tree | cd3492286b53633ee7f9dd8fa692287e1119c950 /gtk/gtkprintoperation.c | |
parent | 6ca5430a74c86b448e96b64166d67b3268e24789 (diff) | |
download | gtk+-0ef74c936f7a5b36a66ea828506b4b44e25a1998.tar.gz |
Add paper size combo and orientation combo to print dialog
Paper size combo and orientation combo can be added by
gtk_print_operation_set_embed_page_setup_dialog() to GtkPrinUnixDialog
now. This function induce calling of
gtk_print_unix_dailog_set_embed_page_setup_dialog() after creation of
dialog. These two functions control embed-page-setup-dialog properties
in GtkPrintOperation and in GtkPrintUnixDialog.
There is also new function gtk_print_unix_dialog_get_page_setup_set()
which says whether page setup was set by user.
Selected page setup is stored as default page setup in
GtkPrintOperation.
New class is added, its name is GtkCustomPaperUnixDialog. The class
manages custom sizes. It is derived from GtkPageSetupUnixDialog's
CustomPaperDialog structure.
Page layout preview is modified, so, it shows dimensions of current
page setup (mm or inch - depends on locale). It also shows the name of
actual paper if page setup dialog is not embedded (paper size combo is
not visible).
gtk-demo is actualized to include this new feature.
Diffstat (limited to 'gtk/gtkprintoperation.c')
-rw-r--r-- | gtk/gtkprintoperation.c | 71 |
1 files changed, 70 insertions, 1 deletions
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c index f3ebd85af3..765e7d0b25 100644 --- a/gtk/gtkprintoperation.c +++ b/gtk/gtkprintoperation.c @@ -69,7 +69,8 @@ enum PROP_EXPORT_FILENAME, PROP_STATUS, PROP_STATUS_STRING, - PROP_CUSTOM_TAB_LABEL + PROP_CUSTOM_TAB_LABEL, + PROP_EMBED_PAGE_SETUP }; static guint signals[LAST_SIGNAL] = { 0 }; @@ -165,6 +166,7 @@ gtk_print_operation_init (GtkPrintOperation *operation) priv->is_sync = FALSE; priv->support_selection = FALSE; priv->has_selection = FALSE; + priv->embed_page_setup = FALSE; priv->page_drawing_state = GTK_PAGE_DRAWING_STATE_READY; @@ -320,6 +322,9 @@ gtk_print_operation_set_property (GObject *object, case PROP_CUSTOM_TAB_LABEL: gtk_print_operation_set_custom_tab_label (op, g_value_get_string (value)); break; + case PROP_EMBED_PAGE_SETUP: + gtk_print_operation_set_embed_page_setup (op, g_value_get_boolean (value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -379,6 +384,9 @@ gtk_print_operation_get_property (GObject *object, case PROP_CUSTOM_TAB_LABEL: g_value_set_string (value, priv->custom_tab_label); break; + case PROP_EMBED_PAGE_SETUP: + g_value_set_boolean (value, priv->embed_page_setup); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec); break; @@ -1229,6 +1237,21 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class) FALSE, GTK_PARAM_READWRITE)); + + /** + * GtkPrintOperation:embed-page-setup: + * + * If %TRUE, page size combo box and orientation combo box are embedded into page setup page. + * + * Since: 2.18 + */ + g_object_class_install_property (gobject_class, + PROP_EMBED_PAGE_SETUP, + g_param_spec_boolean ("embed-page-setup", + P_("Embed Page Setup"), + P_("TRUE if page setup combos are embedded in GtkPrintDialog"), + FALSE, + GTK_PARAM_READWRITE)); } /** @@ -2198,6 +2221,52 @@ gtk_print_operation_set_defer_drawing (GtkPrintOperation *op) } /** + * gtk_print_operation_set_embed_page_setup: + * @op: a #GtkPrintOperation + * @embed: %TRUE to embed page setup selection in the #GtkPrintDialog + * + * Embed page size combo box and orientation combo box into page setup page. + * Selected page setup is stored as default page setup in #GtkPrintOperation. + * + * Since: 2.18 + **/ +void +gtk_print_operation_set_embed_page_setup (GtkPrintOperation *op, + gboolean embed) +{ + GtkPrintOperationPrivate *priv; + + g_return_if_fail (GTK_IS_PRINT_OPERATION (op)); + + priv = op->priv; + + embed = embed != FALSE; + if (priv->embed_page_setup != embed) + { + priv->embed_page_setup = embed; + g_object_notify (G_OBJECT (op), "embed-page-setup"); + } +} + +/** + * gtk_print_operation_get_embed_page_setup: + * @op: a #GtkPrintOperation + * + * Gets the value of #GtkPrintOperation::embed-page-setup property. + * + * Returns: whether page setup selection combos are embedded + * + * Since: 2.18 + */ +gboolean +gtk_print_operation_get_embed_page_setup (GtkPrintOperation *op) +{ + g_return_val_if_fail (GTK_IS_PRINT_OPERATION (op), FALSE); + + return op->priv->embed_page_setup; +} + +/** * gtk_print_operation_draw_page_finish: * @op: a #GtkPrintOperation * |