+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),
struct _glMergePropertiesDialogPrivate {
- GladeXML *gui;
-
glLabel *label;
glMerge *merge;
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);
glLabel *label,
GtkWindow *window)
{
+ GladeXML *gui;
gchar *description;
glMergeSrcType src_type;
gchar *src;
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));
struct _glNewLabelDialogPrivate {
- GladeXML *gui;
-
GtkWidget *media_select;
GtkWidget *rotate_label;
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");
}
gl_new_label_dialog_construct (glNewLabelDialog *dialog,
GtkWindow *win)
{
+ GladeXML *gui;
GtkWidget *vbox, *media_select_vbox, *rotate_label_vbox;
gchar *name;
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),
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),
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);
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);
glLabel *label;
- GladeXML *gui;
-
GtkWidget *simple_frame;
GtkWidget *copies_vbox;
GtkWidget *copies;
glPrintState state;
};
-typedef struct _glPrintOpSettings
+struct _glPrintOpSettings
{
GtkPrintSettings *gtk_settings;
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);
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);
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);
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),
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);
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);
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);
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);
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);
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);
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);
glView *view;
- GladeXML *gui;
-
GtkWidget *tool_bar;
/* Font selection */
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");
}
static void
gl_ui_property_bar_construct (glUIPropertyBar *property_bar)
{
+ GladeXML *gui;
GList *family_names = NULL;
GList *family_node;
GdkColor *gdk_color;
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);
struct _glWdgtMediaSelectPrivate {
- GladeXML *gui;
-
GtkWidget *page_size_combo;
GtkWidget *category_combo;
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");
}
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);
static void
gl_wdgt_media_select_construct (glWdgtMediaSelect *media_select)
{
+ GladeXML *gui;
GtkWidget *hbox;
GList *page_sizes = NULL;
GList *categories = NULL;
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);
struct _glWdgtRotateLabelPrivate {
- GladeXML *gui;
-
GtkWidget *rotate_check;
GtkWidget *rotate_drawingarea;
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
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,