+/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */
+
/*
* (GLABELS) Label and Business Card Creation program for GNOME
*
#include <config.h>
#include "wdgt-print-copies.h"
+
+#include <glib/gi18n.h>
+#include <gtk/gtktogglebutton.h>
+#include <gtk/gtkspinbutton.h>
+#include <gtk/gtkradiobutton.h>
+#include <gtk/gtklabel.h>
+#include <gtk/gtkvbox.h>
+
+#include "hig.h"
#include "wdgt-mini-preview.h"
#include "marshal.h"
/* Private globals */
/*===========================================*/
-static GObjectClass *parent_class;
-
/*===========================================*/
/* Local function prototypes */
/*===========================================*/
-static void gl_wdgt_print_copies_class_init (glWdgtPrintCopiesClass * class);
-static void gl_wdgt_print_copies_instance_init (glWdgtPrintCopies * copies);
static void gl_wdgt_print_copies_finalize (GObject * object);
static void gl_wdgt_print_copies_construct (glWdgtPrintCopies * copies,
/****************************************************************************/
/* Boilerplate Object stuff. */
/****************************************************************************/
-guint
-gl_wdgt_print_copies_get_type (void)
-{
- static guint wdgt_print_copies_type = 0;
-
- if (!wdgt_print_copies_type) {
- GTypeInfo wdgt_print_copies_info = {
- sizeof (glWdgtPrintCopiesClass),
- NULL,
- NULL,
- (GClassInitFunc) gl_wdgt_print_copies_class_init,
- NULL,
- NULL,
- sizeof (glWdgtPrintCopies),
- 0,
- (GInstanceInitFunc) gl_wdgt_print_copies_instance_init,
- };
-
- wdgt_print_copies_type =
- g_type_register_static (gl_hig_hbox_get_type (),
- "glWdgtPrintCopies",
- &wdgt_print_copies_info, 0);
- }
-
- return wdgt_print_copies_type;
-}
+G_DEFINE_TYPE (glWdgtPrintCopies, gl_wdgt_print_copies, GTK_TYPE_HBOX);
static void
gl_wdgt_print_copies_class_init (glWdgtPrintCopiesClass * class)
{
- GObjectClass *object_class;
-
- object_class = (GObjectClass *) class;
+ GObjectClass *object_class = G_OBJECT_CLASS (class);
- parent_class = g_type_class_peek_parent (class);
+ gl_wdgt_print_copies_parent_class = g_type_class_peek_parent (class);
object_class->finalize = gl_wdgt_print_copies_finalize;
}
static void
-gl_wdgt_print_copies_instance_init (glWdgtPrintCopies * copies)
+gl_wdgt_print_copies_init (glWdgtPrintCopies * copies)
{
copies->labels_per_sheet = 0;
static void
gl_wdgt_print_copies_finalize (GObject * object)
{
- glWdgtPrintCopies *copies;
- glWdgtPrintCopiesClass *class;
-
g_return_if_fail (object != NULL);
g_return_if_fail (GL_IS_WDGT_PRINT_COPIES (object));
- copies = GL_WDGT_PRINT_COPIES (object);
-
- G_OBJECT_CLASS (parent_class)->finalize (object);
+ G_OBJECT_CLASS (gl_wdgt_print_copies_parent_class)->finalize (object);
}
GtkWidget *
gl_wdgt_print_copies_construct (glWdgtPrintCopies *copies,
glLabel *label)
{
- GtkWidget *whbox, *wvbox, *whbox1;
- GSList *radio_group = NULL;
- GtkObject *adjust;
- const glTemplate *template;
+ const lglTemplateFrame *frame;
+ GtkWidget *whbox, *wvbox, *whbox1;
+ GSList *radio_group = NULL;
+ GtkObject *adjust;
whbox = GTK_WIDGET (copies);
- template = gl_label_get_template (label);
- copies->labels_per_sheet = gl_template_get_n_labels (template);
+ frame = (lglTemplateFrame *)label->template->frames->data;
+
+ copies->labels_per_sheet = lgl_template_frame_get_n_labels (frame);
/* mini_preview canvas */
copies->mini_preview = gl_wdgt_mini_preview_new (WDGT_MINI_PREVIEW_HEIGHT,
WDGT_MINI_PREVIEW_WIDTH);
gl_wdgt_mini_preview_set_template (GL_WDGT_MINI_PREVIEW(copies->mini_preview),
- template);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), copies->mini_preview);
+ label->template);
+ gtk_box_pack_start (GTK_BOX(whbox), copies->mini_preview, FALSE, FALSE, 0);
- wvbox = gl_hig_vbox_new (GL_HIG_VBOX_INNER);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), wvbox);
+ wvbox = gtk_vbox_new (FALSE, GL_HIG_PAD1);
+ gtk_box_pack_start (GTK_BOX(whbox), wvbox, FALSE, FALSE, 0);
/* Sheet controls */
- whbox1 = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox1);
+ whbox1 = gtk_hbox_new (FALSE, GL_HIG_PAD2);
+ gtk_box_pack_start (GTK_BOX(wvbox), whbox1, FALSE, FALSE, 0);
copies->sheets_radio =
gtk_radio_button_new_with_label (radio_group, _("Sheets:"));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->sheets_radio);
+ gtk_box_pack_start (GTK_BOX(whbox1), copies->sheets_radio, FALSE, FALSE, 0);
adjust = gtk_adjustment_new (1, 1.0, 10.0, 1.0, 10.0, 10.0);
copies->sheets_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust),
1.0, 0);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->sheets_spin);
+ gtk_box_pack_start (GTK_BOX(whbox1), copies->sheets_spin, FALSE, FALSE, 0);
gl_wdgt_mini_preview_highlight_range (GL_WDGT_MINI_PREVIEW(copies->mini_preview),
1, copies->labels_per_sheet);
/* Blank line */
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), gtk_label_new (""));
+ gtk_box_pack_start (GTK_BOX(wvbox), gtk_label_new (""), FALSE, FALSE, 0);
/* Label controls */
- whbox1 = gl_hig_hbox_new ();
- gl_hig_vbox_add_widget (GL_HIG_VBOX(wvbox), whbox1);
+ whbox1 = gtk_hbox_new (FALSE, GL_HIG_PAD2);
+ gtk_box_pack_start (GTK_BOX(wvbox), whbox1, FALSE, FALSE, 0);
radio_group =
gtk_radio_button_get_group (GTK_RADIO_BUTTON (copies->sheets_radio));
copies->labels_radio =
gtk_radio_button_new_with_label (radio_group, _("Labels"));
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->labels_radio);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1),
- gtk_label_new (_("from:")));
+ gtk_box_pack_start (GTK_BOX(whbox1), copies->labels_radio, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(whbox1), gtk_label_new (_("from:")), FALSE, FALSE, 0);
adjust = gtk_adjustment_new (1, 1.0, copies->labels_per_sheet,
1.0, 10.0, 10.0);
copies->first_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust),
1.0, 0);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->first_spin);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1),
- gtk_label_new (_("to:")));
+ gtk_box_pack_start (GTK_BOX(whbox1), copies->first_spin, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(whbox1), gtk_label_new (_("to:")), FALSE, FALSE, 0);
adjust = gtk_adjustment_new (copies->labels_per_sheet,
1.0, copies->labels_per_sheet,
1.0, 10.0, 10.0);
copies->last_spin = gtk_spin_button_new (GTK_ADJUSTMENT (adjust),
1.0, 0);
- gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox1), copies->last_spin);
+ gtk_box_pack_start (GTK_BOX(whbox1), copies->last_spin, FALSE, FALSE, 0);
gtk_widget_set_sensitive (copies->first_spin, FALSE);
gtk_widget_set_sensitive (copies->last_spin, FALSE);