]> git.sur5r.net Git - glabels/commitdiff
2007-04-02 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Tue, 3 Apr 2007 01:13:20 +0000 (01:13 +0000)
committerJim Evins <evins@snaught.com>
Tue, 3 Apr 2007 01:13:20 +0000 (01:13 +0000)
* src/merge-properties-dialog.c:
* src/new-label-dialog.c:
* src/object-editor.c:
* src/prefs-dialog.c:
* src/print-op.c:
* src/template-designer.c:
* src/ui-property-bar.c:
* src/wdgt-media-select.c:
* src/wdgt-rotate-label.c:
Fixed several memory leaks.

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

glabels2/ChangeLog
glabels2/src/merge-properties-dialog.c
glabels2/src/new-label-dialog.c
glabels2/src/object-editor.c
glabels2/src/prefs-dialog.c
glabels2/src/print-op.c
glabels2/src/template-designer.c
glabels2/src/ui-property-bar.c
glabels2/src/wdgt-media-select.c
glabels2/src/wdgt-rotate-label.c

index acc7bd2557bb2c4fc5a75c2549aea6376a5f3cb6..6d404f0886bcc3e64f923b4013ec61cb149a35b8 100644 (file)
@@ -1,3 +1,16 @@
+2007-04-02  Jim Evins  <evins@snaught.com>
+
+       * src/merge-properties-dialog.c:
+       * src/new-label-dialog.c:
+       * src/object-editor.c:
+       * src/prefs-dialog.c:
+       * src/print-op.c:
+       * src/template-designer.c:
+       * src/ui-property-bar.c:
+       * src/wdgt-media-select.c:
+       * src/wdgt-rotate-label.c:
+               Fixed several memory leaks.
+
 2007-04-01  Jim Evins  <evins@snaught.com>
 
        * src/label-text.c: (gl_label_text_init), (copy),
index 88c70d4b2246e6b40a24c6a732777639cd7e4e5b..d5f3508ddb8dc136bdd738c056705e7d3d8dfb4f 100644 (file)
@@ -50,8 +50,6 @@
 
 struct _glMergePropertiesDialogPrivate {
 
-       GladeXML     *gui;
-
        glLabel      *label;
        glMerge      *merge;
 
@@ -144,15 +142,6 @@ gl_merge_properties_dialog_init (glMergePropertiesDialog *dialog)
 
        dialog->priv = g_new0 (glMergePropertiesDialogPrivate, 1);
 
-       dialog->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "merge-properties-dialog.glade",
-                                          "merge_properties_vbox",
-                                          NULL);
-
-       if (!dialog->priv->gui) {
-               g_critical ("Could not open merge-properties-dialog.glade. gLabels may not be installed correctly!");
-               return;
-       }
-
        gtk_container_set_border_width (GTK_CONTAINER(dialog), GL_HIG_PAD2);
 
        gtk_dialog_set_has_separator (GTK_DIALOG(dialog), FALSE);
@@ -219,6 +208,7 @@ gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog,
                                      glLabel                 *label,
                                      GtkWindow               *window)
 {
+       GladeXML          *gui;
        gchar             *description;
        glMergeSrcType     src_type;
        gchar             *src;
@@ -239,21 +229,25 @@ gl_merge_properties_dialog_construct (glMergePropertiesDialog *dialog,
                gtk_window_set_destroy_with_parent (GTK_WINDOW(dialog), TRUE);
        }
 
-       vbox = glade_xml_get_widget (dialog->priv->gui,
-                                    "merge_properties_vbox");
+       gui = glade_xml_new (GLABELS_GLADE_DIR "merge-properties-dialog.glade",
+                             "merge_properties_vbox", NULL);
+
+       if (!gui) {
+               g_critical ("Could not open merge-properties-dialog.glade. gLabels may not be installed correctly!");
+               return;
+       }
+
+       vbox = glade_xml_get_widget (gui, "merge_properties_vbox");
        gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), vbox);
 
