*/
#include "config.h"
+
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <math.h>
-#include "gtkintl.h"
-#include "gtkprivate.h"
+#include "gtkprintunixdialog.h"
+
+#include "gtkcustompaperunixdialog.h"
+#include "gtkprintbackend.h"
+#include "gtkprinter-private.h"
+#include "gtkprinteroptionwidget.h"
+#include "gtkprintutils.h"
#include "gtkspinbutton.h"
#include "gtkcellrendererpixbuf.h"
#include "gtklabel.h"
#include "gtkeventbox.h"
#include "gtkbuildable.h"
-
-#include "gtkcustompaperunixdialog.h"
-#include "gtkprintbackend.h"
-#include "gtkprinter-private.h"
-#include "gtkprintunixdialog.h"
-#include "gtkprinteroptionwidget.h"
-#include "gtkprintutils.h"
-
#include "gtkmessagedialog.h"
#include "gtkbutton.h"
+#include "gtkintl.h"
+#include "gtkprivate.h"
+#include "gtktypebuiltins.h"
-#define EXAMPLE_PAGE_AREA_SIZE 140
+#define EXAMPLE_PAGE_AREA_SIZE 110
#define RULER_DISTANCE 7.5
#define RULER_RADIUS 2
guint prop_id,
GValue *value,
GParamSpec *pspec);
-static void gtk_print_unix_dialog_style_set (GtkWidget *widget,
- GtkStyle *previous_style);
+static void gtk_print_unix_dialog_style_updated (GtkWidget *widget);
static void populate_dialog (GtkPrintUnixDialog *dialog);
static void unschedule_idle_mark_conflicts (GtkPrintUnixDialog *dialog);
static void selected_printer_changed (GtkTreeSelection *selection,
GtkPrinter *current_printer;
GtkPrinter *request_details_printer;
- guint request_details_tag;
+ gulong request_details_tag;
GtkPrinterOptionSet *options;
gulong options_changed_handler;
gulong mark_conflicts_id;
object_class->set_property = gtk_print_unix_dialog_set_property;
object_class->get_property = gtk_print_unix_dialog_get_property;
- widget_class->style_set = gtk_print_unix_dialog_style_set;
+ widget_class->style_updated = gtk_print_unix_dialog_style_updated;
g_object_class_install_property (object_class,
PROP_PAGE_SETUP,
gdk_display_flush (display);
if (cursor)
- gdk_cursor_unref (cursor);
+ g_object_unref (cursor);
}
static void
gtk_label_set_markup (GTK_LABEL (label_widget), bold_text);
g_free (bold_text);
- frame = gtk_vbox_new (FALSE, 6);
+ frame = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (frame), label_widget, FALSE, FALSE, 0);
alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0);
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), widget);
- hbox = gtk_hbox_new (FALSE, 12);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_box_pack_start (GTK_BOX (hbox), widget, FALSE, FALSE, 0);
gtk_widget_show (hbox);
priv->options_changed_handler =
g_signal_connect_swapped (priv->options, "changed", G_CALLBACK (options_changed_cb), dialog);
+ schedule_idle_mark_conflicts (dialog);
}
update_dialog_from_settings (dialog);
gchar *text,
gint text_x)
{
- GtkStyle *style;
+ GtkStyleContext *context;
gint x, y, width, height;
gint text_y, linewidth;
+ GdkRGBA color;
x = x_offset * scale;
y = y_offset * scale;
linewidth = 2;
text_y = 21;
- style = gtk_widget_get_style (widget);
+ context = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
- gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
+ gtk_style_context_get_background_color (context, 0, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr, x, y, width, height);
cairo_fill (cr);
- gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
+ gtk_style_context_get_color (context, 0, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
cairo_set_line_width (cr, linewidth);
cairo_rectangle (cr, x + linewidth/2.0, y + linewidth/2.0, width - linewidth, height - linewidth);
cairo_stroke (cr);
cairo_set_font_size (cr, (gint)(9 * scale));
cairo_move_to (cr, x + (gint)(text_x * scale), y + (gint)(text_y * scale));
cairo_show_text (cr, text);
+
+ gtk_style_context_restore (context);
}
static gboolean
}
static void
-gtk_print_unix_dialog_style_set (GtkWidget *widget,
- GtkStyle *previous_style)
+gtk_print_unix_dialog_style_updated (GtkWidget *widget)
{
- GTK_WIDGET_CLASS (gtk_print_unix_dialog_parent_class)->style_set (widget, previous_style);
+ GTK_WIDGET_CLASS (gtk_print_unix_dialog_parent_class)->style_updated (widget);
if (gtk_widget_has_screen (widget))
{
GtkWidget *custom_input;
const gchar *range_tooltip;
- main_vbox = gtk_vbox_new (FALSE, 18);
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_widget_show (main_vbox);
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_box_pack_start (GTK_BOX (main_vbox), vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
gtk_widget_show (treeview);
gtk_container_add (GTK_CONTAINER (scrolled), treeview);
- custom_input = gtk_hbox_new (FALSE, 18);
+ custom_input = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 18);
gtk_widget_show (custom_input);
gtk_box_pack_start (GTK_BOX (vbox), custom_input, FALSE, FALSE, 0);
priv->extension_point = custom_input;
- hbox = gtk_hbox_new (FALSE, 18);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 18);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
if (val == NULL)
return layout;
+ if (val[0] == '\0' && priv->options)
+ {
+ GtkPrinterOption *option = gtk_printer_option_set_lookup (priv->options, "gtk-n-up-layout");
+ if (option)
+ val = option->value;
+ }
+
enum_class = g_type_class_ref (GTK_TYPE_NUMBER_UP_LAYOUT);
enum_value = g_enum_get_value_by_nick (enum_class, val);
if (enum_value)
GtkPrintUnixDialog *dialog)
{
GtkPrintUnixDialogPrivate *priv = dialog->priv;
- GtkStyle *style;
+ GtkStyleContext *context;
gdouble ratio;
gint w, h, tmp, shadow_offset;
gint pages_x, pages_y, i, x, y, layout_w, layout_h;
PangoLayout *layout;
PangoFontDescription *font;
gchar *text;
- GdkColor *color;
+ GdkRGBA color;
GtkNumberUpLayout number_up_layout;
gint start_x, end_x, start_y, end_y;
gint dx, dy;
pages_y = tmp;
}
- style = gtk_widget_get_style (widget);
+ context = gtk_widget_get_style_context (widget);
+
+ gtk_style_context_save (context);
+ gtk_style_context_add_class (context, GTK_STYLE_CLASS_VIEW);
pos_x = (width - w) / 2;
pos_y = (height - h) / 2 - 10;
shadow_offset = 3;
- color = &style->text[GTK_STATE_NORMAL];
- cairo_set_source_rgba (cr, color->red / 65535., color->green / 65535., color->blue / 65535, 0.5);
+ gtk_style_context_get_color (context, 0, &color);
+ cairo_set_source_rgba (cr, color.red, color.green, color.blue, 0.5);
cairo_rectangle (cr, shadow_offset + 1, shadow_offset + 1, w, h);
cairo_fill (cr);
- gdk_cairo_set_source_color (cr, &style->base[GTK_STATE_NORMAL]);
+ gtk_style_context_get_background_color (context, 0, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
cairo_rectangle (cr, 1, 1, w, h);
cairo_fill (cr);
cairo_set_line_width (cr, 1.0);
cairo_rectangle (cr, 0.5, 0.5, w + 1, h + 1);
- gdk_cairo_set_source_color (cr, &style->text[GTK_STATE_NORMAL]);
+ gtk_style_context_get_color (context, 0, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
cairo_stroke (cr);
i = 1;
cairo_stroke (cr);
}
+ gtk_style_context_restore (context);
+
return TRUE;
}
GtkWidget *combo, *spinbutton, *draw;
GtkCellRenderer *cell;
- main_vbox = gtk_vbox_new (FALSE, 18);
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_widget_show (main_vbox);
- hbox = gtk_hbox_new (FALSE, 18);
+ hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 18);
gtk_widget_show (hbox);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox, FALSE, FALSE, 0);
0, 1, 3, 4, GTK_FILL, 0,
0, 0);
- combo = gtk_combo_box_new_text ();
+ combo = gtk_combo_box_text_new ();
priv->page_set_combo = combo;
gtk_widget_show (combo);
gtk_table_attach (GTK_TABLE (table), combo,
0, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
/* In enum order */
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("All sheets"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Even sheets"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Odd sheets"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("All sheets"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Even sheets"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Odd sheets"));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
label = gtk_label_new_with_mnemonic (_("Sc_ale:"));
0, 1, 4, 5, GTK_FILL, 0,
0, 0);
- hbox2 = gtk_hbox_new (FALSE, 6);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6);
gtk_widget_show (hbox2);
gtk_table_attach (GTK_TABLE (table), hbox2,
1, 2, 4, 5, GTK_FILL, 0,
0, 1, 4, 5,
GTK_FILL, 0, 0, 0);
- combo = gtk_combo_box_new_text ();
+ combo = gtk_combo_box_text_new ();
priv->orientation_combo = GTK_WIDGET (combo);
gtk_table_attach (GTK_TABLE (table), combo,
1, 2, 4, 5, GTK_FILL, 0,
0, 0);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), combo);
/* In enum order */
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Portrait"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Landscape"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Reverse portrait"));
- gtk_combo_box_append_text (GTK_COMBO_BOX (combo), _("Reverse landscape"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Portrait"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Landscape"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Reverse portrait"));
+ gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), _("Reverse landscape"));
gtk_combo_box_set_active (GTK_COMBO_BOX (combo), 0);
gtk_widget_set_sensitive (combo, FALSE);
gtk_widget_show (combo);
/* Add the page layout preview */
- hbox2 = gtk_hbox_new (FALSE, 0);
+ hbox2 = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0);
gtk_widget_show (hbox2);
gtk_box_pack_start (GTK_BOX (main_vbox), hbox2, TRUE, TRUE, 0);
draw = gtk_drawing_area_new ();
gtk_widget_set_has_window (draw, FALSE);
priv->page_layout_preview = draw;
- gtk_widget_set_size_request (draw, 350, 200);
+ gtk_widget_set_size_request (draw, 280, 160);
g_signal_connect (draw, "draw", G_CALLBACK (draw_page_cb), dialog);
gtk_widget_show (draw);
GTK_POLICY_NEVER,
GTK_POLICY_AUTOMATIC);
- main_vbox = gtk_vbox_new (FALSE, 18);
+ main_vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 18);
gtk_container_set_border_width (GTK_CONTAINER (main_vbox), 12);
gtk_widget_show (main_vbox);
gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
gtk_box_set_spacing (GTK_BOX (action_area), 6);
- vbox = gtk_vbox_new (FALSE, 6);
+ vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 5);
gtk_box_pack_start (GTK_BOX (content_area), vbox, TRUE, TRUE, 0);
gtk_widget_show (vbox);
&priv->finishing_page);
create_advanced_page (print_dialog);
- priv->conflicts_widget = conflict_hbox = gtk_hbox_new (FALSE, 12);
+ priv->conflicts_widget = conflict_hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12);
gtk_box_pack_end (GTK_BOX (vbox), conflict_hbox, FALSE, FALSE, 0);
image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_MENU);
gtk_widget_show (image);
*
* Gets the currently selected printer.
*
- * Returns: the currently selected printer
+ * Returns: (transfer none): the currently selected printer
*
* Since: 2.10
*/
*
* Gets the page setup that is used by the #GtkPrintUnixDialog.
*
- * Returns: the page setup of @dialog.
+ * Returns: (transfer none): the page setup of @dialog.
*
* Since: 2.10
*/