summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarek Kasik <mkasik@redhat.com>2009-06-08 15:37:32 +0200
committerMarek Kasik <mkasik@redhat.com>2009-06-08 15:37:32 +0200
commita12a583c99982a4072cb3ac8ae969a9ebd5cbd69 (patch)
tree74fafbcf4791378162fb3da35070aa08a77edd90
parent9a4122a1302ae4d09610b3b86995095c877d8f95 (diff)
downloadgtk+-a12a583c99982a4072cb3ac8ae969a9ebd5cbd69.tar.gz
Add ability to print selection
Add a new radio button "Selection" to the print dialog. Its presence depends on calling of functions gtk_print_operation_set_support_selection() and gtk_print_dialog_unix_set_support_selection(). Sensitivity of the radio depends on calling of functions gtk_print_operation_set_has_selection() and gtk_print_dialog_unix_set_has_selection(). There are new properties GtkPrintUnixDialog::support-selection, GtkPrintUnixDialog::has-selection, GtkPrintOperation::support-selection and GtkPrintOperation::has-selection. Corresponding getters are gtk_print_dialog_unix_get_support_selection(), gtk_print_dialog_unix_get_has_selection(), gtk_print_operation_get_support_selection() and gtk_print_operation_get_has_selection(). Application has to set number of pages to which the selection will be formated in GtkPrintOperation::begin-print's callback by the gtk_print_operation_set_n_pages() function (bug #344519). There is also new property GtkPrintUnixDialog::manual-capabilities controled by gtk_print_unix_dialog_set_manual_capabilities() and gtk_print_unix_dialog_get_manual_capabilities().
-rw-r--r--docs/reference/gtk/gtk-sections.txt9
-rw-r--r--gtk/gtk.symbols9
-rw-r--r--gtk/gtkenums.h3
-rw-r--r--gtk/gtkprintoperation-private.h2
-rw-r--r--gtk/gtkprintoperation-unix.c6
-rw-r--r--gtk/gtkprintoperation.c128
-rw-r--r--gtk/gtkprintoperation.h6
-rw-r--r--gtk/gtkprintsettings.c6
-rw-r--r--gtk/gtkprintunixdialog.c241
-rw-r--r--gtk/gtkprintunixdialog.h7
10 files changed, 401 insertions, 16 deletions
diff --git a/docs/reference/gtk/gtk-sections.txt b/docs/reference/gtk/gtk-sections.txt
index 83e998c63f..c567d3d6b0 100644
--- a/docs/reference/gtk/gtk-sections.txt
+++ b/docs/reference/gtk/gtk-sections.txt
@@ -6562,6 +6562,10 @@ gtk_print_operation_set_defer_drawing
gtk_print_operation_get_status
gtk_print_operation_get_status_string
gtk_print_operation_is_finished
+gtk_print_operation_set_support_selection
+gtk_print_operation_get_support_selection
+gtk_print_operation_set_has_selection
+gtk_print_operation_get_has_selection
gtk_print_run_page_setup_dialog
GtkPageSetupDoneFunc
gtk_print_run_page_setup_dialog_async
@@ -6606,8 +6610,13 @@ gtk_print_unix_dialog_set_settings
gtk_print_unix_dialog_get_settings
gtk_print_unix_dialog_get_selected_printer
gtk_print_unix_dialog_add_custom_tab
+gtk_print_unix_dialog_set_support_selection
+gtk_print_unix_dialog_get_support_selection
+gtk_print_unix_dialog_set_has_selection
+gtk_print_unix_dialog_get_has_selection
GtkPrintCapabilities
gtk_print_unix_dialog_set_manual_capabilities
+gtk_print_unix_dialog_get_manual_capabilities
<SUBSECTION Standard>
GTK_TYPE_PRINT_UNIX_DIALOG
diff --git a/gtk/gtk.symbols b/gtk/gtk.symbols
index 404c1162e9..30a94cb15f 100644
--- a/gtk/gtk.symbols
+++ b/gtk/gtk.symbols
@@ -2986,6 +2986,10 @@ gtk_print_operation_is_finished
gtk_print_operation_cancel
gtk_print_operation_draw_page_finish
gtk_print_operation_set_defer_drawing
+gtk_print_operation_set_support_selection
+gtk_print_operation_get_support_selection
+gtk_print_operation_set_has_selection
+gtk_print_operation_get_has_selection
#endif
#endif
@@ -3110,6 +3114,11 @@ gtk_print_unix_dialog_get_settings
gtk_print_unix_dialog_get_selected_printer
gtk_print_unix_dialog_add_custom_tab
gtk_print_unix_dialog_set_manual_capabilities
+gtk_print_unix_dialog_get_manual_capabilities
+gtk_print_unix_dialog_set_support_selection
+gtk_print_unix_dialog_get_support_selection
+gtk_print_unix_dialog_set_has_selection
+gtk_print_unix_dialog_get_has_selection
#endif
#endif
#endif
diff --git a/gtk/gtkenums.h b/gtk/gtkenums.h
index 1d9467b651..2dc9f8fcdc 100644
--- a/gtk/gtkenums.h
+++ b/gtk/gtkenums.h
@@ -494,7 +494,8 @@ typedef enum
{
GTK_PRINT_PAGES_ALL,
GTK_PRINT_PAGES_CURRENT,
- GTK_PRINT_PAGES_RANGES
+ GTK_PRINT_PAGES_RANGES,
+ GTK_PRINT_PAGES_SELECTION
} GtkPrintPages;
typedef enum
diff --git a/gtk/gtkprintoperation-private.h b/gtk/gtkprintoperation-private.h
index 718f16df6f..8c800eaea5 100644
--- a/gtk/gtkprintoperation-private.h
+++ b/gtk/gtkprintoperation-private.h
@@ -54,6 +54,8 @@ struct _GtkPrintOperationPrivate
guint cancelled : 1;
guint allow_async : 1;
guint is_sync : 1;
+ guint support_selection : 1;
+ guint has_selection : 1;
GtkPageDrawingState page_drawing_state;
diff --git a/gtk/gtkprintoperation-unix.c b/gtk/gtkprintoperation-unix.c
index ad8bc126f8..765752b158 100644
--- a/gtk/gtkprintoperation-unix.c
+++ b/gtk/gtkprintoperation-unix.c
@@ -421,6 +421,12 @@ get_print_dialog (GtkPrintOperation *op,
gtk_print_unix_dialog_set_current_page (GTK_PRINT_UNIX_DIALOG (pd),
priv->current_page);
+ gtk_print_unix_dialog_set_support_selection (GTK_PRINT_UNIX_DIALOG (pd),
+ priv->support_selection);
+
+ gtk_print_unix_dialog_set_has_selection (GTK_PRINT_UNIX_DIALOG (pd),
+ priv->has_selection);
+
g_signal_emit_by_name (op, "create-custom-widget",
&priv->custom_widget);
diff --git a/gtk/gtkprintoperation.c b/gtk/gtkprintoperation.c
index c3b61c03d7..966417b22f 100644
--- a/gtk/gtkprintoperation.c
+++ b/gtk/gtkprintoperation.c
@@ -163,6 +163,8 @@ gtk_print_operation_init (GtkPrintOperation *operation)
priv->export_filename = NULL;
priv->track_print_status = FALSE;
priv->is_sync = FALSE;
+ priv->support_selection = FALSE;
+ priv->has_selection = FALSE;
priv->page_drawing_state = GTK_PAGE_DRAWING_STATE_READY;
@@ -223,6 +225,7 @@ preview_iface_is_selected (GtkPrintOperationPreview *preview,
switch (priv->print_pages)
{
+ case GTK_PRINT_PAGES_SELECTION:
case GTK_PRINT_PAGES_ALL:
return (page_nr >= 0) && (page_nr < priv->nr_of_pages);
case GTK_PRINT_PAGES_CURRENT:
@@ -1193,6 +1196,39 @@ gtk_print_operation_class_init (GtkPrintOperationClass *class)
NULL,
GTK_PARAM_READWRITE));
+ /**
+ * GtkPrintOperation:support-selection:
+ *
+ * If %TRUE, the print operation will support print of selection.
+ * This allows the print dialog to show a "Selection" button.
+ *
+ * Since: 2.18
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TRACK_PRINT_STATUS,
+ g_param_spec_boolean ("support-selection",
+ P_("Support Selection"),
+ P_("TRUE if the print operation will support print of selection."),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
+ /**
+ * GtkPrintOperation:has-selection:
+ *
+ * Determines whether there is a selection in your application.
+ * This can allow your application to print the selection.
+ * This is typically used to make a "Selection" button sensitive.
+ *
+ * Since: 2.18
+ */
+ g_object_class_install_property (gobject_class,
+ PROP_TRACK_PRINT_STATUS,
+ g_param_spec_boolean ("has-selection",
+ P_("Has Selection"),
+ P_("TRUE if a selecion exists."),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
}
/**
@@ -2976,7 +3012,99 @@ gtk_print_operation_cancel (GtkPrintOperation *op)
op->priv->cancelled = TRUE;
}
+/**
+ * gtk_print_operation_set_support_selection:
+ * @op: a #GtkPrintOperation
+ * @support_selection: %TRUE to support selection
+ *
+ * Sets whether selection is supported by #GtkPrintOperation.
+ *
+ * Since: 2.18
+ */
+void
+gtk_print_operation_set_support_selection (GtkPrintOperation *op,
+ gboolean support_selection)
+{
+ GtkPrintOperationPrivate *priv;
+ g_return_if_fail (GTK_IS_PRINT_OPERATION (op));
+
+ priv = op->priv;
+
+ support_selection = support_selection != FALSE;
+ if (priv->support_selection != support_selection)
+ {
+ priv->support_selection = support_selection;
+ g_object_notify (G_OBJECT (op), "support-selection");
+ }
+}
+
+/**
+ * gtk_print_operation_get_support_selection:
+ * @op: a #GtkPrintOperation
+ *
+ * Gets the value of #GtkPrintOperation::support-selection property.
+ *
+ * Returns: whether the application supports print of selection
+ *
+ * Since: 2.18
+ */
+gboolean
+gtk_print_operation_get_support_selection (GtkPrintOperation *op)
+{
+ g_return_val_if_fail (GTK_IS_PRINT_OPERATION (op), FALSE);
+
+ return op->priv->support_selection;
+}
+
+/**
+ * gtk_print_operation_set_has_selection:
+ * @op: a #GtkPrintOperation
+ * @has_selection: %TRUE indicates that a selection exists
+ *
+ * Sets whether there is a selection to print.
+ *
+ * Application has to set number of pages to which the selection
+ * will draw by gtk_print_operation_set_n_pages() in a callback of
+ * #GtkPrintOperation::begin-print.
+ *
+ * Since: 2.18
+ */
+void
+gtk_print_operation_set_has_selection (GtkPrintOperation *op,
+ gboolean has_selection)
+{
+ GtkPrintOperationPrivate *priv;
+
+ g_return_if_fail (GTK_IS_PRINT_OPERATION (op));
+
+ priv = op->priv;
+
+ has_selection = has_selection != FALSE;
+ if (priv->has_selection != has_selection)
+ {
+ priv->has_selection = has_selection;
+ g_object_notify (G_OBJECT (op), "has-selection");
+ }
+}
+
+/**
+ * gtk_print_operation_get_has_selection:
+ * @op: a #GtkPrintOperation
+ *
+ * Gets the value of #GtkPrintOperation::has-selection property.
+ *
+ * Returns: whether there is a selection
+ *
+ * Since: 2.18
+ */
+gboolean
+gtk_print_operation_get_has_selection (GtkPrintOperation *op)
+{
+ g_return_val_if_fail (GTK_IS_PRINT_OPERATION (op), FALSE);
+
+ return op->priv->has_selection;
+}
#define __GTK_PRINT_OPERATION_C__
#include "gtkaliasdef.c"
diff --git a/gtk/gtkprintoperation.h b/gtk/gtkprintoperation.h
index af46332fcf..aee3d95ec6 100644
--- a/gtk/gtkprintoperation.h
+++ b/gtk/gtkprintoperation.h
@@ -178,6 +178,12 @@ gboolean gtk_print_operation_is_finished (GtkPrintOper
void gtk_print_operation_cancel (GtkPrintOperation *op);
void gtk_print_operation_draw_page_finish (GtkPrintOperation *op);
void gtk_print_operation_set_defer_drawing (GtkPrintOperation *op);
+void gtk_print_operation_set_support_selection (GtkPrintOperation *op,
+ gboolean support_selection);
+gboolean gtk_print_operation_get_support_selection (GtkPrintOperation *op);
+void gtk_print_operation_set_has_selection (GtkPrintOperation *op,
+ gboolean has_selection);
+gboolean gtk_print_operation_get_has_selection (GtkPrintOperation *op);
GtkPageSetup *gtk_print_run_page_setup_dialog (GtkWindow *parent,
GtkPageSetup *page_setup,
diff --git a/gtk/gtkprintsettings.c b/gtk/gtkprintsettings.c
index 4328960f9e..e50208017b 100644
--- a/gtk/gtkprintsettings.c
+++ b/gtk/gtkprintsettings.c
@@ -1356,6 +1356,9 @@ gtk_print_settings_get_print_pages (GtkPrintSettings *settings)
if (val == NULL || (strcmp (val, "all") == 0))
return GTK_PRINT_PAGES_ALL;
+ if (strcmp (val, "selection") == 0)
+ return GTK_PRINT_PAGES_SELECTION;
+
if (strcmp (val, "current") == 0)
return GTK_PRINT_PAGES_CURRENT;
@@ -1389,6 +1392,9 @@ gtk_print_settings_set_print_pages (GtkPrintSettings *settings,
case GTK_PRINT_PAGES_CURRENT:
str = "current";
break;
+ case GTK_PRINT_PAGES_SELECTION:
+ str = "selection";
+ break;
case GTK_PRINT_PAGES_RANGES:
str = "ranges";
break;
diff --git a/gtk/gtkprintunixdialog.c b/gtk/gtkprintunixdialog.c
index 92c93e9300..85fa6eaa78 100644
--- a/gtk/gtkprintunixdialog.c
+++ b/gtk/gtkprintunixdialog.c
@@ -115,7 +115,10 @@ enum {
PROP_PAGE_SETUP,
PROP_CURRENT_PAGE,
PROP_PRINT_SETTINGS,
- PROP_SELECTED_PRINTER
+ PROP_SELECTED_PRINTER,
+ PROP_MANUAL_CAPABILITIES,
+ PROP_SUPPORT_SELECTION,
+ PROP_HAS_SELECTION
};
enum {
@@ -143,8 +146,13 @@ struct GtkPrintUnixDialogPrivate
GtkPageSetup *page_setup;
gboolean page_setup_set;
+ gboolean support_selection;
+ gboolean has_selection;
+
GtkWidget *all_pages_radio;
GtkWidget *current_page_radio;
+ GtkWidget *selection_radio;
+ GtkWidget *range_table;
GtkWidget *page_range_radio;
GtkWidget *page_range_entry;
@@ -286,6 +294,31 @@ gtk_print_unix_dialog_class_init (GtkPrintUnixDialogClass *class)
GTK_TYPE_PRINTER,
GTK_PARAM_READABLE));
+ g_object_class_install_property (object_class,
+ PROP_MANUAL_CAPABILITIES,
+ g_param_spec_flags ("manual-capabilities",
+ P_("Manual Capabilites"),
+ P_("Capabilities the application can handle"),
+ GTK_TYPE_PRINT_CAPABILITIES,
+ 0,
+ GTK_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_SUPPORT_SELECTION,
+ g_param_spec_boolean ("support-selection",
+ P_("Support Selection"),
+ P_("Whether the dialog supports selection"),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
+ g_object_class_install_property (object_class,
+ PROP_HAS_SELECTION,
+ g_param_spec_boolean ("has-selection",
+ P_("Has Selection"),
+ P_("Whether the application has a selection"),
+ FALSE,
+ GTK_PARAM_READWRITE));
+
g_type_class_add_private (class, sizeof (GtkPrintUnixDialogPrivate));
}
@@ -428,6 +461,9 @@ gtk_print_unix_dialog_init (GtkPrintUnixDialog *dialog)
priv->page_setup = gtk_page_setup_new ();
priv->page_setup_set = FALSE;
+ priv->support_selection = FALSE;
+ priv->has_selection = FALSE;
+
g_signal_connect (dialog,
"destroy",
(GCallback) gtk_print_unix_dialog_destroy,
@@ -783,6 +819,15 @@ gtk_print_unix_dialog_set_property (GObject *object,
case PROP_PRINT_SETTINGS:
gtk_print_unix_dialog_set_settings (dialog, g_value_get_object (value));
break;
+ case PROP_MANUAL_CAPABILITIES:
+ gtk_print_unix_dialog_set_manual_capabilities (dialog, g_value_get_flags (value));
+ break;
+ case PROP_SUPPORT_SELECTION:
+ gtk_print_unix_dialog_set_support_selection (dialog, g_value_get_boolean (value));
+ break;
+ case PROP_HAS_SELECTION:
+ gtk_print_unix_dialog_set_has_selection (dialog, g_value_get_boolean (value));
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -812,6 +857,15 @@ gtk_print_unix_dialog_get_property (GObject *object,
case PROP_SELECTED_PRINTER:
g_value_set_object (value, priv->current_printer);
break;
+ case PROP_MANUAL_CAPABILITIES:
+ g_value_set_flags (value, priv->manual_capabilities);
+ break;
+ case PROP_SUPPORT_SELECTION:
+ g_value_set_boolean (value, priv->support_selection);
+ break;
+ case PROP_HAS_SELECTION:
+ g_value_set_boolean (value, priv->has_selection);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -1803,7 +1857,8 @@ create_main_page (GtkPrintUnixDialog *dialog)
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
- table = gtk_table_new (3, 2, FALSE);
+ table = gtk_table_new (4, 2, FALSE);
+ priv->range_table = table;
gtk_table_set_row_spacings (GTK_TABLE (table), 6);
gtk_table_set_col_spacings (GTK_TABLE (table), 12);
frame = wrap_in_frame (_("Range"), table);
@@ -1826,6 +1881,17 @@ create_main_page (GtkPrintUnixDialog *dialog)
0, 2, 1, 2, GTK_FILL, 0,
0, 0);
+
+ radio = gtk_radio_button_new_with_mnemonic (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)),
+ _("Se_lection"));
+
+ gtk_widget_set_sensitive (radio, priv->has_selection);
+ priv->selection_radio = radio;
+ gtk_table_attach (GTK_TABLE (table), radio,
+ 0, 2, 2, 3, GTK_FILL, 0,
+ 0, 0);
+ gtk_table_set_row_spacing (GTK_TABLE (table), 2, 0);
+
radio = gtk_radio_button_new_with_mnemonic (gtk_radio_button_get_group (GTK_RADIO_BUTTON (radio)), _("Pag_es:"));
range_tooltip = _("Specify one or more page ranges,\n e.g. 1-3,7,11");
gtk_widget_set_tooltip_text (radio, range_tooltip);
@@ -1833,7 +1899,7 @@ create_main_page (GtkPrintUnixDialog *dialog)
priv->page_range_radio = radio;
gtk_widget_show (radio);
gtk_table_attach (GTK_TABLE (table), radio,
- 0, 1, 2, 3, GTK_FILL, 0,
+ 0, 1, 3, 4, GTK_FILL, 0,
0, 0);
entry = gtk_entry_new ();
gtk_widget_set_tooltip_text (entry, range_tooltip);
@@ -1842,7 +1908,7 @@ create_main_page (GtkPrintUnixDialog *dialog)
priv->page_range_entry = entry;
gtk_widget_show (entry);
gtk_table_attach (GTK_TABLE (table), entry,
- 1, 2, 2, 3, GTK_FILL, 0,
+ 1, 2, 3, 4, GTK_FILL, 0,
0, 0);
g_signal_connect (radio, "toggled", G_CALLBACK (update_entry_sensitivity), entry);
update_entry_sensitivity (radio, entry);
@@ -2030,6 +2096,8 @@ dialog_get_print_pages (GtkPrintUnixDialog *dialog)
return GTK_PRINT_PAGES_ALL;
else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->current_page_radio)))
return GTK_PRINT_PAGES_CURRENT;
+ else if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->selection_radio)))
+ return GTK_PRINT_PAGES_SELECTION;
else
return GTK_PRINT_PAGES_RANGES;
}
@@ -2044,6 +2112,8 @@ dialog_set_print_pages (GtkPrintUnixDialog *dialog,
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->page_range_radio), TRUE);
else if (pages == GTK_PRINT_PAGES_CURRENT)
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->current_page_radio), TRUE);
+ else if (pages == GTK_PRINT_PAGES_SELECTION)
+ gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->selection_radio), TRUE);
else
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->all_pages_radio), TRUE);
}
@@ -3410,21 +3480,162 @@ gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog *dialog,
{
GtkPrintUnixDialogPrivate *priv = dialog->priv;
- priv->manual_capabilities = capabilities;
- update_dialog_from_capabilities (dialog);
+ if (priv->manual_capabilities != capabilities)
+ {
+ priv->manual_capabilities = capabilities;
+ update_dialog_from_capabilities (dialog);
- if (priv->current_printer)
+ if (priv->current_printer)
+ {
+ GtkTreeSelection *selection;
+
+ selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
+
+ g_object_unref (priv->current_printer);
+ priv->current_printer = NULL;
+ priv->internal_printer_change = TRUE;
+ selected_printer_changed (selection, dialog);
+ priv->internal_printer_change = FALSE;
+ }
+
+ g_object_notify (G_OBJECT (dialog), "manual-capabilities");
+ }
+}
+
+/**
+ * gtk_print_unix_dialog_get_manual_capabilities:
+ * @dialog: a #GtkPrintUnixDialog
+ *
+ * Gets the value of #GtkPrintUnixDialog::manual-capabilities property.
+ *
+ * Returns: the printing capabilities
+ *
+ * Since: 2.18
+ */
+GtkPrintCapabilities
+gtk_print_unix_dialog_get_manual_capabilities (GtkPrintUnixDialog *dialog)
+{
+ g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), FALSE);
+
+ return dialog->priv->manual_capabilities;
+}
+
+/**
+ * gtk_print_unix_dialog_set_support_selection:
+ * @dialog: a #GtkPrintUnixDialog
+ * @support_selection: %TRUE to allow print selection
+ *
+ * Sets whether the print dialog allows user to print a selection.
+ *
+ * Since: 2.18
+ */
+void
+gtk_print_unix_dialog_set_support_selection (GtkPrintUnixDialog *dialog,
+ gboolean support_selection)
+{
+ GtkPrintUnixDialogPrivate *priv;
+
+ g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
+
+ priv = dialog->priv;
+
+ support_selection = support_selection != FALSE;
+ if (priv->support_selection != support_selection)
{
- GtkTreeSelection *selection;
+ priv->support_selection = support_selection;
- selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (priv->printer_treeview));
+ if (priv->selection_radio)
+ {
+ if (support_selection)
+ {
+ gtk_widget_set_sensitive (priv->selection_radio, priv->has_selection);
+ gtk_table_set_row_spacing (GTK_TABLE (priv->range_table),
+ 2,
+ gtk_table_get_default_row_spacing (GTK_TABLE (priv->range_table)));
+ gtk_widget_show (priv->selection_radio);
+ }
+ else
+ {
+ gtk_widget_set_sensitive (priv->selection_radio, FALSE);
+ gtk_table_set_row_spacing (GTK_TABLE (priv->range_table), 2, 0);
+ gtk_widget_hide (priv->selection_radio);
+ }
+ }
- g_object_unref (priv->current_printer);
- priv->current_printer = NULL;
- priv->internal_printer_change = TRUE;
- selected_printer_changed (selection, dialog);
- priv->internal_printer_change = FALSE;
- }
+ g_object_notify (G_OBJECT (dialog), "support-selection");
+ }
+}
+
+/**
+ * gtk_print_unix_dialog_get_support_selection:
+ * @dialog: a #GtkPrintUnixDialog
+ *
+ * Gets the value of #GtkPrintUnixDialog::support-selection property.
+ *
+ * Returns: whether the application supports print of selection
+ *
+ * Since: 2.18
+ */
+gboolean
+gtk_print_unix_dialog_get_support_selection (GtkPrintUnixDialog *dialog)
+{
+ g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), FALSE);
+
+ return dialog->priv->support_selection;
+}
+
+/**
+ * gtk_print_unix_dialog_set_has_selection:
+ * @dialog: a #GtkPrintUnixDialog
+ * @has_selection: %TRUE indicates that a selection exists
+ *
+ * Sets whether a selection exists.
+ *
+ * Since: 2.18
+ */
+void
+gtk_print_unix_dialog_set_has_selection (GtkPrintUnixDialog *dialog,
+ gboolean has_selection)
+{
+ GtkPrintUnixDialogPrivate *priv;
+
+ g_return_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog));
+
+ priv = dialog->priv;
+
+ has_selection = has_selection != FALSE;
+ if (priv->has_selection != has_selection)
+ {
+ priv->has_selection = has_selection;
+
+ if (priv->selection_radio)
+ {
+ if (priv->support_selection)
+ gtk_widget_set_sensitive (priv->selection_radio, has_selection);
+ else
+ gtk_widget_set_sensitive (priv->selection_radio, FALSE);
+ }
+
+ g_object_notify (G_OBJECT (dialog), "has-selection");
+ }
+}
+
+/**
+ * gtk_print_unix_dialog_get_has_selection:
+ * @dialog: a #GtkPrintUnixDialog
+ *
+ * Gets the value of #GtkPrintUnixDialog::has-selection property.
+ *
+ * Returns: whether there is a selection
+ *
+ * Since: 2.18
+ */
+gboolean
+gtk_print_unix_dialog_get_has_selection (GtkPrintUnixDialog *dialog)
+{
+ g_return_val_if_fail (GTK_IS_PRINT_UNIX_DIALOG (dialog), FALSE);
+
+ return dialog->priv->has_selection;
}
#define __GTK_PRINT_UNIX_DIALOG_C__
diff --git a/gtk/gtkprintunixdialog.h b/gtk/gtkprintunixdialog.h
index c7a919f9dc..0d7efccfc3 100644
--- a/gtk/gtkprintunixdialog.h
+++ b/gtk/gtkprintunixdialog.h
@@ -83,6 +83,13 @@ void gtk_print_unix_dialog_add_custom_tab (GtkPrintUnixDialog
GtkWidget *tab_label);
void gtk_print_unix_dialog_set_manual_capabilities (GtkPrintUnixDialog *dialog,
GtkPrintCapabilities capabilities);
+GtkPrintCapabilities gtk_print_unix_dialog_get_manual_capabilities (GtkPrintUnixDialog *dialog);
+void gtk_print_unix_dialog_set_support_selection (GtkPrintUnixDialog *dialog,
+ gboolean support_selection);
+gboolean gtk_print_unix_dialog_get_support_selection (GtkPrintUnixDialog *dialog);
+void gtk_print_unix_dialog_set_has_selection (GtkPrintUnixDialog *dialog,
+ gboolean has_selection);
+gboolean gtk_print_unix_dialog_get_has_selection (GtkPrintUnixDialog *dialog);
G_END_DECLS