-       dialog->priv->type_combo    = glade_xml_get_widget (dialog->priv->gui,
-                                                           "type_combo");
-       dialog->priv->location_vbox = glade_xml_get_widget (dialog->priv->gui,
-                                                           "location_vbox");
-       dialog->priv->treeview      = glade_xml_get_widget (dialog->priv->gui,
-                                                           "treeview");
-
-       dialog->priv->select_all_button   = glade_xml_get_widget (dialog->priv->gui,
-                                                               "select_all_button");
-       dialog->priv->unselect_all_button = glade_xml_get_widget (dialog->priv->gui,
-                                                               "unselect_all_button");
+       dialog->priv->type_combo    = glade_xml_get_widget (gui, "type_combo");
+       dialog->priv->location_vbox = glade_xml_get_widget (gui, "location_vbox");
+       dialog->priv->treeview      = glade_xml_get_widget (gui, "treeview");
+
+       dialog->priv->select_all_button   = glade_xml_get_widget (gui, "select_all_button");
+       dialog->priv->unselect_all_button = glade_xml_get_widget (gui, "unselect_all_button");
+
+        g_object_unref (gui);
 
        gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dialog->priv->type_combo));
 
index 7b611653b75dbff83356aef8f676300f084bc4e6..038ed43b2540a60a2c096003147b6257a2df6884 100644 (file)
@@ -42,8 +42,6 @@
 
 struct _glNewLabelDialogPrivate {
 
-        GladeXML     *gui;
-
        GtkWidget *media_select;
        GtkWidget *rotate_label;
 
@@ -104,15 +102,6 @@ gl_new_label_dialog_init (glNewLabelDialog *dialog)
        gtk_window_set_destroy_with_parent (GTK_WINDOW (dialog), TRUE);
        gtk_window_set_modal (GTK_WINDOW (dialog), TRUE);
 
-        dialog->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "new-label-dialog.glade",
-                                           "new_label_dialog_vbox",
-                                           NULL);
-
-        if (!dialog->priv->gui) {
-                g_critical ("Could not open new-label-dialog.glade. gLabels may not be installed correctly!");
-                return;
-        }
-
        gl_debug (DEBUG_FILE, "END");
 }
 
