]> git.sur5r.net Git - glabels/commitdiff
2004-07-12 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Mon, 12 Jul 2004 16:37:24 +0000 (16:37 +0000)
committerJim Evins <evins@snaught.com>
Mon, 12 Jul 2004 16:37:24 +0000 (16:37 +0000)
Various code cleanups.

* src/label-barcode.c:
Removed unneeded include of gnome-glyphlist.h.

* src/label-text.c: (get_size):
Fixed memory leak: unref glyphlists when done with them.

* src/object-editor-bc-page.c: (gl_object_editor_prepare_bc_page):
* src/object-editor-data-page.c:
(gl_object_editor_prepare_data_page):
* src/object-editor-image-page.c:
(gl_object_editor_prepare_image_page):
* src/object-editor-line-page.c:
(gl_object_editor_prepare_line_page):
* src/object-editor-lsize-page.c:
(gl_object_editor_prepare_lsize_page):
* src/object-editor-position-page.c:
(gl_object_editor_prepare_position_page):
* src/object-editor-size-page.c:
(gl_object_editor_prepare_size_page):
* src/object-editor-text-page.c:
(gl_object_editor_prepare_text_page):
Removed unneeded size groups, originally intended to keep widgets aligned.
Now use tables to lay these out in object-editor.glade.

* src/print.c: (draw_text_object):
Fixed memory leak: unref glyphlists when done with them.

* src/view-barcode.c: (draw_barcode):
Fixed memory leak: unref glyphlists when done with them.

* src/view-text.c: (update_object_from_editor_cb), (draw_hacktext):
- Removed unneeded cast of gl_object_editor_get_text_line_spacing()s
  return value.
- Fixed memory leak: unref glyphlists when done with them.

git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@433 f5e0f49d-192f-0410-a22d-a8d8700d0965

14 files changed:
glabels2/ChangeLog
glabels2/src/label-barcode.c
glabels2/src/label-text.c
glabels2/src/object-editor-bc-page.c
glabels2/src/object-editor-data-page.c
glabels2/src/object-editor-image-page.c
glabels2/src/object-editor-line-page.c
glabels2/src/object-editor-lsize-page.c
glabels2/src/object-editor-position-page.c
glabels2/src/object-editor-size-page.c
glabels2/src/object-editor-text-page.c
glabels2/src/print.c
glabels2/src/view-barcode.c
glabels2/src/view-text.c

index fd29e957f2a19515fa2b76b133b3bcbc2e7585d3..d70d46a5bd814acfeea6c09d7ce0e886992f1067 100644 (file)
@@ -1,3 +1,42 @@
+2004-07-12  Jim Evins  <evins@snaught.com>
+
+       Various code cleanups.
+
+       * src/label-barcode.c:
+               Removed unneeded include of gnome-glyphlist.h.
+       
+       * src/label-text.c: (get_size):
+               Fixed memory leak: unref glyphlists when done with them.
+       
+       * src/object-editor-bc-page.c: (gl_object_editor_prepare_bc_page):
+       * src/object-editor-data-page.c:
+       (gl_object_editor_prepare_data_page):
+       * src/object-editor-image-page.c:
+       (gl_object_editor_prepare_image_page):
+       * src/object-editor-line-page.c:
+       (gl_object_editor_prepare_line_page):
+       * src/object-editor-lsize-page.c:
+       (gl_object_editor_prepare_lsize_page):
+       * src/object-editor-position-page.c:
+       (gl_object_editor_prepare_position_page):
+       * src/object-editor-size-page.c:
+       (gl_object_editor_prepare_size_page):
+       * src/object-editor-text-page.c:
+       (gl_object_editor_prepare_text_page):
+               Removed unneeded size groups, originally intended to keep widgets aligned.
+               Now use tables to lay these out in object-editor.glade.
+       
+       * src/print.c: (draw_text_object):
+               Fixed memory leak: unref glyphlists when done with them.
+
+       * src/view-barcode.c: (draw_barcode):
+               Fixed memory leak: unref glyphlists when done with them.
+
+       * src/view-text.c: (update_object_from_editor_cb), (draw_hacktext):
+               - Removed unneeded cast of gl_object_editor_get_text_line_spacing()s
+                 return value.
+               - Fixed memory leak: unref glyphlists when done with them.
+
 2004-07-11  Jim Evins  <evins@snaught.com>
 
        * data/glabels-2.0.dtd:
