From: Jim Evins Date: Mon, 12 Jul 2004 16:37:24 +0000 (+0000) Subject: 2004-07-12 Jim Evins X-Git-Tag: glabels-2_3_0~464 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=fe42d658938053fa034ba7b8e56e3d6b5ba098ca;p=glabels 2004-07-12 Jim Evins 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 --- diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index fd29e957..d70d46a5 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,42 @@ +2004-07-12 Jim Evins + + 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 * data/glabels-2.0.dtd: diff --git a/glabels2/src/label-barcode.c b/glabels2/src/label-barcode.c index 1222ede2..636e0f12 100644 --- a/glabels2/src/label-barcode.c +++ b/glabels2/src/label-barcode.c @@ -21,7 +21,6 @@ */ #include -#include #include "label-barcode.h" diff --git a/glabels2/src/label-text.c b/glabels2/src/label-text.c index 82e3c1eb..2a8a4324 100644 --- a/glabels2/src/label-text.c +++ b/glabels2/src/label-text.c @@ -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) { diff --git a/glabels2/src/object-editor-bc-page.c b/glabels2/src/object-editor-bc-page.c index ea31d23e..872925be 100644 --- a/glabels2/src/object-editor-bc-page.c +++ b/glabels2/src/object-editor-bc-page.c @@ -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); diff --git a/glabels2/src/object-editor-data-page.c b/glabels2/src/object-editor-data-page.c index 1fac8c7a..cb0d7bed 100644 --- a/glabels2/src/object-editor-data-page.c +++ b/glabels2/src/object-editor-data-page.c @@ -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); diff --git a/glabels2/src/object-editor-image-page.c b/glabels2/src/object-editor-image-page.c index 83cd3556..4464fab7 100644 --- a/glabels2/src/object-editor-image-page.c +++ b/glabels2/src/object-editor-image-page.c @@ -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); diff --git a/glabels2/src/object-editor-line-page.c b/glabels2/src/object-editor-line-page.c index de686409..a23c626a 100644 --- a/glabels2/src/object-editor-line-page.c +++ b/glabels2/src/object-editor-line-page.c @@ -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); diff --git a/glabels2/src/object-editor-lsize-page.c b/glabels2/src/object-editor-lsize-page.c index 6cbaf2f0..0731899b 100644 --- a/glabels2/src/object-editor-lsize-page.c +++ b/glabels2/src/object-editor-lsize-page.c @@ -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); diff --git a/glabels2/src/object-editor-position-page.c b/glabels2/src/object-editor-position-page.c index edf80300..1ccdadbb 100644 --- a/glabels2/src/object-editor-position-page.c +++ b/glabels2/src/object-editor-position-page.c @@ -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); diff --git a/glabels2/src/object-editor-size-page.c b/glabels2/src/object-editor-size-page.c index a35ab183..30728383 100644 --- a/glabels2/src/object-editor-size-page.c +++ b/glabels2/src/object-editor-size-page.c @@ -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) { diff --git a/glabels2/src/object-editor-text-page.c b/glabels2/src/object-editor-text-page.c index db642884..0c202399 100644 --- a/glabels2/src/object-editor-text-page.c +++ b/glabels2/src/object-editor-text-page.c @@ -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); diff --git a/glabels2/src/print.c b/glabels2/src/print.c index 83b99711..65ff33b7 100644 --- a/glabels2/src/print.c +++ b/glabels2/src/print.c @@ -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: diff --git a/glabels2/src/view-barcode.c b/glabels2/src/view-barcode.c index 99d088f4..dca63b73 100644 --- a/glabels2/src/view-barcode.c +++ b/glabels2/src/view-barcode.c @@ -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); diff --git a/glabels2/src/view-text.c b/glabels2/src/view-text.c index f129033e..d2abc47b 100644 --- a/glabels2/src/view-text.c +++ b/glabels2/src/view-text.c @@ -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);