From: Jim Evins Date: Wed, 14 Feb 2007 18:16:46 +0000 (+0000) Subject: 2007-02-14 Jim Evins X-Git-Tag: glabels-2_3_0~358 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=70d3926fcf186c46f553e1ea58a1072a9ab4c68f;p=glabels 2007-02-14 Jim Evins * src/base64.c: * src/base64.h: * src/bc-gnubarcode.c: * src/bc-gnubarcode.h: * src/bc-postnet.c: * src/bc-postnet.h: * src/bc.c: * src/bc.h: * src/canvas-hacktext.c: * src/canvas-hacktext.h: * src/debug.c: * src/debug.h: * src/file.c: * src/file.h: * src/glabels.c: * src/hig.h: * src/label-barcode.c: * src/label-barcode.h: * src/label-box.c: * src/label-box.h: * src/label-ellipse.c: * src/label-ellipse.h: * src/label-image.c: * src/label-image.h: * src/label-line.c: * src/label-line.h: * src/label-object.c: * src/label-object.h: * src/label-text.c: * src/label-text.h: * src/label.c: * src/label.h: * src/merge-evolution.c: * src/merge-evolution.h: * src/merge-init.c: * src/merge-init.h: * src/merge-properties-dialog.c: * src/merge-properties-dialog.h: * src/merge-text.c: * src/merge-text.h: * src/merge-vcard.c: * src/merge-vcard.h: * src/merge.c: * src/merge.h: * src/mini-preview-pixbuf.h: * src/new-label-dialog.c: * src/new-label-dialog.h: * src/object-editor-bc-page.c: * src/object-editor-data-page.c: * src/object-editor-edit-page.c: * src/object-editor-fill-page.c: * src/object-editor-image-page.c: * src/object-editor-line-page.c: * src/object-editor-lsize-page.c: * src/object-editor-position-page.c: * src/object-editor-private.h: * src/object-editor-size-page.c: * src/object-editor-text-page.c: * src/object-editor.c: * src/object-editor.h: * src/pixbuf-cache.c: * src/pixbuf-cache.h: * src/prefs-dialog.c: * src/prefs-dialog.h: * src/prefs-model.c: * src/prefs-model.h: * src/prefs.c: * src/prefs.h: * src/print-op.c: * src/stock.c: * src/stock.h: * src/template-designer.c: * src/text-node.c: * src/text-node.h: * src/ui-commands.c: * src/ui-commands.h: * src/ui-property-bar.c: * src/ui-property-bar.h: * src/ui-sidebar.c: * src/ui-sidebar.h: * src/ui-util.c: * src/ui-util.h: * src/ui.c: * src/ui.h: * src/util.c: * src/util.h: * src/view-barcode.c: * src/view-barcode.h: * src/view-box.c: * src/view-box.h: * src/view-ellipse.c: * src/view-ellipse.h: * src/view-highlight.c: * src/view-highlight.h: * src/view-image.c: * src/view-image.h: * src/view-line.c: * src/view-line.h: * src/view-object.c: * src/view-object.h: * src/view-text.c: * src/view-text.h: * src/view.c: * src/view.h: * src/wdgt-chain-button.c: * src/wdgt-chain-button.h: * src/wdgt-media-select.c: * src/wdgt-mini-preview.c: * src/wdgt-print-copies.c: * src/wdgt-print-copies.h: * src/wdgt-print-merge.c: * src/wdgt-print-merge.h: * src/wdgt-rotate-label.c: * src/window.h: * src/xml-label-04.c: * src/xml-label-04.h: * src/xml-label-191.c: * src/xml-label-191.h: * src/xml-label.c: * src/xml-label.h: Assorted superficial cleanup. Including: - Use G_DEFINE_TYPE for all objects. - Reconcile style of all class initializer functions - Reconcile style of all finalize functions - Add emacs mode line to all source files git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@614 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index 4c438fed..ac414b63 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,132 @@ +2007-02-14 Jim Evins + + * src/base64.c: + * src/base64.h: + * src/bc-gnubarcode.c: + * src/bc-gnubarcode.h: + * src/bc-postnet.c: + * src/bc-postnet.h: + * src/bc.c: + * src/bc.h: + * src/canvas-hacktext.c: + * src/canvas-hacktext.h: + * src/debug.c: + * src/debug.h: + * src/file.c: + * src/file.h: + * src/glabels.c: + * src/hig.h: + * src/label-barcode.c: + * src/label-barcode.h: + * src/label-box.c: + * src/label-box.h: + * src/label-ellipse.c: + * src/label-ellipse.h: + * src/label-image.c: + * src/label-image.h: + * src/label-line.c: + * src/label-line.h: + * src/label-object.c: + * src/label-object.h: + * src/label-text.c: + * src/label-text.h: + * src/label.c: + * src/label.h: + * src/merge-evolution.c: + * src/merge-evolution.h: + * src/merge-init.c: + * src/merge-init.h: + * src/merge-properties-dialog.c: + * src/merge-properties-dialog.h: + * src/merge-text.c: + * src/merge-text.h: + * src/merge-vcard.c: + * src/merge-vcard.h: + * src/merge.c: + * src/merge.h: + * src/mini-preview-pixbuf.h: + * src/new-label-dialog.c: + * src/new-label-dialog.h: + * src/object-editor-bc-page.c: + * src/object-editor-data-page.c: + * src/object-editor-edit-page.c: + * src/object-editor-fill-page.c: + * src/object-editor-image-page.c: + * src/object-editor-line-page.c: + * src/object-editor-lsize-page.c: + * src/object-editor-position-page.c: + * src/object-editor-private.h: + * src/object-editor-size-page.c: + * src/object-editor-text-page.c: + * src/object-editor.c: + * src/object-editor.h: + * src/pixbuf-cache.c: + * src/pixbuf-cache.h: + * src/prefs-dialog.c: + * src/prefs-dialog.h: + * src/prefs-model.c: + * src/prefs-model.h: + * src/prefs.c: + * src/prefs.h: + * src/print-op.c: + * src/stock.c: + * src/stock.h: + * src/template-designer.c: + * src/text-node.c: + * src/text-node.h: + * src/ui-commands.c: + * src/ui-commands.h: + * src/ui-property-bar.c: + * src/ui-property-bar.h: + * src/ui-sidebar.c: + * src/ui-sidebar.h: + * src/ui-util.c: + * src/ui-util.h: + * src/ui.c: + * src/ui.h: + * src/util.c: + * src/util.h: + * src/view-barcode.c: + * src/view-barcode.h: + * src/view-box.c: + * src/view-box.h: + * src/view-ellipse.c: + * src/view-ellipse.h: + * src/view-highlight.c: + * src/view-highlight.h: + * src/view-image.c: + * src/view-image.h: + * src/view-line.c: + * src/view-line.h: + * src/view-object.c: + * src/view-object.h: + * src/view-text.c: + * src/view-text.h: + * src/view.c: + * src/view.h: + * src/wdgt-chain-button.c: + * src/wdgt-chain-button.h: + * src/wdgt-media-select.c: + * src/wdgt-mini-preview.c: + * src/wdgt-print-copies.c: + * src/wdgt-print-copies.h: + * src/wdgt-print-merge.c: + * src/wdgt-print-merge.h: + * src/wdgt-rotate-label.c: + * src/window.h: + * src/xml-label-04.c: + * src/xml-label-04.h: + * src/xml-label-191.c: + * src/xml-label-191.h: + * src/xml-label.c: + * src/xml-label.h: + + Assorted superficial cleanup. Including: + - Use G_DEFINE_TYPE for all objects. + - Reconcile style of all class initializer functions + - Reconcile style of all finalize functions + - Add emacs mode line to all source files + 2007-02-06 Jim Evins Assorted cleanup and removal of deprecated items. diff --git a/glabels2/src/base64.c b/glabels2/src/base64.c index f2927908..da8ef348 100644 --- a/glabels2/src/base64.c +++ b/glabels2/src/base64.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/base64.h b/glabels2/src/base64.h index acddd178..420d2a4c 100644 --- a/glabels2/src/base64.h +++ b/glabels2/src/base64.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/bc-gnubarcode.c b/glabels2/src/bc-gnubarcode.c index c24b587a..2c84114b 100644 --- a/glabels2/src/bc-gnubarcode.c +++ b/glabels2/src/bc-gnubarcode.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/bc-gnubarcode.h b/glabels2/src/bc-gnubarcode.h index 136d0978..1e91d998 100644 --- a/glabels2/src/bc-gnubarcode.h +++ b/glabels2/src/bc-gnubarcode.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/bc-postnet.c b/glabels2/src/bc-postnet.c index 9979cde8..1db1df18 100644 --- a/glabels2/src/bc-postnet.c +++ b/glabels2/src/bc-postnet.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/bc-postnet.h b/glabels2/src/bc-postnet.h index 0753290a..6e642ab2 100644 --- a/glabels2/src/bc-postnet.h +++ b/glabels2/src/bc-postnet.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/bc.c b/glabels2/src/bc.c index c4c5a0db..9b78b023 100644 --- a/glabels2/src/bc.c +++ b/glabels2/src/bc.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/bc.h b/glabels2/src/bc.h index 70b70324..8d57b469 100644 --- a/glabels2/src/bc.h +++ b/glabels2/src/bc.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/canvas-hacktext.c b/glabels2/src/canvas-hacktext.c index 2e5ec01b..9b8c3f7e 100644 --- a/glabels2/src/canvas-hacktext.c +++ b/glabels2/src/canvas-hacktext.c @@ -1,4 +1,5 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * gnome-canvas-hacktext.c: Hacktext item type for GnomeCanvas widget * This is mainly used for gnome-print preview context diff --git a/glabels2/src/canvas-hacktext.h b/glabels2/src/canvas-hacktext.h index 7fe30134..051acda8 100644 --- a/glabels2/src/canvas-hacktext.h +++ b/glabels2/src/canvas-hacktext.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + #ifndef __GL_CANVAS_HACKTEXT_H__ #define __GL_CANVAS_HACKTEXT_H__ diff --git a/glabels2/src/debug.c b/glabels2/src/debug.c index 462eb897..089deee8 100644 --- a/glabels2/src/debug.c +++ b/glabels2/src/debug.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/debug.h b/glabels2/src/debug.h index 15d51bd6..7498a6fd 100644 --- a/glabels2/src/debug.h +++ b/glabels2/src/debug.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/file.c b/glabels2/src/file.c index 4f934c55..a6d97d8d 100644 --- a/glabels2/src/file.c +++ b/glabels2/src/file.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/file.h b/glabels2/src/file.h index 7d5fb7a0..ba826075 100644 --- a/glabels2/src/file.h +++ b/glabels2/src/file.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/glabels.c b/glabels2/src/glabels.c index 40a69739..ab8b16dd 100644 --- a/glabels2/src/glabels.c +++ b/glabels2/src/glabels.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /** * (GLABELS) Label and Business Card Creation program for GNOME @@ -30,7 +30,6 @@ #include #include "critical-error-handler.h" -#include "splash.h" #include "stock.h" #include "merge-init.h" #include "recent.h" diff --git a/glabels2/src/hig.h b/glabels2/src/hig.h index cb2bb4e8..6b4c2494 100644 --- a/glabels2/src/hig.h +++ b/glabels2/src/hig.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/label-barcode.c b/glabels2/src/label-barcode.c index 805d6b57..ba80a9cf 100644 --- a/glabels2/src/label-barcode.c +++ b/glabels2/src/label-barcode.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -51,16 +53,12 @@ struct _glLabelBarcodePrivate { /* Private globals. */ /*========================================================*/ -static glLabelObjectClass *parent_class = NULL; - static guint instance = 0; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_label_barcode_class_init (glLabelBarcodeClass *klass); -static void gl_label_barcode_instance_init (glLabelBarcode *lbc); static void gl_label_barcode_finalize (GObject *object); static void copy (glLabelObject *dst_object, @@ -73,46 +71,22 @@ static void get_size (glLabelObject *object, static void set_line_color (glLabelObject *object, glColorNode *line_color); -static glColorNode *get_line_color (glLabelObject *object); +static glColorNode *get_line_color (glLabelObject *object); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_label_barcode_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glLabelBarcodeClass), - NULL, - NULL, - (GClassInitFunc) gl_label_barcode_class_init, - NULL, - NULL, - sizeof (glLabelBarcode), - 0, - (GInstanceInitFunc) gl_label_barcode_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_LABEL_OBJECT, - "glLabelBarcode", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glLabelBarcode, gl_label_barcode, GL_TYPE_LABEL_OBJECT); static void -gl_label_barcode_class_init (glLabelBarcodeClass *klass) +gl_label_barcode_class_init (glLabelBarcodeClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glLabelObjectClass *label_object_class = (glLabelObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glLabelObjectClass *label_object_class = GL_LABEL_OBJECT_CLASS (class); - parent_class = g_type_class_peek_parent (klass); + gl_label_barcode_parent_class = g_type_class_peek_parent (class); label_object_class->copy = copy; label_object_class->get_size = get_size; @@ -123,27 +97,25 @@ gl_label_barcode_class_init (glLabelBarcodeClass *klass) } static void -gl_label_barcode_instance_init (glLabelBarcode *lbc) +gl_label_barcode_init (glLabelBarcode *lbc) { - lbc->private = g_new0 (glLabelBarcodePrivate, 1); - lbc->private->color_node = gl_color_node_new_default (); + lbc->priv = g_new0 (glLabelBarcodePrivate, 1); + lbc->priv->color_node = gl_color_node_new_default (); } static void gl_label_barcode_finalize (GObject *object) { - glLabelBarcode *lbc; + glLabelBarcode *lbc = GL_LABEL_BARCODE (object); g_return_if_fail (object && GL_IS_LABEL_BARCODE (object)); - lbc = GL_LABEL_BARCODE (object); - - gl_text_node_free (&lbc->private->text_node); - g_free (lbc->private->id); - gl_color_node_free (&(lbc->private->color_node)); - g_free (lbc->private); + gl_text_node_free (&lbc->priv->text_node); + g_free (lbc->priv->id); + gl_color_node_free (&(lbc->priv->color_node)); + g_free (lbc->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_label_barcode_parent_class)->finalize (object); } /*****************************************************************************/ @@ -209,10 +181,10 @@ gl_label_barcode_set_data (glLabelBarcode *lbc, g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); - if (!gl_text_node_equal (lbc->private->text_node, text_node)) { + if (!gl_text_node_equal (lbc->priv->text_node, text_node)) { - gl_text_node_free (&lbc->private->text_node); - lbc->private->text_node = gl_text_node_dup (text_node); + gl_text_node_free (&lbc->priv->text_node); + lbc->priv->text_node = gl_text_node_dup (text_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc)); @@ -232,16 +204,16 @@ gl_label_barcode_set_props (glLabelBarcode *lbc, g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); - if ( ((lbc->private->id == NULL) && (id != NULL)) - || (g_strcasecmp (lbc->private->id, id) != 0) - || (lbc->private->text_flag != text_flag) - || (lbc->private->checksum_flag != checksum_flag) - || (lbc->private->format_digits != format_digits)) { + if ( ((lbc->priv->id == NULL) && (id != NULL)) + || (g_strcasecmp (lbc->priv->id, id) != 0) + || (lbc->priv->text_flag != text_flag) + || (lbc->priv->checksum_flag != checksum_flag) + || (lbc->priv->format_digits != format_digits)) { - lbc->private->id = g_strdup (id); - lbc->private->text_flag = text_flag; - lbc->private->checksum_flag = checksum_flag; - lbc->private->format_digits = format_digits; + lbc->priv->id = g_strdup (id); + lbc->priv->text_flag = text_flag; + lbc->priv->checksum_flag = checksum_flag; + lbc->priv->format_digits = format_digits; gl_label_object_emit_changed (GL_LABEL_OBJECT(lbc)); @@ -259,7 +231,7 @@ gl_label_barcode_get_data (glLabelBarcode *lbc) { g_return_val_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc), NULL); - return gl_text_node_dup (lbc->private->text_node); + return gl_text_node_dup (lbc->priv->text_node); } void @@ -271,10 +243,10 @@ gl_label_barcode_get_props (glLabelBarcode *lbc, { g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); - *id = g_strdup (lbc->private->id); - *text_flag = lbc->private->text_flag; - *checksum_flag = lbc->private->checksum_flag; - *format_digits = lbc->private->format_digits; + *id = g_strdup (lbc->priv->id); + *text_flag = lbc->priv->text_flag; + *checksum_flag = lbc->priv->checksum_flag; + *format_digits = lbc->priv->format_digits; } /*---------------------------------------------------------------------------*/ @@ -294,30 +266,30 @@ get_size (glLabelObject *object, g_return_if_fail (lbc && GL_IS_LABEL_BARCODE (lbc)); - (* parent_class->get_size) (object, &w_parent, &h_parent); + (* GL_LABEL_OBJECT_CLASS (gl_label_barcode_parent_class)->get_size) (object, &w_parent, &h_parent); - if (lbc->private->text_node->field_flag) { - data = gl_barcode_default_digits (lbc->private->id, - lbc->private->format_digits); + if (lbc->priv->text_node->field_flag) { + data = gl_barcode_default_digits (lbc->priv->id, + lbc->priv->format_digits); } else { - data = gl_text_node_expand (lbc->private->text_node, NULL); + data = gl_text_node_expand (lbc->priv->text_node, NULL); } - gbc = gl_barcode_new (lbc->private->id, - lbc->private->text_flag, - lbc->private->checksum_flag, + gbc = gl_barcode_new (lbc->priv->id, + lbc->priv->text_flag, + lbc->priv->checksum_flag, w_parent, h_parent, data); if ( gbc == NULL ) { /* Try again with default digits. */ - data = gl_barcode_default_digits (lbc->private->id, - lbc->private->format_digits); - gbc = gl_barcode_new (lbc->private->id, - lbc->private->text_flag, - lbc->private->checksum_flag, + data = gl_barcode_default_digits (lbc->priv->id, + lbc->priv->format_digits); + gbc = gl_barcode_new (lbc->priv->id, + lbc->priv->text_flag, + lbc->priv->checksum_flag, w_parent, h_parent, data); @@ -343,10 +315,10 @@ set_line_color (glLabelObject *object, g_return_if_fail (lbarcode && GL_IS_LABEL_BARCODE (lbarcode)); - if ( !gl_color_node_equal(lbarcode->private->color_node, line_color_node) ) { + if ( !gl_color_node_equal(lbarcode->priv->color_node, line_color_node) ) { - gl_color_node_free (&(lbarcode->private->color_node)); - lbarcode->private->color_node = gl_color_node_dup (line_color_node); + gl_color_node_free (&(lbarcode->priv->color_node)); + lbarcode->priv->color_node = gl_color_node_dup (line_color_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(lbarcode)); } } @@ -361,5 +333,5 @@ get_line_color (glLabelObject *object) g_return_if_fail (lbarcode && GL_IS_LABEL_BARCODE (lbarcode)); - return gl_color_node_dup (lbarcode->private->color_node); + return gl_color_node_dup (lbarcode->priv->color_node); } diff --git a/glabels2/src/label-barcode.h b/glabels2/src/label-barcode.h index 507cdcd4..4eda31da 100644 --- a/glabels2/src/label-barcode.h +++ b/glabels2/src/label-barcode.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -44,7 +46,7 @@ typedef struct _glLabelBarcodePrivate glLabelBarcodePrivate; struct _glLabelBarcode { glLabelObject object; - glLabelBarcodePrivate *private; + glLabelBarcodePrivate *priv; }; struct _glLabelBarcodeClass { diff --git a/glabels2/src/label-box.c b/glabels2/src/label-box.c index f909a723..e824c9ba 100644 --- a/glabels2/src/label-box.c +++ b/glabels2/src/label-box.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -42,16 +44,12 @@ struct _glLabelBoxPrivate { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - static guint instance = 0; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_label_box_class_init (glLabelBoxClass *klass); -static void gl_label_box_instance_init (glLabelBox *lbox); static void gl_label_box_finalize (GObject *object); static void copy (glLabelObject *dst_object, @@ -77,39 +75,15 @@ static gdouble get_line_width (glLabelObject *object); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_label_box_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glLabelBoxClass), - NULL, - NULL, - (GClassInitFunc) gl_label_box_class_init, - NULL, - NULL, - sizeof (glLabelBox), - 0, - (GInstanceInitFunc) gl_label_box_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_LABEL_OBJECT, - "glLabelBox", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glLabelBox, gl_label_box, GL_TYPE_LABEL_OBJECT); static void -gl_label_box_class_init (glLabelBoxClass *klass) +gl_label_box_class_init (glLabelBoxClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glLabelObjectClass *label_object_class = (glLabelObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glLabelObjectClass *label_object_class = GL_LABEL_OBJECT_CLASS (class); - parent_class = g_type_class_peek_parent (klass); + gl_label_box_parent_class = g_type_class_peek_parent (class); label_object_class->copy = copy; label_object_class->set_fill_color = set_fill_color; @@ -123,27 +97,25 @@ gl_label_box_class_init (glLabelBoxClass *klass) } static void -gl_label_box_instance_init (glLabelBox *lbox) +gl_label_box_init (glLabelBox *lbox) { - lbox->private = g_new0 (glLabelBoxPrivate, 1); - lbox->private->line_color_node = gl_color_node_new_default (); - lbox->private->fill_color_node = gl_color_node_new_default (); + lbox->priv = g_new0 (glLabelBoxPrivate, 1); + lbox->priv->line_color_node = gl_color_node_new_default (); + lbox->priv->fill_color_node = gl_color_node_new_default (); } static void gl_label_box_finalize (GObject *object) { - glLabelBox *lbox; + glLabelBox *lbox = GL_LABEL_BOX (object); g_return_if_fail (object && GL_IS_LABEL_BOX (object)); - lbox = GL_LABEL_BOX (object); - - gl_color_node_free (&(lbox->private->fill_color_node)); - gl_color_node_free (&(lbox->private->line_color_node)); - g_free (lbox->private); + gl_color_node_free (&(lbox->priv->fill_color_node)); + gl_color_node_free (&(lbox->priv->line_color_node)); + g_free (lbox->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_label_box_parent_class)->finalize (object); } /*****************************************************************************/ @@ -207,10 +179,10 @@ set_fill_color (glLabelObject *object, g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); - if (!gl_color_node_equal (lbox->private->fill_color_node, fill_color_node)) { + if (!gl_color_node_equal (lbox->priv->fill_color_node, fill_color_node)) { - gl_color_node_free (&(lbox->private->fill_color_node)); - lbox->private->fill_color_node = gl_color_node_dup (fill_color_node); + gl_color_node_free (&(lbox->priv->fill_color_node)); + lbox->priv->fill_color_node = gl_color_node_dup (fill_color_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); } @@ -228,9 +200,9 @@ set_line_color (glLabelObject *object, g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); - if ( !gl_color_node_equal (lbox->private->line_color_node, line_color_node )) { - gl_color_node_free (&(lbox->private->line_color_node)); - lbox->private->line_color_node = gl_color_node_dup (line_color_node); + if ( !gl_color_node_equal (lbox->priv->line_color_node, line_color_node )) { + gl_color_node_free (&(lbox->priv->line_color_node)); + lbox->priv->line_color_node = gl_color_node_dup (line_color_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); } } @@ -246,8 +218,8 @@ set_line_width (glLabelObject *object, g_return_if_fail (lbox && GL_IS_LABEL_BOX (lbox)); - if ( lbox->private->line_width != line_width ) { - lbox->private->line_width = line_width; + if ( lbox->priv->line_width != line_width ) { + lbox->priv->line_width = line_width; gl_label_object_emit_changed (GL_LABEL_OBJECT(lbox)); } } @@ -263,7 +235,7 @@ get_line_width (glLabelObject *object) g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0.0); - return lbox->private->line_width; + return lbox->priv->line_width; } /*---------------------------------------------------------------------------*/ @@ -276,7 +248,7 @@ get_line_color (glLabelObject *object) g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); - return gl_color_node_dup (lbox->private->line_color_node); + return gl_color_node_dup (lbox->priv->line_color_node); } /*---------------------------------------------------------------------------*/ @@ -289,5 +261,5 @@ get_fill_color (glLabelObject *object) g_return_val_if_fail (lbox && GL_IS_LABEL_BOX (lbox), 0); - return gl_color_node_dup (lbox->private->fill_color_node); + return gl_color_node_dup (lbox->priv->fill_color_node); } diff --git a/glabels2/src/label-box.h b/glabels2/src/label-box.h index 479e2b64..93b05a64 100644 --- a/glabels2/src/label-box.h +++ b/glabels2/src/label-box.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -43,7 +45,7 @@ typedef struct _glLabelBoxPrivate glLabelBoxPrivate; struct _glLabelBox { glLabelObject object; - glLabelBoxPrivate *private; + glLabelBoxPrivate *priv; }; struct _glLabelBoxClass { diff --git a/glabels2/src/label-ellipse.c b/glabels2/src/label-ellipse.c index 0fc35828..390c6da2 100644 --- a/glabels2/src/label-ellipse.c +++ b/glabels2/src/label-ellipse.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -42,16 +44,12 @@ struct _glLabelEllipsePrivate { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - static guint instance = 0; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_label_ellipse_class_init (glLabelEllipseClass *klass); -static void gl_label_ellipse_instance_init (glLabelEllipse *lellipse); static void gl_label_ellipse_finalize (GObject *object); static void copy (glLabelObject *dst_object, @@ -77,39 +75,15 @@ static gdouble get_line_width (glLabelObject *object); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_label_ellipse_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glLabelEllipseClass), - NULL, - NULL, - (GClassInitFunc) gl_label_ellipse_class_init, - NULL, - NULL, - sizeof (glLabelEllipse), - 0, - (GInstanceInitFunc) gl_label_ellipse_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_LABEL_OBJECT, - "glLabelEllipse", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glLabelEllipse, gl_label_ellipse, GL_TYPE_LABEL_OBJECT); static void -gl_label_ellipse_class_init (glLabelEllipseClass *klass) +gl_label_ellipse_class_init (glLabelEllipseClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glLabelObjectClass *label_object_class = (glLabelObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glLabelObjectClass *label_object_class = GL_LABEL_OBJECT_CLASS (class); - parent_class = g_type_class_peek_parent (klass); + gl_label_ellipse_parent_class = g_type_class_peek_parent (class); label_object_class->copy = copy; label_object_class->set_fill_color = set_fill_color; @@ -123,27 +97,25 @@ gl_label_ellipse_class_init (glLabelEllipseClass *klass) } static void -gl_label_ellipse_instance_init (glLabelEllipse *lellipse) +gl_label_ellipse_init (glLabelEllipse *lellipse) { - lellipse->private = g_new0 (glLabelEllipsePrivate, 1); - lellipse->private->fill_color_node = gl_color_node_new_default (); - lellipse->private->fill_color_node = gl_color_node_new_default (); + lellipse->priv = g_new0 (glLabelEllipsePrivate, 1); + lellipse->priv->fill_color_node = gl_color_node_new_default (); + lellipse->priv->fill_color_node = gl_color_node_new_default (); } static void gl_label_ellipse_finalize (GObject *object) { - glLabelEllipse *lellipse; + glLabelEllipse *lellipse = GL_LABEL_ELLIPSE (object); g_return_if_fail (object && GL_IS_LABEL_ELLIPSE (object)); - lellipse = GL_LABEL_ELLIPSE (object); - - gl_color_node_free (&(lellipse->private->line_color_node)); - gl_color_node_free (&(lellipse->private->fill_color_node)); - g_free (lellipse->private); + gl_color_node_free (&(lellipse->priv->line_color_node)); + gl_color_node_free (&(lellipse->priv->fill_color_node)); + g_free (lellipse->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_label_ellipse_parent_class)->finalize (object); } /*****************************************************************************/ @@ -205,10 +177,10 @@ set_fill_color (glLabelObject *object, g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); - if (!gl_color_node_equal (lellipse->private->fill_color_node, fill_color_node)) { + if (!gl_color_node_equal (lellipse->priv->fill_color_node, fill_color_node)) { - gl_color_node_free (&(lellipse->private->fill_color_node)); - lellipse->private->fill_color_node = gl_color_node_dup (fill_color_node); + gl_color_node_free (&(lellipse->priv->fill_color_node)); + lellipse->priv->fill_color_node = gl_color_node_dup (fill_color_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); } @@ -225,10 +197,10 @@ set_line_color (glLabelObject *object, g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); - if ( !gl_color_node_equal (lellipse->private->line_color_node, line_color_node) ) { + if ( !gl_color_node_equal (lellipse->priv->line_color_node, line_color_node) ) { - gl_color_node_free (&(lellipse->private->line_color_node)); - lellipse->private->line_color_node = gl_color_node_dup (line_color_node); + gl_color_node_free (&(lellipse->priv->line_color_node)); + lellipse->priv->line_color_node = gl_color_node_dup (line_color_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); } @@ -245,8 +217,8 @@ set_line_width (glLabelObject *object, g_return_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse)); - if ( lellipse->private->line_width != line_width ) { - lellipse->private->line_width = line_width; + if ( lellipse->priv->line_width != line_width ) { + lellipse->priv->line_width = line_width; gl_label_object_emit_changed (GL_LABEL_OBJECT(lellipse)); } } @@ -262,7 +234,7 @@ get_line_width (glLabelObject *object) g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0.0); - return lellipse->private->line_width; + return lellipse->priv->line_width; } /*---------------------------------------------------------------------------*/ @@ -275,7 +247,7 @@ get_line_color (glLabelObject *object) g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); - return gl_color_node_dup (lellipse->private->line_color_node); + return gl_color_node_dup (lellipse->priv->line_color_node); } /*---------------------------------------------------------------------------*/ @@ -288,5 +260,5 @@ get_fill_color (glLabelObject *object) g_return_val_if_fail (lellipse && GL_IS_LABEL_ELLIPSE (lellipse), 0); - return gl_color_node_dup (lellipse->private->fill_color_node); + return gl_color_node_dup (lellipse->priv->fill_color_node); } diff --git a/glabels2/src/label-ellipse.h b/glabels2/src/label-ellipse.h index 57527dea..439ad5f9 100644 --- a/glabels2/src/label-ellipse.h +++ b/glabels2/src/label-ellipse.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -43,7 +45,7 @@ typedef struct _glLabelEllipsePrivate glLabelEllipsePrivate; struct _glLabelEllipse { glLabelObject object; - glLabelEllipsePrivate *private; + glLabelEllipsePrivate *priv; }; struct _glLabelEllipseClass { diff --git a/glabels2/src/label-image.c b/glabels2/src/label-image.c index c7c368d2..25028d1f 100644 --- a/glabels2/src/label-image.c +++ b/glabels2/src/label-image.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -43,8 +45,6 @@ struct _glLabelImagePrivate { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - static guint instance = 0; static GdkPixbuf *default_pixbuf = NULL; @@ -53,8 +53,6 @@ static GdkPixbuf *default_pixbuf = NULL; /* Private function prototypes. */ /*========================================================*/ -static void gl_label_image_class_init (glLabelImageClass *klass); -static void gl_label_image_instance_init (glLabelImage *limage); static void gl_label_image_finalize (GObject *object); static void copy (glLabelObject *dst_object, @@ -64,39 +62,15 @@ static void copy (glLabelObject *dst_object, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_label_image_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glLabelImageClass), - NULL, - NULL, - (GClassInitFunc) gl_label_image_class_init, - NULL, - NULL, - sizeof (glLabelImage), - 0, - (GInstanceInitFunc) gl_label_image_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_LABEL_OBJECT, - "glLabelImage", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glLabelImage, gl_label_image, GL_TYPE_LABEL_OBJECT); static void -gl_label_image_class_init (glLabelImageClass *klass) +gl_label_image_class_init (glLabelImageClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glLabelObjectClass *label_object_class = (glLabelObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glLabelObjectClass *label_object_class = GL_LABEL_OBJECT_CLASS (class); - parent_class = g_type_class_peek_parent (klass); + gl_label_image_parent_class = g_type_class_peek_parent (class); label_object_class->copy = copy; @@ -104,45 +78,42 @@ gl_label_image_class_init (glLabelImageClass *klass) } static void -gl_label_image_instance_init (glLabelImage *limage) +gl_label_image_init (glLabelImage *limage) { if ( default_pixbuf == NULL ) { default_pixbuf = gdk_pixbuf_new_from_xpm_data ((const char **)checkerboard_xpm); } - limage->private = g_new0 (glLabelImagePrivate, 1); + limage->priv = g_new0 (glLabelImagePrivate, 1); - limage->private->filename = g_new0 (glTextNode, 1); + limage->priv->filename = g_new0 (glTextNode, 1); - limage->private->pixbuf = default_pixbuf; + limage->priv->pixbuf = default_pixbuf; } static void gl_label_image_finalize (GObject *object) { - glLabelObject *lobject; - glLabelImage *limage; + glLabelObject *lobject = GL_LABEL_OBJECT (object); + glLabelImage *limage = GL_LABEL_IMAGE (object);; GHashTable *pixbuf_cache; g_return_if_fail (object && GL_IS_LABEL_IMAGE (object)); - lobject = GL_LABEL_OBJECT (object); - limage = GL_LABEL_IMAGE (object); - - if (!limage->private->filename->field_flag) { + if (!limage->priv->filename->field_flag) { pixbuf_cache = gl_label_get_pixbuf_cache (lobject->parent); gl_pixbuf_cache_remove_pixbuf (pixbuf_cache, - limage->private->filename->data); + limage->priv->filename->data); } - gl_text_node_free (&limage->private->filename); - g_free (limage->private); + gl_text_node_free (&limage->priv->filename); + g_free (limage->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_label_image_parent_class)->finalize (object); } /*****************************************************************************/ -/* NEW label "image" object. */ +/* NEW label "image" object. */ /*****************************************************************************/ GObject * gl_label_image_new (glLabel *label) @@ -178,7 +149,7 @@ copy (glLabelObject *dst_object, /* Make sure destination label has data suitably cached. */ if ( !filename->field_flag && (filename->data != NULL) ) { - pixbuf = limage->private->pixbuf; + pixbuf = limage->priv->pixbuf; if ( pixbuf != default_pixbuf ) { pixbuf_cache = gl_label_get_pixbuf_cache (dst_object->parent); gl_pixbuf_cache_add_pixbuf (pixbuf_cache, filename->data, pixbuf); @@ -209,7 +180,7 @@ gl_label_image_set_filename (glLabelImage *limage, g_return_if_fail (limage && GL_IS_LABEL_IMAGE (limage)); g_return_if_fail (filename != NULL); - old_filename = limage->private->filename; + old_filename = limage->priv->filename; /* If Unchanged don't do anything */ if ( gl_text_node_equal (filename, old_filename ) ) { @@ -224,29 +195,29 @@ gl_label_image_set_filename (glLabelImage *limage, } /* Set new filename. */ - limage->private->filename = gl_text_node_dup(filename); + limage->priv->filename = gl_text_node_dup(filename); gl_text_node_free (&old_filename); /* Now set the pixbuf. */ if ( filename->field_flag || (filename->data == NULL) ) { - limage->private->pixbuf = default_pixbuf; + limage->priv->pixbuf = default_pixbuf; } else { pixbuf = gl_pixbuf_cache_get_pixbuf (pixbuf_cache, filename->data); if (pixbuf != NULL) { - limage->private->pixbuf = pixbuf; + limage->priv->pixbuf = pixbuf; } else { - limage->private->pixbuf = default_pixbuf; + limage->priv->pixbuf = default_pixbuf; } } /* Treat current size as a bounding box, scale image to maintain aspect * ratio while fitting it in this bounding box. */ - image_w = gdk_pixbuf_get_width (limage->private->pixbuf); - image_h = gdk_pixbuf_get_height (limage->private->pixbuf); + image_w = gdk_pixbuf_get_width (limage->priv->pixbuf); + image_h = gdk_pixbuf_get_height (limage->priv->pixbuf); aspect_ratio = image_h / image_w; gl_label_object_get_size (GL_LABEL_OBJECT(limage), &w, &h); if ( h > w*aspect_ratio ) { @@ -270,7 +241,7 @@ gl_label_image_get_filename (glLabelImage *limage) { g_return_val_if_fail (limage && GL_IS_LABEL_IMAGE (limage), NULL); - return gl_text_node_dup (limage->private->filename); + return gl_text_node_dup (limage->priv->filename); } const GdkPixbuf * @@ -279,7 +250,7 @@ gl_label_image_get_pixbuf (glLabelImage *limage, { g_return_val_if_fail (limage && GL_IS_LABEL_IMAGE (limage), NULL); - if ((record != NULL) && limage->private->filename->field_flag) { + if ((record != NULL) && limage->priv->filename->field_flag) { GdkPixbuf *pixbuf = NULL; gchar *real_filename; @@ -287,7 +258,7 @@ gl_label_image_get_pixbuf (glLabelImage *limage, /* Indirect filename, re-evaluate for given record. */ real_filename = gl_merge_eval_key (record, - limage->private->filename->data); + limage->priv->filename->data); if (real_filename != NULL) { pixbuf = gdk_pixbuf_new_from_file (real_filename, NULL); @@ -300,7 +271,7 @@ gl_label_image_get_pixbuf (glLabelImage *limage, } - return limage->private->pixbuf; + return limage->priv->pixbuf; } diff --git a/glabels2/src/label-image.h b/glabels2/src/label-image.h index 7c611a69..a45f0c79 100644 --- a/glabels2/src/label-image.h +++ b/glabels2/src/label-image.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -45,7 +47,7 @@ typedef struct _glLabelImagePrivate glLabelImagePrivate; struct _glLabelImage { glLabelObject object; - glLabelImagePrivate *private; + glLabelImagePrivate *priv; }; struct _glLabelImageClass { diff --git a/glabels2/src/label-line.c b/glabels2/src/label-line.c index 25c120d6..a8272280 100644 --- a/glabels2/src/label-line.c +++ b/glabels2/src/label-line.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -41,16 +43,12 @@ struct _glLabelLinePrivate { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - static guint instance = 0; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_label_line_class_init (glLabelLineClass *klass); -static void gl_label_line_instance_init (glLabelLine *lline); static void gl_label_line_finalize (GObject *object); static void copy (glLabelObject *dst_object, @@ -71,39 +69,15 @@ static gdouble get_line_width (glLabelObject *object); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_label_line_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glLabelLineClass), - NULL, - NULL, - (GClassInitFunc) gl_label_line_class_init, - NULL, - NULL, - sizeof (glLabelLine), - 0, - (GInstanceInitFunc) gl_label_line_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_LABEL_OBJECT, - "glLabelLine", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glLabelLine, gl_label_line, GL_TYPE_LABEL_OBJECT); static void -gl_label_line_class_init (glLabelLineClass *klass) +gl_label_line_class_init (glLabelLineClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glLabelObjectClass *label_object_class = (glLabelObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glLabelObjectClass *label_object_class = GL_LABEL_OBJECT_CLASS (class); - parent_class = g_type_class_peek_parent (klass); + gl_label_line_parent_class = g_type_class_peek_parent (class); label_object_class->copy = copy; label_object_class->set_line_color = set_line_color; @@ -115,25 +89,23 @@ gl_label_line_class_init (glLabelLineClass *klass) } static void -gl_label_line_instance_init (glLabelLine *lline) +gl_label_line_init (glLabelLine *lline) { - lline->private = g_new0 (glLabelLinePrivate, 1); - lline->private->line_color_node = gl_color_node_new_default (); + lline->priv = g_new0 (glLabelLinePrivate, 1); + lline->priv->line_color_node = gl_color_node_new_default (); } static void gl_label_line_finalize (GObject *object) { - glLabelLine *lline; + glLabelLine *lline = GL_LABEL_LINE (object); g_return_if_fail (object && GL_IS_LABEL_LINE (object)); - lline = GL_LABEL_LINE (object); - - gl_color_node_free (&(lline->private->line_color_node)); - g_free (lline->private); + gl_color_node_free (&(lline->priv->line_color_node)); + g_free (lline->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_label_line_parent_class)->finalize (object); } /*****************************************************************************/ @@ -191,10 +163,10 @@ set_line_color (glLabelObject *object, g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); - if ( !gl_color_node_equal (lline->private->line_color_node, line_color_node)) { + if ( !gl_color_node_equal (lline->priv->line_color_node, line_color_node)) { - gl_color_node_free (&(lline->private->line_color_node )); - lline->private->line_color_node = gl_color_node_dup (line_color_node); + gl_color_node_free (&(lline->priv->line_color_node )); + lline->priv->line_color_node = gl_color_node_dup (line_color_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(lline)); } @@ -211,8 +183,8 @@ set_line_width (glLabelObject *object, g_return_if_fail (lline && GL_IS_LABEL_LINE (lline)); - if ( lline->private->line_width != line_width ) { - lline->private->line_width = line_width; + if ( lline->priv->line_width != line_width ) { + lline->priv->line_width = line_width; gl_label_object_emit_changed (GL_LABEL_OBJECT(lline)); } } @@ -228,7 +200,7 @@ get_line_width (glLabelObject *object) g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0.0); - return lline->private->line_width; + return lline->priv->line_width; } /*---------------------------------------------------------------------------*/ @@ -241,5 +213,5 @@ get_line_color (glLabelObject *object) g_return_val_if_fail (lline && GL_IS_LABEL_LINE (lline), 0); - return gl_color_node_dup (lline->private->line_color_node); + return gl_color_node_dup (lline->priv->line_color_node); } diff --git a/glabels2/src/label-line.h b/glabels2/src/label-line.h index 4c2c2d15..3b73e42e 100644 --- a/glabels2/src/label-line.h +++ b/glabels2/src/label-line.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -43,7 +45,7 @@ typedef struct _glLabelLinePrivate glLabelLinePrivate; struct _glLabelLine { glLabelObject object; - glLabelLinePrivate *private; + glLabelLinePrivate *priv; }; struct _glLabelLineClass { diff --git a/glabels2/src/label-object.c b/glabels2/src/label-object.c index 7d31868b..f98c0272 100644 --- a/glabels2/src/label-object.c +++ b/glabels2/src/label-object.c @@ -75,8 +75,6 @@ enum { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - static guint signals[LAST_SIGNAL] = {0}; static guint instance = 0; @@ -85,8 +83,6 @@ static guint instance = 0; /* Private function prototypes. */ /*========================================================*/ -static void gl_label_object_class_init (glLabelObjectClass *klass); -static void gl_label_object_instance_init (glLabelObject *object); static void gl_label_object_finalize (GObject *object); static void merge_changed_cb (glLabel *label, @@ -104,50 +100,25 @@ static void get_size (glLabelObject *object, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_label_object_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glLabelObjectClass), - NULL, - NULL, - (GClassInitFunc) gl_label_object_class_init, - NULL, - NULL, - sizeof (glLabelObject), - 0, - (GInstanceInitFunc) gl_label_object_instance_init, - NULL - }; - - type = g_type_register_static (G_TYPE_OBJECT, - "glLabelObject", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glLabelObject, gl_label_object, G_TYPE_OBJECT); static void -gl_label_object_class_init (glLabelObjectClass *klass) +gl_label_object_class_init (glLabelObjectClass *class) { - GObjectClass *gobject_class = (GObjectClass *) klass; - glLabelObjectClass *object_class = (glLabelObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_LABEL, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_label_object_parent_class = g_type_class_peek_parent (class); - gobject_class->finalize = gl_label_object_finalize; + object_class->finalize = gl_label_object_finalize; - object_class->set_size = set_size; - object_class->get_size = get_size; + class->set_size = set_size; + class->get_size = get_size; signals[CHANGED] = g_signal_new ("changed", - G_OBJECT_CLASS_TYPE (gobject_class), + G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (glLabelObjectClass, changed), NULL, NULL, @@ -157,7 +128,7 @@ gl_label_object_class_init (glLabelObjectClass *klass) signals[MOVED] = g_signal_new ("moved", - G_OBJECT_CLASS_TYPE (gobject_class), + G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (glLabelObjectClass, moved), NULL, NULL, @@ -166,7 +137,7 @@ gl_label_object_class_init (glLabelObjectClass *klass) 2, G_TYPE_DOUBLE, G_TYPE_DOUBLE); signals[FLIP_ROTATE] = g_signal_new ("flip_rotate", - G_OBJECT_CLASS_TYPE (gobject_class), + G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (glLabelObjectClass, flip_rotate), NULL, NULL, @@ -175,7 +146,7 @@ gl_label_object_class_init (glLabelObjectClass *klass) 0); signals[TOP] = g_signal_new ("top", - G_OBJECT_CLASS_TYPE (gobject_class), + G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (glLabelObjectClass, top), NULL, NULL, @@ -185,7 +156,7 @@ gl_label_object_class_init (glLabelObjectClass *klass) signals[BOTTOM] = g_signal_new ("bottom", - G_OBJECT_CLASS_TYPE (gobject_class), + G_OBJECT_CLASS_TYPE (object_class), G_SIGNAL_RUN_LAST, G_STRUCT_OFFSET (glLabelObjectClass, bottom), NULL, NULL, @@ -197,21 +168,21 @@ gl_label_object_class_init (glLabelObjectClass *klass) } static void -gl_label_object_instance_init (glLabelObject *object) +gl_label_object_init (glLabelObject *object) { gl_debug (DEBUG_LABEL, "START"); - object->private = g_new0 (glLabelObjectPrivate, 1); + object->priv = g_new0 (glLabelObjectPrivate, 1); - object->private->name = g_strdup_printf ("object%d", instance++); + object->priv->name = g_strdup_printf ("object%d", instance++); - art_affine_identity (object->private->affine); + art_affine_identity (object->priv->affine); - object->private->shadow_state = FALSE; - object->private->shadow_x = DEFAULT_SHADOW_X_OFFSET; - object->private->shadow_y = DEFAULT_SHADOW_Y_OFFSET; - object->private->shadow_color_node = gl_color_node_new_default (); - object->private->shadow_opacity = DEFAULT_SHADOW_OPACITY; + object->priv->shadow_state = FALSE; + object->priv->shadow_x = DEFAULT_SHADOW_X_OFFSET; + object->priv->shadow_y = DEFAULT_SHADOW_Y_OFFSET; + object->priv->shadow_color_node = gl_color_node_new_default (); + object->priv->shadow_opacity = DEFAULT_SHADOW_OPACITY; gl_debug (DEBUG_LABEL, "END"); } @@ -219,19 +190,20 @@ gl_label_object_instance_init (glLabelObject *object) static void gl_label_object_finalize (GObject *object) { + glLabelObject *label_object = GL_LABEL_OBJECT (object); glLabel *parent; gl_debug (DEBUG_LABEL, "START"); g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - parent = GL_LABEL_OBJECT(object)->parent; - gl_label_remove_object (parent, GL_LABEL_OBJECT(object)); + parent = label_object->parent; + gl_label_remove_object (parent, label_object); - g_free (GL_LABEL_OBJECT(object)->private->name); - g_free (GL_LABEL_OBJECT(object)->private); + g_free (label_object->priv->name); + g_free (label_object->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_label_object_parent_class)->finalize (object); gl_debug (DEBUG_LABEL, "END"); } @@ -380,8 +352,8 @@ gl_label_object_set_name (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - g_free(object->private->name); - object->private->name = name; + g_free(object->priv->name); + object->priv->name = name; g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); @@ -400,7 +372,7 @@ gl_label_object_get_name (glLabelObject *object) gl_debug (DEBUG_LABEL, "END"); - return g_strdup(object->private->name); + return g_strdup(object->priv->name); } /*****************************************************************************/ @@ -417,13 +389,13 @@ gl_label_object_set_position (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - if ( (x != object->private->x) || (y != object->private->y) ) { + if ( (x != object->priv->x) || (y != object->priv->y) ) { - dx = x - object->private->x; - dy = y - object->private->y; + dx = x - object->priv->x; + dy = y - object->priv->y; - object->private->x = x; - object->private->y = y; + object->priv->x = x; + object->priv->y = y; g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy); @@ -446,12 +418,12 @@ gl_label_object_set_position_relative (glLabelObject *object, if ( (dx != 0.0) || (dy != 0.0) ) { - object->private->x += dx; - object->private->y += dy; + object->priv->x += dx; + object->priv->y += dy; gl_debug (DEBUG_LABEL, " x = %f, y= %f", - object->private->x, - object->private->y); + object->priv->x, + object->priv->y); g_signal_emit (G_OBJECT(object), signals[MOVED], 0, dx, dy); @@ -472,8 +444,8 @@ gl_label_object_get_position (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - *x = object->private->x; - *y = object->private->y; + *x = object->priv->x; + *y = object->priv->y; gl_debug (DEBUG_LABEL, "END"); } @@ -488,10 +460,10 @@ set_size (glLabelObject *object, { g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - if ( (object->private->w != w) || (object->private->h != h) ) { + if ( (object->priv->w != w) || (object->priv->h != h) ) { - object->private->w = w; - object->private->h = h; + object->priv->w = w; + object->priv->h = h; g_signal_emit (G_OBJECT(object), signals[CHANGED], 0); } @@ -514,7 +486,7 @@ gl_label_object_set_size (glLabelObject *object, /* We have an object specific method, use it */ GL_LABEL_OBJECT_GET_CLASS(object)->set_size (object, w, h); - object->private->aspect_ratio = h / w; + object->priv->aspect_ratio = h / w; } @@ -534,13 +506,13 @@ gl_label_object_set_size_honor_aspect (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - if ( h > w*object->private->aspect_ratio ) { + if ( h > w*object->priv->aspect_ratio ) { - h = w * object->private->aspect_ratio; + h = w * object->priv->aspect_ratio; } else { - w = h / object->private->aspect_ratio; + w = h / object->priv->aspect_ratio; } @@ -564,8 +536,8 @@ get_size (glLabelObject *object, { g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - *w = object->private->w; - *h = object->private->h; + *w = object->priv->w; + *h = object->priv->h; } /*****************************************************************************/ @@ -632,10 +604,10 @@ gl_label_object_get_extent (glLabelObject *object, art_affine_point (&b4, &a4, affine); /* now find the maximum extent of these points in x and y */ - *x1 = MIN (b1.x, MIN (b2.x, MIN (b3.x, b4.x))) + object->private->x; - *y1 = MIN (b1.y, MIN (b2.y, MIN (b3.y, b4.y))) + object->private->y; - *x2 = MAX (b1.x, MAX (b2.x, MAX (b3.x, b4.x))) + object->private->x; - *y2 = MAX (b1.y, MAX (b2.y, MAX (b3.y, b4.y))) + object->private->y; + *x1 = MIN (b1.x, MIN (b2.x, MIN (b3.x, b4.x))) + object->priv->x; + *y1 = MIN (b1.y, MIN (b2.y, MIN (b3.y, b4.y))) + object->priv->y; + *x2 = MAX (b1.x, MAX (b2.x, MAX (b3.x, b4.x))) + object->priv->x; + *y2 = MAX (b1.y, MAX (b2.y, MAX (b3.y, b4.y))) + object->priv->y; gl_debug (DEBUG_LABEL, "END"); } @@ -1191,9 +1163,9 @@ gl_label_object_set_shadow_state (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - if (object->private->shadow_state != state) + if (object->priv->shadow_state != state) { - object->private->shadow_state = state; + object->priv->shadow_state = state; gl_label_object_emit_changed (object); } @@ -1210,7 +1182,7 @@ gl_label_object_get_shadow_state (glLabelObject *object) g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), FALSE); - return object->private->shadow_state; + return object->priv->shadow_state; } /****************************************************************************/ @@ -1225,10 +1197,10 @@ gl_label_object_set_shadow_offset (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - if ( (x != object->private->shadow_x) || (y != object->private->shadow_y) ) + if ( (x != object->priv->shadow_x) || (y != object->priv->shadow_y) ) { - object->private->shadow_x = x; - object->private->shadow_y = y; + object->priv->shadow_x = x; + object->priv->shadow_y = y; gl_label_object_emit_changed (object); } @@ -1248,8 +1220,8 @@ gl_label_object_get_shadow_offset (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - *x = object->private->shadow_x; - *y = object->private->shadow_y; + *x = object->priv->shadow_x; + *y = object->priv->shadow_y; gl_debug (DEBUG_LABEL, "END"); } @@ -1265,10 +1237,10 @@ gl_label_object_set_shadow_color (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - if ( !gl_color_node_equal (object->private->shadow_color_node, color_node )) + if ( !gl_color_node_equal (object->priv->shadow_color_node, color_node )) { - gl_color_node_free (&(object->private->shadow_color_node)); - object->private->shadow_color_node = gl_color_node_dup (color_node); + gl_color_node_free (&(object->priv->shadow_color_node)); + object->priv->shadow_color_node = gl_color_node_dup (color_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(object)); } @@ -1285,7 +1257,7 @@ gl_label_object_get_shadow_color (glLabelObject *object) g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), NULL); - return gl_color_node_dup (object->private->shadow_color_node); + return gl_color_node_dup (object->priv->shadow_color_node); } /****************************************************************************/ @@ -1299,9 +1271,9 @@ gl_label_object_set_shadow_opacity (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - if (object->private->shadow_opacity != alpha) + if (object->priv->shadow_opacity != alpha) { - object->private->shadow_opacity = alpha; + object->priv->shadow_opacity = alpha; gl_label_object_emit_changed (object); } @@ -1318,7 +1290,7 @@ gl_label_object_get_shadow_opacity (glLabelObject *object) g_return_val_if_fail (object && GL_IS_LABEL_OBJECT (object), FALSE); - return object->private->shadow_opacity; + return object->priv->shadow_opacity; } /****************************************************************************/ @@ -1334,7 +1306,7 @@ gl_label_object_flip_horiz (glLabelObject *object) g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); art_affine_scale (flip_affine, -1.0, 1.0); - art_affine_multiply (object->private->affine, object->private->affine, flip_affine); + art_affine_multiply (object->priv->affine, object->priv->affine, flip_affine); g_signal_emit (G_OBJECT(object), signals[FLIP_ROTATE], 0); @@ -1354,7 +1326,7 @@ gl_label_object_flip_vert (glLabelObject *object) g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); art_affine_scale (flip_affine, 1.0, -1.0); - art_affine_multiply (object->private->affine, object->private->affine, flip_affine); + art_affine_multiply (object->priv->affine, object->priv->affine, flip_affine); g_signal_emit (G_OBJECT(object), signals[FLIP_ROTATE], 0); @@ -1375,7 +1347,7 @@ gl_label_object_rotate (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); art_affine_rotate (rotate_affine, theta_degs); - art_affine_multiply (object->private->affine, object->private->affine, rotate_affine); + art_affine_multiply (object->priv->affine, object->priv->affine, rotate_affine); g_signal_emit (G_OBJECT(object), signals[FLIP_ROTATE], 0); @@ -1393,12 +1365,12 @@ gl_label_object_set_affine (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - object->private->affine[0] = affine[0]; - object->private->affine[1] = affine[1]; - object->private->affine[2] = affine[2]; - object->private->affine[3] = affine[3]; - object->private->affine[4] = affine[4]; - object->private->affine[5] = affine[5]; + object->priv->affine[0] = affine[0]; + object->priv->affine[1] = affine[1]; + object->priv->affine[2] = affine[2]; + object->priv->affine[3] = affine[3]; + object->priv->affine[4] = affine[4]; + object->priv->affine[5] = affine[5]; } /****************************************************************************/ @@ -1412,12 +1384,12 @@ gl_label_object_get_affine (glLabelObject *object, g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - affine[0] = object->private->affine[0]; - affine[1] = object->private->affine[1]; - affine[2] = object->private->affine[2]; - affine[3] = object->private->affine[3]; - affine[4] = object->private->affine[4]; - affine[5] = object->private->affine[5]; + affine[0] = object->priv->affine[0]; + affine[1] = object->priv->affine[1]; + affine[2] = object->priv->affine[2]; + affine[3] = object->priv->affine[3]; + affine[4] = object->priv->affine[4]; + affine[5] = object->priv->affine[5]; } /****************************************************************************/ diff --git a/glabels2/src/label-object.h b/glabels2/src/label-object.h index a7b6bb89..9179e02b 100644 --- a/glabels2/src/label-object.h +++ b/glabels2/src/label-object.h @@ -62,7 +62,7 @@ struct _glLabelObject { glLabel *parent; - glLabelObjectPrivate *private; + glLabelObjectPrivate *priv; }; struct _glLabelObjectClass { diff --git a/glabels2/src/label-text.c b/glabels2/src/label-text.c index bb61ff05..5c4221c6 100644 --- a/glabels2/src/label-text.c +++ b/glabels2/src/label-text.c @@ -70,16 +70,12 @@ struct _glLabelTextPrivate { /* Private globals. */ /*========================================================*/ -static glLabelObjectClass *parent_class = NULL; - static guint instance = 0; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_label_text_class_init (glLabelTextClass *klass); -static void gl_label_text_instance_init (glLabelText *ltext); static void gl_label_text_finalize (GObject *object); static void copy (glLabelObject *dst_object, @@ -131,39 +127,15 @@ static glColorNode* get_text_color (glLabelObject *object); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_label_text_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glLabelTextClass), - NULL, - NULL, - (GClassInitFunc) gl_label_text_class_init, - NULL, - NULL, - sizeof (glLabelText), - 0, - (GInstanceInitFunc) gl_label_text_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_LABEL_OBJECT, - "glLabelText", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glLabelText, gl_label_text, GL_TYPE_LABEL_OBJECT); static void -gl_label_text_class_init (glLabelTextClass *klass) +gl_label_text_class_init (glLabelTextClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glLabelObjectClass *label_object_class = (glLabelObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glLabelObjectClass *label_object_class = GL_LABEL_OBJECT_CLASS (class); - parent_class = g_type_class_peek_parent (klass); + gl_label_text_parent_class = g_type_class_peek_parent (class); label_object_class->copy = copy; @@ -188,43 +160,41 @@ gl_label_text_class_init (glLabelTextClass *klass) } static void -gl_label_text_instance_init (glLabelText *ltext) +gl_label_text_init (glLabelText *ltext) { - ltext->private = g_new0 (glLabelTextPrivate, 1); - - ltext->private->tag_table = gtk_text_tag_table_new (); - ltext->private->buffer = gtk_text_buffer_new (ltext->private->tag_table); - - ltext->private->font_family = g_strdup(DEFAULT_FONT_FAMILY); - ltext->private->font_size = DEFAULT_FONT_SIZE; - ltext->private->font_weight = DEFAULT_FONT_WEIGHT; - ltext->private->font_italic_flag = DEFAULT_FONT_ITALIC_FLAG; - ltext->private->align = DEFAULT_ALIGN; - ltext->private->color_node = gl_color_node_new_default (); - ltext->private->color_node->color = DEFAULT_COLOR; - ltext->private->line_spacing = DEFAULT_TEXT_LINE_SPACING; - ltext->private->auto_shrink = DEFAULT_AUTO_SHRINK; - - g_signal_connect (G_OBJECT(ltext->private->buffer), "changed", + ltext->priv = g_new0 (glLabelTextPrivate, 1); + + ltext->priv->tag_table = gtk_text_tag_table_new (); + ltext->priv->buffer = gtk_text_buffer_new (ltext->priv->tag_table); + + ltext->priv->font_family = g_strdup(DEFAULT_FONT_FAMILY); + ltext->priv->font_size = DEFAULT_FONT_SIZE; + ltext->priv->font_weight = DEFAULT_FONT_WEIGHT; + ltext->priv->font_italic_flag = DEFAULT_FONT_ITALIC_FLAG; + ltext->priv->align = DEFAULT_ALIGN; + ltext->priv->color_node = gl_color_node_new_default (); + ltext->priv->color_node->color = DEFAULT_COLOR; + ltext->priv->line_spacing = DEFAULT_TEXT_LINE_SPACING; + ltext->priv->auto_shrink = DEFAULT_AUTO_SHRINK; + + g_signal_connect (G_OBJECT(ltext->priv->buffer), "changed", G_CALLBACK(buffer_changed_cb), ltext); } static void gl_label_text_finalize (GObject *object) { - glLabelText *ltext; + glLabelText *ltext = GL_LABEL_TEXT (object); g_return_if_fail (object && GL_IS_LABEL_TEXT (object)); - ltext = GL_LABEL_TEXT (object); - - g_object_unref (ltext->private->tag_table); - g_object_unref (ltext->private->buffer); - g_free (ltext->private->font_family); - gl_color_node_free (&(ltext->private->color_node)); - g_free (ltext->private); + g_object_unref (ltext->priv->tag_table); + g_object_unref (ltext->priv->buffer); + g_free (ltext->priv->font_family); + gl_color_node_free (&(ltext->priv->color_node)); + g_free (ltext->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_label_text_parent_class)->finalize (object); } /*****************************************************************************/ @@ -263,14 +233,14 @@ copy (glLabelObject *dst_object, text_color_node = get_text_color (src_object); gl_label_text_set_lines (new_ltext, lines); - new_ltext->private->font_family = g_strdup (ltext->private->font_family); - new_ltext->private->font_size = ltext->private->font_size; - new_ltext->private->font_weight = ltext->private->font_weight; - new_ltext->private->font_italic_flag = ltext->private->font_italic_flag; + new_ltext->priv->font_family = g_strdup (ltext->priv->font_family); + new_ltext->priv->font_size = ltext->priv->font_size; + new_ltext->priv->font_weight = ltext->priv->font_weight; + new_ltext->priv->font_italic_flag = ltext->priv->font_italic_flag; set_text_color (dst_object, text_color_node); - new_ltext->private->align = ltext->private->align; - new_ltext->private->line_spacing = ltext->private->line_spacing; - new_ltext->private->auto_shrink = ltext->private->auto_shrink; + new_ltext->priv->align = ltext->priv->align; + new_ltext->priv->line_spacing = ltext->priv->line_spacing; + new_ltext->priv->auto_shrink = ltext->priv->auto_shrink; gl_color_node_free (&text_color_node); gl_text_node_lines_free (&lines); @@ -293,7 +263,7 @@ gl_label_text_set_lines (glLabelText *ltext, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); text = gl_text_node_lines_expand (lines, NULL); - gtk_text_buffer_set_text (ltext->private->buffer, text, -1); + gtk_text_buffer_set_text (ltext->priv->buffer, text, -1); g_free (text); gl_debug (DEBUG_LABEL, "END"); @@ -307,7 +277,7 @@ gl_label_text_get_buffer (glLabelText *ltext) { g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), NULL); - return ltext->private->buffer; + return ltext->priv->buffer; } GList * @@ -319,8 +289,8 @@ gl_label_text_get_lines (glLabelText *ltext) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), NULL); - gtk_text_buffer_get_bounds (ltext->private->buffer, &start, &end); - text = gtk_text_buffer_get_text (ltext->private->buffer, + gtk_text_buffer_get_bounds (ltext->priv->buffer, &start, &end); + text = gtk_text_buffer_get_text (ltext->priv->buffer, &start, &end, FALSE); lines = gl_text_node_lines_new_from_text (text); g_free (text); @@ -336,7 +306,7 @@ gl_label_text_get_box (glLabelText *ltext, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); /* peek at the parent size. */ - (* parent_class->get_size) (GL_LABEL_OBJECT(ltext), w, h); + (* GL_LABEL_OBJECT_CLASS (gl_label_text_parent_class)->get_size) (GL_LABEL_OBJECT(ltext), w, h); } /*---------------------------------------------------------------------------*/ @@ -372,7 +342,7 @@ get_size (glLabelObject *object, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - (* parent_class->get_size) (object, &w_parent, &h_parent); + (* GL_LABEL_OBJECT_CLASS (gl_label_text_parent_class)->get_size) (object, &w_parent, &h_parent); if ( (w_parent != 0.0) || (h_parent != 0.0) ) { *w = w_parent; @@ -380,8 +350,8 @@ get_size (glLabelObject *object, return; } - gtk_text_buffer_get_bounds (ltext->private->buffer, &start, &end); - text = gtk_text_buffer_get_text (ltext->private->buffer, + gtk_text_buffer_get_bounds (ltext->priv->buffer, &start, &end); + text = gtk_text_buffer_get_text (ltext->priv->buffer, &start, &end, FALSE); @@ -394,13 +364,13 @@ get_size (glLabelObject *object, layout = pango_layout_new (context); - style = GL_LABEL_TEXT (object)->private->font_italic_flag ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL; + style = GL_LABEL_TEXT (object)->priv->font_italic_flag ? PANGO_STYLE_ITALIC : PANGO_STYLE_NORMAL; desc = pango_font_description_new (); - pango_font_description_set_family (desc, GL_LABEL_TEXT (object)->private->font_family); - pango_font_description_set_weight (desc, GL_LABEL_TEXT (object)->private->font_weight); + pango_font_description_set_family (desc, GL_LABEL_TEXT (object)->priv->font_family); + pango_font_description_set_weight (desc, GL_LABEL_TEXT (object)->priv->font_weight); pango_font_description_set_style (desc, style); - pango_font_description_set_size (desc, GL_LABEL_TEXT (object)->private->font_size * PANGO_SCALE * FONT_SCALE); + pango_font_description_set_size (desc, GL_LABEL_TEXT (object)->priv->font_size * PANGO_SCALE * FONT_SCALE); pango_layout_set_font_description (layout, desc); pango_font_description_free (desc); @@ -445,18 +415,18 @@ set_font_family (glLabelObject *object, } gl_util_font_family_list_free (family_names); - if (ltext->private->font_family) { - if (g_strcasecmp (ltext->private->font_family, good_font_family) == 0) { + if (ltext->priv->font_family) { + if (g_strcasecmp (ltext->priv->font_family, good_font_family) == 0) { g_free (good_font_family); gl_debug (DEBUG_LABEL, "END (no change)"); return; } - g_free (ltext->private->font_family); + g_free (ltext->priv->font_family); } - ltext->private->font_family = g_strdup (good_font_family); + ltext->priv->font_family = g_strdup (good_font_family); g_free (good_font_family); - gl_debug (DEBUG_LABEL, "new font family = %s", ltext->private->font_family); + gl_debug (DEBUG_LABEL, "new font family = %s", ltext->priv->font_family); gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); @@ -476,9 +446,9 @@ set_font_size (glLabelObject *object, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - if (ltext->private->font_size != font_size) { + if (ltext->priv->font_size != font_size) { - ltext->private->font_size = font_size; + ltext->priv->font_size = font_size; gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); } @@ -499,9 +469,9 @@ set_font_weight (glLabelObject *object, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - if (ltext->private->font_weight != font_weight) { + if (ltext->priv->font_weight != font_weight) { - ltext->private->font_weight = font_weight; + ltext->priv->font_weight = font_weight; gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); } @@ -522,9 +492,9 @@ set_font_italic_flag (glLabelObject *object, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - if (ltext->private->font_italic_flag != font_italic_flag) { + if (ltext->priv->font_italic_flag != font_italic_flag) { - ltext->private->font_italic_flag = font_italic_flag; + ltext->priv->font_italic_flag = font_italic_flag; gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); } @@ -545,9 +515,9 @@ set_text_alignment (glLabelObject *object, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - if (ltext->private->align != text_alignment) { + if (ltext->priv->align != text_alignment) { - ltext->private->align = text_alignment; + ltext->priv->align = text_alignment; gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); } @@ -568,9 +538,9 @@ set_text_line_spacing (glLabelObject *object, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - if (ltext->private->line_spacing != line_spacing) { + if (ltext->priv->line_spacing != line_spacing) { - ltext->private->line_spacing = line_spacing; + ltext->priv->line_spacing = line_spacing; gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); } @@ -591,10 +561,10 @@ set_text_color (glLabelObject *object, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - if (!gl_color_node_equal (ltext->private->color_node, text_color_node)) { + if (!gl_color_node_equal (ltext->priv->color_node, text_color_node)) { - gl_color_node_free (&(ltext->private->color_node)); - ltext->private->color_node = gl_color_node_dup (text_color_node); + gl_color_node_free (&(ltext->priv->color_node)); + ltext->priv->color_node = gl_color_node_dup (text_color_node); gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); @@ -615,7 +585,7 @@ get_font_family (glLabelObject *object) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), NULL); - return g_strdup (ltext->private->font_family); + return g_strdup (ltext->priv->font_family); } /*---------------------------------------------------------------------------*/ @@ -630,7 +600,7 @@ get_font_size (glLabelObject *object) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), 0.0); - return ltext->private->font_size; + return ltext->priv->font_size; } /*---------------------------------------------------------------------------*/ @@ -645,7 +615,7 @@ get_font_weight (glLabelObject *object) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), PANGO_WEIGHT_NORMAL); - return ltext->private->font_weight; + return ltext->priv->font_weight; } /*---------------------------------------------------------------------------*/ @@ -660,7 +630,7 @@ get_font_italic_flag (glLabelObject *object) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), FALSE); - return ltext->private->font_italic_flag; + return ltext->priv->font_italic_flag; } /*---------------------------------------------------------------------------*/ @@ -675,7 +645,7 @@ get_text_alignment (glLabelObject *object) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), GTK_JUSTIFY_LEFT); - return ltext->private->align; + return ltext->priv->align; } /*---------------------------------------------------------------------------*/ @@ -690,7 +660,7 @@ get_text_line_spacing (glLabelObject *object) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), 0.0); - return ltext->private->line_spacing; + return ltext->priv->line_spacing; } /*---------------------------------------------------------------------------*/ @@ -705,7 +675,7 @@ get_text_color (glLabelObject *object) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), 0); - return gl_color_node_dup (ltext->private->color_node); + return gl_color_node_dup (ltext->priv->color_node); } /*****************************************************************************/ @@ -719,9 +689,9 @@ gl_label_text_set_auto_shrink (glLabelText *ltext, g_return_if_fail (ltext && GL_IS_LABEL_TEXT (ltext)); - if (ltext->private->auto_shrink != auto_shrink) { + if (ltext->priv->auto_shrink != auto_shrink) { - ltext->private->auto_shrink = auto_shrink; + ltext->priv->auto_shrink = auto_shrink; gl_label_object_emit_changed (GL_LABEL_OBJECT(ltext)); } @@ -739,5 +709,5 @@ gl_label_text_get_auto_shrink (glLabelText *ltext) g_return_val_if_fail (ltext && GL_IS_LABEL_TEXT (ltext), 0); - return ltext->private->auto_shrink; + return ltext->priv->auto_shrink; } diff --git a/glabels2/src/label-text.h b/glabels2/src/label-text.h index 50a359a0..e0997fef 100644 --- a/glabels2/src/label-text.h +++ b/glabels2/src/label-text.h @@ -48,7 +48,7 @@ typedef struct _glLabelTextPrivate glLabelTextPrivate; struct _glLabelText { glLabelObject object; - glLabelTextPrivate *private; + glLabelTextPrivate *priv; }; struct _glLabelTextClass { diff --git a/glabels2/src/label.c b/glabels2/src/label.c index e80c0a17..8ed9016e 100644 --- a/glabels2/src/label.c +++ b/glabels2/src/label.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -67,8 +69,6 @@ enum { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - static guint signals[LAST_SIGNAL] = {0}; static guint untitled = 0; @@ -77,9 +77,7 @@ static guint untitled = 0; /* Private function prototypes. */ /*========================================================*/ -static void gl_label_class_init (glLabelClass *klass); -static void gl_label_instance_init (glLabel *label); -static void gl_label_finalize (GObject *object); +static void gl_label_finalize (GObject *object); static void object_changed_cb (glLabelObject *object, glLabel *label); @@ -93,40 +91,16 @@ static void object_moved_cb (glLabelObject *object, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_label_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glLabelClass), - NULL, - NULL, - (GClassInitFunc) gl_label_class_init, - NULL, - NULL, - sizeof (glLabel), - 0, - (GInstanceInitFunc) gl_label_instance_init, - NULL - }; - - type = g_type_register_static (G_TYPE_OBJECT, - "glLabel", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glLabel, gl_label, G_TYPE_OBJECT); static void -gl_label_class_init (glLabelClass *klass) +gl_label_class_init (glLabelClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_LABEL, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_label_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_label_finalize; @@ -180,15 +154,16 @@ gl_label_class_init (glLabelClass *klass) } static void -gl_label_instance_init (glLabel *label) +gl_label_init (glLabel *label) { gl_debug (DEBUG_LABEL, "START"); - label->private = g_new0 (glLabelPrivate, 1); - label->private->template = NULL; - label->private->filename = NULL; - label->private->merge = NULL; - label->private->pixbuf_cache = gl_pixbuf_cache_new (); + label->priv = g_new0 (glLabelPrivate, 1); + + label->priv->template = NULL; + label->priv->filename = NULL; + label->priv->merge = NULL; + label->priv->pixbuf_cache = gl_pixbuf_cache_new (); gl_debug (DEBUG_LABEL, "END"); } @@ -196,30 +171,28 @@ gl_label_instance_init (glLabel *label) static void gl_label_finalize (GObject *object) { - glLabel *label; + glLabel *label = GL_LABEL (object); GList *p, *p_next; gl_debug (DEBUG_LABEL, "START"); g_return_if_fail (object && GL_IS_LABEL (object)); - label = GL_LABEL (object); - for (p = label->objects; p != NULL; p = p_next) { p_next = p->next; /* NOTE: p will be left dangling */ g_object_unref (G_OBJECT(p->data)); } - gl_template_free (label->private->template); - g_free (label->private->filename); - if (label->private->merge != NULL) { - g_object_unref (G_OBJECT(label->private->merge)); + gl_template_free (label->priv->template); + g_free (label->priv->filename); + if (label->priv->merge != NULL) { + g_object_unref (G_OBJECT(label->priv->merge)); } - gl_pixbuf_cache_free (label->private->pixbuf_cache); + gl_pixbuf_cache_free (label->priv->pixbuf_cache); - g_free (label->private); + g_free (label->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_label_parent_class)->finalize (object); gl_debug (DEBUG_LABEL, "END"); } @@ -233,9 +206,9 @@ gl_label_new (void) label = g_object_new (gl_label_get_type(), NULL); - label->private->compression = 9; + label->priv->compression = 9; - label->private->modified_flag = FALSE; + label->priv->modified_flag = FALSE; gl_debug (DEBUG_LABEL, "END"); @@ -258,7 +231,7 @@ gl_label_add_object (glLabel *label, object->parent = label; label->objects = g_list_append (label->objects, object); - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); @@ -296,7 +269,7 @@ gl_label_remove_object (glLabel *label, G_CALLBACK(object_moved_cb), label); - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); @@ -314,9 +287,9 @@ object_changed_cb (glLabelObject *object, glLabel *label) { - if ( !label->private->modified_flag ) { + if ( !label->priv->modified_flag ) { - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); } @@ -334,9 +307,9 @@ object_moved_cb (glLabelObject *object, glLabel *label) { - if ( !label->private->modified_flag ) { + if ( !label->priv->modified_flag ) { - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); } @@ -357,7 +330,7 @@ gl_label_raise_object_to_top (glLabel *label, label->objects = g_list_remove (label->objects, object); label->objects = g_list_append (label->objects, object); - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); @@ -378,7 +351,7 @@ gl_label_lower_object_to_bottom (glLabel *label, label->objects = g_list_remove (label->objects, object); label->objects = g_list_prepend (label->objects, object); - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); g_signal_emit (G_OBJECT(label), signals[CHANGED], 0); @@ -397,13 +370,13 @@ gl_label_set_template (glLabel *label, g_return_if_fail (label && GL_IS_LABEL (label)); - if ((label->private->template == NULL) || - (g_strcasecmp (template->name, label->private->template->name) != 0)) { + if ((label->priv->template == NULL) || + (g_strcasecmp (template->name, label->priv->template->name) != 0)) { - gl_template_free (label->private->template); - label->private->template = gl_template_dup (template); + gl_template_free (label->priv->template); + label->priv->template = gl_template_dup (template); - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); g_signal_emit (G_OBJECT(label), signals[SIZE_CHANGED], 0); @@ -425,11 +398,11 @@ gl_label_set_rotate_flag (glLabel *label, g_return_if_fail (label && GL_IS_LABEL (label)); - if (rotate_flag != label->private->rotate_flag) { + if (rotate_flag != label->priv->rotate_flag) { - label->private->rotate_flag = rotate_flag; + label->priv->rotate_flag = rotate_flag; - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); g_signal_emit (G_OBJECT(label), signals[SIZE_CHANGED], 0); @@ -452,7 +425,7 @@ gl_label_get_template (glLabel *label) gl_debug (DEBUG_LABEL, "END"); - return gl_template_dup (label->private->template); + return gl_template_dup (label->priv->template); } /****************************************************************************/ @@ -467,7 +440,7 @@ gl_label_get_rotate_flag (glLabel *label) gl_debug (DEBUG_LABEL, "END"); - return label->private->rotate_flag; + return label->priv->rotate_flag; } /****************************************************************************/ @@ -485,7 +458,7 @@ gl_label_get_size (glLabel *label, g_return_if_fail (label && GL_IS_LABEL (label)); - template = label->private->template; + template = label->priv->template; if ( !template ) { gl_debug (DEBUG_LABEL, "END -- template NULL"); *w = *h = 0; @@ -493,7 +466,7 @@ gl_label_get_size (glLabel *label, } label_type = gl_template_get_first_label_type (template); - if (!label->private->rotate_flag) { + if (!label->priv->rotate_flag) { gl_template_get_label_size (label_type, w, h); } else { gl_template_get_label_size (label_type, h, w); @@ -513,12 +486,12 @@ gl_label_set_merge (glLabel *label, g_return_if_fail (label && GL_IS_LABEL (label)); - if ( label->private->merge != NULL ) { - g_object_unref (G_OBJECT(label->private->merge)); + if ( label->priv->merge != NULL ) { + g_object_unref (G_OBJECT(label->priv->merge)); } - label->private->merge = gl_merge_dup (merge); + label->priv->merge = gl_merge_dup (merge); - label->private->modified_flag = TRUE; + label->priv->modified_flag = TRUE; g_signal_emit (G_OBJECT(label), signals[MERGE_CHANGED], 0); g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); @@ -539,7 +512,7 @@ gl_label_get_merge (glLabel *label) gl_debug (DEBUG_LABEL, "END"); - return gl_merge_dup (label->private->merge); + return gl_merge_dup (label->priv->merge); } /****************************************************************************/ @@ -550,7 +523,7 @@ gl_label_get_filename (glLabel *label) { gl_debug (DEBUG_LABEL, ""); - return g_strdup ( label->private->filename ); + return g_strdup ( label->priv->filename ); } /****************************************************************************/ @@ -561,19 +534,19 @@ gl_label_get_short_name (glLabel *label) { gl_debug (DEBUG_LABEL, ""); - if ( label->private->filename == NULL ) { + if ( label->priv->filename == NULL ) { - if ( label->private->untitled_instance == 0 ) { - label->private->untitled_instance = ++untitled; + if ( label->priv->untitled_instance == 0 ) { + label->priv->untitled_instance = ++untitled; } return g_strdup_printf ( "%s %d", _("Untitled"), - label->private->untitled_instance ); + label->priv->untitled_instance ); } else { gchar *temp_name, *short_name; - temp_name = g_path_get_basename ( label->private->filename ); + temp_name = g_path_get_basename ( label->priv->filename ); short_name = gl_util_remove_extension (temp_name); g_free (temp_name); @@ -587,7 +560,7 @@ gl_label_get_short_name (glLabel *label) GHashTable * gl_label_get_pixbuf_cache (glLabel *label) { - return label->private->pixbuf_cache; + return label->priv->pixbuf_cache; } /****************************************************************************/ @@ -596,8 +569,8 @@ gl_label_get_pixbuf_cache (glLabel *label) gboolean gl_label_is_modified (glLabel *label) { - gl_debug (DEBUG_LABEL, "return %d", label->private->modified_flag); - return label->private->modified_flag; + gl_debug (DEBUG_LABEL, "return %d", label->priv->modified_flag); + return label->priv->modified_flag; } /****************************************************************************/ @@ -606,8 +579,8 @@ gl_label_is_modified (glLabel *label) gboolean gl_label_is_untitled (glLabel *label) { - gl_debug (DEBUG_LABEL, "return %d",(label->private->filename == NULL)); - return (label->private->filename == NULL); + gl_debug (DEBUG_LABEL, "return %d",(label->priv->filename == NULL)); + return (label->priv->filename == NULL); } /****************************************************************************/ @@ -637,7 +610,7 @@ void gl_label_set_filename (glLabel *label, const gchar *filename) { - label->private->filename = g_strdup (filename); + label->priv->filename = g_strdup (filename); g_signal_emit (G_OBJECT(label), signals[NAME_CHANGED], 0); } @@ -649,9 +622,9 @@ void gl_label_clear_modified (glLabel *label) { - if ( label->private->modified_flag ) { + if ( label->priv->modified_flag ) { - label->private->modified_flag = FALSE; + label->priv->modified_flag = FALSE; g_signal_emit (G_OBJECT(label), signals[MODIFIED_CHANGED], 0); } @@ -675,7 +648,7 @@ gl_label_set_compression (glLabel *label, } gl_debug (DEBUG_LABEL, "actual set %d", compression); - label->private->compression = compression; + label->priv->compression = compression; } @@ -685,7 +658,7 @@ gl_label_set_compression (glLabel *label, gint gl_label_get_compression (glLabel *label) { - gl_debug (DEBUG_LABEL, "return %d", label->private->compression); - return label->private->compression; + gl_debug (DEBUG_LABEL, "return %d", label->priv->compression); + return label->priv->compression; } diff --git a/glabels2/src/label.h b/glabels2/src/label.h index 8d2873c9..4a908120 100644 --- a/glabels2/src/label.h +++ b/glabels2/src/label.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -47,7 +49,7 @@ struct _glLabel { GList *objects; - glLabelPrivate *private; + glLabelPrivate *priv; }; struct _glLabelClass { diff --git a/glabels2/src/merge-evolution.c b/glabels2/src/merge-evolution.c index 30efb897..78c66fc5 100644 --- a/glabels2/src/merge-evolution.c +++ b/glabels2/src/merge-evolution.c @@ -64,15 +64,10 @@ enum { /* Private globals */ /*===========================================*/ -static glMergeClass *parent_class = NULL; - - /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_merge_evolution_class_init (glMergeEvolutionClass *klass); -static void gl_merge_evolution_instance_init (glMergeEvolution *object); static void gl_merge_evolution_finalize (GObject *object); static void gl_merge_evolution_set_property (GObject *object, @@ -100,41 +95,17 @@ static void free_field_list (GList *fields); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_merge_evolution_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glMergeEvolutionClass), - NULL, - NULL, - (GClassInitFunc) gl_merge_evolution_class_init, - NULL, - NULL, - sizeof (glMergeEvolution), - 0, - (GInstanceInitFunc) gl_merge_evolution_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_MERGE, - "glMergeEvolution", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glMergeEvolution, gl_merge_evolution, GL_TYPE_MERGE); static void -gl_merge_evolution_class_init (glMergeEvolutionClass *klass) +gl_merge_evolution_class_init (glMergeEvolutionClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glMergeClass *merge_class = (glMergeClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glMergeClass *merge_class = GL_MERGE_CLASS (class); gl_debug (DEBUG_MERGE, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_merge_evolution_parent_class = g_type_class_peek_parent (class); object_class->set_property = gl_merge_evolution_set_property; object_class->get_property = gl_merge_evolution_get_property; @@ -160,12 +131,12 @@ gl_merge_evolution_class_init (glMergeEvolutionClass *klass) } static void -gl_merge_evolution_instance_init (glMergeEvolution *merge_evolution) +gl_merge_evolution_init (glMergeEvolution *merge_evolution) { gl_debug (DEBUG_MERGE, "START"); - merge_evolution->private = g_new0 (glMergeEvolutionPrivate, 1); - merge_evolution->private->query = g_strdup(DEFAULT_QUERY); + merge_evolution->priv = g_new0 (glMergeEvolutionPrivate, 1); + merge_evolution->priv->query = g_strdup(DEFAULT_QUERY); gl_debug (DEBUG_MERGE, "END"); } @@ -173,18 +144,17 @@ gl_merge_evolution_instance_init (glMergeEvolution *merge_evolution) static void gl_merge_evolution_finalize (GObject *object) { - glMergeEvolution *merge_evolution; + glMergeEvolution *merge_evolution = GL_MERGE_EVOLUTION (object); gl_debug (DEBUG_MERGE, "START"); g_return_if_fail (object && GL_IS_MERGE_EVOLUTION (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + free_field_list(merge_evolution->priv->fields); + g_free (merge_evolution->priv->query); + g_free (merge_evolution->priv); - merge_evolution = GL_MERGE_EVOLUTION (object); - free_field_list(merge_evolution->private->fields); - g_free (merge_evolution->private->query); - g_free (merge_evolution->private); + G_OBJECT_CLASS (gl_merge_evolution_parent_class)->finalize (object); gl_debug (DEBUG_MERGE, "END"); } @@ -205,10 +175,10 @@ gl_merge_evolution_set_property (GObject *object, switch (param_id) { case ARG_QUERY: - g_free (merge_evolution->private->query); - merge_evolution->private->query = g_value_dup_string (value); + g_free (merge_evolution->priv->query); + merge_evolution->priv->query = g_value_dup_string (value); gl_debug (DEBUG_MERGE, "ARG \"query\" = \"%s\"", - merge_evolution->private->query); + merge_evolution->priv->query); break; default: @@ -235,7 +205,7 @@ gl_merge_evolution_get_property (GObject *object, switch (param_id) { case ARG_QUERY: - g_value_set_string (value, merge_evolution->private->query); + g_value_set_string (value, merge_evolution->priv->query); break; default: @@ -262,7 +232,7 @@ gl_merge_evolution_get_key_list (glMerge *merge) /* for the previously retrieved supported fileds, go through them and find * their pretty names */ - for (iter = merge_evolution->private->fields; + for (iter = merge_evolution->priv->fields; iter != NULL; iter = g_list_next(iter)) { @@ -303,38 +273,38 @@ gl_merge_evolution_open (glMerge *merge) merge_evolution = GL_MERGE_EVOLUTION (merge); - query = e_book_query_from_string(merge_evolution->private->query); + query = e_book_query_from_string(merge_evolution->priv->query); if (!query) { g_warning (_("Couldn't construct query")); return; } - merge_evolution->private->book = e_book_new_system_addressbook(&error); - if (!merge_evolution->private->book) { + merge_evolution->priv->book = e_book_new_system_addressbook(&error); + if (!merge_evolution->priv->book) { g_warning (_("Couldn't open addressbook: %s"), error->message); e_book_query_unref(query); g_error_free (error); return; } - if (!e_book_open(merge_evolution->private->book, TRUE, &error)) { + if (!e_book_open(merge_evolution->priv->book, TRUE, &error)) { g_warning (_("Couldn't open addressbook: %s"), error->message); g_error_free (error); e_book_query_unref(query); - g_object_unref(merge_evolution->private->book); - merge_evolution->private->book = NULL; + g_object_unref(merge_evolution->priv->book); + merge_evolution->priv->book = NULL; return; } /* fetch the list of fields supported by this address book */ - status = e_book_get_supported_fields(merge_evolution->private->book, + status = e_book_get_supported_fields(merge_evolution->priv->book, &fields, &error); if (status == FALSE) { g_warning (_("Couldn't list available fields: %s"), error->message); g_error_free (error); e_book_query_unref(query); - g_object_unref(merge_evolution->private->book); - merge_evolution->private->book = NULL; + g_object_unref(merge_evolution->priv->book); + merge_evolution->priv->book = NULL; return; } @@ -349,25 +319,25 @@ gl_merge_evolution_open (glMerge *merge) continue; } - merge_evolution->private->fields = - g_list_prepend(merge_evolution->private->fields, field_id); + merge_evolution->priv->fields = + g_list_prepend(merge_evolution->priv->fields, field_id); } free_field_list(fields); /* don't need the list of names anymore */ - gl_debug(DEBUG_MERGE, "Field list length: %d", g_list_length(merge_evolution->private->fields)); + gl_debug(DEBUG_MERGE, "Field list length: %d", g_list_length(merge_evolution->priv->fields)); /* finally retrieve the contacts */ - status = e_book_get_contacts (merge_evolution->private->book, + status = e_book_get_contacts (merge_evolution->priv->book, query, - &merge_evolution->private->contacts, + &merge_evolution->priv->contacts, &error); if (status == FALSE) { g_warning (_("Couldn't get contacts: %s"), error->message); g_error_free (error); e_book_query_unref(query); - free_field_list(merge_evolution->private->fields); - g_object_unref(merge_evolution->private->book); - merge_evolution->private->book = NULL; + free_field_list(merge_evolution->priv->fields); + g_object_unref(merge_evolution->priv->book); + merge_evolution->priv->book = NULL; return; } @@ -392,10 +362,10 @@ gl_merge_evolution_close (glMerge *merge) merge_evolution = GL_MERGE_EVOLUTION (merge); /* unref all of the objects created in _open */ - g_object_unref(merge_evolution->private->book); - merge_evolution->private->book = NULL; + g_object_unref(merge_evolution->priv->book); + merge_evolution->priv->book = NULL; - for (iter = merge_evolution->private->contacts; + for (iter = merge_evolution->priv->contacts; iter != NULL; iter = g_list_next(iter)) { @@ -403,8 +373,8 @@ gl_merge_evolution_close (glMerge *merge) g_object_unref(contact); } - g_list_free(merge_evolution->private->contacts); - merge_evolution->private->contacts = NULL; + g_list_free(merge_evolution->priv->contacts); + merge_evolution->priv->contacts = NULL; } /*--------------------------------------------------------------------------*/ @@ -423,7 +393,7 @@ gl_merge_evolution_get_record (glMerge *merge) merge_evolution = GL_MERGE_EVOLUTION (merge); - head = merge_evolution->private->contacts; + head = merge_evolution->priv->contacts; if (head == NULL) { return NULL; /* past the last record */ } @@ -437,7 +407,7 @@ gl_merge_evolution_get_record (glMerge *merge) * that contact */ /* iterate through the supported fields, and add them to the list */ - for (iter = merge_evolution->private->fields; + for (iter = merge_evolution->priv->fields; iter != NULL; iter = g_list_next(iter)) { @@ -457,8 +427,8 @@ gl_merge_evolution_get_record (glMerge *merge) /* do a destructive read */ g_object_unref (contact); - merge_evolution->private->contacts = - g_list_remove_link (merge_evolution->private->contacts, head); + merge_evolution->priv->contacts = + g_list_remove_link (merge_evolution->priv->contacts, head); g_list_free_1 (head); return record; @@ -481,11 +451,11 @@ gl_merge_evolution_copy (glMerge *dst_merge, dst_merge_evolution = GL_MERGE_EVOLUTION (dst_merge); src_merge_evolution = GL_MERGE_EVOLUTION (src_merge); - dst_merge_evolution->private->query = g_strdup(src_merge_evolution->private->query); + dst_merge_evolution->priv->query = g_strdup(src_merge_evolution->priv->query); - dst_merge_evolution->private->fields = g_list_copy(src_merge_evolution->private->fields); - for (src_iter = src_merge_evolution->private->fields, - dst_iter = dst_merge_evolution->private->fields; + dst_merge_evolution->priv->fields = g_list_copy(src_merge_evolution->priv->fields); + for (src_iter = src_merge_evolution->priv->fields, + dst_iter = dst_merge_evolution->priv->fields; src_iter != NULL && dst_iter != NULL; src_iter = g_list_next(src_iter), dst_iter = g_list_next(dst_iter)) { diff --git a/glabels2/src/merge-evolution.h b/glabels2/src/merge-evolution.h index 32c8a9c0..26468abc 100644 --- a/glabels2/src/merge-evolution.h +++ b/glabels2/src/merge-evolution.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -31,7 +33,7 @@ G_BEGIN_DECLS /* The following object arguments are available: * * name type description - * -------------------------------------------------------------------------------- + * --------------------------------------------------------------------------- * query gchar* The query used to select records * */ @@ -51,13 +53,13 @@ typedef struct _glMergeEvolutionPrivate glMergeEvolutionPrivate; struct _glMergeEvolution { - glMerge object; + glMerge object; - glMergeEvolutionPrivate *private; + glMergeEvolutionPrivate *priv; }; struct _glMergeEvolutionClass { - glMergeClass parent_class; + glMergeClass parent_class; }; diff --git a/glabels2/src/merge-init.c b/glabels2/src/merge-init.c index d44d3c07..b62551be 100644 --- a/glabels2/src/merge-init.c +++ b/glabels2/src/merge-init.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/merge-init.h b/glabels2/src/merge-init.h index 33d48ec9..7bd57eef 100644 --- a/glabels2/src/merge-init.h +++ b/glabels2/src/merge-init.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/merge-properties-dialog.c b/glabels2/src/merge-properties-dialog.c index c21f521a..d0b52610 100644 --- a/glabels2/src/merge-properties-dialog.c +++ b/glabels2/src/merge-properties-dialog.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME @@ -84,14 +84,11 @@ enum { /* Private globals */ /*===========================================*/ -static GtkDialogClass* parent_class = NULL; /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_merge_properties_dialog_class_init (glMergePropertiesDialogClass *klass); -static void gl_merge_properties_dialog_init (glMergePropertiesDialog *dlg); static void gl_merge_properties_dialog_finalize (GObject *object); static void gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog, glLabel *label, @@ -124,42 +121,16 @@ static void unselect_all_button_clicked_cb (GtkWidget /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_merge_properties_dialog_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo info = - { - sizeof (glMergePropertiesDialogClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gl_merge_properties_dialog_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glMergePropertiesDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) gl_merge_properties_dialog_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_DIALOG, - "glMergePropertiesDialog", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glMergePropertiesDialog, gl_merge_properties_dialog, GTK_TYPE_DIALOG); static void -gl_merge_properties_dialog_class_init (glMergePropertiesDialogClass *klass) +gl_merge_properties_dialog_class_init (glMergePropertiesDialogClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_MERGE, ""); - parent_class = g_type_class_peek_parent (klass); + gl_merge_properties_dialog_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_merge_properties_dialog_finalize; } @@ -200,25 +171,20 @@ gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog) static void gl_merge_properties_dialog_finalize (GObject *object) { - glMergePropertiesDialog* dialog; + glMergePropertiesDialog* dialog = GL_MERGE_PROPERTIES_DIALOG (object); gl_debug (DEBUG_MERGE, "START"); g_return_if_fail (object != NULL); - - dialog = GL_MERGE_PROPERTIES_DIALOG (object); - g_return_if_fail (GL_IS_MERGE_PROPERTIES_DIALOG (dialog)); g_return_if_fail (dialog->priv != NULL); - G_OBJECT_CLASS (parent_class)->finalize (object); - if (dialog->priv->merge != NULL) { g_object_unref (G_OBJECT (dialog->priv->merge)); } - g_free (dialog->priv); + G_OBJECT_CLASS (gl_merge_properties_dialog_parent_class)->finalize (object); gl_debug (DEBUG_MERGE, "END"); } diff --git a/glabels2/src/merge-properties-dialog.h b/glabels2/src/merge-properties-dialog.h index 3fcc28a5..f98ea7bf 100644 --- a/glabels2/src/merge-properties-dialog.h +++ b/glabels2/src/merge-properties-dialog.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/merge-text.c b/glabels2/src/merge-text.c index 8802235a..77afcfed 100644 --- a/glabels2/src/merge-text.c +++ b/glabels2/src/merge-text.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -52,15 +54,11 @@ enum { /* Private globals */ /*===========================================*/ -static glMergeClass *parent_class = NULL; - /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_merge_text_class_init (glMergeTextClass *klass); -static void gl_merge_text_instance_init (glMergeText *object); static void gl_merge_text_finalize (GObject *object); static void gl_merge_text_set_property (GObject *object, @@ -89,41 +87,17 @@ static void free_fields (GList **fields); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_merge_text_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glMergeTextClass), - NULL, - NULL, - (GClassInitFunc) gl_merge_text_class_init, - NULL, - NULL, - sizeof (glMergeText), - 0, - (GInstanceInitFunc) gl_merge_text_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_MERGE, - "glMergeText", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glMergeText, gl_merge_text, GL_TYPE_MERGE); static void -gl_merge_text_class_init (glMergeTextClass *klass) +gl_merge_text_class_init (glMergeTextClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glMergeClass *merge_class = (glMergeClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glMergeClass *merge_class = GL_MERGE_CLASS (class); gl_debug (DEBUG_MERGE, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_merge_text_parent_class = g_type_class_peek_parent (class); object_class->set_property = gl_merge_text_set_property; object_class->get_property = gl_merge_text_get_property; @@ -148,11 +122,11 @@ gl_merge_text_class_init (glMergeTextClass *klass) } static void -gl_merge_text_instance_init (glMergeText *merge_text) +gl_merge_text_init (glMergeText *merge_text) { gl_debug (DEBUG_MERGE, "START"); - merge_text->private = g_new0 (glMergeTextPrivate, 1); + merge_text->priv = g_new0 (glMergeTextPrivate, 1); gl_debug (DEBUG_MERGE, "END"); } @@ -160,11 +134,15 @@ gl_merge_text_instance_init (glMergeText *merge_text) static void gl_merge_text_finalize (GObject *object) { + glMergeText *merge_text = GL_MERGE_TEXT (object); + gl_debug (DEBUG_MERGE, "START"); g_return_if_fail (object && GL_IS_MERGE_TEXT (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (merge_text->priv); + + G_OBJECT_CLASS (gl_merge_text_parent_class)->finalize (object); gl_debug (DEBUG_MERGE, "END"); } @@ -185,9 +163,9 @@ gl_merge_text_set_property (GObject *object, switch (param_id) { case ARG_DELIM: - merge_text->private->delim = g_value_get_char (value); + merge_text->priv->delim = g_value_get_char (value); gl_debug (DEBUG_MERGE, "ARG \"delim\" = \"%c\"", - merge_text->private->delim); + merge_text->priv->delim); break; default: @@ -214,7 +192,7 @@ gl_merge_text_get_property (GObject *object, switch (param_id) { case ARG_DELIM: - g_value_set_char (value, merge_text->private->delim); + g_value_set_char (value, merge_text->priv->delim); break; default: @@ -291,7 +269,7 @@ gl_merge_text_open (glMerge *merge) src = gl_merge_get_src (merge); if (src != NULL) { - merge_text->private->fp = fopen (src, "r"); + merge_text->priv->fp = fopen (src, "r"); } g_free (src); @@ -307,10 +285,10 @@ gl_merge_text_close (glMerge *merge) merge_text = GL_MERGE_TEXT (merge); - if (merge_text->private->fp != NULL) { + if (merge_text->priv->fp != NULL) { - fclose (merge_text->private->fp); - merge_text->private->fp = NULL; + fclose (merge_text->priv->fp); + merge_text->priv->fp = NULL; } } @@ -331,8 +309,8 @@ gl_merge_text_get_record (glMerge *merge) merge_text = GL_MERGE_TEXT (merge); - delim = merge_text->private->delim; - fp = merge_text->private->fp; + delim = merge_text->priv->delim; + fp = merge_text->priv->fp; if (fp == NULL) { return NULL; @@ -376,7 +354,7 @@ gl_merge_text_copy (glMerge *dst_merge, dst_merge_text = GL_MERGE_TEXT (dst_merge); src_merge_text = GL_MERGE_TEXT (src_merge); - dst_merge_text->private->delim = src_merge_text->private->delim; + dst_merge_text->priv->delim = src_merge_text->priv->delim; } /*---------------------------------------------------------------------------*/ diff --git a/glabels2/src/merge-text.h b/glabels2/src/merge-text.h index 7bf03700..65bad54d 100644 --- a/glabels2/src/merge-text.h +++ b/glabels2/src/merge-text.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -29,7 +31,7 @@ G_BEGIN_DECLS /* The following object arguments are available: * * name type description - * -------------------------------------------------------------------------------- + * --------------------------------------------------------------------------- * delim gchar Field delimiter. * */ @@ -51,7 +53,7 @@ typedef struct _glMergeTextPrivate glMergeTextPrivate; struct _glMergeText { glMerge object; - glMergeTextPrivate *private; + glMergeTextPrivate *priv; }; struct _glMergeTextClass { diff --git a/glabels2/src/merge-vcard.c b/glabels2/src/merge-vcard.c index 3ab663d6..c0eb1449 100644 --- a/glabels2/src/merge-vcard.c +++ b/glabels2/src/merge-vcard.c @@ -58,15 +58,11 @@ enum { /* Private globals */ /*===========================================*/ -static glMergeClass *parent_class = NULL; - /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_merge_vcard_class_init (glMergeVCardClass *klass); -static void gl_merge_vcard_instance_init (glMergeVCard *object); static void gl_merge_vcard_finalize (GObject *object); static void gl_merge_vcard_set_property (GObject *object, @@ -88,46 +84,22 @@ static void gl_merge_vcard_copy (glMerge *dst_merg glMerge *src_merge); static char * parse_next_vcard (FILE *fp); -/* utility function prototypes go here */ + /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_merge_vcard_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glMergeVCardClass), - NULL, - NULL, - (GClassInitFunc) gl_merge_vcard_class_init, - NULL, - NULL, - sizeof (glMergeVCard), - 0, - (GInstanceInitFunc) gl_merge_vcard_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_MERGE, - "glMergeVCard", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glMergeVCard, gl_merge_vcard, GL_TYPE_MERGE); static void -gl_merge_vcard_class_init (glMergeVCardClass *klass) +gl_merge_vcard_class_init (glMergeVCardClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glMergeClass *merge_class = (glMergeClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glMergeClass *merge_class = GL_MERGE_CLASS (class); gl_debug (DEBUG_MERGE, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_merge_vcard_parent_class = g_type_class_peek_parent (class); object_class->set_property = gl_merge_vcard_set_property; object_class->get_property = gl_merge_vcard_get_property; @@ -145,11 +117,11 @@ gl_merge_vcard_class_init (glMergeVCardClass *klass) } static void -gl_merge_vcard_instance_init (glMergeVCard *merge_vcard) +gl_merge_vcard_init (glMergeVCard *merge_vcard) { gl_debug (DEBUG_MERGE, "START"); - merge_vcard->private = g_new0 (glMergeVCardPrivate, 1); + merge_vcard->priv = g_new0 (glMergeVCardPrivate, 1); gl_debug (DEBUG_MERGE, "END"); } @@ -157,16 +129,15 @@ gl_merge_vcard_instance_init (glMergeVCard *merge_vcard) static void gl_merge_vcard_finalize (GObject *object) { - glMergeVCard *merge_vcard; + glMergeVCard *merge_vcard = GL_MERGE_VCARD (object); gl_debug (DEBUG_MERGE, "START"); g_return_if_fail (object && GL_IS_MERGE_VCARD (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (merge_vcard->priv); - merge_vcard = GL_MERGE_VCARD (object); - g_free (merge_vcard->private); + G_OBJECT_CLASS (gl_merge_vcard_parent_class)->finalize (object); gl_debug (DEBUG_MERGE, "END"); } @@ -263,7 +234,7 @@ gl_merge_vcard_open (glMerge *merge) src = gl_merge_get_src (merge); if (src != NULL) { - merge_vcard->private->fp = fopen (src, "r"); + merge_vcard->priv->fp = fopen (src, "r"); } g_free (src); @@ -281,9 +252,9 @@ gl_merge_vcard_close (glMerge *merge) merge_vcard = GL_MERGE_VCARD (merge); - if (merge_vcard->private->fp != NULL) { - fclose (merge_vcard->private->fp); - merge_vcard->private->fp = NULL; + if (merge_vcard->priv->fp != NULL) { + fclose (merge_vcard->priv->fp); + merge_vcard->priv->fp = NULL; } } @@ -302,7 +273,7 @@ gl_merge_vcard_get_record (glMerge *merge) merge_vcard = GL_MERGE_VCARD (merge); - vcard = parse_next_vcard(merge_vcard->private->fp); + vcard = parse_next_vcard(merge_vcard->priv->fp); if (vcard == NULL || vcard[0] == '\0') { return NULL; /* EOF */ } diff --git a/glabels2/src/merge-vcard.h b/glabels2/src/merge-vcard.h index b6712e3c..7ede444f 100644 --- a/glabels2/src/merge-vcard.h +++ b/glabels2/src/merge-vcard.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -31,7 +33,7 @@ G_BEGIN_DECLS /* The following object arguments are available: * * name type description - * -------------------------------------------------------------------------------- + * --------------------------------------------------------------------------- * */ @@ -52,7 +54,7 @@ typedef struct _glMergeVCardPrivate glMergeVCardPrivate; struct _glMergeVCard { glMerge object; - glMergeVCardPrivate *private; + glMergeVCardPrivate *priv; }; struct _glMergeVCardClass { diff --git a/glabels2/src/merge.c b/glabels2/src/merge.c index 2bba656c..b5429baf 100644 --- a/glabels2/src/merge.c +++ b/glabels2/src/merge.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -62,16 +64,12 @@ typedef struct { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - static GList *backends = NULL; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_merge_class_init (glMergeClass *klass); -static void gl_merge_instance_init (glMerge *object); static void gl_merge_finalize (GObject *object); static void merge_open (glMerge *merge); @@ -227,40 +225,16 @@ gl_merge_description_to_name (gchar *description) /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_merge_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glMergeClass), - NULL, - NULL, - (GClassInitFunc) gl_merge_class_init, - NULL, - NULL, - sizeof (glMerge), - 0, - (GInstanceInitFunc) gl_merge_instance_init, - NULL - }; - - type = g_type_register_static (G_TYPE_OBJECT, - "glMerge", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glMerge, gl_merge, G_TYPE_OBJECT); static void -gl_merge_class_init (glMergeClass *klass) +gl_merge_class_init (glMergeClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_MERGE, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_merge_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_merge_finalize; @@ -268,11 +242,11 @@ gl_merge_class_init (glMergeClass *klass) } static void -gl_merge_instance_init (glMerge *merge) +gl_merge_init (glMerge *merge) { gl_debug (DEBUG_MERGE, "START"); - merge->private = g_new0 (glMergePrivate, 1); + merge->priv = g_new0 (glMergePrivate, 1); gl_debug (DEBUG_MERGE, "END"); } @@ -280,17 +254,19 @@ gl_merge_instance_init (glMerge *merge) static void gl_merge_finalize (GObject *object) { + glMerge *merge = GL_MERGE (object); + gl_debug (DEBUG_MERGE, "START"); g_return_if_fail (object && GL_IS_MERGE (object)); - merge_free_record_list (&GL_MERGE(object)->private->record_list); - g_free (GL_MERGE(object)->private->name); - g_free (GL_MERGE(object)->private->description); - g_free (GL_MERGE(object)->private->src); - g_free (GL_MERGE(object)->private); + merge_free_record_list (&merge->priv->record_list); + g_free (merge->priv->name); + g_free (merge->priv->description); + g_free (merge->priv->src); + g_free (merge->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_merge_parent_class)->finalize (object); gl_debug (DEBUG_MERGE, "END"); } @@ -316,9 +292,9 @@ gl_merge_new (gchar *name) backend->n_params, backend->params)); - merge->private->name = g_strdup (name); - merge->private->description = g_strdup (backend->description); - merge->private->src_type = backend->src_type; + merge->priv->name = g_strdup (name); + merge->priv->description = g_strdup (backend->description); + merge->priv->src_type = backend->src_type; break; } @@ -351,12 +327,12 @@ gl_merge_dup (glMerge *src_merge) g_return_val_if_fail (GL_IS_MERGE (src_merge), NULL); dst_merge = g_object_new (G_OBJECT_TYPE(src_merge), NULL); - dst_merge->private->name = g_strdup (src_merge->private->name); - dst_merge->private->description = g_strdup (src_merge->private->description); - dst_merge->private->src = g_strdup (src_merge->private->src); - dst_merge->private->src_type = src_merge->private->src_type; - dst_merge->private->record_list - = merge_dup_record_list (src_merge->private->record_list); + dst_merge->priv->name = g_strdup (src_merge->priv->name); + dst_merge->priv->description = g_strdup (src_merge->priv->description); + dst_merge->priv->src = g_strdup (src_merge->priv->src); + dst_merge->priv->src_type = src_merge->priv->src_type; + dst_merge->priv->record_list + = merge_dup_record_list (src_merge->priv->record_list); if ( GL_MERGE_GET_CLASS(src_merge)->copy != NULL ) { @@ -384,7 +360,7 @@ gl_merge_get_name (glMerge *merge) g_return_val_if_fail (GL_IS_MERGE (merge), g_strdup("None")); - return g_strdup(merge->private->name); + return g_strdup(merge->priv->name); } /*****************************************************************************/ @@ -401,7 +377,7 @@ gl_merge_get_description (glMerge *merge) g_return_val_if_fail (GL_IS_MERGE (merge), g_strdup(_("None"))); - return g_strdup(merge->private->description); + return g_strdup(merge->priv->description); } /*****************************************************************************/ @@ -418,7 +394,7 @@ gl_merge_get_src_type (glMerge *merge) g_return_val_if_fail (GL_IS_MERGE (merge), GL_MERGE_SRC_IS_FIXED); - return merge->private->src_type; + return merge->priv->src_type; } /*****************************************************************************/ @@ -444,24 +420,24 @@ gl_merge_set_src (glMerge *merge, if ( src == NULL) { - if ( merge->private->src != NULL ) + if ( merge->priv->src != NULL ) { - g_free (merge->private->src); + g_free (merge->priv->src); } - merge->private->src = NULL; - merge_free_record_list (&merge->private->record_list); + merge->priv->src = NULL; + merge_free_record_list (&merge->priv->record_list); } else { - if ( merge->private->src != NULL ) + if ( merge->priv->src != NULL ) { - g_free(merge->private->src); + g_free(merge->priv->src); } - merge->private->src = g_strdup (src); + merge->priv->src = g_strdup (src); - merge_free_record_list (&merge->private->record_list); + merge_free_record_list (&merge->priv->record_list); merge_open (merge); while ( (record = merge_get_record (merge)) != NULL ) @@ -469,7 +445,7 @@ gl_merge_set_src (glMerge *merge, record_list = g_list_append( record_list, record ); } merge_close (merge); - merge->private->record_list = record_list; + merge->priv->record_list = record_list; } @@ -491,7 +467,7 @@ gl_merge_get_src (glMerge *merge) g_return_val_if_fail (GL_IS_MERGE (merge), NULL); - return g_strdup(merge->private->src); + return g_strdup(merge->priv->src); } /*****************************************************************************/ @@ -734,7 +710,7 @@ gl_merge_get_record_list (glMerge *merge) gl_debug (DEBUG_MERGE, ""); if ( merge != NULL ) { - return merge->private->record_list; + return merge->priv->record_list; } else { return NULL; } @@ -801,7 +777,7 @@ gl_merge_get_record_count (glMerge *merge) gl_debug (DEBUG_MERGE, "START"); count = 0; - for ( p=merge->private->record_list; p!=NULL; p=p->next ) { + for ( p=merge->priv->record_list; p!=NULL; p=p->next ) { record = (glMergeRecord *)p->data; if ( record->select_flag ) count ++; diff --git a/glabels2/src/merge.h b/glabels2/src/merge.h index f69922dc..819ca25b 100644 --- a/glabels2/src/merge.h +++ b/glabels2/src/merge.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -59,7 +61,7 @@ typedef struct _glMergePrivate glMergePrivate; struct _glMerge { GObject object; - glMergePrivate *private; + glMergePrivate *priv; }; struct _glMergeClass { diff --git a/glabels2/src/mini-preview-pixbuf.h b/glabels2/src/mini-preview-pixbuf.h index 84ecd24b..05bd3235 100644 --- a/glabels2/src/mini-preview-pixbuf.h +++ b/glabels2/src/mini-preview-pixbuf.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/new-label-dialog.c b/glabels2/src/new-label-dialog.c index 0864c8aa..990cf2f4 100644 --- a/glabels2/src/new-label-dialog.c +++ b/glabels2/src/new-label-dialog.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME @@ -54,14 +54,10 @@ struct _glNewLabelDialogPrivate { /* Private globals */ /*===========================================*/ -static GtkDialogClass* parent_class = NULL; - /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_new_label_dialog_class_init (glNewLabelDialogClass *klass); -static void gl_new_label_dialog_init (glNewLabelDialog *dlg); static void gl_new_label_dialog_finalize (GObject *object); static void gl_new_label_dialog_construct (glNewLabelDialog *dialog, @@ -75,42 +71,16 @@ static void template_changed_cb (glWdgtMediaSelect *se /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_new_label_dialog_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo info = - { - sizeof (glNewLabelDialogClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gl_new_label_dialog_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glNewLabelDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) gl_new_label_dialog_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_DIALOG, - "glNewLabelDialog", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glNewLabelDialog, gl_new_label_dialog, GTK_TYPE_DIALOG); static void -gl_new_label_dialog_class_init (glNewLabelDialogClass *klass) +gl_new_label_dialog_class_init (glNewLabelDialogClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_FILE, ""); - parent_class = g_type_class_peek_parent (klass); + gl_new_label_dialog_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_new_label_dialog_finalize; } @@ -151,20 +121,17 @@ gl_new_label_dialog_init (glNewLabelDialog *dialog) static void gl_new_label_dialog_finalize (GObject *object) { - glNewLabelDialog* dialog; + glNewLabelDialog* dialog = GL_NEW_LABEL_DIALOG (object);; gl_debug (DEBUG_FILE, "START"); g_return_if_fail (object != NULL); - - dialog = GL_NEW_LABEL_DIALOG (object); - g_return_if_fail (GL_IS_NEW_LABEL_DIALOG (dialog)); g_return_if_fail (dialog->priv != NULL); g_free (dialog->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_new_label_dialog_parent_class)->finalize (object); gl_debug (DEBUG_FILE, "END"); diff --git a/glabels2/src/new-label-dialog.h b/glabels2/src/new-label-dialog.h index 291c3971..a38a48d9 100644 --- a/glabels2/src/new-label-dialog.h +++ b/glabels2/src/new-label-dialog.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/object-editor-bc-page.c b/glabels2/src/object-editor-bc-page.c index b5b57fc7..f2863c87 100644 --- a/glabels2/src/object-editor-bc-page.c +++ b/glabels2/src/object-editor-bc-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-data-page.c b/glabels2/src/object-editor-data-page.c index 0cc62916..77380c36 100644 --- a/glabels2/src/object-editor-data-page.c +++ b/glabels2/src/object-editor-data-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-edit-page.c b/glabels2/src/object-editor-edit-page.c index ba9c584b..9ff2bc86 100644 --- a/glabels2/src/object-editor-edit-page.c +++ b/glabels2/src/object-editor-edit-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-fill-page.c b/glabels2/src/object-editor-fill-page.c index 52a38b64..b8fd91ef 100644 --- a/glabels2/src/object-editor-fill-page.c +++ b/glabels2/src/object-editor-fill-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-image-page.c b/glabels2/src/object-editor-image-page.c index b8d13ed0..989fa24d 100644 --- a/glabels2/src/object-editor-image-page.c +++ b/glabels2/src/object-editor-image-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-line-page.c b/glabels2/src/object-editor-line-page.c index e1aa2831..fd4c17d1 100644 --- a/glabels2/src/object-editor-line-page.c +++ b/glabels2/src/object-editor-line-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-lsize-page.c b/glabels2/src/object-editor-lsize-page.c index fb3861fd..4a3dd0d3 100644 --- a/glabels2/src/object-editor-lsize-page.c +++ b/glabels2/src/object-editor-lsize-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-position-page.c b/glabels2/src/object-editor-position-page.c index 96b061df..3f8a2da4 100644 --- a/glabels2/src/object-editor-position-page.c +++ b/glabels2/src/object-editor-position-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-private.h b/glabels2/src/object-editor-private.h index a927bc2c..21244045 100644 --- a/glabels2/src/object-editor-private.h +++ b/glabels2/src/object-editor-private.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-size-page.c b/glabels2/src/object-editor-size-page.c index c250e73e..cdf83e39 100644 --- a/glabels2/src/object-editor-size-page.c +++ b/glabels2/src/object-editor-size-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor-text-page.c b/glabels2/src/object-editor-text-page.c index be4e231e..58cf4c57 100644 --- a/glabels2/src/object-editor-text-page.c +++ b/glabels2/src/object-editor-text-page.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/object-editor.c b/glabels2/src/object-editor.c index 9507ccbb..48c23566 100644 --- a/glabels2/src/object-editor.c +++ b/glabels2/src/object-editor.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /** * (GLABELS) Label and Business Card Creation program for GNOME @@ -60,14 +60,10 @@ typedef void (*ChangedSignal) (GObject * object, gpointer data); gint gl_object_editor_signals[LAST_SIGNAL] = { 0 }; -static GtkVBoxClass *parent_class = NULL; - /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_object_editor_class_init (glObjectEditorClass *klass); -static void gl_object_editor_init (glObjectEditor *editor); static void gl_object_editor_finalize (GObject *object); static void gl_object_notebook_construct_valist (glObjectEditor *editor, @@ -80,42 +76,16 @@ static void prefs_changed_cb (glObjectEditor *editor); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_object_editor_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo info = - { - sizeof (glObjectEditorClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gl_object_editor_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glObjectEditor), - 0, /* n_preallocs */ - (GInstanceInitFunc) gl_object_editor_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_VBOX, - "glObjectEditor", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glObjectEditor, gl_object_editor, GTK_TYPE_VBOX); static void -gl_object_editor_class_init (glObjectEditorClass *klass) +gl_object_editor_class_init (glObjectEditorClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_EDITOR, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_object_editor_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_object_editor_finalize; @@ -181,27 +151,23 @@ gl_object_editor_init (glObjectEditor *editor) static void gl_object_editor_finalize (GObject *object) { - glObjectEditor* editor; + glObjectEditor* editor = GL_OBJECT_EDITOR (object);; gl_debug (DEBUG_EDITOR, "START"); g_return_if_fail (object != NULL); - - editor = GL_OBJECT_EDITOR (object); - g_return_if_fail (GL_IS_OBJECT_EDITOR (editor)); g_return_if_fail (editor->priv != NULL); if (editor->priv->gui) { g_object_unref (G_OBJECT (editor->priv->gui)); } - g_free (editor->priv); g_signal_handlers_disconnect_by_func (G_OBJECT(gl_prefs), prefs_changed_cb, editor); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_object_editor_parent_class)->finalize (object); gl_debug (DEBUG_EDITOR, "END"); } diff --git a/glabels2/src/object-editor.h b/glabels2/src/object-editor.h index 41424a7b..2f229bb7 100644 --- a/glabels2/src/object-editor.h +++ b/glabels2/src/object-editor.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/pixbuf-cache.c b/glabels2/src/pixbuf-cache.c index 4fc01ad1..1641111d 100644 --- a/glabels2/src/pixbuf-cache.c +++ b/glabels2/src/pixbuf-cache.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/pixbuf-cache.h b/glabels2/src/pixbuf-cache.h index 51d0550e..5fe8a80c 100644 --- a/glabels2/src/pixbuf-cache.h +++ b/glabels2/src/pixbuf-cache.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/prefs-dialog.c b/glabels2/src/prefs-dialog.c index d97516bc..8c19a476 100644 --- a/glabels2/src/prefs-dialog.c +++ b/glabels2/src/prefs-dialog.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME @@ -87,105 +87,76 @@ struct _glPrefsDialogPrivate /* Private globals. */ /*========================================================*/ -static GtkDialogClass* parent_class = NULL; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_prefs_dialog_class_init (glPrefsDialogClass *klass); -static void gl_prefs_dialog_init (glPrefsDialog *dlg); static void gl_prefs_dialog_finalize (GObject *object); -static void gl_prefs_dialog_construct (glPrefsDialog *dlg); +static void gl_prefs_dialog_construct (glPrefsDialog *dialog); static void response_cb (glPrefsDialog *dialog, gint response, gpointer user_data); -static void construct_locale_page (glPrefsDialog *dlg); -static void construct_object_page (glPrefsDialog *dlg); +static void construct_locale_page (glPrefsDialog *dialog); +static void construct_object_page (glPrefsDialog *dialog); static void align_toggle_cb (GtkToggleButton *toggle, - glPrefsDialog *dlg); + glPrefsDialog *dialog); -static void update_locale_page_from_prefs (glPrefsDialog *dlg); -static void update_object_page_from_prefs (glPrefsDialog *dlg); +static void update_locale_page_from_prefs (glPrefsDialog *dialog); +static void update_object_page_from_prefs (glPrefsDialog *dialog); -static void update_prefs_from_locale_page (glPrefsDialog *dlg); -static void update_prefs_from_object_page (glPrefsDialog *dlg); +static void update_prefs_from_locale_page (glPrefsDialog *dialog); +static void update_prefs_from_object_page (glPrefsDialog *dialog); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_prefs_dialog_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo info = - { - sizeof (glPrefsDialogClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gl_prefs_dialog_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glPrefsDialog), - 0, /* n_preallocs */ - (GInstanceInitFunc) gl_prefs_dialog_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_DIALOG, - "glPrefsDialog", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glPrefsDialog, gl_prefs_dialog, GTK_TYPE_DIALOG); static void -gl_prefs_dialog_class_init (glPrefsDialogClass *klass) +gl_prefs_dialog_class_init (glPrefsDialogClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_PREFS, ""); - parent_class = g_type_class_peek_parent (klass); + gl_prefs_dialog_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_prefs_dialog_finalize; } static void -gl_prefs_dialog_init (glPrefsDialog *dlg) +gl_prefs_dialog_init (glPrefsDialog *dialog) { gl_debug (DEBUG_PREFS, "START"); - dlg->priv = g_new0 (glPrefsDialogPrivate, 1); + dialog->priv = g_new0 (glPrefsDialogPrivate, 1); - dlg->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "prefs-dialog.glade", + dialog->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "prefs-dialog.glade", "prefs_notebook", NULL); - if (!dlg->priv->gui) { + if (!dialog->priv->gui) { g_critical ("Could not open prefs-dialog.glade. gLabels may not be installed correctly!"); return; } - gtk_container_set_border_width (GTK_CONTAINER(dlg), GL_HIG_PAD2); + gtk_container_set_border_width (GTK_CONTAINER(dialog), GL_HIG_PAD2); - gtk_dialog_set_has_separator (GTK_DIALOG(dlg), FALSE); - gtk_dialog_add_button (GTK_DIALOG(dlg), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); - gtk_dialog_set_default_response (GTK_DIALOG (dlg), GTK_RESPONSE_CLOSE); + gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE); + gtk_dialog_add_button (GTK_DIALOG(dialog), GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE); + gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_CLOSE); - g_signal_connect(G_OBJECT (dlg), "response", + g_signal_connect(G_OBJECT (dialog), "response", G_CALLBACK (response_cb), NULL); - gtk_window_set_modal (GTK_WINDOW (dlg), TRUE); - gtk_window_set_title (GTK_WINDOW (dlg), _("gLabels Preferences")); - gtk_window_set_resizable (GTK_WINDOW (dlg), FALSE); + gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); + gtk_window_set_title (GTK_WINDOW (dialog), _("gLabels Preferences")); + gtk_window_set_resizable (GTK_WINDOW (dialog), FALSE); gl_debug (DEBUG_PREFS, "END"); } @@ -193,20 +164,17 @@ gl_prefs_dialog_init (glPrefsDialog *dlg) static void gl_prefs_dialog_finalize (GObject *object) { - glPrefsDialog* dlg; + glPrefsDialog* dialog = GL_PREFS_DIALOG (object); gl_debug (DEBUG_PREFS, "START"); g_return_if_fail (object != NULL); - - dlg = GL_PREFS_DIALOG (object); - - g_return_if_fail (GL_IS_PREFS_DIALOG (dlg)); - g_return_if_fail (dlg->priv != NULL); + g_return_if_fail (GL_IS_PREFS_DIALOG (dialog)); + g_return_if_fail (dialog->priv != NULL); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (dialog->priv); - g_free (dlg->priv); + G_OBJECT_CLASS (gl_prefs_dialog_parent_class)->finalize (object); gl_debug (DEBUG_PREFS, "END"); } @@ -217,63 +185,63 @@ gl_prefs_dialog_finalize (GObject *object) GtkWidget* gl_prefs_dialog_new (GtkWindow *parent) { - GtkWidget *dlg; + GtkWidget *dialog; gl_debug (DEBUG_PREFS, "START"); gl_debug (DEBUG_PREFS, "page size = \"%s\"", gl_prefs->default_page_size); - dlg = GTK_WIDGET (g_object_new (GL_TYPE_PREFS_DIALOG, NULL)); + dialog = GTK_WIDGET (g_object_new (GL_TYPE_PREFS_DIALOG, NULL)); if (parent) - gtk_window_set_transient_for (GTK_WINDOW (dlg), parent); + gtk_window_set_transient_for (GTK_WINDOW (dialog), parent); - gl_prefs_dialog_construct (GL_PREFS_DIALOG(dlg)); + gl_prefs_dialog_construct (GL_PREFS_DIALOG(dialog)); gl_debug (DEBUG_PREFS, "END"); - return dlg; + return dialog; } /*---------------------------------------------------------------------------*/ /* PRIVATE. Construct composite widget. */ /*---------------------------------------------------------------------------*/ static void -gl_prefs_dialog_construct (glPrefsDialog *dlg) +gl_prefs_dialog_construct (glPrefsDialog *dialog) { GtkWidget *notebook; - g_return_if_fail (GL_IS_PREFS_DIALOG (dlg)); - g_return_if_fail (dlg->priv != NULL); + g_return_if_fail (GL_IS_PREFS_DIALOG (dialog)); + g_return_if_fail (dialog->priv != NULL); - notebook = glade_xml_get_widget (dlg->priv->gui, "prefs_notebook"); - gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), notebook, FALSE, FALSE, 0); + notebook = glade_xml_get_widget (dialog->priv->gui, "prefs_notebook"); + gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), notebook, FALSE, FALSE, 0); - construct_locale_page (dlg); - construct_object_page (dlg); + construct_locale_page (dialog); + construct_object_page (dialog); - update_locale_page_from_prefs (dlg); - update_object_page_from_prefs (dlg); + update_locale_page_from_prefs (dialog); + update_object_page_from_prefs (dialog); - gtk_widget_show_all (GTK_DIALOG (dlg)->vbox); + gtk_widget_show_all (GTK_DIALOG (dialog)->vbox); } /*---------------------------------------------------------------------------*/ /* PRIVATE. "Response" callback. */ /*---------------------------------------------------------------------------*/ static void -response_cb (glPrefsDialog *dlg, +response_cb (glPrefsDialog *dialog, gint response, gpointer user_data) { gl_debug (DEBUG_VIEW, "START"); - g_return_if_fail(dlg != NULL); - g_return_if_fail(GTK_IS_DIALOG(dlg)); + g_return_if_fail(dialog != NULL); + g_return_if_fail(GTK_IS_DIALOG(dialog)); switch(response) { case GTK_RESPONSE_CLOSE: - gtk_widget_hide (GTK_WIDGET(dlg)); + gtk_widget_hide (GTK_WIDGET(dialog)); break; case GTK_RESPONSE_DELETE_EVENT: break; @@ -289,137 +257,137 @@ response_cb (glPrefsDialog *dlg, /* PRIVATE. Build Locale Properties Notebook Tab */ /*--------------------------------------------------------------------------*/ static void -construct_locale_page (glPrefsDialog *dlg) +construct_locale_page (glPrefsDialog *dialog) { - dlg->priv->units_points_radio = - glade_xml_get_widget (dlg->priv->gui, "units_points_radio"); + dialog->priv->units_points_radio = + glade_xml_get_widget (dialog->priv->gui, "units_points_radio"); - dlg->priv->units_inches_radio = - glade_xml_get_widget (dlg->priv->gui, "units_inches_radio"); + dialog->priv->units_inches_radio = + glade_xml_get_widget (dialog->priv->gui, "units_inches_radio"); - dlg->priv->units_mm_radio = - glade_xml_get_widget (dlg->priv->gui, "units_mm_radio"); + dialog->priv->units_mm_radio = + glade_xml_get_widget (dialog->priv->gui, "units_mm_radio"); - dlg->priv->page_size_us_letter_radio = - glade_xml_get_widget (dlg->priv->gui, "page_size_us_letter_radio"); + dialog->priv->page_size_us_letter_radio = + glade_xml_get_widget (dialog->priv->gui, "page_size_us_letter_radio"); - dlg->priv->page_size_a4_radio = - glade_xml_get_widget (dlg->priv->gui, "page_size_a4_radio"); + dialog->priv->page_size_a4_radio = + glade_xml_get_widget (dialog->priv->gui, "page_size_a4_radio"); g_signal_connect_swapped ( - G_OBJECT(dlg->priv->units_points_radio), - "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_points_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_connect_swapped ( - G_OBJECT(dlg->priv->units_inches_radio), - "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_inches_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_connect_swapped ( - G_OBJECT(dlg->priv->units_mm_radio), - "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_mm_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_connect_swapped ( - G_OBJECT(dlg->priv->page_size_us_letter_radio), - "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->page_size_us_letter_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_connect_swapped ( - G_OBJECT(dlg->priv->page_size_a4_radio), - "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->page_size_a4_radio), + "toggled", G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); } /*--------------------------------------------------------------------------*/ /* PRIVATE. Build Default Object Properties Notebook Tab */ /*--------------------------------------------------------------------------*/ static void -construct_object_page (glPrefsDialog *dlg) +construct_object_page (glPrefsDialog *dialog) { GList *family_names; - dlg->priv->text_family_combo = - glade_xml_get_widget (dlg->priv->gui, "text_family_combo"); - dlg->priv->text_size_spin = - glade_xml_get_widget (dlg->priv->gui, "text_size_spin"); - dlg->priv->text_bold_toggle = - glade_xml_get_widget (dlg->priv->gui, "text_bold_toggle"); - dlg->priv->text_italic_toggle = - glade_xml_get_widget (dlg->priv->gui, "text_italic_toggle"); - dlg->priv->text_color_combo = - glade_xml_get_widget (dlg->priv->gui, "text_color_combo"); - dlg->priv->text_left_toggle = - glade_xml_get_widget (dlg->priv->gui, "text_left_toggle"); - dlg->priv->text_center_toggle = - glade_xml_get_widget (dlg->priv->gui, "text_center_toggle"); - dlg->priv->text_right_toggle = - glade_xml_get_widget (dlg->priv->gui, "text_right_toggle"); - dlg->priv->text_line_spacing_spin = - glade_xml_get_widget (dlg->priv->gui, "text_line_spacing_spin"); - - dlg->priv->line_width_spin = - glade_xml_get_widget (dlg->priv->gui, "line_width_spin"); - dlg->priv->line_color_combo = - glade_xml_get_widget (dlg->priv->gui, "line_color_combo"); - - dlg->priv->fill_color_combo = - glade_xml_get_widget (dlg->priv->gui, "fill_color_combo"); - - gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dlg->priv->text_family_combo)); + dialog->priv->text_family_combo = + glade_xml_get_widget (dialog->priv->gui, "text_family_combo"); + dialog->priv->text_size_spin = + glade_xml_get_widget (dialog->priv->gui, "text_size_spin"); + dialog->priv->text_bold_toggle = + glade_xml_get_widget (dialog->priv->gui, "text_bold_toggle"); + dialog->priv->text_italic_toggle = + glade_xml_get_widget (dialog->priv->gui, "text_italic_toggle"); + dialog->priv->text_color_combo = + glade_xml_get_widget (dialog->priv->gui, "text_color_combo"); + dialog->priv->text_left_toggle = + glade_xml_get_widget (dialog->priv->gui, "text_left_toggle"); + dialog->priv->text_center_toggle = + glade_xml_get_widget (dialog->priv->gui, "text_center_toggle"); + dialog->priv->text_right_toggle = + glade_xml_get_widget (dialog->priv->gui, "text_right_toggle"); + dialog->priv->text_line_spacing_spin = + glade_xml_get_widget (dialog->priv->gui, "text_line_spacing_spin"); + + dialog->priv->line_width_spin = + glade_xml_get_widget (dialog->priv->gui, "line_width_spin"); + dialog->priv->line_color_combo = + glade_xml_get_widget (dialog->priv->gui, "line_color_combo"); + + dialog->priv->fill_color_combo = + glade_xml_get_widget (dialog->priv->gui, "fill_color_combo"); + + gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dialog->priv->text_family_combo)); /* Load family names */ family_names = gl_util_get_font_family_list (); - gl_util_combo_box_set_strings (GTK_COMBO_BOX (dlg->priv->text_family_combo), + gl_util_combo_box_set_strings (GTK_COMBO_BOX (dialog->priv->text_family_combo), family_names); gl_util_font_family_list_free (family_names); - g_signal_connect_swapped (G_OBJECT(dlg->priv->text_family_combo), + g_signal_connect_swapped (G_OBJECT(dialog->priv->text_family_combo), "changed", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); - g_signal_connect_swapped (G_OBJECT(dlg->priv->text_size_spin), + G_OBJECT(dialog)); + g_signal_connect_swapped (G_OBJECT(dialog->priv->text_size_spin), "changed", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); - g_signal_connect_swapped (G_OBJECT(dlg->priv->text_bold_toggle), + G_OBJECT(dialog)); + g_signal_connect_swapped (G_OBJECT(dialog->priv->text_bold_toggle), "toggled", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); - g_signal_connect_swapped (G_OBJECT(dlg->priv->text_italic_toggle), + G_OBJECT(dialog)); + g_signal_connect_swapped (G_OBJECT(dialog->priv->text_italic_toggle), "toggled", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); - g_signal_connect_swapped (G_OBJECT(dlg->priv->text_color_combo), + G_OBJECT(dialog)); + g_signal_connect_swapped (G_OBJECT(dialog->priv->text_color_combo), "color_changed", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); + G_OBJECT(dialog)); - g_signal_connect (G_OBJECT(dlg->priv->text_left_toggle), + g_signal_connect (G_OBJECT(dialog->priv->text_left_toggle), "toggled", G_CALLBACK(align_toggle_cb), - G_OBJECT(dlg)); - g_signal_connect (G_OBJECT(dlg->priv->text_center_toggle), + G_OBJECT(dialog)); + g_signal_connect (G_OBJECT(dialog->priv->text_center_toggle), "toggled", G_CALLBACK(align_toggle_cb), - G_OBJECT(dlg)); - g_signal_connect (G_OBJECT(dlg->priv->text_right_toggle), + G_OBJECT(dialog)); + g_signal_connect (G_OBJECT(dialog->priv->text_right_toggle), "toggled", G_CALLBACK(align_toggle_cb), - G_OBJECT(dlg)); + G_OBJECT(dialog)); - g_signal_connect_swapped (G_OBJECT(dlg->priv->text_line_spacing_spin), + g_signal_connect_swapped (G_OBJECT(dialog->priv->text_line_spacing_spin), "changed", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); + G_OBJECT(dialog)); - g_signal_connect_swapped (G_OBJECT(dlg->priv->line_width_spin), + g_signal_connect_swapped (G_OBJECT(dialog->priv->line_width_spin), "changed", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); - g_signal_connect_swapped (G_OBJECT(dlg->priv->line_color_combo), + G_OBJECT(dialog)); + g_signal_connect_swapped (G_OBJECT(dialog->priv->line_color_combo), "color_changed", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); + G_OBJECT(dialog)); - g_signal_connect_swapped (G_OBJECT(dlg->priv->fill_color_combo), + g_signal_connect_swapped (G_OBJECT(dialog->priv->fill_color_combo), "color_changed", G_CALLBACK(update_prefs_from_object_page), - G_OBJECT(dlg)); + G_OBJECT(dialog)); } @@ -428,36 +396,36 @@ construct_object_page (glPrefsDialog *dlg) /*--------------------------------------------------------------------------*/ static void align_toggle_cb (GtkToggleButton *toggle, - glPrefsDialog *dlg) + glPrefsDialog *dialog) { if (gtk_toggle_button_get_active (toggle)) { - if (GTK_WIDGET (toggle) == GTK_WIDGET (dlg->priv->text_left_toggle)) { + if (GTK_WIDGET (toggle) == GTK_WIDGET (dialog->priv->text_left_toggle)) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (dlg->priv->text_center_toggle), + (dialog->priv->text_center_toggle), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (dlg->priv->text_right_toggle), + (dialog->priv->text_right_toggle), FALSE); } else if (GTK_WIDGET (toggle) == - GTK_WIDGET (dlg->priv->text_center_toggle)) { + GTK_WIDGET (dialog->priv->text_center_toggle)) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (dlg->priv->text_left_toggle), + (dialog->priv->text_left_toggle), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (dlg->priv->text_right_toggle), + (dialog->priv->text_right_toggle), FALSE); } else if (GTK_WIDGET (toggle) == - GTK_WIDGET (dlg->priv->text_right_toggle)) { + GTK_WIDGET (dialog->priv->text_right_toggle)) { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (dlg->priv->text_left_toggle), + (dialog->priv->text_left_toggle), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON - (dlg->priv->text_center_toggle), + (dialog->priv->text_center_toggle), FALSE); } - update_prefs_from_object_page (dlg); + update_prefs_from_object_page (dialog); } } @@ -467,38 +435,38 @@ align_toggle_cb (GtkToggleButton *toggle, /* PRIVATE. Update locale page widgets from current prefs. */ /*--------------------------------------------------------------------------*/ static void -update_locale_page_from_prefs (glPrefsDialog *dlg) +update_locale_page_from_prefs (glPrefsDialog *dialog) { g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->units_points_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_points_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->units_inches_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_inches_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->units_mm_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_mm_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->page_size_us_letter_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->page_size_us_letter_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->page_size_a4_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->page_size_a4_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); switch (gl_prefs->units) { case GL_UNITS_POINT: gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON(dlg->priv->units_points_radio), + GTK_TOGGLE_BUTTON(dialog->priv->units_points_radio), TRUE); break; case GL_UNITS_INCH: gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON(dlg->priv->units_inches_radio), + GTK_TOGGLE_BUTTON(dialog->priv->units_inches_radio), TRUE); break; case GL_UNITS_MM: gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON(dlg->priv->units_mm_radio), + GTK_TOGGLE_BUTTON(dialog->priv->units_mm_radio), TRUE); break; default: @@ -508,79 +476,79 @@ update_locale_page_from_prefs (glPrefsDialog *dlg) if ( g_strcasecmp(gl_prefs->default_page_size, US_LETTER_ID) == 0) { gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON(dlg->priv->page_size_us_letter_radio), + GTK_TOGGLE_BUTTON(dialog->priv->page_size_us_letter_radio), TRUE); } else if ( g_strcasecmp(gl_prefs->default_page_size, A4_ID) == 0) { gtk_toggle_button_set_active ( - GTK_TOGGLE_BUTTON(dlg->priv->page_size_a4_radio), + GTK_TOGGLE_BUTTON(dialog->priv->page_size_a4_radio), TRUE); } else { g_message ("Unknown default page size"); /* Shouldn't happen */ } g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->units_points_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_points_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->units_inches_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_inches_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->units_mm_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->units_mm_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->page_size_us_letter_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->page_size_us_letter_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->page_size_a4_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->page_size_a4_radio), + G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); } /*--------------------------------------------------------------------------*/ /* PRIVATE. Update object page widgets from current prefs. */ /*--------------------------------------------------------------------------*/ static void -update_object_page_from_prefs (glPrefsDialog *dlg) +update_object_page_from_prefs (glPrefsDialog *dialog) { GList *family_names; gchar *good_font_family; GdkColor *gdk_color; g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_family_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_family_combo), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_size_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_size_spin), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_bold_toggle), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_bold_toggle), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_italic_toggle), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_italic_toggle), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_color_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_color_combo), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_left_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_left_toggle), + G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_center_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_center_toggle), + G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_right_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_right_toggle), + G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->text_line_spacing_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_line_spacing_spin), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->line_width_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->line_width_spin), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->line_color_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->line_color_combo), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_block_by_func ( - G_OBJECT(dlg->priv->fill_color_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->fill_color_combo), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); /* Make sure we have a valid font family. if not provide a good default. */ @@ -597,109 +565,109 @@ update_object_page_from_prefs (glPrefsDialog *dlg) } } gl_util_font_family_list_free (family_names); - gl_util_combo_box_set_active_text (GTK_COMBO_BOX (dlg->priv->text_family_combo), + gl_util_combo_box_set_active_text (GTK_COMBO_BOX (dialog->priv->text_family_combo), good_font_family); g_free (good_font_family); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->text_size_spin), + gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->text_size_spin), gl_prefs->default_font_size); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_bold_toggle), + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_bold_toggle), (gl_prefs->default_font_weight == PANGO_WEIGHT_BOLD)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_italic_toggle), + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_italic_toggle), gl_prefs->default_font_italic_flag); gdk_color = gl_color_to_gdk_color (gl_prefs->default_text_color); - color_combo_set_color (COLOR_COMBO(dlg->priv->text_color_combo), gdk_color); + color_combo_set_color (COLOR_COMBO(dialog->priv->text_color_combo), gdk_color); g_free (gdk_color); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_left_toggle), + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_left_toggle), (gl_prefs->default_text_alignment == GTK_JUSTIFY_LEFT)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_center_toggle), + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_center_toggle), (gl_prefs->default_text_alignment == GTK_JUSTIFY_CENTER)); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dlg->priv->text_right_toggle), + gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_right_toggle), (gl_prefs->default_text_alignment == GTK_JUSTIFY_RIGHT)); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->text_line_spacing_spin), + gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->text_line_spacing_spin), gl_prefs->default_text_line_spacing); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (dlg->priv->line_width_spin), + gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->priv->line_width_spin), gl_prefs->default_line_width); gdk_color = gl_color_to_gdk_color (gl_prefs->default_line_color); - color_combo_set_color (COLOR_COMBO(dlg->priv->line_color_combo), gdk_color); + color_combo_set_color (COLOR_COMBO(dialog->priv->line_color_combo), gdk_color); g_free (gdk_color); gdk_color = gl_color_to_gdk_color (gl_prefs->default_fill_color); - color_combo_set_color (COLOR_COMBO(dlg->priv->fill_color_combo), gdk_color); + color_combo_set_color (COLOR_COMBO(dialog->priv->fill_color_combo), gdk_color); g_free (gdk_color); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_family_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_family_combo), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_size_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_size_spin), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_bold_toggle), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_bold_toggle), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_italic_toggle), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_italic_toggle), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_color_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_color_combo), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_left_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_left_toggle), + G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_center_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_center_toggle), + G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_right_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_right_toggle), + G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->text_line_spacing_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->text_line_spacing_spin), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->line_width_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->line_width_spin), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->line_color_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->line_color_combo), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); g_signal_handlers_unblock_by_func ( - G_OBJECT(dlg->priv->fill_color_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dlg)); + G_OBJECT(dialog->priv->fill_color_combo), + G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); } /*--------------------------------------------------------------------------*/ /* PRIVATE. Update prefs from current state of locale page widgets. */ /*--------------------------------------------------------------------------*/ static void -update_prefs_from_locale_page (glPrefsDialog *dlg) +update_prefs_from_locale_page (glPrefsDialog *dialog) { if (gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON(dlg->priv->units_points_radio))) { + GTK_TOGGLE_BUTTON(dialog->priv->units_points_radio))) { gl_prefs->units = GL_UNITS_POINT; } if (gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON(dlg->priv->units_inches_radio))) { + GTK_TOGGLE_BUTTON(dialog->priv->units_inches_radio))) { gl_prefs->units = GL_UNITS_INCH; } if (gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON(dlg->priv->units_mm_radio))) { + GTK_TOGGLE_BUTTON(dialog->priv->units_mm_radio))) { gl_prefs->units = GL_UNITS_MM; } if (gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON(dlg->priv->page_size_us_letter_radio))) { + GTK_TOGGLE_BUTTON(dialog->priv->page_size_us_letter_radio))) { gl_prefs->default_page_size = US_LETTER_ID; } if (gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON(dlg->priv->page_size_a4_radio))) { + GTK_TOGGLE_BUTTON(dialog->priv->page_size_a4_radio))) { gl_prefs->default_page_size = A4_ID; } @@ -710,7 +678,7 @@ update_prefs_from_locale_page (glPrefsDialog *dlg) /* PRIVATE. Update prefs from current state of object page widgets. */ /*--------------------------------------------------------------------------*/ static void -update_prefs_from_object_page (glPrefsDialog *dlg) +update_prefs_from_object_page (glPrefsDialog *dialog) { GdkColor *gdk_color; gboolean is_default; @@ -718,12 +686,12 @@ update_prefs_from_object_page (glPrefsDialog *dlg) g_free (gl_prefs->default_font_family); gl_prefs->default_font_family = - gtk_combo_box_get_active_text (GTK_COMBO_BOX (dlg->priv->text_family_combo)); + gtk_combo_box_get_active_text (GTK_COMBO_BOX (dialog->priv->text_family_combo)); gl_prefs->default_font_size = - gtk_spin_button_get_value (GTK_SPIN_BUTTON(dlg->priv->text_size_spin)); + gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->text_size_spin)); if (gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON (dlg->priv->text_bold_toggle))) { + (GTK_TOGGLE_BUTTON (dialog->priv->text_bold_toggle))) { gl_prefs->default_font_weight = PANGO_WEIGHT_BOLD; } else { gl_prefs->default_font_weight = PANGO_WEIGHT_NORMAL; @@ -731,24 +699,24 @@ update_prefs_from_object_page (glPrefsDialog *dlg) gl_prefs->default_font_italic_flag = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON - (dlg->priv->text_italic_toggle)); + (dialog->priv->text_italic_toggle)); - gdk_color = color_combo_get_color (COLOR_COMBO(dlg->priv->text_color_combo), + gdk_color = color_combo_get_color (COLOR_COMBO(dialog->priv->text_color_combo), &is_default); if (!is_default) { gl_prefs->default_text_color = gl_color_from_gdk_color (gdk_color); } if (gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON (dlg->priv->text_left_toggle))) { + (GTK_TOGGLE_BUTTON (dialog->priv->text_left_toggle))) { gl_prefs->default_text_alignment = GTK_JUSTIFY_LEFT; } else if (gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON (dlg->priv->text_right_toggle))) { + (GTK_TOGGLE_BUTTON (dialog->priv->text_right_toggle))) { gl_prefs->default_text_alignment = GTK_JUSTIFY_RIGHT; } else if (gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON (dlg->priv->text_center_toggle))) { + (GTK_TOGGLE_BUTTON (dialog->priv->text_center_toggle))) { gl_prefs->default_text_alignment = GTK_JUSTIFY_CENTER; } else { /* Should not happen. */ @@ -757,19 +725,19 @@ update_prefs_from_object_page (glPrefsDialog *dlg) gl_prefs->default_text_line_spacing = - gtk_spin_button_get_value (GTK_SPIN_BUTTON(dlg->priv->text_line_spacing_spin)); + gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->text_line_spacing_spin)); gl_prefs->default_line_width = - gtk_spin_button_get_value (GTK_SPIN_BUTTON(dlg->priv->line_width_spin)); + gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->line_width_spin)); - gdk_color = color_combo_get_color (COLOR_COMBO(dlg->priv->line_color_combo), + gdk_color = color_combo_get_color (COLOR_COMBO(dialog->priv->line_color_combo), &is_default); if (!is_default) { gl_prefs->default_line_color = gl_color_from_gdk_color (gdk_color); } - gdk_color = color_combo_get_color (COLOR_COMBO(dlg->priv->fill_color_combo), + gdk_color = color_combo_get_color (COLOR_COMBO(dialog->priv->fill_color_combo), &is_default); if (!is_default) { gl_prefs->default_fill_color = gl_color_from_gdk_color (gdk_color); diff --git a/glabels2/src/prefs-dialog.h b/glabels2/src/prefs-dialog.h index 45fcc761..8ec8e929 100644 --- a/glabels2/src/prefs-dialog.h +++ b/glabels2/src/prefs-dialog.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/prefs-model.c b/glabels2/src/prefs-model.c index abe34b2b..ee435004 100644 --- a/glabels2/src/prefs-model.c +++ b/glabels2/src/prefs-model.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -101,16 +103,12 @@ enum { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - static guint signals[LAST_SIGNAL] = {0}; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_prefs_model_class_init (glPrefsModelClass *klass); -static void gl_prefs_model_instance_init (glPrefsModel *object); static void gl_prefs_model_finalize (GObject *object); static void notify_cb (GConfClient *client, @@ -142,40 +140,16 @@ static const gchar *units_to_string (glUnitsType units); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_prefs_model_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glPrefsModelClass), - NULL, - NULL, - (GClassInitFunc) gl_prefs_model_class_init, - NULL, - NULL, - sizeof (glPrefsModel), - 0, - (GInstanceInitFunc) gl_prefs_model_instance_init, - NULL - }; - - type = g_type_register_static (G_TYPE_OBJECT, - "glPrefsModel", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glPrefsModel, gl_prefs_model, G_TYPE_OBJECT); static void -gl_prefs_model_class_init (glPrefsModelClass *klass) +gl_prefs_model_class_init (glPrefsModelClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_PREFS, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_prefs_model_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_prefs_model_finalize; @@ -193,7 +167,7 @@ gl_prefs_model_class_init (glPrefsModelClass *klass) } static void -gl_prefs_model_instance_init (glPrefsModel *prefs_model) +gl_prefs_model_init (glPrefsModel *prefs_model) { gl_debug (DEBUG_PREFS, "START"); @@ -217,16 +191,17 @@ gl_prefs_model_instance_init (glPrefsModel *prefs_model) static void gl_prefs_model_finalize (GObject *object) { + glPrefsModel *prefs_model = GL_PREFS_MODEL (object); + gl_debug (DEBUG_PREFS, "START"); g_return_if_fail (object && GL_IS_PREFS_MODEL (object)); - g_object_unref (G_OBJECT(GL_PREFS_MODEL(object)->gconf_client)); - - g_free (GL_PREFS_MODEL(object)->default_page_size); - g_free (GL_PREFS_MODEL(object)->default_font_family); + g_object_unref (G_OBJECT(prefs_model->gconf_client)); + g_free (prefs_model->default_page_size); + g_free (prefs_model->default_font_family); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_prefs_model_parent_class)->finalize (object); gl_debug (DEBUG_PREFS, "END"); } diff --git a/glabels2/src/prefs-model.h b/glabels2/src/prefs-model.h index e85b058f..5d6f5654 100644 --- a/glabels2/src/prefs-model.h +++ b/glabels2/src/prefs-model.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/prefs.c b/glabels2/src/prefs.c index d8141843..23636c89 100644 --- a/glabels2/src/prefs.c +++ b/glabels2/src/prefs.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/prefs.h b/glabels2/src/prefs.h index b406f29d..ce08f137 100644 --- a/glabels2/src/prefs.h +++ b/glabels2/src/prefs.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/print-op.c b/glabels2/src/print-op.c index fbbade5e..d6a30831 100644 --- a/glabels2/src/print-op.c +++ b/glabels2/src/print-op.c @@ -85,14 +85,10 @@ struct _glPrintOpPrivate { /* Private globals */ /*===========================================*/ -static GtkPrintOperationClass* parent_class = NULL; - /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_print_op_class_init (glPrintOpClass *klass); -static void gl_print_op_init (glPrintOp *op); static void gl_print_op_finalize (GObject *object); static void gl_print_op_construct (glPrintOp *op, @@ -131,43 +127,17 @@ static void draw_page_cb (GtkPrintOperation *operation, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_print_op_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo info = - { - sizeof (glPrintOpClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gl_print_op_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glPrintOp), - 0, /* n_preallocs */ - (GInstanceInitFunc) gl_print_op_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_PRINT_OPERATION, - "glPrintOp", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glPrintOp, gl_print_op, GTK_TYPE_PRINT_OPERATION); static void -gl_print_op_class_init (glPrintOpClass *klass) +gl_print_op_class_init (glPrintOpClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); - GtkPrintOperationClass *print_class = GTK_PRINT_OPERATION_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkPrintOperationClass *print_class = GTK_PRINT_OPERATION_CLASS (class); gl_debug (DEBUG_PRINT, ""); - parent_class = g_type_class_peek_parent (klass); + gl_print_op_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_print_op_finalize; } @@ -190,15 +160,12 @@ gl_print_op_init (glPrintOp *op) static void gl_print_op_finalize (GObject *object) { - glPrintOp* op; + glPrintOp* op = GL_PRINT_OP (object); gl_debug (DEBUG_PRINT, ""); g_return_if_fail (object != NULL); - - op = GL_PRINT_OP (object); - - g_return_if_fail (GL_IS_PRINT_OP (op)); + g_return_if_fail (GL_IS_PRINT_OP (op)); g_return_if_fail (op->priv != NULL); if (op->priv->label) { @@ -207,7 +174,7 @@ gl_print_op_finalize (GObject *object) g_free (op->priv->filename); g_free (op->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_print_op_parent_class)->finalize (object); g_free (op->priv); } diff --git a/glabels2/src/stock.c b/glabels2/src/stock.c index 13f04403..fe2af71f 100644 --- a/glabels2/src/stock.c +++ b/glabels2/src/stock.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/stock.h b/glabels2/src/stock.h index 70e2bd0a..14fb907a 100644 --- a/glabels2/src/stock.h +++ b/glabels2/src/stock.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/template-designer.c b/glabels2/src/template-designer.c index 74f60f44..e2b3c262 100644 --- a/glabels2/src/template-designer.c +++ b/glabels2/src/template-designer.c @@ -197,114 +197,85 @@ enum { /* Private globals. */ /*========================================================*/ -static GtkAssistantClass* parent_class = NULL; /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_template_designer_class_init (glTemplateDesignerClass *klass); -static void gl_template_designer_init (glTemplateDesigner *dlg); static void gl_template_designer_finalize (GObject *object); -static void gl_template_designer_construct (glTemplateDesigner *dlg); +static void gl_template_designer_construct (glTemplateDesigner *dialog); -static void construct_start_page (glTemplateDesigner *dlg, +static void construct_start_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_name_page (glTemplateDesigner *dlg, +static void construct_name_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_pg_size_page (glTemplateDesigner *dlg, +static void construct_pg_size_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_shape_page (glTemplateDesigner *dlg, +static void construct_shape_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_rect_size_page (glTemplateDesigner *dlg, +static void construct_rect_size_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_round_size_page (glTemplateDesigner *dlg, +static void construct_round_size_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_cd_size_page (glTemplateDesigner *dlg, +static void construct_cd_size_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_nlayouts_page (glTemplateDesigner *dlg, +static void construct_nlayouts_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_layout_page (glTemplateDesigner *dlg, +static void construct_layout_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void construct_finish_page (glTemplateDesigner *dlg, +static void construct_finish_page (glTemplateDesigner *dialog, GdkPixbuf *logo); -static void cancel_cb (glTemplateDesigner *dlg); -static void apply_cb (glTemplateDesigner *dlg); -static void close_cb (glTemplateDesigner *dlg); -static void prepare_cb (glTemplateDesigner *dlg, +static void cancel_cb (glTemplateDesigner *dialog); +static void apply_cb (glTemplateDesigner *dialog); +static void close_cb (glTemplateDesigner *dialog); +static void prepare_cb (glTemplateDesigner *dialog, GtkWidget *page); static gint forward_page_function (gint current_page, gpointer data); -static void name_page_changed_cb (glTemplateDesigner *dlg); +static void name_page_changed_cb (glTemplateDesigner *dialog); -static void pg_size_page_changed_cb (glTemplateDesigner *dlg); +static void pg_size_page_changed_cb (glTemplateDesigner *dialog); -static void rect_size_page_prepare_cb (glTemplateDesigner *dlg); +static void rect_size_page_prepare_cb (glTemplateDesigner *dialog); -static void round_size_page_prepare_cb (glTemplateDesigner *dlg); +static void round_size_page_prepare_cb (glTemplateDesigner *dialog); -static void cd_size_page_prepare_cb (glTemplateDesigner *dlg); +static void cd_size_page_prepare_cb (glTemplateDesigner *dialog); -static void layout_page_prepare_cb (glTemplateDesigner *dlg); +static void layout_page_prepare_cb (glTemplateDesigner *dialog); -static void layout_page_changed_cb (glTemplateDesigner *dlg); +static void layout_page_changed_cb (glTemplateDesigner *dialog); -static void print_test_cb (glTemplateDesigner *dlg); +static void print_test_cb (glTemplateDesigner *dialog); -static glTemplate *build_template (glTemplateDesigner *dlg); +static glTemplate *build_template (glTemplateDesigner *dialog); /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_template_designer_get_type (void) -{ - static GType type = 0; - - if (!type) - { - static const GTypeInfo info = - { - sizeof (glTemplateDesignerClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gl_template_designer_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glTemplateDesigner), - 0, /* n_preallocs */ - (GInstanceInitFunc) gl_template_designer_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_ASSISTANT, - "glTemplateDesigner", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glTemplateDesigner, gl_template_designer, GTK_TYPE_ASSISTANT); static void -gl_template_designer_class_init (glTemplateDesignerClass *klass) +gl_template_designer_class_init (glTemplateDesignerClass *class) { - GObjectClass *object_class = G_OBJECT_CLASS (klass); + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_TEMPLATE, ""); - parent_class = g_type_class_peek_parent (klass); + gl_template_designer_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_template_designer_finalize; } @@ -324,21 +295,18 @@ gl_template_designer_init (glTemplateDesigner *dialog) static void gl_template_designer_finalize (GObject *object) { - glTemplateDesigner* dialog; + glTemplateDesigner* dialog = GL_TEMPLATE_DESIGNER (object); gl_debug (DEBUG_TEMPLATE, "START"); g_return_if_fail (object != NULL); - - dialog = GL_TEMPLATE_DESIGNER (object); - g_return_if_fail (GL_IS_TEMPLATE_DESIGNER (dialog)); g_return_if_fail (dialog->priv != NULL); - G_OBJECT_CLASS (parent_class)->finalize (object); - g_free (dialog->priv); + G_OBJECT_CLASS (gl_template_designer_parent_class)->finalize (object); + gl_debug (DEBUG_TEMPLATE, "END"); } diff --git a/glabels2/src/text-node.c b/glabels2/src/text-node.c index 1ab4c6b4..21500ca7 100644 --- a/glabels2/src/text-node.c +++ b/glabels2/src/text-node.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/text-node.h b/glabels2/src/text-node.h index 47a6293d..4a9bd228 100644 --- a/glabels2/src/text-node.h +++ b/glabels2/src/text-node.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/ui-commands.c b/glabels2/src/ui-commands.c index d3884ec1..696cdcbb 100644 --- a/glabels2/src/ui-commands.c +++ b/glabels2/src/ui-commands.c @@ -349,27 +349,27 @@ void gl_ui_cmd_edit_preferences (GtkAction *action, glWindow *window) { - static GtkWidget *dlg = NULL; + static GtkWidget *dialog = NULL; gl_debug (DEBUG_COMMANDS, "START"); g_return_if_fail (action && GTK_IS_ACTION(action)); g_return_if_fail (window && GL_IS_WINDOW(window)); - if (dlg != NULL) + if (dialog != NULL) { - gtk_window_present (GTK_WINDOW (dlg)); - gtk_window_set_transient_for (GTK_WINDOW (dlg), + gtk_window_present (GTK_WINDOW (dialog)); + gtk_window_set_transient_for (GTK_WINDOW (dialog), GTK_WINDOW(window)); } else { - dlg = gl_prefs_dialog_new (GTK_WINDOW(window)); + dialog = gl_prefs_dialog_new (GTK_WINDOW(window)); - g_signal_connect (G_OBJECT (dlg), "destroy", - G_CALLBACK (gtk_widget_destroyed), &dlg); + g_signal_connect (G_OBJECT (dialog), "destroy", + G_CALLBACK (gtk_widget_destroyed), &dialog); - gtk_widget_show (dlg); + gtk_widget_show (dialog); } diff --git a/glabels2/src/ui-commands.h b/glabels2/src/ui-commands.h index 0d5b05db..fc8a3db9 100644 --- a/glabels2/src/ui-commands.h +++ b/glabels2/src/ui-commands.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/ui-property-bar.c b/glabels2/src/ui-property-bar.c index 604f7d0e..c2a6e7ae 100644 --- a/glabels2/src/ui-property-bar.c +++ b/glabels2/src/ui-property-bar.c @@ -43,13 +43,13 @@ #include "debug.h" -/*============================================================================*/ -/* Private macros and constants. */ -/*============================================================================*/ +/*===========================================================================*/ +/* Private macros and constants. */ +/*===========================================================================*/ -/*============================================================================*/ -/* Private data types */ -/*============================================================================*/ +/*===========================================================================*/ +/* Private data types */ +/*===========================================================================*/ struct _glUIPropertyBarPrivate { @@ -83,18 +83,14 @@ struct _glUIPropertyBarPrivate { }; -/*============================================================================*/ -/* Private globals */ -/*============================================================================*/ +/*===========================================================================*/ +/* Private globals */ +/*===========================================================================*/ -static GtkHBoxClass *parent_class; +/*===========================================================================*/ +/* Local function prototypes */ +/*===========================================================================*/ -/*============================================================================*/ -/* Local function prototypes */ -/*============================================================================*/ - -static void gl_ui_property_bar_class_init (glUIPropertyBarClass *class); -static void gl_ui_property_bar_instance_init (glUIPropertyBar *property_bar); static void gl_ui_property_bar_finalize (GObject *object); static void gl_ui_property_bar_construct (glUIPropertyBar *property_bar); @@ -159,40 +155,16 @@ static void set_line_width_items_sensitive (glUIPropertyBar *property /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_ui_property_bar_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glUIPropertyBarClass), - NULL, - NULL, - (GClassInitFunc) gl_ui_property_bar_class_init, - NULL, - NULL, - sizeof (glUIPropertyBar), - 0, - (GInstanceInitFunc) gl_ui_property_bar_instance_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_HBOX, - "glUIPropertyBar", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glUIPropertyBar, gl_ui_property_bar, GTK_TYPE_HBOX); static void gl_ui_property_bar_class_init (glUIPropertyBarClass *class) { - GObjectClass *object_class = (GObjectClass *) class; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_PROPERTY_BAR, "START"); - parent_class = g_type_class_peek_parent (class); + gl_ui_property_bar_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_ui_property_bar_finalize; @@ -200,7 +172,7 @@ gl_ui_property_bar_class_init (glUIPropertyBarClass *class) } static void -gl_ui_property_bar_instance_init (glUIPropertyBar *property_bar) +gl_ui_property_bar_init (glUIPropertyBar *property_bar) { gl_debug (DEBUG_PROPERTY_BAR, "START"); @@ -221,23 +193,20 @@ gl_ui_property_bar_instance_init (glUIPropertyBar *property_bar) static void gl_ui_property_bar_finalize (GObject *object) { - glUIPropertyBar *property_bar; + glUIPropertyBar *property_bar = GL_UI_PROPERTY_BAR (object); gl_debug (DEBUG_PROPERTY_BAR, "START"); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_UI_PROPERTY_BAR (object)); - property_bar = GL_UI_PROPERTY_BAR (object); - if (property_bar->priv->view) { g_object_unref (G_OBJECT(property_bar->priv->view)); } - - G_OBJECT_CLASS (parent_class)->finalize (object); - g_free (property_bar->priv); + G_OBJECT_CLASS (gl_ui_property_bar_parent_class)->finalize (object); + gl_debug (DEBUG_PROPERTY_BAR, "END"); } diff --git a/glabels2/src/ui-property-bar.h b/glabels2/src/ui-property-bar.h index 6d3287fb..e2af1912 100644 --- a/glabels2/src/ui-property-bar.h +++ b/glabels2/src/ui-property-bar.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /** * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/ui-sidebar.c b/glabels2/src/ui-sidebar.c index 2c13e557..924b0fa2 100644 --- a/glabels2/src/ui-sidebar.c +++ b/glabels2/src/ui-sidebar.c @@ -34,15 +34,15 @@ #include "debug.h" -/*============================================================================*/ -/* Private macros and constants. */ -/*============================================================================*/ +/*===========================================================================*/ +/* Private macros and constants. */ +/*===========================================================================*/ #define DEFAULT_SIDEBAR_WIDTH 340 -/*============================================================================*/ -/* Private data types */ -/*============================================================================*/ +/*===========================================================================*/ +/* Private data types */ +/*===========================================================================*/ struct _glUISidebarPrivate { @@ -52,18 +52,15 @@ struct _glUISidebarPrivate { GtkWidget *empty_child; }; -/*============================================================================*/ -/* Private globals */ -/*============================================================================*/ +/*===========================================================================*/ +/* Private globals */ +/*===========================================================================*/ -static GtkVBoxClass *parent_class; -/*============================================================================*/ -/* Local function prototypes */ -/*============================================================================*/ +/*===========================================================================*/ +/* Local function prototypes */ +/*===========================================================================*/ -static void gl_ui_sidebar_class_init (glUISidebarClass *class); -static void gl_ui_sidebar_instance_init (glUISidebar *sidebar); static void gl_ui_sidebar_finalize (GObject *object); static void gl_ui_sidebar_construct (glUISidebar *sidebar); @@ -76,40 +73,16 @@ static void selection_changed_cb (glView *view, /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_ui_sidebar_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glUISidebarClass), - NULL, - NULL, - (GClassInitFunc) gl_ui_sidebar_class_init, - NULL, - NULL, - sizeof (glUISidebar), - 0, - (GInstanceInitFunc) gl_ui_sidebar_instance_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_VBOX, - "glUISidebar", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glUISidebar, gl_ui_sidebar, GTK_TYPE_VBOX); static void gl_ui_sidebar_class_init (glUISidebarClass *class) { - GObjectClass *object_class = (GObjectClass *) class; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_UI, "START"); - parent_class = g_type_class_peek_parent (class); + gl_ui_sidebar_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_ui_sidebar_finalize; @@ -117,7 +90,7 @@ gl_ui_sidebar_class_init (glUISidebarClass *class) } static void -gl_ui_sidebar_instance_init (glUISidebar *sidebar) +gl_ui_sidebar_init (glUISidebar *sidebar) { gl_debug (DEBUG_UI, "START"); @@ -129,23 +102,20 @@ gl_ui_sidebar_instance_init (glUISidebar *sidebar) static void gl_ui_sidebar_finalize (GObject *object) { - glUISidebar *sidebar; + glUISidebar *sidebar = GL_UI_SIDEBAR (object); gl_debug (DEBUG_UI, "START"); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_UI_SIDEBAR (object)); - sidebar = GL_UI_SIDEBAR (object); - if (sidebar->priv->view) { g_object_unref (G_OBJECT(sidebar->priv->view)); } - - G_OBJECT_CLASS (parent_class)->finalize (object); - g_free (sidebar->priv); + G_OBJECT_CLASS (gl_ui_sidebar_parent_class)->finalize (object); + gl_debug (DEBUG_UI, "END"); } diff --git a/glabels2/src/ui-sidebar.h b/glabels2/src/ui-sidebar.h index 74eb599f..9ec1264d 100644 --- a/glabels2/src/ui-sidebar.h +++ b/glabels2/src/ui-sidebar.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /** * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/ui-util.c b/glabels2/src/ui-util.c index 509e9059..3a0539df 100644 --- a/glabels2/src/ui-util.c +++ b/glabels2/src/ui-util.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/ui-util.h b/glabels2/src/ui-util.h index 262b6552..ffa2653e 100644 --- a/glabels2/src/ui-util.h +++ b/glabels2/src/ui-util.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/ui.c b/glabels2/src/ui.c index b7ce5852..b1872642 100644 --- a/glabels2/src/ui.c +++ b/glabels2/src/ui.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/ui.h b/glabels2/src/ui.h index 72563bc8..19135d53 100644 --- a/glabels2/src/ui.h +++ b/glabels2/src/ui.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/util.c b/glabels2/src/util.c index 0273abfc..6d9331b3 100644 --- a/glabels2/src/util.c +++ b/glabels2/src/util.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/util.h b/glabels2/src/util.h index 89fb800d..aa0ff25e 100644 --- a/glabels2/src/util.h +++ b/glabels2/src/util.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/view-barcode.c b/glabels2/src/view-barcode.c index 894f471f..b1c6e31e 100644 --- a/glabels2/src/view-barcode.c +++ b/glabels2/src/view-barcode.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -60,15 +62,11 @@ struct _glViewBarcodePrivate { /* Private globals. */ /*========================================================*/ -static glViewObjectClass *parent_class = NULL; - /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_view_barcode_class_init (glViewBarcodeClass *klass); -static void gl_view_barcode_instance_init (glViewBarcode *view_bc); static void gl_view_barcode_finalize (GObject *object); static GtkWidget *construct_properties_editor (glViewObject *view_object); @@ -97,41 +95,17 @@ static void draw_barcode (glViewBarcode *vi /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_view_barcode_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewBarcodeClass), - NULL, - NULL, - (GClassInitFunc) gl_view_barcode_class_init, - NULL, - NULL, - sizeof (glViewBarcode), - 0, - (GInstanceInitFunc) gl_view_barcode_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_VIEW_OBJECT, - "glViewBarcode", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glViewBarcode, gl_view_barcode, GL_TYPE_VIEW_OBJECT); static void -gl_view_barcode_class_init (glViewBarcodeClass *klass) +gl_view_barcode_class_init (glViewBarcodeClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glViewObjectClass *view_object_class = (glViewObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glViewObjectClass *view_object_class = GL_VIEW_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_view_barcode_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_barcode_finalize; @@ -141,11 +115,11 @@ gl_view_barcode_class_init (glViewBarcodeClass *klass) } static void -gl_view_barcode_instance_init (glViewBarcode *view_bc) +gl_view_barcode_init (glViewBarcode *view_bc) { gl_debug (DEBUG_VIEW, "START"); - view_bc->private = g_new0 (glViewBarcodePrivate, 1); + view_bc->priv = g_new0 (glViewBarcodePrivate, 1); gl_debug (DEBUG_VIEW, "END"); } @@ -153,13 +127,15 @@ gl_view_barcode_instance_init (glViewBarcode *view_bc) static void gl_view_barcode_finalize (GObject *object) { - glLabel *parent; + glViewBarcode *view_bc = GL_VIEW_BARCODE (object); gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object && GL_IS_VIEW_BARCODE (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (view_bc->priv); + + G_OBJECT_CLASS (gl_view_barcode_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } @@ -579,13 +555,13 @@ draw_barcode (glViewBarcode *view_barcode) } /* remove previous items from group. */ - for (li = view_barcode->private->item_list; li!=NULL; li = li->next) { + for (li = view_barcode->priv->item_list; li!=NULL; li = li->next) { gl_debug (DEBUG_VIEW, "in loop"); gtk_object_destroy (GTK_OBJECT (li->data)); } gl_debug (DEBUG_VIEW, "1"); - g_list_free (view_barcode->private->item_list); - view_barcode->private->item_list = NULL; + g_list_free (view_barcode->priv->item_list); + view_barcode->priv->item_list = NULL; gl_debug (DEBUG_VIEW, "2"); /* get Gnome Font */ @@ -606,8 +582,8 @@ draw_barcode (glViewBarcode *view_barcode) "outline_color_rgba", color_node->color, "width_pixels", 1, NULL); - view_barcode->private->item_list = - g_list_prepend (view_barcode->private->item_list, item); + view_barcode->priv->item_list = + g_list_prepend (view_barcode->priv->item_list, item); if (digits == NULL || *digits == '\0') { @@ -635,8 +611,8 @@ draw_barcode (glViewBarcode *view_barcode) gnome_glyphlist_unref (glyphlist); - view_barcode->private->item_list = - g_list_prepend (view_barcode->private->item_list, item); + view_barcode->priv->item_list = + g_list_prepend (view_barcode->priv->item_list, item); } else { points = gnome_canvas_points_new (2); @@ -654,8 +630,8 @@ draw_barcode (glViewBarcode *view_barcode) "width_units", line->width, "fill_color_rgba", color_node->color, NULL); - view_barcode->private->item_list = - g_list_prepend (view_barcode->private->item_list, item); + view_barcode->priv->item_list = + g_list_prepend (view_barcode->priv->item_list, item); } gnome_canvas_points_free (points); @@ -683,8 +659,8 @@ draw_barcode (glViewBarcode *view_barcode) gnome_glyphlist_unref (glyphlist); - view_barcode->private->item_list = - g_list_prepend (view_barcode->private->item_list, item); + view_barcode->priv->item_list = + g_list_prepend (view_barcode->priv->item_list, item); } diff --git a/glabels2/src/view-barcode.h b/glabels2/src/view-barcode.h index 7edbeff0..38478a22 100644 --- a/glabels2/src/view-barcode.h +++ b/glabels2/src/view-barcode.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -41,13 +43,13 @@ typedef struct _glViewBarcodeClass glViewBarcodeClass; typedef struct _glViewBarcodePrivate glViewBarcodePrivate; struct _glViewBarcode { - glViewObject parent_object; + glViewObject parent_object; - glViewBarcodePrivate *private; + glViewBarcodePrivate *priv; }; struct _glViewBarcodeClass { - glViewObjectClass parent_class; + glViewObjectClass parent_class; }; diff --git a/glabels2/src/view-box.c b/glabels2/src/view-box.c index e8b50b57..e0a265d2 100644 --- a/glabels2/src/view-box.c +++ b/glabels2/src/view-box.c @@ -57,15 +57,11 @@ struct _glViewBoxPrivate { /* Private globals. */ /*========================================================*/ -static glViewObjectClass *parent_class = NULL; - /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_view_box_class_init (glViewBoxClass *klass); -static void gl_view_box_instance_init (glViewBox *view_box); static void gl_view_box_finalize (GObject *object); static GtkWidget *construct_properties_editor (glViewObject *view_object); @@ -92,41 +88,18 @@ static void update_editor_from_label_cb (glLabel *label, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_view_box_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewBoxClass), - NULL, - NULL, - (GClassInitFunc) gl_view_box_class_init, - NULL, - NULL, - sizeof (glViewBox), - 0, - (GInstanceInitFunc) gl_view_box_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_VIEW_OBJECT, - "glViewBox", &info, 0); - } +G_DEFINE_TYPE (glViewBox, gl_view_box, GL_TYPE_VIEW_OBJECT); - return type; -} static void -gl_view_box_class_init (glViewBoxClass *klass) +gl_view_box_class_init (glViewBoxClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glViewObjectClass *view_object_class = (glViewObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glViewObjectClass *view_object_class = GL_VIEW_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_view_box_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_box_finalize; @@ -136,11 +109,11 @@ gl_view_box_class_init (glViewBoxClass *klass) } static void -gl_view_box_instance_init (glViewBox *view_box) +gl_view_box_init (glViewBox *view_box) { gl_debug (DEBUG_VIEW, "START"); - view_box->private = g_new0 (glViewBoxPrivate, 1); + view_box->priv = g_new0 (glViewBoxPrivate, 1); gl_debug (DEBUG_VIEW, "END"); } @@ -148,13 +121,15 @@ gl_view_box_instance_init (glViewBox *view_box) static void gl_view_box_finalize (GObject *object) { - glLabel *parent; + glViewBox *view_box = GL_VIEW_BOX (object); gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object && GL_IS_VIEW_BOX (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (view_box->priv); + + G_OBJECT_CLASS (gl_view_box_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } @@ -181,11 +156,11 @@ gl_view_box_new (glLabelBox *object, GL_VIEW_HIGHLIGHT_BOX_RESIZABLE); /* Create analogous canvas items. */ - view_box->private->shadow_item = + view_box->priv->shadow_item = gl_view_object_item_new (GL_VIEW_OBJECT(view_box), gnome_canvas_rect_get_type (), NULL); - view_box->private->object_item = + view_box->priv->object_item = gl_view_object_item_new (GL_VIEW_OBJECT(view_box), gnome_canvas_rect_get_type (), NULL); @@ -293,7 +268,7 @@ update_canvas_item_from_object_cb (glLabelObject *object, fill_color_node->color); /* Adjust appearance of analogous canvas items. */ - gnome_canvas_item_set (view_box->private->shadow_item, + gnome_canvas_item_set (view_box->priv->shadow_item, "x1", shadow_x, "y1", shadow_y, "x2", shadow_x + w + DELTA, @@ -305,14 +280,14 @@ update_canvas_item_from_object_cb (glLabelObject *object, if (shadow_state) { - gnome_canvas_item_show (view_box->private->shadow_item); + gnome_canvas_item_show (view_box->priv->shadow_item); } else { - gnome_canvas_item_hide (view_box->private->shadow_item); + gnome_canvas_item_hide (view_box->priv->shadow_item); } - gnome_canvas_item_set (view_box->private->object_item, + gnome_canvas_item_set (view_box->priv->object_item, "x2", w + DELTA, "y2", h + DELTA, "width_units", line_width, diff --git a/glabels2/src/view-box.h b/glabels2/src/view-box.h index af63d5e5..2e5f04fb 100644 --- a/glabels2/src/view-box.h +++ b/glabels2/src/view-box.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -43,7 +45,7 @@ typedef struct _glViewBoxPrivate glViewBoxPrivate; struct _glViewBox { glViewObject parent_object; - glViewBoxPrivate *private; + glViewBoxPrivate *priv; }; struct _glViewBoxClass { diff --git a/glabels2/src/view-ellipse.c b/glabels2/src/view-ellipse.c index 0c3fe942..1d7a1675 100644 --- a/glabels2/src/view-ellipse.c +++ b/glabels2/src/view-ellipse.c @@ -57,15 +57,11 @@ struct _glViewEllipsePrivate { /* Private globals. */ /*========================================================*/ -static glViewObjectClass *parent_class = NULL; - /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_view_ellipse_class_init (glViewEllipseClass *klass); -static void gl_view_ellipse_instance_init (glViewEllipse *view_ellipse); static void gl_view_ellipse_finalize (GObject *object); static GtkWidget *construct_properties_editor (glViewObject *view_object); @@ -92,41 +88,17 @@ static void update_editor_from_label_cb (glLabel *label, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_view_ellipse_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewEllipseClass), - NULL, - NULL, - (GClassInitFunc) gl_view_ellipse_class_init, - NULL, - NULL, - sizeof (glViewEllipse), - 0, - (GInstanceInitFunc) gl_view_ellipse_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_VIEW_OBJECT, - "glViewEllipse", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glViewEllipse, gl_view_ellipse, GL_TYPE_VIEW_OBJECT); static void -gl_view_ellipse_class_init (glViewEllipseClass *klass) +gl_view_ellipse_class_init (glViewEllipseClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glViewObjectClass *view_object_class = (glViewObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glViewObjectClass *view_object_class = GL_VIEW_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_view_ellipse_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_ellipse_finalize; @@ -136,11 +108,11 @@ gl_view_ellipse_class_init (glViewEllipseClass *klass) } static void -gl_view_ellipse_instance_init (glViewEllipse *view_ellipse) +gl_view_ellipse_init (glViewEllipse *view_ellipse) { gl_debug (DEBUG_VIEW, "START"); - view_ellipse->private = g_new0 (glViewEllipsePrivate, 1); + view_ellipse->priv = g_new0 (glViewEllipsePrivate, 1); gl_debug (DEBUG_VIEW, "END"); } @@ -148,13 +120,15 @@ gl_view_ellipse_instance_init (glViewEllipse *view_ellipse) static void gl_view_ellipse_finalize (GObject *object) { - glLabel *parent; + glViewEllipse *view_ellipse = GL_VIEW_ELLIPSE (object); gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object && GL_IS_VIEW_ELLIPSE (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (view_ellipse->priv); + + G_OBJECT_CLASS (gl_view_ellipse_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } @@ -181,11 +155,11 @@ gl_view_ellipse_new (glLabelEllipse *object, GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE); /* Create analogous canvas items. */ - view_ellipse->private->shadow_item = + view_ellipse->priv->shadow_item = gl_view_object_item_new (GL_VIEW_OBJECT(view_ellipse), gnome_canvas_ellipse_get_type (), NULL); - view_ellipse->private->object_item = + view_ellipse->priv->object_item = gl_view_object_item_new (GL_VIEW_OBJECT(view_ellipse), gnome_canvas_ellipse_get_type (), NULL); @@ -293,7 +267,7 @@ update_canvas_item_from_object_cb (glLabelObject *object, fill_color_node->color); /* Adjust appearance of analogous canvas items. */ - gnome_canvas_item_set (view_ellipse->private->shadow_item, + gnome_canvas_item_set (view_ellipse->priv->shadow_item, "x1", shadow_x, "y1", shadow_y, "x2", shadow_x + w + DELTA, @@ -305,14 +279,14 @@ update_canvas_item_from_object_cb (glLabelObject *object, if (shadow_state) { - gnome_canvas_item_show (view_ellipse->private->shadow_item); + gnome_canvas_item_show (view_ellipse->priv->shadow_item); } else { - gnome_canvas_item_hide (view_ellipse->private->shadow_item); + gnome_canvas_item_hide (view_ellipse->priv->shadow_item); } - gnome_canvas_item_set (view_ellipse->private->object_item, + gnome_canvas_item_set (view_ellipse->priv->object_item, "x2", w + DELTA, "y2", h + DELTA, "width_units", line_width, diff --git a/glabels2/src/view-ellipse.h b/glabels2/src/view-ellipse.h index d7f13b6f..e3ec57bf 100644 --- a/glabels2/src/view-ellipse.h +++ b/glabels2/src/view-ellipse.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -41,13 +43,13 @@ typedef struct _glViewEllipseClass glViewEllipseClass; typedef struct _glViewEllipsePrivate glViewEllipsePrivate; struct _glViewEllipse { - glViewObject parent_object; + glViewObject parent_object; - glViewEllipsePrivate *private; + glViewEllipsePrivate *priv; }; struct _glViewEllipseClass { - glViewObjectClass parent_class; + glViewObjectClass parent_class; }; diff --git a/glabels2/src/view-highlight.c b/glabels2/src/view-highlight.c index 64e859aa..4b744f52 100644 --- a/glabels2/src/view-highlight.c +++ b/glabels2/src/view-highlight.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -58,14 +60,11 @@ struct _glViewHighlightPrivate { /* Private globals */ /*===========================================*/ -static GObjectClass *parent_class = NULL; /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_view_highlight_class_init (glViewHighlightClass *klass); -static void gl_view_highlight_instance_init (glViewHighlight *view_highlight); static void gl_view_highlight_finalize (GObject *object); @@ -150,40 +149,16 @@ static int passthrough_event_handler (GnomeCanvasItem *handle_item, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_view_highlight_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewHighlightClass), - NULL, - NULL, - (GClassInitFunc) gl_view_highlight_class_init, - NULL, - NULL, - sizeof (glViewHighlight), - 0, - (GInstanceInitFunc) gl_view_highlight_instance_init, - NULL - }; - - type = g_type_register_static (G_TYPE_OBJECT, - "glViewHighlight", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glViewHighlight, gl_view_highlight, G_TYPE_OBJECT); static void -gl_view_highlight_class_init (glViewHighlightClass *klass) +gl_view_highlight_class_init (glViewHighlightClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_view_highlight_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_highlight_finalize; @@ -191,11 +166,11 @@ gl_view_highlight_class_init (glViewHighlightClass *klass) } static void -gl_view_highlight_instance_init (glViewHighlight *view_highlight) +gl_view_highlight_init (glViewHighlight *view_highlight) { gl_debug (DEBUG_VIEW, "START"); - view_highlight->private = g_new0 (glViewHighlightPrivate, 1); + view_highlight->priv = g_new0 (glViewHighlightPrivate, 1); gl_debug (DEBUG_VIEW, "END"); } @@ -203,27 +178,24 @@ gl_view_highlight_instance_init (glViewHighlight *view_highlight) static void gl_view_highlight_finalize (GObject *object) { - glLabel *parent; - glViewHighlight *view_highlight; + glViewHighlight *view_highlight = GL_VIEW_HIGHLIGHT (object); gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object && GL_IS_VIEW_HIGHLIGHT (object)); - view_highlight = GL_VIEW_HIGHLIGHT (object); - /* Free up handler owned by view. */ - g_signal_handlers_disconnect_by_func (G_OBJECT (view_highlight->private->view), + g_signal_handlers_disconnect_by_func (G_OBJECT (view_highlight->priv->view), G_CALLBACK (view_scale_changed_cb), object); - gtk_object_destroy (GTK_OBJECT(view_highlight->private->position_group)); + gtk_object_destroy (GTK_OBJECT(view_highlight->priv->position_group)); - if (view_highlight->private) { - g_free (view_highlight->private); + if (view_highlight->priv) { + g_free (view_highlight->priv); } - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_view_highlight_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } @@ -251,10 +223,10 @@ gl_view_highlight_new (glViewObject *view_object, view_highlight = g_object_new (gl_view_highlight_get_type (), NULL); - view_highlight->private->style = style; - view_highlight->private->view = view; - view_highlight->private->object = object; - view_highlight->private->position_group = + view_highlight->priv->style = style; + view_highlight->priv->view = view; + view_highlight->priv->object = object; + view_highlight->priv->position_group = gnome_canvas_item_new (view->highlight_group, gnome_canvas_group_get_type (), "x", x, @@ -282,19 +254,19 @@ gl_view_highlight_new (glViewObject *view_object, } - gl_label_object_get_affine (view_highlight->private->object, affine); - gnome_canvas_item_affine_absolute (view_highlight->private->group, affine); + gl_label_object_get_affine (view_highlight->priv->object, affine); + gnome_canvas_item_affine_absolute (view_highlight->priv->group, affine); - g_signal_connect (G_OBJECT (view_highlight->private->object), "moved", + g_signal_connect (G_OBJECT (view_highlight->priv->object), "moved", G_CALLBACK (object_moved_cb), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->object), "changed", + g_signal_connect (G_OBJECT (view_highlight->priv->object), "changed", G_CALLBACK (object_changed_cb), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->object), "flip_rotate", + g_signal_connect (G_OBJECT (view_highlight->priv->object), "flip_rotate", G_CALLBACK (flip_rotate_object_cb), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->view), "zoom_changed", + g_signal_connect (G_OBJECT (view_highlight->priv->view), "zoom_changed", G_CALLBACK (view_scale_changed_cb), view_highlight); gl_debug (DEBUG_VIEW, "END"); @@ -322,29 +294,29 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, g_return_if_fail (view_highlight && GL_IS_VIEW_HIGHLIGHT (view_highlight)); g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); - view = view_highlight->private->view; + view = view_highlight->priv->view; scale = view->zoom * view->home_scale; - object = view_highlight->private->object; + object = view_highlight->priv->object; - position_group = GNOME_CANVAS_GROUP(view_highlight->private->position_group); + position_group = GNOME_CANVAS_GROUP(view_highlight->priv->position_group); g_return_if_fail (view && GL_IS_VIEW (view)); g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); gl_label_object_get_size (object, &w, &h); - view_highlight->private->group = + view_highlight->priv->group = gnome_canvas_item_new (position_group, gnome_canvas_group_get_type (), "x", 0.0, "y", 0.0, NULL); - gnome_canvas_item_hide (view_highlight->private->group); - group = view_highlight->private->group; + gnome_canvas_item_hide (view_highlight->priv->group); + group = view_highlight->priv->group; #ifdef SHOW_OUTLINE switch (style) { case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: - view_highlight->private->outline = + view_highlight->priv->outline = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", -0.5, @@ -356,7 +328,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, NULL); break; case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: - view_highlight->private->outline = + view_highlight->priv->outline = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_ellipse_get_type (), "x1", -0.5, @@ -368,12 +340,12 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, NULL); break; default: - view_highlight->private->outline = NULL; + view_highlight->priv->outline = NULL; g_message ("Invalid resizable highlight style"); } #endif - view_highlight->private->tl = + view_highlight->priv->tl = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", -HANDLE_PIXELS/scale, @@ -385,7 +357,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - view_highlight->private->tr = + view_highlight->priv->tr = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", w - HANDLE_PIXELS/scale, @@ -397,7 +369,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - view_highlight->private->bl = + view_highlight->priv->bl = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", -HANDLE_PIXELS/scale, @@ -409,7 +381,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - view_highlight->private->br = + view_highlight->priv->br = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", w - HANDLE_PIXELS/scale, @@ -421,7 +393,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - view_highlight->private->sl = + view_highlight->priv->sl = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", -HANDLE_PIXELS/scale, @@ -433,7 +405,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - view_highlight->private->sr = + view_highlight->priv->sr = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", w - HANDLE_PIXELS/scale, @@ -445,7 +417,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - view_highlight->private->st = + view_highlight->priv->st = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", w / 2.0 - HANDLE_PIXELS/scale, @@ -457,7 +429,7 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - view_highlight->private->sb = + view_highlight->priv->sb = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", w / 2.0 - HANDLE_PIXELS/scale, @@ -469,25 +441,25 @@ highlight_resizable_box_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - g_signal_connect (G_OBJECT (view_highlight->private->tl), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->tl), "event", G_CALLBACK (tl_resize_event_handler), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->tr), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->tr), "event", G_CALLBACK (tr_resize_event_handler), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->bl), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->bl), "event", G_CALLBACK (bl_resize_event_handler), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->br), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->br), "event", G_CALLBACK (br_resize_event_handler), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->sl), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->sl), "event", G_CALLBACK (sl_resize_event_handler), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->sr), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->sr), "event", G_CALLBACK (sr_resize_event_handler), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->st), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->st), "event", G_CALLBACK (st_resize_event_handler), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->sb), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->sb), "event", G_CALLBACK (sb_resize_event_handler), view_highlight); #ifdef SHOW_OUTLINE - g_signal_connect (G_OBJECT (view_highlight->private->outline), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->outline), "event", G_CALLBACK (passthrough_event_handler), view_object); #endif @@ -518,12 +490,12 @@ highlight_resizable_line_construct (glViewHighlight *view_highlight, g_return_if_fail (view_highlight && GL_IS_VIEW_HIGHLIGHT (view_highlight)); g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); - view = view_highlight->private->view; + view = view_highlight->priv->view; scale = view->zoom * view->home_scale; - object = view_highlight->private->object; + object = view_highlight->priv->object; - position_group = GNOME_CANVAS_GROUP(view_highlight->private->position_group); + position_group = GNOME_CANVAS_GROUP(view_highlight->priv->position_group); g_return_if_fail (view && GL_IS_VIEW (view)); g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); @@ -534,19 +506,19 @@ highlight_resizable_line_construct (glViewHighlight *view_highlight, points = gnome_canvas_points_new (2); #endif - view_highlight->private->group = + view_highlight->priv->group = gnome_canvas_item_new (position_group, gnome_canvas_group_get_type (), "x", 0.0, "y", 0.0, NULL); - gnome_canvas_item_hide (view_highlight->private->group); - group = view_highlight->private->group; + gnome_canvas_item_hide (view_highlight->priv->group); + group = view_highlight->priv->group; #ifdef SHOW_OUTLINE points->coords[0] = 0.0; points->coords[1] = 0.0; points->coords[2] = dx; points->coords[3] = dy; - view_highlight->private->outline = + view_highlight->priv->outline = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_line_get_type (), "points", points, @@ -555,7 +527,7 @@ highlight_resizable_line_construct (glViewHighlight *view_highlight, NULL); #endif - view_highlight->private->p1 = + view_highlight->priv->p1 = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", -HANDLE_PIXELS/scale, @@ -567,7 +539,7 @@ highlight_resizable_line_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - view_highlight->private->p2 = + view_highlight->priv->p2 = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", dx - HANDLE_PIXELS/scale, @@ -579,13 +551,13 @@ highlight_resizable_line_construct (glViewHighlight *view_highlight, "outline_color_rgba", BG_COLOR, NULL); - g_signal_connect (G_OBJECT (view_highlight->private->p1), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->p1), "event", G_CALLBACK (p1_resize_event_handler), view_highlight); - g_signal_connect (G_OBJECT (view_highlight->private->p2), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->p2), "event", G_CALLBACK (p2_resize_event_handler), view_highlight); #ifdef SHOW_OUTLINE - g_signal_connect (G_OBJECT (view_highlight->private->outline), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->outline), "event", G_CALLBACK (passthrough_event_handler), view_object); #endif @@ -616,11 +588,11 @@ highlight_simple_construct (glViewHighlight *view_highlight, g_return_if_fail (view_highlight && GL_IS_VIEW_HIGHLIGHT (view_highlight)); g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); - view = view_highlight->private->view; + view = view_highlight->priv->view; - object = view_highlight->private->object; + object = view_highlight->priv->object; - position_group = GNOME_CANVAS_GROUP(view_highlight->private->position_group); + position_group = GNOME_CANVAS_GROUP(view_highlight->priv->position_group); g_return_if_fail (view && GL_IS_VIEW (view)); g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); @@ -628,14 +600,14 @@ highlight_simple_construct (glViewHighlight *view_highlight, gl_label_object_get_size (object, &w, &h); - view_highlight->private->group = + view_highlight->priv->group = gnome_canvas_item_new (position_group, gnome_canvas_group_get_type (), "x", 0.0, "y", 0.0, NULL); - gnome_canvas_item_hide (view_highlight->private->group); - group = view_highlight->private->group; + gnome_canvas_item_hide (view_highlight->priv->group); + group = view_highlight->priv->group; - view_highlight->private->outline = + view_highlight->priv->outline = gnome_canvas_item_new (GNOME_CANVAS_GROUP(group), gnome_canvas_rect_get_type (), "x1", -0.5, @@ -647,7 +619,7 @@ highlight_simple_construct (glViewHighlight *view_highlight, NULL); - g_signal_connect (G_OBJECT (view_highlight->private->outline), "event", + g_signal_connect (G_OBJECT (view_highlight->priv->outline), "event", G_CALLBACK (passthrough_event_handler), view_object); gnome_canvas_item_raise_to_top (group); @@ -661,9 +633,9 @@ highlight_simple_construct (glViewHighlight *view_highlight, void gl_view_highlight_show (glViewHighlight *view_highlight) { - gnome_canvas_item_show (view_highlight->private->group); + gnome_canvas_item_show (view_highlight->priv->group); - gnome_canvas_item_raise_to_top (view_highlight->private->group); + gnome_canvas_item_raise_to_top (view_highlight->priv->group); } /****************************************************************************/ @@ -672,7 +644,7 @@ gl_view_highlight_show (glViewHighlight *view_highlight) void gl_view_highlight_hide (glViewHighlight *view_highlight) { - gnome_canvas_item_hide (view_highlight->private->group); + gnome_canvas_item_hide (view_highlight->priv->group); } /*---------------------------------------------------------------------------*/ @@ -687,7 +659,7 @@ object_moved_cb (glLabelObject *object, gl_debug (DEBUG_VIEW, "START"); /* Adjust location of outer canvas group. */ - gnome_canvas_item_move (view_highlight->private->position_group, dx, dy); + gnome_canvas_item_move (view_highlight->priv->position_group, dx, dy); gl_debug (DEBUG_VIEW, "END"); } @@ -705,7 +677,7 @@ flip_rotate_object_cb (glLabelObject *object, /* Adjust affine of inner canvas group. */ gl_label_object_get_affine (object, affine); - gnome_canvas_item_affine_absolute (view_highlight->private->group, affine); + gnome_canvas_item_affine_absolute (view_highlight->priv->group, affine); gl_debug (DEBUG_VIEW, "END"); } @@ -724,7 +696,7 @@ object_changed_cb (glLabelObject *object, g_return_if_fail (view_highlight && GL_IS_VIEW_HIGHLIGHT (view_highlight)); g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - switch (view_highlight->private->style) { + switch (view_highlight->priv->style) { case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: @@ -760,7 +732,7 @@ view_scale_changed_cb (glView *view, g_return_if_fail (view_highlight && GL_IS_VIEW_HIGHLIGHT (view_highlight)); g_return_if_fail (view && GL_IS_VIEW (view)); - switch (view_highlight->private->style) { + switch (view_highlight->priv->style) { case GL_VIEW_HIGHLIGHT_BOX_RESIZABLE: case GL_VIEW_HIGHLIGHT_ELLIPSE_RESIZABLE: @@ -796,14 +768,14 @@ update_resizable_box (glViewHighlight *view_highlight) g_return_if_fail (view_highlight && GL_IS_VIEW_HIGHLIGHT (view_highlight)); - scale = view_highlight->private->view->zoom * - view_highlight->private->view->home_scale; + scale = view_highlight->priv->view->zoom * + view_highlight->priv->view->home_scale; - gl_label_object_get_size (view_highlight->private->object, &w, &h); + gl_label_object_get_size (view_highlight->priv->object, &w, &h); #ifdef SHOW_OUTLINE - gnome_canvas_item_set (view_highlight->private->outline, + gnome_canvas_item_set (view_highlight->priv->outline, "x1", -0.5, "y1", -0.5, "x2", w + 0.5, @@ -811,63 +783,63 @@ update_resizable_box (glViewHighlight *view_highlight) NULL); #endif - gnome_canvas_item_set (view_highlight->private->tl, + gnome_canvas_item_set (view_highlight->priv->tl, "x1", -HANDLE_PIXELS/scale, "y1", -HANDLE_PIXELS/scale, "x2", +HANDLE_PIXELS/scale, "y2", +HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_set (view_highlight->private->tr, + gnome_canvas_item_set (view_highlight->priv->tr, "x1", w - HANDLE_PIXELS/scale, "y1", -HANDLE_PIXELS/scale, "x2", w + HANDLE_PIXELS/scale, "y2", +HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_set (view_highlight->private->bl, + gnome_canvas_item_set (view_highlight->priv->bl, "x1", -HANDLE_PIXELS/scale, "y1", h - HANDLE_PIXELS/scale, "x2", +HANDLE_PIXELS/scale, "y2", h + HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_set (view_highlight->private->br, + gnome_canvas_item_set (view_highlight->priv->br, "x1", w - HANDLE_PIXELS/scale, "y1", h - HANDLE_PIXELS/scale, "x2", w + HANDLE_PIXELS/scale, "y2", h + HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_set (view_highlight->private->sl, + gnome_canvas_item_set (view_highlight->priv->sl, "x1", -HANDLE_PIXELS/scale, "y1", h / 2.0 - HANDLE_PIXELS/scale, "x2", +HANDLE_PIXELS/scale, "y2", h / 2.0 + HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_set (view_highlight->private->sr, + gnome_canvas_item_set (view_highlight->priv->sr, "x1", w - HANDLE_PIXELS/scale, "y1", h / 2.0 - HANDLE_PIXELS/scale, "x2", w + HANDLE_PIXELS/scale, "y2", h / 2.0 + HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_set (view_highlight->private->st, + gnome_canvas_item_set (view_highlight->priv->st, "x1", w / 2.0 - HANDLE_PIXELS/scale, "y1", -HANDLE_PIXELS/scale, "x2", w / 2.0 + HANDLE_PIXELS/scale, "y2", +HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_set (view_highlight->private->sb, + gnome_canvas_item_set (view_highlight->priv->sb, "x1", w / 2.0 - HANDLE_PIXELS/scale, "y1", h - HANDLE_PIXELS/scale, "x2", w / 2.0 + HANDLE_PIXELS/scale, "y2", h + HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_raise_to_top (view_highlight->private->group); + gnome_canvas_item_raise_to_top (view_highlight->priv->group); gl_debug (DEBUG_VIEW, "END"); } @@ -888,10 +860,10 @@ update_resizable_line (glViewHighlight *view_highlight) g_return_if_fail (view_highlight && GL_IS_VIEW_HIGHLIGHT (view_highlight)); - scale = view_highlight->private->view->zoom * - view_highlight->private->view->home_scale; + scale = view_highlight->priv->view->zoom * + view_highlight->priv->view->home_scale; - gl_label_object_get_size (view_highlight->private->object, &dx, &dy); + gl_label_object_get_size (view_highlight->priv->object, &dx, &dy); #ifdef SHOW_OUTLINE points = gnome_canvas_points_new (2); @@ -900,17 +872,17 @@ update_resizable_line (glViewHighlight *view_highlight) points->coords[1] = 0.0; points->coords[2] = dx; points->coords[3] = dy; - gnome_canvas_item_set (view_highlight->private->outline, "points", points, NULL); + gnome_canvas_item_set (view_highlight->priv->outline, "points", points, NULL); #endif - gnome_canvas_item_set (view_highlight->private->p1, + gnome_canvas_item_set (view_highlight->priv->p1, "x1", -HANDLE_PIXELS/scale, "y1", -HANDLE_PIXELS/scale, "x2", +HANDLE_PIXELS/scale, "y2", +HANDLE_PIXELS/scale, NULL); - gnome_canvas_item_set (view_highlight->private->p2, + gnome_canvas_item_set (view_highlight->priv->p2, "x1", dx - HANDLE_PIXELS/scale, "y1", dy - HANDLE_PIXELS/scale, "x2", dx + HANDLE_PIXELS/scale, @@ -921,7 +893,7 @@ update_resizable_line (glViewHighlight *view_highlight) gnome_canvas_points_free (points); #endif - gnome_canvas_item_raise_to_top (view_highlight->private->group); + gnome_canvas_item_raise_to_top (view_highlight->priv->group); gl_debug (DEBUG_VIEW, "END"); } @@ -938,14 +910,14 @@ update_simple (glViewHighlight *view_highlight) g_return_if_fail (view_highlight && GL_IS_VIEW_HIGHLIGHT (view_highlight)); - gl_label_object_get_size (view_highlight->private->object, &w, &h); + gl_label_object_get_size (view_highlight->priv->object, &w, &h); - gnome_canvas_item_set (view_highlight->private->outline, + gnome_canvas_item_set (view_highlight->priv->outline, "x2", w + 0.5, "y2", h + 0.5, NULL); - gnome_canvas_item_raise_to_top (view_highlight->private->group); + gnome_canvas_item_raise_to_top (view_highlight->priv->group); gl_debug (DEBUG_VIEW, "END"); } @@ -964,11 +936,11 @@ get_origin_and_corners (glViewHighlight *view_highlight, { glLabelObject *object; - object = view_highlight->private->object;; + object = view_highlight->priv->object;; /* origin, relative to item */ gl_label_object_get_position (object, x0, y0); - gnome_canvas_item_w2i (view_highlight->private->group, x0, y0); + gnome_canvas_item_w2i (view_highlight->priv->group, x0, y0); /* Top left corner, relative to item */ *x1 = 0.0; @@ -994,12 +966,12 @@ tl_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1027,7 +999,7 @@ tl_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); @@ -1041,7 +1013,7 @@ tl_resize_event_handler (GnomeCanvasItem *handle_item, y1 = y2 - h; x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; @@ -1053,7 +1025,7 @@ tl_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (x2 - event->motion.x, MIN_ITEM_SIZE); h = MAX (y2 - event->motion.y, MIN_ITEM_SIZE); @@ -1067,7 +1039,7 @@ tl_resize_event_handler (GnomeCanvasItem *handle_item, y1 = y2 - h; x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; } else { @@ -1076,14 +1048,14 @@ tl_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1109,12 +1081,12 @@ tr_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1142,7 +1114,7 @@ tr_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (event->button.x - x1, MIN_ITEM_SIZE); h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); @@ -1156,7 +1128,7 @@ tr_resize_event_handler (GnomeCanvasItem *handle_item, y1 = y2 - h; x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; @@ -1168,7 +1140,7 @@ tr_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (event->button.x - x1, MIN_ITEM_SIZE); h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); @@ -1182,7 +1154,7 @@ tr_resize_event_handler (GnomeCanvasItem *handle_item, y1 = y2 - h; x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; } else { @@ -1191,14 +1163,14 @@ tr_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1224,12 +1196,12 @@ bl_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1257,7 +1229,7 @@ bl_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); h = MAX (event->button.y - x1, MIN_ITEM_SIZE); @@ -1271,7 +1243,7 @@ bl_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; @@ -1283,7 +1255,7 @@ bl_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); h = MAX (event->button.y - x1, MIN_ITEM_SIZE); @@ -1297,7 +1269,7 @@ bl_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; } else { @@ -1306,14 +1278,14 @@ bl_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1339,12 +1311,12 @@ br_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1374,7 +1346,7 @@ br_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (event->button.x - x1, MIN_ITEM_SIZE); h = MAX (event->button.y - x1, MIN_ITEM_SIZE); @@ -1387,7 +1359,7 @@ br_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; @@ -1400,7 +1372,7 @@ br_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (event->button.x - x1, MIN_ITEM_SIZE); h = MAX (event->button.y - x1, MIN_ITEM_SIZE); @@ -1413,7 +1385,7 @@ br_resize_event_handler (GnomeCanvasItem *handle_item, y0 = y0 + y1; /* x1 unchanged */ /* y1 unchanged */ - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; } else { @@ -1423,7 +1395,7 @@ br_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: gl_debug (DEBUG_VIEW, "ENTER_NOTIFY"); cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1431,7 +1403,7 @@ br_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_LEAVE_NOTIFY: gl_debug (DEBUG_VIEW, "LEAVE_NOTIFY"); cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1457,12 +1429,12 @@ sl_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1489,7 +1461,7 @@ sl_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); h = y2 - y1; @@ -1499,7 +1471,7 @@ sl_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; @@ -1511,7 +1483,7 @@ sl_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (x2 - event->button.x, MIN_ITEM_SIZE); h = y2 - y1; @@ -1521,7 +1493,7 @@ sl_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; } else { @@ -1530,14 +1502,14 @@ sl_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1562,12 +1534,12 @@ sr_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1594,7 +1566,7 @@ sr_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (event->button.x - x1, MIN_ITEM_SIZE); h = y2 - y1; @@ -1604,7 +1576,7 @@ sr_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; @@ -1616,7 +1588,7 @@ sr_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = MAX (event->button.x - x1, MIN_ITEM_SIZE); h = y2 - y1; @@ -1626,7 +1598,7 @@ sr_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; } else { @@ -1635,14 +1607,14 @@ sr_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1667,12 +1639,12 @@ st_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1699,7 +1671,7 @@ st_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = x2 - x1; h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); @@ -1709,7 +1681,7 @@ st_resize_event_handler (GnomeCanvasItem *handle_item, y1 = y2 - h; x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; @@ -1721,7 +1693,7 @@ st_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = x2 - x1; h = MAX (y2 - event->button.y, MIN_ITEM_SIZE); @@ -1731,7 +1703,7 @@ st_resize_event_handler (GnomeCanvasItem *handle_item, y1 = y2 - h; x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; } else { @@ -1740,14 +1712,14 @@ st_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1772,12 +1744,12 @@ sb_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1804,7 +1776,7 @@ sb_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = x2 - x1; h = MAX (event->button.y - x1, MIN_ITEM_SIZE); @@ -1814,7 +1786,7 @@ sb_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; @@ -1826,7 +1798,7 @@ sb_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); w = x2 - x1; h = MAX (event->button.y - x1, MIN_ITEM_SIZE); @@ -1836,7 +1808,7 @@ sb_resize_event_handler (GnomeCanvasItem *handle_item, /* y1 unchanged */ x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); return TRUE; } else { @@ -1845,14 +1817,14 @@ sb_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1877,12 +1849,12 @@ p1_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -1909,7 +1881,7 @@ p1_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); x1 = event->button.x; y1 = event->button.y; @@ -1917,7 +1889,7 @@ p1_resize_event_handler (GnomeCanvasItem *handle_item, dy = (y2 - event->button.y); x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); gl_label_object_set_size (object, dx, dy); return TRUE; @@ -1930,7 +1902,7 @@ p1_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); x1 = event->button.x; y1 = event->button.y; @@ -1938,7 +1910,7 @@ p1_resize_event_handler (GnomeCanvasItem *handle_item, dy = (y2 - event->button.y); x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); gl_label_object_set_size (object, dx, dy); return TRUE; @@ -1948,14 +1920,14 @@ p1_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; @@ -1980,12 +1952,12 @@ p2_resize_event_handler (GnomeCanvasItem *handle_item, glLabelObject *object; GdkCursor *cursor; - if ( view_highlight->private->view->state != GL_VIEW_STATE_ARROW ) { + if ( view_highlight->priv->view->state != GL_VIEW_STATE_ARROW ) { /* don't interfere with object creation modes */ return FALSE; } - object = view_highlight->private->object;; + object = view_highlight->priv->object;; switch (event->type) { @@ -2012,7 +1984,7 @@ p2_resize_event_handler (GnomeCanvasItem *handle_item, &x0, &y0, &x1, &y1, &x2, &y2); gnome_canvas_item_ungrab (handle_item, event->button.time); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); /* x1 unchanged */ /* y1 unchanged */ @@ -2020,7 +1992,7 @@ p2_resize_event_handler (GnomeCanvasItem *handle_item, dy = (event->button.y - x1); x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); gl_label_object_set_size (object, dx, dy); return TRUE; @@ -2033,7 +2005,7 @@ p2_resize_event_handler (GnomeCanvasItem *handle_item, if (dragging && (event->motion.state & GDK_BUTTON1_MASK)) { get_origin_and_corners (view_highlight, &x0, &y0, &x1, &y1, &x2, &y2); - gnome_canvas_item_w2i (view_highlight->private->group, + gnome_canvas_item_w2i (view_highlight->priv->group, &event->button.x, &event->button.y); /* x1 unchanged */ /* y1 unchanged */ @@ -2041,7 +2013,7 @@ p2_resize_event_handler (GnomeCanvasItem *handle_item, dy = (event->button.y - x1); x0 = x0 + x1; y0 = y0 + y1; - gnome_canvas_item_i2w (view_highlight->private->group, &x0, &y0); + gnome_canvas_item_i2w (view_highlight->priv->group, &x0, &y0); gl_label_object_set_position (object, x0, y0); gl_label_object_set_size (object, dx, dy); return TRUE; @@ -2051,14 +2023,14 @@ p2_resize_event_handler (GnomeCanvasItem *handle_item, case GDK_ENTER_NOTIFY: cursor = gdk_cursor_new (GDK_CROSSHAIR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; case GDK_LEAVE_NOTIFY: cursor = gdk_cursor_new (GDK_LEFT_PTR); - gdk_window_set_cursor (view_highlight->private->view->canvas->window, + gdk_window_set_cursor (view_highlight->priv->view->canvas->window, cursor); gdk_cursor_unref (cursor); return TRUE; diff --git a/glabels2/src/view-highlight.h b/glabels2/src/view-highlight.h index d49987d1..d597ff39 100644 --- a/glabels2/src/view-highlight.h +++ b/glabels2/src/view-highlight.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -49,7 +51,7 @@ typedef struct _glViewHighlightPrivate glViewHighlightPrivate; struct _glViewHighlight { GObject parent_object; - glViewHighlightPrivate *private; + glViewHighlightPrivate *priv; }; struct _glViewHighlightClass { diff --git a/glabels2/src/view-image.c b/glabels2/src/view-image.c index 96ce6e9d..4c797300 100644 --- a/glabels2/src/view-image.c +++ b/glabels2/src/view-image.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -54,8 +56,6 @@ struct _glViewImagePrivate { /* Private globals. */ /*========================================================*/ -static glViewObjectClass *parent_class = NULL; - /* Save state of image file entry */ static gchar *image_path = NULL; @@ -63,8 +63,6 @@ static gchar *image_path = NULL; /* Private function prototypes. */ /*========================================================*/ -static void gl_view_image_class_init (glViewImageClass *klass); -static void gl_view_image_instance_init (glViewImage *view_image); static void gl_view_image_finalize (GObject *object); static GtkWidget *construct_properties_editor (glViewObject *view_object); @@ -91,41 +89,17 @@ static void update_editor_from_label_cb (glLabel *label, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_view_image_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewImageClass), - NULL, - NULL, - (GClassInitFunc) gl_view_image_class_init, - NULL, - NULL, - sizeof (glViewImage), - 0, - (GInstanceInitFunc) gl_view_image_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_VIEW_OBJECT, - "glViewImage", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glViewImage, gl_view_image, GL_TYPE_VIEW_OBJECT); static void -gl_view_image_class_init (glViewImageClass *klass) +gl_view_image_class_init (glViewImageClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glViewObjectClass *view_object_class = (glViewObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glViewObjectClass *view_object_class = GL_VIEW_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_view_image_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_image_finalize; @@ -135,11 +109,11 @@ gl_view_image_class_init (glViewImageClass *klass) } static void -gl_view_image_instance_init (glViewImage *view_image) +gl_view_image_init (glViewImage *view_image) { gl_debug (DEBUG_VIEW, "START"); - view_image->private = g_new0 (glViewImagePrivate, 1); + view_image->priv = g_new0 (glViewImagePrivate, 1); gl_debug (DEBUG_VIEW, "END"); } @@ -147,13 +121,15 @@ gl_view_image_instance_init (glViewImage *view_image) static void gl_view_image_finalize (GObject *object) { - glLabel *parent; + glViewImage *view_image = GL_VIEW_IMAGE (object); gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object && GL_IS_VIEW_IMAGE (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (view_image->priv); + + G_OBJECT_CLASS (gl_view_image_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } @@ -185,7 +161,7 @@ gl_view_image_new (glLabelImage *object, pixbuf = gl_label_image_get_pixbuf(object, NULL); /* Create analogous canvas item. */ - view_image->private->item = + view_image->priv->item = gl_view_object_item_new (GL_VIEW_OBJECT(view_image), gnome_canvas_pixbuf_get_type (), "x", 0.0, @@ -267,7 +243,7 @@ update_canvas_item_from_object_cb (glLabelObject *object, pixbuf = gl_label_image_get_pixbuf (GL_LABEL_IMAGE(object), NULL); /* Adjust appearance of analogous canvas item. */ - gnome_canvas_item_set (view_image->private->item, + gnome_canvas_item_set (view_image->priv->item, "width_set", TRUE, "height_set", TRUE, "width", w, diff --git a/glabels2/src/view-image.h b/glabels2/src/view-image.h index d19c9810..693371e9 100644 --- a/glabels2/src/view-image.h +++ b/glabels2/src/view-image.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -41,13 +43,13 @@ typedef struct _glViewImageClass glViewImageClass; typedef struct _glViewImagePrivate glViewImagePrivate; struct _glViewImage { - glViewObject parent_object; + glViewObject parent_object; - glViewImagePrivate *private; + glViewImagePrivate *priv; }; struct _glViewImageClass { - glViewObjectClass parent_class; + glViewObjectClass parent_class; }; diff --git a/glabels2/src/view-line.c b/glabels2/src/view-line.c index a025c8c8..7c2954ba 100644 --- a/glabels2/src/view-line.c +++ b/glabels2/src/view-line.c @@ -55,15 +55,10 @@ struct _glViewLinePrivate { /* Private globals. */ /*========================================================*/ -static glViewObjectClass *parent_class = NULL; - - /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_view_line_class_init (glViewLineClass *klass); -static void gl_view_line_instance_init (glViewLine *view_line); static void gl_view_line_finalize (GObject *object); static GtkWidget *construct_properties_editor (glViewObject *view_object); @@ -90,41 +85,17 @@ static void update_editor_from_label_cb (glLabel *label, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_view_line_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewLineClass), - NULL, - NULL, - (GClassInitFunc) gl_view_line_class_init, - NULL, - NULL, - sizeof (glViewLine), - 0, - (GInstanceInitFunc) gl_view_line_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_VIEW_OBJECT, - "glViewLine", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glViewLine, gl_view_line, GL_TYPE_VIEW_OBJECT); static void -gl_view_line_class_init (glViewLineClass *klass) +gl_view_line_class_init (glViewLineClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glViewObjectClass *view_object_class = (glViewObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glViewObjectClass *view_object_class = GL_VIEW_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_view_line_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_line_finalize; @@ -134,11 +105,11 @@ gl_view_line_class_init (glViewLineClass *klass) } static void -gl_view_line_instance_init (glViewLine *view_line) +gl_view_line_init (glViewLine *view_line) { gl_debug (DEBUG_VIEW, "START"); - view_line->private = g_new0 (glViewLinePrivate, 1); + view_line->priv = g_new0 (glViewLinePrivate, 1); gl_debug (DEBUG_VIEW, "END"); } @@ -146,13 +117,15 @@ gl_view_line_instance_init (glViewLine *view_line) static void gl_view_line_finalize (GObject *object) { - glLabel *parent; + glViewLine *view_line = GL_VIEW_LINE (object); gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object && GL_IS_VIEW_LINE (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (view_line->priv); + + G_OBJECT_CLASS (gl_view_line_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } @@ -179,11 +152,11 @@ gl_view_line_new (glLabelLine *object, GL_VIEW_HIGHLIGHT_LINE_RESIZABLE); /* Create analogous canvas item. */ - view_line->private->shadow_item = + view_line->priv->shadow_item = gl_view_object_item_new (GL_VIEW_OBJECT(view_line), gnome_canvas_line_get_type (), NULL); - view_line->private->object_item = + view_line->priv->object_item = gl_view_object_item_new (GL_VIEW_OBJECT(view_line), gnome_canvas_line_get_type (), NULL); @@ -286,7 +259,7 @@ update_canvas_item_from_object_cb (glLabelObject *object, points->coords[1] = shadow_y; points->coords[2] = shadow_x + w; points->coords[3] = shadow_y + h; - gnome_canvas_item_set (view_line->private->shadow_item, + gnome_canvas_item_set (view_line->priv->shadow_item, "points", points, "width_units", line_width, "fill_color_rgba", shadow_line_color, @@ -294,18 +267,18 @@ update_canvas_item_from_object_cb (glLabelObject *object, if (shadow_state) { - gnome_canvas_item_show (view_line->private->shadow_item); + gnome_canvas_item_show (view_line->priv->shadow_item); } else { - gnome_canvas_item_hide (view_line->private->shadow_item); + gnome_canvas_item_hide (view_line->priv->shadow_item); } points->coords[0] = 0.0; points->coords[1] = 0.0; points->coords[2] = w; points->coords[3] = h; - gnome_canvas_item_set (view_line->private->object_item, + gnome_canvas_item_set (view_line->priv->object_item, "points", points, "width_units", line_width, "fill_color_rgba", line_color_node->color, diff --git a/glabels2/src/view-line.h b/glabels2/src/view-line.h index 5d532d1a..2740433c 100644 --- a/glabels2/src/view-line.h +++ b/glabels2/src/view-line.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -41,13 +43,13 @@ typedef struct _glViewLineClass glViewLineClass; typedef struct _glViewLinePrivate glViewLinePrivate; struct _glViewLine { - glViewObject parent_object; + glViewObject parent_object; - glViewLinePrivate *private; + glViewLinePrivate *priv; }; struct _glViewLineClass { - glViewObjectClass parent_class; + glViewObjectClass parent_class; }; diff --git a/glabels2/src/view-object.c b/glabels2/src/view-object.c index a8efeb04..7ffc765f 100644 --- a/glabels2/src/view-object.c +++ b/glabels2/src/view-object.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME @@ -56,15 +56,11 @@ struct _glViewObjectPrivate { /* Private globals. */ /*========================================================*/ -static GObjectClass *parent_class = NULL; - /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_view_object_class_init (glViewObjectClass *klass); -static void gl_view_object_instance_init (glViewObject *view_object); static void gl_view_object_finalize (GObject *object); static void object_moved_cb (glLabelObject *object, @@ -92,40 +88,16 @@ static gint item_event_arrow_mode (GnomeCanvasItem *item, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_view_object_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewObjectClass), - NULL, - NULL, - (GClassInitFunc) gl_view_object_class_init, - NULL, - NULL, - sizeof (glViewObject), - 0, - (GInstanceInitFunc) gl_view_object_instance_init, - NULL - }; - - type = g_type_register_static (G_TYPE_OBJECT, - "glViewObject", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glViewObject, gl_view_object, G_TYPE_OBJECT); static void -gl_view_object_class_init (glViewObjectClass *klass) +gl_view_object_class_init (glViewObjectClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_view_object_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_object_finalize; @@ -133,11 +105,11 @@ gl_view_object_class_init (glViewObjectClass *klass) } static void -gl_view_object_instance_init (glViewObject *view_object) +gl_view_object_init (glViewObject *view_object) { gl_debug (DEBUG_VIEW, "START"); - view_object->private = g_new0 (glViewObjectPrivate, 1); + view_object->priv = g_new0 (glViewObjectPrivate, 1); gl_debug (DEBUG_VIEW, "END"); } @@ -145,26 +117,27 @@ gl_view_object_instance_init (glViewObject *view_object) static void gl_view_object_finalize (GObject *object) { - glLabel *parent; + glViewObject *view_object = GL_VIEW_OBJECT (object); glView *view; gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object && GL_IS_VIEW_OBJECT (object)); - view = GL_VIEW_OBJECT(object)->private->view; + view = view_object->priv->view; view->object_list = g_list_remove (view->object_list, object); view->selected_object_list = g_list_remove (view->selected_object_list, object); - g_object_unref (GL_VIEW_OBJECT(object)->private->object); - g_object_unref (G_OBJECT(GL_VIEW_OBJECT(object)->private->highlight)); - gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->group)); - if (GL_VIEW_OBJECT(object)->private->property_editor) { - gtk_object_destroy (GTK_OBJECT(GL_VIEW_OBJECT(object)->private->property_editor)); + g_object_unref (view_object->priv->object); + g_object_unref (G_OBJECT(view_object->priv->highlight)); + gtk_object_destroy (GTK_OBJECT(view_object->priv->group)); + if (view_object->priv->property_editor) { + gtk_object_destroy (GTK_OBJECT(view_object->priv->property_editor)); } + g_free (view_object->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_view_object_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } @@ -198,7 +171,7 @@ gl_view_object_set_view (glViewObject *view_object, g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); g_return_if_fail (view && GL_IS_VIEW (view)); - view_object->private->view = view; + view_object->priv->view = view; view->object_list = g_list_prepend (view->object_list, view_object); @@ -222,21 +195,21 @@ gl_view_object_set_object (glViewObject *view_object, g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); g_return_if_fail (object && GL_IS_LABEL_OBJECT (object)); - view_object->private->object = object; + view_object->priv->object = object; gl_label_object_get_position (GL_LABEL_OBJECT(object), &x, &y); gl_label_object_get_size (GL_LABEL_OBJECT(object), &w, &h); /* create canvas group to contain items representing object */ - view_object->private->group = - gnome_canvas_item_new (view_object->private->view->label_group, + view_object->priv->group = + gnome_canvas_item_new (view_object->priv->view->label_group, gnome_canvas_group_get_type (), "x", x, "y", y, NULL); /* Create appropriate selection highlight canvas item. */ - view_object->private->highlight = + view_object->priv->highlight = GL_VIEW_HIGHLIGHT (gl_view_highlight_new (view_object, style)); g_signal_connect (G_OBJECT (object), "moved", @@ -255,7 +228,7 @@ gl_view_object_set_object (glViewObject *view_object, G_CALLBACK (flip_rotate_object_cb), view_object); - g_signal_connect (G_OBJECT (view_object->private->group), "event", + g_signal_connect (G_OBJECT (view_object->priv->group), "event", G_CALLBACK (gl_view_object_item_event_cb), view_object); @@ -274,7 +247,7 @@ gl_view_object_get_view (glViewObject *view_object) gl_debug (DEBUG_VIEW, "END"); - return view_object->private->view; + return view_object->priv->view; } /*****************************************************************************/ @@ -289,7 +262,7 @@ gl_view_object_get_object (glViewObject *view_object) gl_debug (DEBUG_VIEW, "END"); - return view_object->private->object; + return view_object->priv->object; } /*****************************************************************************/ @@ -304,7 +277,7 @@ gl_view_object_get_group (glViewObject *view_object) gl_debug (DEBUG_VIEW, "END"); - return view_object->private->group; + return view_object->priv->group; } /*****************************************************************************/ @@ -324,14 +297,14 @@ gl_view_object_item_new (glViewObject *view_object, g_return_val_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object), NULL); - item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(view_object->private->group), + item = gnome_canvas_item_new (GNOME_CANVAS_GROUP(view_object->priv->group), type, NULL); va_start (args, first_arg_name); gnome_canvas_item_set_valist (item, first_arg_name, args); va_end (args); - gl_label_object_get_affine (view_object->private->object, affine); + gl_label_object_get_affine (view_object->priv->object, affine); /* Apply a very small rotation, fixes problems with flipped or rotated images */ art_affine_rotate (delta_affine, DELTA_DEG); @@ -353,9 +326,9 @@ gl_view_object_show_highlight (glViewObject *view_object) gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); - g_return_if_fail (view_object->private->highlight); + g_return_if_fail (view_object->priv->highlight); - gl_view_highlight_show (view_object->private->highlight); + gl_view_highlight_show (view_object->priv->highlight); gl_debug (DEBUG_VIEW, "END"); } @@ -369,9 +342,9 @@ gl_view_object_hide_highlight (glViewObject *view_object) gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (view_object && GL_IS_VIEW_OBJECT (view_object)); - g_return_if_fail (view_object->private->highlight); + g_return_if_fail (view_object->priv->highlight); - gl_view_highlight_hide (view_object->private->highlight); + gl_view_highlight_hide (view_object->priv->highlight); gl_debug (DEBUG_VIEW, "END"); } @@ -389,23 +362,23 @@ gl_view_object_get_editor (glViewObject *view_object) if ( GL_VIEW_OBJECT_GET_CLASS(view_object)->construct_editor != NULL ) { - if (view_object->private->property_editor == NULL) { - view_object->private->property_editor = + if (view_object->priv->property_editor == NULL) { + view_object->priv->property_editor = GL_VIEW_OBJECT_GET_CLASS(view_object)->construct_editor (view_object); } - g_signal_connect (G_OBJECT (view_object->private->property_editor), + g_signal_connect (G_OBJECT (view_object->priv->property_editor), "destroy", G_CALLBACK (gtk_widget_destroyed), - &view_object->private->property_editor); + &view_object->priv->property_editor); - gtk_widget_show (view_object->private->property_editor); + gtk_widget_show (view_object->priv->property_editor); } gl_debug (DEBUG_VIEW, "END"); - return view_object->private->property_editor; + return view_object->priv->property_editor; } @@ -421,7 +394,7 @@ object_moved_cb (glLabelObject *object, gl_debug (DEBUG_VIEW, "START"); /* Adjust location of analogous canvas group. */ - gnome_canvas_item_move (view_object->private->group, dx, dy); + gnome_canvas_item_move (view_object->priv->group, dx, dy); gl_debug (DEBUG_VIEW, "END"); } @@ -436,7 +409,7 @@ raise_object_cb (glLabelObject *object, gl_debug (DEBUG_VIEW, "START"); /* send to top */ - gnome_canvas_item_raise_to_top (view_object->private->group); + gnome_canvas_item_raise_to_top (view_object->priv->group); gl_debug (DEBUG_VIEW, "END"); } @@ -451,7 +424,7 @@ lower_object_cb (glLabelObject *object, gl_debug (DEBUG_VIEW, "START"); /* Send to bottom */ - gnome_canvas_item_lower_to_bottom (view_object->private->group); + gnome_canvas_item_lower_to_bottom (view_object->priv->group); gl_debug (DEBUG_VIEW, "END"); } @@ -475,7 +448,7 @@ flip_rotate_object_cb (glLabelObject *object, art_affine_rotate (delta_affine, DELTA_DEG); art_affine_multiply (affine, affine, delta_affine); - item_list = GNOME_CANVAS_GROUP(view_object->private->group)->item_list; + item_list = GNOME_CANVAS_GROUP(view_object->priv->group)->item_list; for ( p=item_list; p != NULL; p=p->next ) { item = GNOME_CANVAS_ITEM(p->data); gnome_canvas_item_affine_absolute (item, affine); @@ -492,7 +465,7 @@ gl_view_object_select (glViewObject *view_object) { gl_debug (DEBUG_VIEW, "START"); - gl_view_select_object(view_object->private->view, view_object); + gl_view_select_object(view_object->priv->view, view_object); gl_debug (DEBUG_VIEW, "END"); } diff --git a/glabels2/src/view-object.h b/glabels2/src/view-object.h index c2451ba8..fae724e1 100644 --- a/glabels2/src/view-object.h +++ b/glabels2/src/view-object.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -43,13 +45,13 @@ typedef struct _glViewObjectPrivate glViewObjectPrivate; #include "view-highlight.h" struct _glViewObject { - GObject parent_object; + GObject parent_object; - glViewObjectPrivate *private; + glViewObjectPrivate *priv; }; struct _glViewObjectClass { - GObjectClass parent_class; + GObjectClass parent_class; /* * Methods diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c index 516d0c7f..93913369 100644 --- a/glabels2/src/view-text.c +++ b/glabels2/src/view-text.c @@ -72,15 +72,10 @@ struct _glViewTextPrivate { /* Private globals. */ /*========================================================*/ -static glViewObjectClass *parent_class = NULL; - - /*========================================================*/ /* Private function prototypes. */ /*========================================================*/ -static void gl_view_text_class_init (glViewTextClass *klass); -static void gl_view_text_instance_init (glViewText *view_text); static void gl_view_text_finalize (GObject *object); static GtkWidget *construct_properties_editor (glViewObject *view_object); @@ -127,41 +122,17 @@ static gint item_event_cb (GnomeCanvasItem *item, /*****************************************************************************/ /* Boilerplate object stuff. */ /*****************************************************************************/ -GType -gl_view_text_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewTextClass), - NULL, - NULL, - (GClassInitFunc) gl_view_text_class_init, - NULL, - NULL, - sizeof (glViewText), - 0, - (GInstanceInitFunc) gl_view_text_instance_init, - NULL - }; - - type = g_type_register_static (GL_TYPE_VIEW_OBJECT, - "glViewText", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glViewText, gl_view_text, GL_TYPE_VIEW_OBJECT); static void -gl_view_text_class_init (glViewTextClass *klass) +gl_view_text_class_init (glViewTextClass *class) { - GObjectClass *object_class = (GObjectClass *) klass; - glViewObjectClass *view_object_class = (glViewObjectClass *) klass; + GObjectClass *object_class = G_OBJECT_CLASS (class); + glViewObjectClass *view_object_class = GL_VIEW_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (klass); + gl_view_text_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_text_finalize; @@ -171,11 +142,11 @@ gl_view_text_class_init (glViewTextClass *klass) } static void -gl_view_text_instance_init (glViewText *view_text) +gl_view_text_init (glViewText *view_text) { gl_debug (DEBUG_VIEW, "START"); - view_text->private = g_new0 (glViewTextPrivate, 1); + view_text->priv = g_new0 (glViewTextPrivate, 1); gl_debug (DEBUG_VIEW, "END"); } @@ -183,13 +154,15 @@ gl_view_text_instance_init (glViewText *view_text) static void gl_view_text_finalize (GObject *object) { - glLabel *parent; + glViewText *view_text = GL_VIEW_TEXT (object); gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object && GL_IS_VIEW_TEXT (object)); - G_OBJECT_CLASS (parent_class)->finalize (object); + g_free (view_text->priv); + + G_OBJECT_CLASS (gl_view_text_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } @@ -755,19 +728,19 @@ draw_hacktext (glViewText *view_text) color_node->color); /* remove previous items from group. */ - for (li = view_text->private->object_item_list; li != NULL; li = li->next) { + for (li = view_text->priv->object_item_list; li != NULL; li = li->next) { gl_debug (DEBUG_VIEW, "in loop"); gtk_object_destroy (GTK_OBJECT (li->data)); } - for (li = view_text->private->shadow_item_list; li != NULL; li = li->next) { + for (li = view_text->priv->shadow_item_list; li != NULL; li = li->next) { gl_debug (DEBUG_VIEW, "in loop"); gtk_object_destroy (GTK_OBJECT (li->data)); } gl_debug (DEBUG_VIEW, "1"); - g_list_free (view_text->private->object_item_list); - g_list_free (view_text->private->shadow_item_list); - view_text->private->object_item_list = NULL; - view_text->private->shadow_item_list = NULL; + g_list_free (view_text->priv->object_item_list); + g_list_free (view_text->priv->shadow_item_list); + view_text->priv->object_item_list = NULL; + view_text->priv->shadow_item_list = NULL; gl_debug (DEBUG_VIEW, "2"); /* get Gnome Font */ @@ -821,8 +794,8 @@ draw_hacktext (glViewText *view_text) gnome_glyphlist_unref (glyphlist); - view_text->private->shadow_item_list = - g_list_prepend (view_text->private->shadow_item_list, item); + view_text->priv->shadow_item_list = + g_list_prepend (view_text->priv->shadow_item_list, item); } } @@ -868,8 +841,8 @@ draw_hacktext (glViewText *view_text) gnome_glyphlist_unref (glyphlist); - view_text->private->object_item_list = - g_list_prepend (view_text->private->object_item_list, item); + view_text->priv->object_item_list = + g_list_prepend (view_text->priv->object_item_list, item); } @@ -989,10 +962,10 @@ draw_cursor (glViewText *view_text) points->coords[2] = x_offset; points->coords[3] = GL_LABEL_TEXT_MARGIN + (i+1)*font_size; - if (view_text->private->cursor) { - gtk_object_destroy (GTK_OBJECT (view_text->private->cursor)); + if (view_text->priv->cursor) { + gtk_object_destroy (GTK_OBJECT (view_text->priv->cursor)); } - view_text->private->cursor = + view_text->priv->cursor = gl_view_object_item_new (GL_VIEW_OBJECT(view_text), gnome_canvas_line_get_type (), "points", points, @@ -1001,8 +974,8 @@ draw_cursor (glViewText *view_text) NULL); gnome_canvas_points_free (points); - if ( !view_text->private->cursor_visible ) { - gnome_canvas_item_hide (view_text->private->cursor); + if ( !view_text->priv->cursor_visible ) { + gnome_canvas_item_hide (view_text->priv->cursor); } } @@ -1043,11 +1016,11 @@ mark_set_cb (GtkTextBuffer *textbuffer, static void blink_start (glViewText *view_text) { - if ( !view_text->private->cursor_visible ) return; + if ( !view_text->priv->cursor_visible ) return; - view_text->private->cursor_state = TRUE; - gnome_canvas_item_show (view_text->private->cursor); - view_text->private->cursor_timeout = + view_text->priv->cursor_state = TRUE; + gnome_canvas_item_show (view_text->priv->cursor); + view_text->priv->cursor_timeout = gtk_timeout_add (CURSOR_ON_TIME, (GtkFunction)blink_cb, view_text); } @@ -1057,12 +1030,12 @@ blink_start (glViewText *view_text) static void blink_stop (glViewText *view_text) { - if ( view_text->private->cursor_timeout ) { - gtk_timeout_remove (view_text->private->cursor_timeout); - view_text->private->cursor_timeout = 0; + if ( view_text->priv->cursor_timeout ) { + gtk_timeout_remove (view_text->priv->cursor_timeout); + view_text->priv->cursor_timeout = 0; } - gnome_canvas_item_hide (view_text->private->cursor); + gnome_canvas_item_hide (view_text->priv->cursor); } /*--------------------------------------------------------------------------*/ @@ -1071,20 +1044,20 @@ blink_stop (glViewText *view_text) static gboolean blink_cb (glViewText *view_text) { - if ( view_text->private->cursor_visible ) { + if ( view_text->priv->cursor_visible ) { - view_text->private->cursor_state = - !view_text->private->cursor_state; + view_text->priv->cursor_state = + !view_text->priv->cursor_state; - if ( view_text->private->cursor_state ) { - gnome_canvas_item_show (view_text->private->cursor); - view_text->private->cursor_timeout = + if ( view_text->priv->cursor_state ) { + gnome_canvas_item_show (view_text->priv->cursor); + view_text->priv->cursor_timeout = gtk_timeout_add (CURSOR_ON_TIME, (GtkFunction)blink_cb, view_text); } else { - gnome_canvas_item_hide (view_text->private->cursor); - view_text->private->cursor_timeout = + gnome_canvas_item_hide (view_text->priv->cursor); + view_text->priv->cursor_timeout = gtk_timeout_add (CURSOR_OFF_TIME, (GtkFunction)blink_cb, view_text); } diff --git a/glabels2/src/view-text.h b/glabels2/src/view-text.h index 679e69a8..c17b0fc8 100644 --- a/glabels2/src/view-text.h +++ b/glabels2/src/view-text.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -43,7 +45,7 @@ typedef struct _glViewTextPrivate glViewTextPrivate; struct _glViewText { glViewObject parent_object; - glViewTextPrivate *private; + glViewTextPrivate *priv; }; struct _glViewTextClass { diff --git a/glabels2/src/view.c b/glabels2/src/view.c index 3ec7d13c..f0466474 100644 --- a/glabels2/src/view.c +++ b/glabels2/src/view.c @@ -89,8 +89,6 @@ enum { /* Private globals */ /*==========================================================================*/ -static GtkContainerClass *parent_class; - static guint signals[LAST_SIGNAL] = {0}; /* "CLIPBOARD" selection */ @@ -120,8 +118,6 @@ static gdouble zooms[] = { /* Local function prototypes */ /*==========================================================================*/ -static void gl_view_class_init (glViewClass *class); -static void gl_view_init (glView *view); static void gl_view_finalize (GObject *object); static void gl_view_construct (glView *view); @@ -215,40 +211,16 @@ static void selection_received_cb (GtkWidget *widget, /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_view_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glViewClass), - NULL, - NULL, - (GClassInitFunc) gl_view_class_init, - NULL, - NULL, - sizeof (glView), - 0, - (GInstanceInitFunc) gl_view_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_VBOX, - "glView", &info, 0); - } - - return type; -} +G_DEFINE_TYPE (glView, gl_view, GTK_TYPE_VBOX); static void gl_view_class_init (glViewClass *class) { - GObjectClass *object_class = (GObjectClass *) class; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_VIEW, "START"); - parent_class = g_type_class_peek_parent (class); + gl_view_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_view_finalize; @@ -332,20 +304,18 @@ gl_view_init (glView *view) static void gl_view_finalize (GObject *object) { - glView *view; + glView *view = GL_VIEW (object); gl_debug (DEBUG_VIEW, "START"); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_VIEW (object)); - view = GL_VIEW (object); - if (view->default_font_family) { g_free (view->default_font_family); } - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_view_parent_class)->finalize (object); gl_debug (DEBUG_VIEW, "END"); } diff --git a/glabels2/src/view.h b/glabels2/src/view.h index 9006ec88..427aef72 100644 --- a/glabels2/src/view.h +++ b/glabels2/src/view.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/wdgt-chain-button.c b/glabels2/src/wdgt-chain-button.c index 8616e0b3..7491311f 100644 --- a/glabels2/src/wdgt-chain-button.c +++ b/glabels2/src/wdgt-chain-button.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* wdgt-chain-button.c * Modified version of gimpchainbutton.c for gLabels: * @@ -41,9 +43,6 @@ enum }; -static void gl_wdgt_chain_button_class_init (glWdgtChainButtonClass *klass); -static void gl_wdgt_chain_button_init (glWdgtChainButton *button); - static void gl_wdgt_chain_button_clicked_callback (GtkWidget *widget, glWdgtChainButton *button); static gboolean gl_wdgt_chain_button_draw_lines (GtkWidget *widget, @@ -62,79 +61,53 @@ static const gchar *gl_wdgt_chain_stock_items[] = static guint gl_wdgt_chain_button_signals[LAST_SIGNAL] = { 0 }; -static GtkTableClass *parent_class = NULL; -GType -gl_wdgt_chain_button_get_type (void) -{ - static GType type = 0; - - if (! type) - { - static const GTypeInfo info = - { - sizeof (glWdgtChainButtonClass), - NULL, /* base_init */ - NULL, /* base_finalize */ - (GClassInitFunc) gl_wdgt_chain_button_class_init, - NULL, /* class_finalize */ - NULL, /* class_data */ - sizeof (glWdgtChainButton), - 0, /* n_preallocs */ - (GInstanceInitFunc) gl_wdgt_chain_button_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_TABLE, - "glWdgtChainButton", &info, 0); - } +G_DEFINE_TYPE (glWdgtChainButton, gl_wdgt_chain_button, GTK_TYPE_TABLE); - return type; -} static void -gl_wdgt_chain_button_class_init (glWdgtChainButtonClass *klass) +gl_wdgt_chain_button_class_init (glWdgtChainButtonClass *class) { - parent_class = g_type_class_peek_parent (klass); - - gl_wdgt_chain_button_signals[TOGGLED] = - g_signal_new ("toggled", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_FIRST, - G_STRUCT_OFFSET (glWdgtChainButtonClass, toggled), - NULL, NULL, - g_cclosure_marshal_VOID__VOID, - G_TYPE_NONE, 0); - - klass->toggled = NULL; + gl_wdgt_chain_button_parent_class = g_type_class_peek_parent (class); + + gl_wdgt_chain_button_signals[TOGGLED] = + g_signal_new ("toggled", + G_TYPE_FROM_CLASS (class), + G_SIGNAL_RUN_FIRST, + G_STRUCT_OFFSET (glWdgtChainButtonClass, toggled), + NULL, NULL, + g_cclosure_marshal_VOID__VOID, + G_TYPE_NONE, 0); + + class->toggled = NULL; } static void gl_wdgt_chain_button_init (glWdgtChainButton *button) { - button->position = GL_WDGT_CHAIN_TOP; - button->active = FALSE; - - button->line1 = gtk_drawing_area_new (); - button->line2 = gtk_drawing_area_new (); - button->image = gtk_image_new (); - - button->button = gtk_button_new (); - - gtk_button_set_relief (GTK_BUTTON (button->button), GTK_RELIEF_NONE); - gtk_container_add (GTK_CONTAINER (button->button), button->image); - gtk_widget_show (button->image); - - g_signal_connect (button->button, "clicked", - G_CALLBACK (gl_wdgt_chain_button_clicked_callback), - button); - g_signal_connect (button->line1, "expose_event", - G_CALLBACK (gl_wdgt_chain_button_draw_lines), - button); - g_signal_connect (button->line2, "expose_event", - G_CALLBACK (gl_wdgt_chain_button_draw_lines), - button); + button->position = GL_WDGT_CHAIN_TOP; + button->active = FALSE; + + button->line1 = gtk_drawing_area_new (); + button->line2 = gtk_drawing_area_new (); + button->image = gtk_image_new (); + + button->button = gtk_button_new (); + + gtk_button_set_relief (GTK_BUTTON (button->button), GTK_RELIEF_NONE); + gtk_container_add (GTK_CONTAINER (button->button), button->image); + gtk_widget_show (button->image); + + g_signal_connect (button->button, "clicked", + G_CALLBACK (gl_wdgt_chain_button_clicked_callback), + button); + g_signal_connect (button->line1, "expose_event", + G_CALLBACK (gl_wdgt_chain_button_draw_lines), + button); + g_signal_connect (button->line2, "expose_event", + G_CALLBACK (gl_wdgt_chain_button_draw_lines), + button); } diff --git a/glabels2/src/wdgt-chain-button.h b/glabels2/src/wdgt-chain-button.h index e6a9f0db..382af2a4 100644 --- a/glabels2/src/wdgt-chain-button.h +++ b/glabels2/src/wdgt-chain-button.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* wdgt-chain-button.h * Modified version of gimpchainbutton.h for gLabels: * diff --git a/glabels2/src/wdgt-media-select.c b/glabels2/src/wdgt-media-select.c index 1419767d..22c5f040 100644 --- a/glabels2/src/wdgt-media-select.c +++ b/glabels2/src/wdgt-media-select.c @@ -83,16 +83,12 @@ typedef void (*glWdgtMediaSelectSignal) (GObject * object, gpointer data); /* Private globals */ /*===========================================*/ -static GObjectClass *parent_class; - static gint wdgt_media_select_signals[LAST_SIGNAL] = { 0 }; /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_wdgt_media_select_class_init (glWdgtMediaSelectClass *class); -static void gl_wdgt_media_select_instance_init (glWdgtMediaSelect *media_select); static void gl_wdgt_media_select_finalize (GObject *object); static void gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select); @@ -114,42 +110,17 @@ static void load_list (GtkListStore *store, /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_wdgt_media_select_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glWdgtMediaSelectClass), - NULL, - NULL, - (GClassInitFunc) gl_wdgt_media_select_class_init, - NULL, - NULL, - sizeof (glWdgtMediaSelect), - 0, - (GInstanceInitFunc) gl_wdgt_media_select_instance_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_VBOX, - "glWdgtMediaSelect", &info, 0); - } +G_DEFINE_TYPE (glWdgtMediaSelect, gl_wdgt_media_select, GTK_TYPE_VBOX); - return type; -} static void gl_wdgt_media_select_class_init (glWdgtMediaSelectClass *class) { - GObjectClass *object_class; + GObjectClass *object_class = G_OBJECT_CLASS (class); gl_debug (DEBUG_MEDIA_SELECT, "START"); - object_class = (GObjectClass *) class; - - parent_class = g_type_class_peek_parent (class); + gl_wdgt_media_select_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_media_select_finalize; @@ -166,7 +137,7 @@ gl_wdgt_media_select_class_init (glWdgtMediaSelectClass *class) } static void -gl_wdgt_media_select_instance_init (glWdgtMediaSelect *media_select) +gl_wdgt_media_select_init (glWdgtMediaSelect *media_select) { gl_debug (DEBUG_MEDIA_SELECT, "START"); @@ -187,20 +158,17 @@ gl_wdgt_media_select_instance_init (glWdgtMediaSelect *media_select) static void gl_wdgt_media_select_finalize (GObject *object) { - glWdgtMediaSelect *media_select; - glWdgtMediaSelectClass *class; + glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (object); gl_debug (DEBUG_MEDIA_SELECT, "START"); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (object)); - media_select = GL_WDGT_MEDIA_SELECT (object); - - G_OBJECT_CLASS (parent_class)->finalize (object); - g_free (media_select->priv); + G_OBJECT_CLASS (gl_wdgt_media_select_parent_class)->finalize (object); + gl_debug (DEBUG_MEDIA_SELECT, "END"); } diff --git a/glabels2/src/wdgt-mini-preview.c b/glabels2/src/wdgt-mini-preview.c index 9ef51d80..01501399 100644 --- a/glabels2/src/wdgt-mini-preview.c +++ b/glabels2/src/wdgt-mini-preview.c @@ -76,16 +76,12 @@ struct _glWdgtMiniPreviewPrivate { /* Private globals */ /*===========================================*/ -static GtkDrawingAreaClass *parent_class; - static gint wdgt_mini_preview_signals[LAST_SIGNAL] = { 0 }; /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_wdgt_mini_preview_class_init (glWdgtMiniPreviewClass *class); -static void gl_wdgt_mini_preview_instance_init (glWdgtMiniPreview *preview); static void gl_wdgt_mini_preview_finalize (GObject *object); static void gl_wdgt_mini_preview_construct (glWdgtMiniPreview *preview, @@ -149,31 +145,8 @@ static gint find_closest_label (glWdgtMiniPreview *preview, /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_wdgt_mini_preview_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glWdgtMiniPreviewClass), - NULL, - NULL, - (GClassInitFunc) gl_wdgt_mini_preview_class_init, - NULL, - NULL, - sizeof (glWdgtMiniPreview), - 0, - (GInstanceInitFunc) gl_wdgt_mini_preview_instance_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_DRAWING_AREA, - "glWdgtMiniPreview", &info, 0); - } +G_DEFINE_TYPE (glWdgtMiniPreview, gl_wdgt_mini_preview, GTK_TYPE_DRAWING_AREA); - return type; -} static void gl_wdgt_mini_preview_class_init (glWdgtMiniPreviewClass *class) @@ -183,7 +156,7 @@ gl_wdgt_mini_preview_class_init (glWdgtMiniPreviewClass *class) gl_debug (DEBUG_MINI_PREVIEW, "START"); - parent_class = gtk_type_class (gtk_hbox_get_type ()); + gl_wdgt_mini_preview_parent_class = gtk_type_class (gtk_hbox_get_type ()); object_class->finalize = gl_wdgt_mini_preview_finalize; @@ -215,7 +188,7 @@ gl_wdgt_mini_preview_class_init (glWdgtMiniPreviewClass *class) } static void -gl_wdgt_mini_preview_instance_init (glWdgtMiniPreview *preview) +gl_wdgt_mini_preview_init (glWdgtMiniPreview *preview) { gl_debug (DEBUG_MINI_PREVIEW, "START"); @@ -231,21 +204,18 @@ gl_wdgt_mini_preview_instance_init (glWdgtMiniPreview *preview) static void gl_wdgt_mini_preview_finalize (GObject *object) { - glWdgtMiniPreview *preview; - glWdgtMiniPreviewClass *class; + glWdgtMiniPreview *preview = GL_WDGT_MINI_PREVIEW (object); gl_debug (DEBUG_MINI_PREVIEW, "START"); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_WDGT_MINI_PREVIEW (object)); - preview = GL_WDGT_MINI_PREVIEW (object); - gl_template_free (preview->priv->template); g_free (preview->priv->centers); g_free (preview->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_wdgt_mini_preview_parent_class)->finalize (object); gl_debug (DEBUG_MINI_PREVIEW, "END"); } diff --git a/glabels2/src/wdgt-print-copies.c b/glabels2/src/wdgt-print-copies.c index 7d3b633d..5b2f1090 100644 --- a/glabels2/src/wdgt-print-copies.c +++ b/glabels2/src/wdgt-print-copies.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -44,14 +46,10 @@ /* 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, @@ -72,46 +70,20 @@ preview_pressed (glWdgtMiniPreview *mini_preview, /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_wdgt_print_copies_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glWdgtPrintCopiesClass), - NULL, - NULL, - (GClassInitFunc) gl_wdgt_print_copies_class_init, - NULL, - NULL, - sizeof (glWdgtPrintCopies), - 0, - (GInstanceInitFunc) gl_wdgt_print_copies_instance_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_HBOX, - "glWdgtPrintCopies", &info, 0); - } - - return 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; @@ -128,15 +100,12 @@ gl_wdgt_print_copies_instance_init (glWdgtPrintCopies * copies) static void gl_wdgt_print_copies_finalize (GObject * object) { - glWdgtPrintCopies *copies; - glWdgtPrintCopiesClass *class; + glWdgtPrintCopies *copies = GL_WDGT_PRINT_COPIES (object); 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 * diff --git a/glabels2/src/wdgt-print-copies.h b/glabels2/src/wdgt-print-copies.h index 5180b185..7e24dee3 100644 --- a/glabels2/src/wdgt-print-copies.h +++ b/glabels2/src/wdgt-print-copies.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/wdgt-print-merge.c b/glabels2/src/wdgt-print-merge.c index 1d0295aa..dc02de92 100644 --- a/glabels2/src/wdgt-print-merge.c +++ b/glabels2/src/wdgt-print-merge.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * @@ -48,14 +50,10 @@ /* Private globals */ /*===========================================*/ -static GObjectClass *parent_class; - /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_wdgt_print_merge_class_init (glWdgtPrintMergeClass * class); -static void gl_wdgt_print_merge_instance_init (glWdgtPrintMerge * merge); static void gl_wdgt_print_merge_finalize (GObject * object); static void gl_wdgt_print_merge_construct (glWdgtPrintMerge * merge, @@ -74,46 +72,21 @@ static void spin_cb (GtkSpinButton * spinbutton, /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_wdgt_print_merge_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glWdgtPrintMergeClass), - NULL, - NULL, - (GClassInitFunc) gl_wdgt_print_merge_class_init, - NULL, - NULL, - sizeof (glWdgtPrintMerge), - 0, - (GInstanceInitFunc) gl_wdgt_print_merge_instance_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_HBOX, - "glWdgtPrintMerge", &info, 0); - } +G_DEFINE_TYPE (glWdgtPrintMerge, gl_wdgt_print_merge, GTK_TYPE_HBOX); - return type; -} static void gl_wdgt_print_merge_class_init (glWdgtPrintMergeClass * 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_merge_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_print_merge_finalize; } static void -gl_wdgt_print_merge_instance_init (glWdgtPrintMerge * merge) +gl_wdgt_print_merge_init (glWdgtPrintMerge * merge) { merge->mini_preview = NULL; @@ -126,15 +99,12 @@ gl_wdgt_print_merge_instance_init (glWdgtPrintMerge * merge) static void gl_wdgt_print_merge_finalize (GObject * object) { - glWdgtPrintMerge *merge; - glWdgtPrintMergeClass *class; + glWdgtPrintMerge *merge = GL_WDGT_PRINT_MERGE (object); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_WDGT_PRINT_MERGE (object)); - merge = GL_WDGT_PRINT_MERGE (object); - - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_wdgt_print_merge_parent_class)->finalize (object); } GtkWidget * diff --git a/glabels2/src/wdgt-print-merge.h b/glabels2/src/wdgt-print-merge.h index a2a2d387..9e3a24da 100644 --- a/glabels2/src/wdgt-print-merge.h +++ b/glabels2/src/wdgt-print-merge.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/wdgt-rotate-label.c b/glabels2/src/wdgt-rotate-label.c index afd0027b..b4f99ef7 100644 --- a/glabels2/src/wdgt-rotate-label.c +++ b/glabels2/src/wdgt-rotate-label.c @@ -67,22 +67,16 @@ enum { LAST_SIGNAL }; -typedef void (*glWdgtRotateLabelSignal) (GObject * object, gpointer data); - /*===========================================*/ /* Private globals */ /*===========================================*/ -static GObjectClass *parent_class; - static gint wdgt_rotate_label_signals[LAST_SIGNAL] = { 0 }; /*===========================================*/ /* Local function prototypes */ /*===========================================*/ -static void gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass *class); -static void gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel *rotate_label); static void gl_wdgt_rotate_label_finalize (GObject *object); static void gl_wdgt_rotate_label_construct (glWdgtRotateLabel *rotate_label); @@ -118,40 +112,15 @@ static gboolean expose_cb (GtkWidget *drawinga /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_wdgt_rotate_label_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glWdgtRotateLabelClass), - NULL, - NULL, - (GClassInitFunc) gl_wdgt_rotate_label_class_init, - NULL, - NULL, - sizeof (glWdgtRotateLabel), - 0, - (GInstanceInitFunc) gl_wdgt_rotate_label_instance_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_VBOX, - "glWdgtRotateLabel", &info, 0); - } +G_DEFINE_TYPE (glWdgtRotateLabel, gl_wdgt_rotate_label, GTK_TYPE_VBOX); - return type; -} static void gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass *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_rotate_label_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_wdgt_rotate_label_finalize; @@ -167,7 +136,7 @@ gl_wdgt_rotate_label_class_init (glWdgtRotateLabelClass *class) } static void -gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel *rotate_label) +gl_wdgt_rotate_label_init (glWdgtRotateLabel *rotate_label) { rotate_label->priv = g_new0 (glWdgtRotateLabelPrivate, 1); @@ -184,22 +153,18 @@ gl_wdgt_rotate_label_instance_init (glWdgtRotateLabel *rotate_label) static void gl_wdgt_rotate_label_finalize (GObject *object) { - glWdgtRotateLabel *rotate_label; - glWdgtRotateLabelClass *class; + glWdgtRotateLabel *rotate_label = GL_WDGT_ROTATE_LABEL (object); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_WDGT_ROTATE_LABEL (object)); - rotate_label = GL_WDGT_ROTATE_LABEL (object); - if (rotate_label->priv->template) { gl_template_free (rotate_label->priv->template); rotate_label->priv->template = NULL; } - g_free (rotate_label->priv); - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_wdgt_rotate_label_parent_class)->finalize (object); } GtkWidget * diff --git a/glabels2/src/window.c b/glabels2/src/window.c index a72a77d1..9d66e851 100644 --- a/glabels2/src/window.c +++ b/glabels2/src/window.c @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME @@ -42,9 +42,9 @@ #include "debug.h" -/*============================================================================*/ -/* Private macros and constants. */ -/*============================================================================*/ +/*===========================================================================*/ +/* Private macros and constants. */ +/*===========================================================================*/ #define DEFAULT_WINDOW_WIDTH 788 #define DEFAULT_WINDOW_HEIGHT 600 @@ -52,20 +52,17 @@ #define CURSOR_INFO_WIDTH 150 #define ZOOM_INFO_WIDTH 50 -/*============================================================================*/ -/* Private globals */ -/*============================================================================*/ -static GtkWindowClass *parent_class; +/*===========================================================================*/ +/* Private globals */ +/*===========================================================================*/ static GList *window_list = NULL; -/*============================================================================*/ -/* Local function prototypes */ -/*============================================================================*/ +/*===========================================================================*/ +/* Local function prototypes */ +/*===========================================================================*/ -static void gl_window_class_init (glWindowClass *class); -static void gl_window_init (glWindow *window); static void gl_window_finalize (GObject *object); static void gl_window_destroy (GtkObject *gtk_object); @@ -106,41 +103,18 @@ static void modified_changed_cb (glLabel *label, /****************************************************************************/ /* Boilerplate Object stuff. */ /****************************************************************************/ -GType -gl_window_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (glWindowClass), - NULL, - NULL, - (GClassInitFunc) gl_window_class_init, - NULL, - NULL, - sizeof (glWindow), - 0, - (GInstanceInitFunc) gl_window_init, - NULL - }; - - type = g_type_register_static (GTK_TYPE_WINDOW, - "glWindow", &info, 0); - } +G_DEFINE_TYPE (glWindow, gl_window, GTK_TYPE_WINDOW); - return type; -} static void gl_window_class_init (glWindowClass *class) { - GObjectClass *object_class = (GObjectClass *) class; - GtkObjectClass *gtk_object_class = (GtkObjectClass *) class; + GObjectClass *object_class = G_OBJECT_CLASS (class); + GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (class); gl_debug (DEBUG_WINDOW, "START"); - parent_class = g_type_class_peek_parent (class); + gl_window_parent_class = g_type_class_peek_parent (class); object_class->finalize = gl_window_finalize; @@ -234,16 +208,14 @@ gl_window_init (glWindow *window) static void gl_window_finalize (GObject *object) { - glWindow *window; + glWindow *window = GL_WINDOW (object); gl_debug (DEBUG_WINDOW, "START"); g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_WINDOW (object)); - window = GL_WINDOW (object); - - G_OBJECT_CLASS (parent_class)->finalize (object); + G_OBJECT_CLASS (gl_window_parent_class)->finalize (object); gl_debug (DEBUG_WINDOW, "END"); } @@ -266,8 +238,8 @@ gl_window_destroy (GtkObject *gtk_object) window->ui = NULL; } - if (GTK_OBJECT_CLASS (parent_class)->destroy) { - GTK_OBJECT_CLASS (parent_class)->destroy (gtk_object); + if (GTK_OBJECT_CLASS (gl_window_parent_class)->destroy) { + GTK_OBJECT_CLASS (gl_window_parent_class)->destroy (gtk_object); } gl_debug (DEBUG_WINDOW, "END"); diff --git a/glabels2/src/window.h b/glabels2/src/window.h index 44ccd195..ff0ded3f 100644 --- a/glabels2/src/window.h +++ b/glabels2/src/window.h @@ -1,4 +1,4 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ /* * (GLABELS) Label and Business Card Creation program for GNOME diff --git a/glabels2/src/xml-label-04.c b/glabels2/src/xml-label-04.c index a0c5515b..fd775b93 100644 --- a/glabels2/src/xml-label-04.c +++ b/glabels2/src/xml-label-04.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/xml-label-04.h b/glabels2/src/xml-label-04.h index 65dfc44d..be11bafd 100644 --- a/glabels2/src/xml-label-04.h +++ b/glabels2/src/xml-label-04.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/xml-label-191.c b/glabels2/src/xml-label-191.c index 21479da0..94448d8a 100644 --- a/glabels2/src/xml-label-191.c +++ b/glabels2/src/xml-label-191.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/xml-label-191.h b/glabels2/src/xml-label-191.h index 033df2f5..eb98d6d0 100644 --- a/glabels2/src/xml-label-191.h +++ b/glabels2/src/xml-label-191.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/xml-label.c b/glabels2/src/xml-label.c index 2234bf3b..d4fa00aa 100644 --- a/glabels2/src/xml-label.c +++ b/glabels2/src/xml-label.c @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME * diff --git a/glabels2/src/xml-label.h b/glabels2/src/xml-label.h index 738b27bf..5c5f0c37 100644 --- a/glabels2/src/xml-label.h +++ b/glabels2/src/xml-label.h @@ -1,3 +1,5 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- */ + /* * (GLABELS) Label and Business Card Creation program for GNOME *