index 1222ede293b1b2ea456d465ef1aae59e8d6836bb..636e0f12b9aeef1560e0192aebe51762e0e2a000 100644 (file)
@@ -21,7 +21,6 @@
  */
 
 #include <glib.h>
-#include <libgnomeprint/gnome-glyphlist.h>
 
 #include "label-barcode.h"
 
index 82e3c1eb403563948715bf3023c0b9e6e1b746a2..2a8a432459f77d38f6af94e81d2da9c1286d1d10 100644 (file)
@@ -391,6 +391,8 @@ get_size (glLabelObject *object,
 
                gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox);
 
+               gnome_glyphlist_unref (glyphlist);
+
                if ( bbox.x1 > *w ) *w = bbox.x1;
 
                if (i) {
index ea31d23eff3370f7c235aaabfbd06e39ad8d7058..872925be4786ff5ee113d723dcc86b13aaa358b5 100644 (file)
@@ -59,8 +59,6 @@ void
 gl_object_editor_prepare_bc_page (glObjectEditor       *editor)
 {
        GList        *styles = NULL;
-       GtkSizeGroup *label_size_group;
-       GtkWidget    *label;
 
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -83,13 +81,6 @@ gl_object_editor_prepare_bc_page (glObjectEditor       *editor)
        gtk_combo_set_popdown_strings (GTK_COMBO(editor->priv->bc_style_combo), styles);
        gl_barcode_free_styles_list (styles);
 
-       /* Align label widths */
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-       label = glade_xml_get_widget (editor->priv->gui, "bc_style_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "bc_color_label");
-       gtk_size_group_add_widget (label_size_group, label);
-
        /* Un-hide */
        gtk_widget_show_all (editor->priv->bc_page_vbox);
 
index 1fac8c7a6a6b5b2632527bd75fdc841c1da05c22..cb0d7bed2e6b84505381150033414eef63fac9ec 100644 (file)
@@ -58,7 +58,6 @@ void
 gl_object_editor_prepare_data_page (glObjectEditor *editor)
 {
        GdkColor     *gdk_color;
-       GtkSizeGroup *label_size_group;
 
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -76,11 +75,6 @@ gl_object_editor_prepare_data_page (glObjectEditor *editor)
        editor->priv->data_key_entry     = glade_xml_get_widget (editor->priv->gui,
                                                                 "data_key_entry");
 
-       /* Align label widths */
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-       gtk_size_group_add_widget (label_size_group, editor->priv->data_literal_radio);
-       gtk_size_group_add_widget (label_size_group, editor->priv->data_key_radio);
-
        /* Un-hide */
        gtk_widget_show_all (editor->priv->data_page_vbox);
 
index 83cd355657a0123e7528585d5e8a09643753f98b..4464fab759a2326c5bd7909e110eec1ccb9b0740 100644 (file)
@@ -58,7 +58,6 @@ void
 gl_object_editor_prepare_image_page (glObjectEditor *editor)
 {
        GdkColor     *gdk_color;
-       GtkSizeGroup *label_size_group;
        GtkWidget    *ge;
 
        gl_debug (DEBUG_EDITOR, "START");
@@ -77,11 +76,6 @@ gl_object_editor_prepare_image_page (glObjectEditor *editor)
        editor->priv->img_key_entry    = glade_xml_get_widget (editor->priv->gui,
                                                               "img_key_entry");
 
-       /* Align label widths */
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-       gtk_size_group_add_widget (label_size_group, editor->priv->img_file_radio);
-       gtk_size_group_add_widget (label_size_group, editor->priv->img_key_radio);
-
        /* Un-hide */
        gtk_widget_show_all (editor->priv->img_page_vbox);
 
index de6864097d06b9010df1a6d29f7164ccb30a5d3e..a23c626a44b2766f672b5d527cf58ddbe2908072 100644 (file)
@@ -57,8 +57,6 @@ void
 gl_object_editor_prepare_line_page (glObjectEditor *editor)
 {
        GdkColor     *gdk_color;
-       GtkSizeGroup *label_size_group;
-       GtkWidget    *label;
 
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -77,13 +75,6 @@ gl_object_editor_prepare_line_page (glObjectEditor *editor)
        color_combo_set_color (COLOR_COMBO(editor->priv->line_color_combo), gdk_color);
        g_free (gdk_color);
 
-       /* Align label widths */
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-       label = glade_xml_get_widget (editor->priv->gui, "line_w_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "line_color_label");
-       gtk_size_group_add_widget (label_size_group, label);
-
        /* Un-hide */
        gtk_widget_show_all (editor->priv->line_page_vbox);
 
index 6cbaf2f0e9dcf3a6817df62161a874069f6f67d8..0731899b4420e5e22bfd26c474eb1e3cf4274552 100644 (file)
@@ -64,8 +64,6 @@ gl_object_editor_prepare_lsize_page (glObjectEditor       *editor)
        const gchar  *units_string;
        gdouble       climb_rate;
        gint          digits;
-       GtkSizeGroup *label_size_group;
-       GtkWidget    *label;
 
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -91,13 +89,6 @@ gl_object_editor_prepare_lsize_page (glObjectEditor       *editor)
                                        climb_rate, 10.0*climb_rate);
        gtk_label_set_text (GTK_LABEL(editor->priv->lsize_r_units_label), units_string);
 
-       /* Align label widths */
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-       label = glade_xml_get_widget (editor->priv->gui, "lsize_r_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "lsize_theta_label");
-       gtk_size_group_add_widget (label_size_group, label);
-
        /* Un-hide */
        gtk_widget_show_all (editor->priv->lsize_page_vbox);
 
index edf80300be88aa2989cf3bd825a47dbb37916888..1ccdadbbbfdbbd87708cbabe7a8b2a9f68041ab0 100644 (file)
@@ -57,8 +57,6 @@ gl_object_editor_prepare_position_page (glObjectEditor *editor)
        const gchar  *units_string;
        gdouble       climb_rate;
        gint          digits;
-       GtkSizeGroup *label_size_group;
-       GtkWidget    *label;
 
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -90,13 +88,6 @@ gl_object_editor_prepare_position_page (glObjectEditor *editor)
                                        climb_rate, 10.0*climb_rate);
        gtk_label_set_text (GTK_LABEL(editor->priv->pos_y_units_label), units_string);
 
-       /* Align label widths */
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-       label = glade_xml_get_widget (editor->priv->gui, "pos_x_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "pos_y_label");
-       gtk_size_group_add_widget (label_size_group, label);
-
        /* Un-hide */
        gtk_widget_show_all (editor->priv->pos_page_vbox);
 
index a35ab18358308944a5d48c4080683f57e81f4648..30728383f897599d25a1e35a56b2e50920a1a3ff 100644 (file)
@@ -64,8 +64,6 @@ gl_object_editor_prepare_size_page (glObjectEditor       *editor,
        const gchar  *units_string;
        gdouble       climb_rate;
        gint          digits;
-       GtkSizeGroup *label_size_group;
-       GtkWidget    *label;
 
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -101,13 +99,6 @@ gl_object_editor_prepare_size_page (glObjectEditor       *editor,
                                        climb_rate, 10.0*climb_rate);
        gtk_label_set_text (GTK_LABEL(editor->priv->size_h_units_label), units_string);
 
-       /* Align label widths */
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-       label = glade_xml_get_widget (editor->priv->gui, "size_w_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "size_h_label");
-       gtk_size_group_add_widget (label_size_group, label);
-
        /* Un-hide */
        gtk_widget_show_all (editor->priv->size_page_vbox);
        if (option != GL_OBJECT_EDITOR_SIZE_IMAGE_PAGE) {
index db6428844e4c32c1bbe1aecfaacc0f40b53828c5..0c202399564956b5cef99c70f082766517f5fe15 100644 (file)
@@ -60,8 +60,6 @@ void
 gl_object_editor_prepare_text_page (glObjectEditor       *editor)
 {
        GList        *family_names = NULL;
-       GtkSizeGroup *label_size_group;
-       GtkWidget    *label;
 
        gl_debug (DEBUG_EDITOR, "START");
 
@@ -97,21 +95,6 @@ gl_object_editor_prepare_text_page (glObjectEditor       *editor)
                                       family_names);
        gnome_font_family_list_free (family_names);
 
-       /* Align label widths */
-       label_size_group = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
-       label = glade_xml_get_widget (editor->priv->gui, "text_family_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "text_size_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "text_style_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "text_color_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "text_align_label");
-       gtk_size_group_add_widget (label_size_group, label);
-       label = glade_xml_get_widget (editor->priv->gui, "text_line_spacing_label");
-       gtk_size_group_add_widget (label_size_group, label);
-
        /* Un-hide */
        gtk_widget_show_all (editor->priv->text_page_vbox);
 
index 83b9971178feb460504a0d73434cfb829d70b617..65ff33b72427f2d7ed72d7cffbd5e6bbc0aa37d3 100644 (file)
@@ -774,6 +774,7 @@ draw_text_object (PrintInfo     *pi,
                                                                    line[i]);
                        gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox);
                        w = bbox.x1;
+                       gnome_glyphlist_unref (glyphlist);
 
                        /* If width is too large, iteratively shrink font_size until this
                           line fits the width, or until the font size is ridiculously
@@ -793,6 +794,7 @@ draw_text_object (PrintInfo     *pi,
                                                                            line[i]);
                                gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox);
                                w = bbox.x1;
+                               gnome_glyphlist_unref (glyphlist);
                        }
                }
 
@@ -819,6 +821,7 @@ draw_text_object (PrintInfo     *pi,
 
                gnome_glyphlist_bbox (glyphlist, affine, 0, &bbox);
                w = bbox.x1;
+               gnome_glyphlist_unref (glyphlist);
 
                switch (just) {
                case GTK_JUSTIFY_LEFT:
index 99d088f42274dd5156cc8642c8565c07f251cea8..dca63b737f4ed7fac5079e7b7ec6678795fafb88 100644 (file)
@@ -585,6 +585,8 @@ draw_barcode (glViewBarcode *view_barcode)
                                                "y", y_offset,
                                                "glyphlist", glyphlist, NULL);
 
+               gnome_glyphlist_unref (glyphlist);
+
                view_barcode->private->item_list =
                        g_list_prepend (view_barcode->private->item_list, item);
        } else {
@@ -634,6 +636,8 @@ draw_barcode (glViewBarcode *view_barcode)
                                                        "glyphlist", glyphlist,
                                                        NULL);
 
+                       gnome_glyphlist_unref (glyphlist);
+
                        view_barcode->private->item_list =
                                g_list_prepend (view_barcode->private->item_list, item);
 
index f129033eb20e9d402fbcc77aa982e23cc7a86c48..d2abc47b7eff148490503c9c604285eec8139846 100644 (file)
@@ -330,7 +330,7 @@ update_object_from_editor_cb (glObjectEditor *editor,
        font_italic_flag = gl_object_editor_get_font_italic_flag (editor);
        color = gl_object_editor_get_text_color (editor);
        just = gl_object_editor_get_text_alignment (editor);
-       text_line_spacing = (gdouble) gl_object_editor_get_text_line_spacing (editor);
+       text_line_spacing = gl_object_editor_get_text_line_spacing (editor);
        auto_shrink = gl_object_editor_get_text_auto_shrink (editor);
 
        gl_label_object_set_position (object, x, y);
@@ -724,6 +724,9 @@ draw_hacktext (glViewText *view_text)
                                                "x", x_offset,
                                                "y", y_offset,
                                                "glyphlist", glyphlist, NULL);
+
+               gnome_glyphlist_unref (glyphlist);
+
                view_text->private->item_list =
                        g_list_prepend (view_text->private->item_list, item);