#include "gtkcustompaperunixdialog.h"
#include "gtkprintbackend.h"
#include "gtkprintutils.h"
-#include "gtkprinter-private.h"
-#include "gtkalias.h"
#define CUSTOM_PAPER_FILENAME ".gtk-custom-papers"
GtkWidget *spin_button;
} UnitWidget;
-struct GtkCustomPaperUnixDialogPrivate
+struct _GtkCustomPaperUnixDialogPrivate
{
GtkWidget *treeview;
PRINTER_LIST_N_COLS
};
+
G_DEFINE_TYPE (GtkCustomPaperUnixDialog, gtk_custom_paper_unix_dialog, GTK_TYPE_DIALOG)
-#define GTK_CUSTOM_PAPER_UNIX_DIALOG_GET_PRIVATE(o) \
- (G_TYPE_INSTANCE_GET_PRIVATE ((o), GTK_TYPE_CUSTOM_PAPER_UNIX_DIALOG, GtkCustomPaperUnixDialogPrivate))
static void gtk_custom_paper_unix_dialog_finalize (GObject *object);
static void populate_dialog (GtkCustomPaperUnixDialog *dialog);
GtkCustomPaperUnixDialogPrivate *priv;
GtkTreeIter iter;
- priv = dialog->priv = GTK_CUSTOM_PAPER_UNIX_DIALOG_GET_PRIVATE (dialog);
+ dialog->priv = G_TYPE_INSTANCE_GET_PRIVATE (dialog,
+ GTK_TYPE_CUSTOM_PAPER_UNIX_DIALOG,
+ GtkCustomPaperUnixDialogPrivate);
+ priv = dialog->priv;
priv->print_backends = NULL;
/**
* gtk_custom_paper_unix_dialog_new:
- * @title: the title of the dialog, or %NULL
- * @parent: transient parent of the dialog, or %NULL
+ * @title: (allow-none): the title of the dialog, or %NULL
+ * @parent: (allow-none): transient parent of the dialog, or %NULL
*
* Creates a new custom paper dialog.
*
result = g_object_new (GTK_TYPE_CUSTOM_PAPER_UNIX_DIALOG,
"title", title,
+ "transient-for", parent,
+ "modal", parent != NULL,
+ "destroy-with-parent", TRUE,
NULL);
- if (parent)
- {
- gtk_window_set_modal (GTK_WINDOW (result), TRUE);
- gtk_window_set_transient_for (GTK_WINDOW (result), parent);
- }
-
return result;
}
gdouble top, bottom, left, right;
top = bottom = left = right = 0;
- _gtk_printer_get_hard_margins (printer, &top, &bottom, &left, &right);
+ if (!gtk_printer_get_hard_margins (printer, &top, &bottom, &left, &right))
+ return;
priv->non_user_change = TRUE;
unit_widget_set (priv->top_widget, _gtk_print_convert_to_mm (top, GTK_UNIT_POINTS));
populate_dialog (GtkCustomPaperUnixDialog *dialog)
{
GtkCustomPaperUnixDialogPrivate *priv = dialog->priv;
+ GtkDialog *cpu_dialog = GTK_DIALOG (dialog);
+ GtkWidget *action_area, *content_area;
GtkWidget *image, *table, *label, *widget, *frame, *combo;
GtkWidget *hbox, *vbox, *treeview, *scrolled, *button_box, *button;
GtkCellRenderer *cell;
GtkTreeSelection *selection;
GtkUnit user_units;
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ content_area = gtk_dialog_get_content_area (cpu_dialog);
+ action_area = gtk_dialog_get_action_area (cpu_dialog);
+
gtk_container_set_border_width (GTK_CONTAINER (dialog), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 2); /* 2 * 5 + 2 = 12 */
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 5);
- gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->action_area), 6);
+ gtk_box_set_spacing (GTK_BOX (content_area), 2); /* 2 * 5 + 2 = 12 */
+ gtk_container_set_border_width (GTK_CONTAINER (action_area), 5);
+ gtk_box_set_spacing (GTK_BOX (action_area), 6);
hbox = gtk_hbox_new (FALSE, 18);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 5);
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, TRUE, TRUE, 0);
+ gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0);
gtk_widget_show (hbox);
vbox = gtk_vbox_new (FALSE, 6);
load_print_backends (dialog);
}
-
-
-#define __GTK_CUSTOM_PAPER_UNIX_DIALOG_C__
-#include "gtkaliasdef.c"