@@ -159,6 +148,7 @@ static void
 gl_new_label_dialog_construct (glNewLabelDialog   *dialog,
                               GtkWindow          *win)
 {
+        GladeXML  *gui;
        GtkWidget *vbox, *media_select_vbox, *rotate_label_vbox;
        gchar     *name;
 
@@ -166,14 +156,21 @@ gl_new_label_dialog_construct (glNewLabelDialog   *dialog,
 
        gtk_window_set_transient_for (GTK_WINDOW (dialog), win);
 
-        vbox = glade_xml_get_widget (dialog->priv->gui,
-                                     "new_label_dialog_vbox");
+        gui = glade_xml_new (GLABELS_GLADE_DIR "new-label-dialog.glade",
+                             "new_label_dialog_vbox", NULL);
+
+        if (!gui) {
+                g_critical ("Could not open new-label-dialog.glade. gLabels may not be installed correctly!");
+                return;
+        }
+
+        vbox = glade_xml_get_widget (gui, "new_label_dialog_vbox");
        gtk_box_pack_start (GTK_BOX( GTK_DIALOG (dialog)->vbox), vbox, FALSE, FALSE, 0);
 
-        media_select_vbox =
-                glade_xml_get_widget (dialog->priv->gui, "media_select_vbox");
-        rotate_label_vbox =
-                glade_xml_get_widget (dialog->priv->gui, "rotate_label_vbox");
+        media_select_vbox = glade_xml_get_widget (gui, "media_select_vbox");
+        rotate_label_vbox = glade_xml_get_widget (gui, "rotate_label_vbox");
+
+        g_object_unref (gui);
 
        dialog->priv->media_select = gl_wdgt_media_select_new ();
        gtk_box_pack_start (GTK_BOX (media_select_vbox),
index 79515377895d5f592fbc546a341fe0d7e23e28b9..375a29586d835d8654eee0846599d0538e38c09d 100644 (file)
@@ -160,9 +160,6 @@ gl_object_editor_finalize (GObject *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),
@@ -212,6 +209,10 @@ gl_object_editor_new (gchar                *image,
        gl_object_notebook_construct_valist (editor, first_option, args);
        va_end (args);
 
+       if (editor->priv->gui) {
+               g_object_unref (G_OBJECT (editor->priv->gui));
+       }
+
        gl_debug (DEBUG_EDITOR, "END");
 
        return GTK_WIDGET(editor);
index 8c19a47677666926bf9ef831431279810edbc636..e9d3dec35ba8e2d19c03afff337f78355695c373 100644 (file)
@@ -172,6 +172,9 @@ gl_prefs_dialog_finalize (GObject *object)
        g_return_if_fail (GL_IS_PREFS_DIALOG (dialog));
        g_return_if_fail (dialog->priv != NULL);
 
+       if (dialog->priv->gui) {
+               g_object_unref (G_OBJECT (dialog->priv->gui));
+       }
        g_free (dialog->priv);
 
        G_OBJECT_CLASS (gl_prefs_dialog_parent_class)->finalize (object);
index 25de6bcca1e30365a3a65d1efe469755e7407168..da3902900190b5e9057ed07c360781bb517ce14d 100644 (file)
@@ -48,8 +48,6 @@ struct _glPrintOpPrivate {
 
        glLabel   *label;
 
-       GladeXML  *gui;
-
        GtkWidget *simple_frame;
        GtkWidget *copies_vbox;
        GtkWidget *copies;
@@ -80,7 +78,7 @@ struct _glPrintOpPrivate {
         glPrintState state;
 };
 
-typedef struct _glPrintOpSettings
+struct _glPrintOpSettings
 {
 
         GtkPrintSettings *gtk_settings;
@@ -417,49 +415,42 @@ static GObject *
 create_custom_widget_cb (GtkPrintOperation *operation,
                         gpointer           user_data)
 {
-       glPrintOp *op = GL_PRINT_OP (operation);
+       GladeXML      *gui;
+       glPrintOp     *op = GL_PRINT_OP (operation);
        glLabel       *label  = GL_LABEL (user_data);
-
        GtkWidget     *vbox;
-
         glMerge       *merge = NULL;
 
-       op->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "print-custom-widget.glade",
-                                       "print_custom_widget_vbox",
-                                       NULL);
+       gui = glade_xml_new (GLABELS_GLADE_DIR "print-custom-widget.glade",
+                             "print_custom_widget_vbox", NULL);
 
-       if (!op->priv->gui) {
+       if (!gui) {
                g_warning ("Could not open print-op.glade, reinstall glabels!");
                return NULL;
        }
 
-       vbox = glade_xml_get_widget (op->priv->gui, "print_custom_widget_vbox");
+       vbox = glade_xml_get_widget (gui, "print_custom_widget_vbox");
 
        /* ----- Simple print control ----- */
-       op->priv->simple_frame = glade_xml_get_widget (op->priv->gui,
-                                                          "simple_frame");
-       op->priv->copies_vbox  = glade_xml_get_widget (op->priv->gui,
-                                                          "copies_vbox");
+       op->priv->simple_frame = glade_xml_get_widget (gui, "simple_frame");
+       op->priv->copies_vbox  = glade_xml_get_widget (gui, "copies_vbox");
        op->priv->copies = gl_wdgt_print_copies_new (label);
        gtk_box_pack_start (GTK_BOX(op->priv->copies_vbox),
                            op->priv->copies, FALSE, FALSE, 0);
 
        /* ----- Merge print control ----- */
-       op->priv->merge_frame  = glade_xml_get_widget (op->priv->gui,
-                                                          "merge_frame");
-       op->priv->prmerge_vbox = glade_xml_get_widget (op->priv->gui,
-                                                          "prmerge_vbox");
+       op->priv->merge_frame  = glade_xml_get_widget (gui, "merge_frame");
+       op->priv->prmerge_vbox = glade_xml_get_widget (gui, "prmerge_vbox");
        op->priv->prmerge = gl_wdgt_print_merge_new (label);
        gtk_box_pack_start (GTK_BOX(op->priv->prmerge_vbox),
                            op->priv->prmerge, FALSE, FALSE, 0);
 
        /* ----- Options ----------------- */
-       op->priv->outline_check    = glade_xml_get_widget (op->priv->gui,
-                                                              "outline_check");
-       op->priv->reverse_check    = glade_xml_get_widget (op->priv->gui,
-                                                              "reverse_check");
-       op->priv->crop_marks_check = glade_xml_get_widget (op->priv->gui,
-                                                              "crop_marks_check");
+       op->priv->outline_check    = glade_xml_get_widget (gui, "outline_check");
+       op->priv->reverse_check    = glade_xml_get_widget (gui, "reverse_check");
+       op->priv->crop_marks_check = glade_xml_get_widget (gui, "crop_marks_check");
+
+        g_object_unref (gui);
 
         /* ---- Activate either simple or merge print control widgets. ---- */
         merge = gl_label_get_merge (op->priv->label);
index bfd1a53c38b0baff20582b4661912a0f692e1311..fe1aa943db99dde25c0d68c35199ccabfaa8d60d 100644 (file)
@@ -404,6 +404,9 @@ construct_start_page (glTemplateDesigner      *dialog,
 
        dialog->priv->start_page = glade_xml_get_widget (gui, "start_page");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->start_page);
 
@@ -443,6 +446,9 @@ construct_name_page (glTemplateDesigner      *dialog,
        dialog->priv->part_num_entry    = glade_xml_get_widget (gui, "part_num_entry");
        dialog->priv->description_entry = glade_xml_get_widget (gui, "description_entry");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->name_page);
 
@@ -491,6 +497,9 @@ construct_pg_size_page (glTemplateDesigner      *dialog,
        dialog->priv->pg_w_units_label = glade_xml_get_widget (gui, "pg_w_units_label");
        dialog->priv->pg_h_units_label = glade_xml_get_widget (gui, "pg_h_units_label");
 
+        g_object_unref (gui);
+
+
        gl_util_combo_box_add_text_model (GTK_COMBO_BOX (dialog->priv->pg_size_combo));
 
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
@@ -561,6 +570,9 @@ construct_shape_page (glTemplateDesigner      *dialog,
        dialog->priv->shape_round_radio = glade_xml_get_widget (gui, "shape_round_radio");
        dialog->priv->shape_cd_radio    = glade_xml_get_widget (gui, "shape_cd_radio");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->shape_page);
 
@@ -608,6 +620,9 @@ construct_rect_size_page (glTemplateDesigner      *dialog,
        dialog->priv->rect_y_waste_units_label = glade_xml_get_widget (gui, "rect_y_waste_units_label");
        dialog->priv->rect_margin_units_label  = glade_xml_get_widget (gui, "rect_margin_units_label");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->rect_size_page);
 
@@ -705,6 +720,9 @@ construct_round_size_page (glTemplateDesigner      *dialog,
        dialog->priv->round_waste_units_label  = glade_xml_get_widget (gui, "round_waste_units_label");
        dialog->priv->round_margin_units_label = glade_xml_get_widget (gui, "round_margin_units_label");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->round_size_page);
 
@@ -785,6 +803,9 @@ construct_cd_size_page (glTemplateDesigner      *dialog,
        dialog->priv->cd_waste_units_label  = glade_xml_get_widget (gui, "cd_waste_units_label");
        dialog->priv->cd_margin_units_label = glade_xml_get_widget (gui, "cd_margin_units_label");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->cd_size_page);
 
@@ -875,6 +896,9 @@ construct_nlayouts_page (glTemplateDesigner      *dialog,
        dialog->priv->nlayouts_image2 = glade_xml_get_widget (gui, "nlayouts_image2");
        dialog->priv->nlayouts_spin   = glade_xml_get_widget (gui, "nlayouts_spin");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->nlayouts_page);
 
@@ -935,6 +959,9 @@ construct_layout_page (glTemplateDesigner      *dialog,
        dialog->priv->layout_mini_preview   = glade_xml_get_widget (gui, "layout_mini_preview");
        dialog->priv->layout_test_button    = glade_xml_get_widget (gui, "layout_test_button");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->layout_page);
 
@@ -1043,6 +1070,9 @@ construct_finish_page (glTemplateDesigner      *dialog,
 
        dialog->priv->finish_page = glade_xml_get_widget (gui, "finish_page");
 
+        g_object_unref (gui);
+
+
         gtk_assistant_append_page (GTK_ASSISTANT (dialog),
                                    dialog->priv->finish_page);
 
index 5a76f819b8722f042b87f168dc1d28ca18709df8..56bf44ae3b632e9bdb153c89cf3b2ef27b9f62d2 100644 (file)
@@ -55,8 +55,6 @@ struct _glUIPropertyBarPrivate {
 
        glView     *view;
 
-       GladeXML   *gui;
-
        GtkWidget  *tool_bar;
 
        /* Font selection */
@@ -178,15 +176,6 @@ gl_ui_property_bar_init (glUIPropertyBar *property_bar)
 
        property_bar->priv = g_new0 (glUIPropertyBarPrivate, 1);
 
-       property_bar->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "property-bar.glade",
-                                                "property_toolbar",
-                                                NULL);
-
-       if (!property_bar->priv->gui) {
-               g_critical ("Could not open property-bar.glade. gLabels may not be installed correctly!");
-               return;
-       }
-
        gl_debug (DEBUG_PROPERTY_BAR, "END");
 }
 
@@ -235,6 +224,7 @@ gl_ui_property_bar_new (void)
 static void
 gl_ui_property_bar_construct (glUIPropertyBar   *property_bar)
 {
+       GladeXML   *gui;
        GList      *family_names = NULL;
        GList      *family_node;
        GdkColor   *gdk_color;
@@ -243,32 +233,41 @@ gl_ui_property_bar_construct (glUIPropertyBar   *property_bar)
 
        property_bar->priv->stop_signals = TRUE;
 
-       property_bar->priv->tool_bar = glade_xml_get_widget (property_bar->priv->gui,
-                                                            "property_toolbar");
+       gui = glade_xml_new (GLABELS_GLADE_DIR "property-bar.glade",
+                             "property_toolbar", NULL);
+
+       if (!gui) {
+               g_critical ("Could not open property-bar.glade. gLabels may not be installed correctly!");
+               return;
+       }
+
+       property_bar->priv->tool_bar = glade_xml_get_widget (gui, "property_toolbar");
        gtk_container_add (GTK_CONTAINER (property_bar), property_bar->priv->tool_bar);
 
        property_bar->priv->font_family_combo =
-               glade_xml_get_widget (property_bar->priv->gui, "font_family_combo");
+               glade_xml_get_widget (gui, "font_family_combo");
        property_bar->priv->font_size_spin =
-               glade_xml_get_widget (property_bar->priv->gui, "font_size_spin");
+               glade_xml_get_widget (gui, "font_size_spin");
        property_bar->priv->font_bold_toggle =
-               glade_xml_get_widget (property_bar->priv->gui, "font_bold_toggle");
+               glade_xml_get_widget (gui, "font_bold_toggle");
        property_bar->priv->font_italic_toggle =
-               glade_xml_get_widget (property_bar->priv->gui, "font_italic_toggle");
+               glade_xml_get_widget (gui, "font_italic_toggle");
        property_bar->priv->text_align_left_radio =
-               glade_xml_get_widget (property_bar->priv->gui, "text_align_left_radio");
+               glade_xml_get_widget (gui, "text_align_left_radio");
        property_bar->priv->text_align_center_radio =
-               glade_xml_get_widget (property_bar->priv->gui, "text_align_center_radio");
+               glade_xml_get_widget (gui, "text_align_center_radio");
        property_bar->priv->text_align_right_radio =
-               glade_xml_get_widget (property_bar->priv->gui, "text_align_right_radio");
+               glade_xml_get_widget (gui, "text_align_right_radio");
        property_bar->priv->text_color_combo =
-               glade_xml_get_widget (property_bar->priv->gui, "text_color_combo");
+               glade_xml_get_widget (gui, "text_color_combo");
        property_bar->priv->fill_color_combo =
-               glade_xml_get_widget (property_bar->priv->gui, "fill_color_combo");
+               glade_xml_get_widget (gui, "fill_color_combo");
        property_bar->priv->line_color_combo =
-               glade_xml_get_widget (property_bar->priv->gui, "line_color_combo");
+               glade_xml_get_widget (gui, "line_color_combo");
        property_bar->priv->line_width_spin =
-               glade_xml_get_widget (property_bar->priv->gui, "line_width_spin");
+               glade_xml_get_widget (gui, "line_width_spin");
+
+        g_object_unref (gui);
 
        set_doc_items_sensitive (property_bar, FALSE);
 
index de9c5595a2d123df4202f7e4975f1ffa93bd5da4..c9dee67dd51bca7fc0eb6e97fb965a011829b133 100644 (file)
@@ -63,8 +63,6 @@ enum {
 
 struct _glWdgtMediaSelectPrivate {
 
-        GladeXML     *gui;
-
         GtkWidget    *page_size_combo;
         GtkWidget    *category_combo;
 
@@ -140,15 +138,6 @@ gl_wdgt_media_select_init (glWdgtMediaSelect *media_select)
 
         media_select->priv = g_new0 (glWdgtMediaSelectPrivate, 1);
 
-        media_select->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "wdgt-media-select.glade",
-                                           "wdgt_media_select_hbox",
-                                           NULL);
-
-        if (!media_select->priv->gui) {
-                g_critical ("Could not open wdgt-media-select.glade. gLabels may not be installed correctly!");
-                return;
-        }
-
         gl_debug (DEBUG_MEDIA_SELECT, "END");
 }
 
@@ -162,6 +151,7 @@ gl_wdgt_media_select_finalize (GObject *object)
         g_return_if_fail (object != NULL);
         g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (object));
 
+        g_object_unref (media_select->priv->template_store);
         g_free (media_select->priv);
 
         G_OBJECT_CLASS (gl_wdgt_media_select_parent_class)->finalize (object);
@@ -191,6 +181,7 @@ gl_wdgt_media_select_new (void)
 static void
 gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
 {
+        GladeXML          *gui;
         GtkWidget         *hbox;
         GList             *page_sizes = NULL;
         GList             *categories = NULL;
@@ -206,16 +197,25 @@ gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
         g_return_if_fail (GL_IS_WDGT_MEDIA_SELECT (media_select));
         g_return_if_fail (media_select->priv != NULL);
 
-        hbox = glade_xml_get_widget (media_select->priv->gui,
-                                     "wdgt_media_select_hbox");
+        gui = glade_xml_new (GLABELS_GLADE_DIR "wdgt-media-select.glade",
+                             "wdgt_media_select_hbox", NULL);
+
+        if (!gui) {
+                g_critical ("Could not open wdgt-media-select.glade. gLabels may not be installed correctly!");
+                return;
+        }
+
+        hbox = glade_xml_get_widget (gui, "wdgt_media_select_hbox");
         gtk_container_add (GTK_CONTAINER (media_select), hbox);
 
         media_select->priv->page_size_combo =
-                glade_xml_get_widget (media_select->priv->gui, "page_size_combo");
+                glade_xml_get_widget (gui, "page_size_combo");
         media_select->priv->category_combo =
-                glade_xml_get_widget (media_select->priv->gui, "category_combo");
+                glade_xml_get_widget (gui, "category_combo");
         media_select->priv->template_treeview =
-                glade_xml_get_widget (media_select->priv->gui, "template_treeview");
+                glade_xml_get_widget (gui, "template_treeview");
+
+        g_object_unref (gui);
 
         page_size_id = gl_prefs_get_page_size ();
         page_size_name = gl_paper_lookup_name_from_id (page_size_id);
index b4f99ef7e62816699aff8bbf3bb0d65cd5611743..3c38a5eee08ce37fc33db843090e4751c88453ac 100644 (file)
@@ -54,8 +54,6 @@
 
 struct _glWdgtRotateLabelPrivate {
 
-        GladeXML     *gui;
-
         GtkWidget    *rotate_check;
         GtkWidget    *rotate_drawingarea;
 
@@ -139,15 +137,6 @@ static void
 gl_wdgt_rotate_label_init (glWdgtRotateLabel *rotate_label)
 {
         rotate_label->priv = g_new0 (glWdgtRotateLabelPrivate, 1);
-
-        rotate_label->priv->gui = glade_xml_new (GLABELS_GLADE_DIR "wdgt-rotate-label.glade",
-                                           "rotate_hbox",
-                                           NULL);
-
-        if (!rotate_label->priv->gui) {
-                g_critical ("Could not open wdgt-media-select.glade. gLabels may not be installed correctly!");
-                return;
-        }
 }
 
 static void
@@ -185,18 +174,28 @@ gl_wdgt_rotate_label_new (void)
 static void
 gl_wdgt_rotate_label_construct (glWdgtRotateLabel *rotate_label)
 {
+        GladeXML  *gui;
        GtkWidget *hbox;
 
         g_return_if_fail (GL_IS_WDGT_ROTATE_LABEL (rotate_label));
         g_return_if_fail (rotate_label->priv != NULL);
 
-        hbox = glade_xml_get_widget (rotate_label->priv->gui, "rotate_hbox");
+        gui = glade_xml_new (GLABELS_GLADE_DIR "wdgt-rotate-label.glade",
+                             "rotate_hbox", NULL);
+
+        if (!gui) {
+                g_critical ("Could not open wdgt-media-select.glade. gLabels may not be installed correctly!");
+                return;
+        }
+
+        hbox = glade_xml_get_widget (gui, "rotate_hbox");
         gtk_container_add (GTK_CONTAINER (rotate_label), hbox);
 
-        rotate_label->priv->rotate_check =
-                glade_xml_get_widget (rotate_label->priv->gui, "rotate_check");
-        rotate_label->priv->rotate_drawingarea =
-                glade_xml_get_widget (rotate_label->priv->gui, "rotate_drawingarea");
+        rotate_label->priv->rotate_check       = glade_xml_get_widget (gui, "rotate_check");
+        rotate_label->priv->rotate_drawingarea = glade_xml_get_widget (gui, "rotate_drawingarea");
+
+        g_object_unref (gui);
+
 
        gtk_widget_set_size_request (rotate_label->priv->rotate_drawingarea,
                                      MINI_PREVIEW_CANVAS_PIXELS,