From 76cb751459575fbd6a6ccfbd26aac9cb28bcb974 Mon Sep 17 00:00:00 2001 From: Jim Evins Date: Thu, 10 May 2007 02:57:52 +0000 Subject: [PATCH] 2007-05-09 Jim Evins * src/object-editor-bc-page.c: * src/object-editor-data-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-shadow-page.c: * src/object-editor-size-page.c: * src/object-editor-text-page.c: * src/object-editor.c: * src/prefs-dialog.c: * src/template-designer.c: * src/ui-property-bar.c: * src/wdgt-media-select.c: Replaced signal block/unblock pairs with simple flags. This reduces some code clutter, hopefully making it easier to read. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@660 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- glabels2/ChangeLog | 21 ++ glabels2/src/object-editor-bc-page.c | 48 +-- glabels2/src/object-editor-data-page.c | 16 +- glabels2/src/object-editor-fill-page.c | 18 +- glabels2/src/object-editor-image-page.c | 74 ++--- glabels2/src/object-editor-line-page.c | 35 +-- glabels2/src/object-editor-lsize-page.c | 30 +- glabels2/src/object-editor-position-page.c | 42 +-- glabels2/src/object-editor-private.h | 2 + glabels2/src/object-editor-shadow-page.c | 80 ++--- glabels2/src/object-editor-size-page.c | 83 ++--- glabels2/src/object-editor-text-page.c | 91 ++---- glabels2/src/object-editor.c | 4 + glabels2/src/prefs-dialog.c | 217 +++++--------- glabels2/src/template-designer.c | 105 ++----- glabels2/src/ui-property-bar.c | 333 +++++++++++---------- glabels2/src/wdgt-media-select.c | 18 +- 17 files changed, 445 insertions(+), 772 deletions(-) diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index 1e6aa4b2..7c009bf8 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,24 @@ +2007-05-09 Jim Evins + + * src/object-editor-bc-page.c: + * src/object-editor-data-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-shadow-page.c: + * src/object-editor-size-page.c: + * src/object-editor-text-page.c: + * src/object-editor.c: + * src/prefs-dialog.c: + * src/template-designer.c: + * src/ui-property-bar.c: + * src/wdgt-media-select.c: + Replaced signal block/unblock pairs with simple flags. This reduces + some code clutter, hopefully making it easier to read. + 2007-05-05 Jim Evins * src/template-designer.c: (apply_cb): diff --git a/glabels2/src/object-editor-bc-page.c b/glabels2/src/object-editor-bc-page.c index b5f07230..464029e0 100644 --- a/glabels2/src/object-editor-bc-page.c +++ b/glabels2/src/object-editor-bc-page.c @@ -163,7 +163,9 @@ style_changed_cb (glObjectEditor *editor) const gchar *id; gchar *ex_string = NULL; guint digits; - + + if (editor->priv->stop_signals) return; + style_string = gtk_combo_box_get_active_text (GTK_COMBO_BOX (editor->priv->bc_style_combo)); @@ -229,18 +231,7 @@ gl_object_editor_set_bc_style (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_style_combo), - G_CALLBACK (style_changed_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_text_check), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_cs_check), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_digits_spin), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = TRUE; style_string = gl_barcode_id_to_name (id); @@ -285,18 +276,7 @@ gl_object_editor_set_bc_style (glObjectEditor *editor, !editor->priv->data_format_fixed_flag); } - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_style_combo), - G_CALLBACK (style_changed_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_text_check), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_cs_check), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_digits_spin), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -346,12 +326,7 @@ gl_object_editor_set_bc_color (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_color_combo), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->bc_key_combo), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_widget_set_sensitive (editor->priv->bc_key_radio, merge_flag); @@ -383,12 +358,7 @@ gl_object_editor_set_bc_color (glObjectEditor *editor, color_node->key); } - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_color_combo), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->bc_key_combo), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -436,7 +406,9 @@ gl_object_editor_get_bc_color (glObjectEditor *editor) static void bc_radio_toggled_cb (glObjectEditor *editor) { - gl_debug (DEBUG_EDITOR, "START"); + if (editor->priv->stop_signals) return; + + gl_debug (DEBUG_EDITOR, "START"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->bc_color_radio))) { gtk_widget_set_sensitive (editor->priv->bc_color_combo, TRUE); diff --git a/glabels2/src/object-editor-data-page.c b/glabels2/src/object-editor-data-page.c index 5bf85e52..449d3e28 100644 --- a/glabels2/src/object-editor-data-page.c +++ b/glabels2/src/object-editor-data-page.c @@ -111,6 +111,8 @@ gl_object_editor_prepare_data_page (glObjectEditor *editor) static void data_radio_toggled_cb (glObjectEditor *editor) { + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_WDGT, "START"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->data_literal_radio))) { @@ -149,12 +151,7 @@ gl_object_editor_set_data (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_text_entry), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->data_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = TRUE; gtk_widget_set_sensitive (editor->priv->data_key_radio, merge_flag); @@ -198,12 +195,7 @@ gl_object_editor_set_data (glObjectEditor *editor, } - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_text_entry), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->data_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } diff --git a/glabels2/src/object-editor-fill-page.c b/glabels2/src/object-editor-fill-page.c index 0fedf68e..c40f8a17 100644 --- a/glabels2/src/object-editor-fill-page.c +++ b/glabels2/src/object-editor-fill-page.c @@ -126,12 +126,7 @@ gl_object_editor_set_fill_color (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->fill_color_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->fill_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = TRUE; gtk_widget_set_sensitive (editor->priv->fill_key_radio, merge_flag); @@ -164,12 +159,7 @@ gl_object_editor_set_fill_color (glObjectEditor *editor, color_node->key); } - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->fill_color_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->fill_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -214,7 +204,9 @@ gl_object_editor_get_fill_color (glObjectEditor *editor) static void fill_radio_toggled_cb (glObjectEditor *editor) { - gl_debug (DEBUG_EDITOR, "START"); + if (editor->priv->stop_signals) return; + + gl_debug (DEBUG_EDITOR, "START"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->fill_color_radio))) { gtk_widget_set_sensitive (editor->priv->fill_color_combo, TRUE); diff --git a/glabels2/src/object-editor-image-page.c b/glabels2/src/object-editor-image-page.c index eac7ea66..a975ab29 100644 --- a/glabels2/src/object-editor-image-page.c +++ b/glabels2/src/object-editor-image-page.c @@ -127,6 +127,8 @@ gl_object_editor_prepare_image_page (glObjectEditor *editor) static void img_radio_toggled_cb (glObjectEditor *editor) { + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_WDGT, "START"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->img_file_radio))) { @@ -153,18 +155,7 @@ gl_object_editor_set_image (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_file_button), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_file_radio), - G_CALLBACK (img_radio_toggled_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->img_key_radio), - G_CALLBACK (img_radio_toggled_cb), - editor); + editor->priv->stop_signals = TRUE; gtk_widget_set_sensitive (editor->priv->img_key_radio, merge_flag); @@ -193,18 +184,7 @@ gl_object_editor_set_image (glObjectEditor *editor, text_node->data); } - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_file_button), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_file_radio), - G_CALLBACK (img_radio_toggled_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->img_key_radio), - G_CALLBACK (img_radio_toggled_cb), - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -245,28 +225,28 @@ gl_object_editor_get_image (glObjectEditor *editor) static void update_preview_cb (GtkFileChooser *file_chooser, gpointer data) { - GtkWidget *preview; - char *filename; - GdkPixbuf *pixbuf; - gboolean have_preview; - - preview = GTK_WIDGET (data); - filename = gtk_file_chooser_get_preview_filename (file_chooser); - - if (filename) { - pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL); - have_preview = (pixbuf != NULL); - g_free (filename); - - gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf); - if (pixbuf) - gdk_pixbuf_unref (pixbuf); - - gtk_file_chooser_set_preview_widget_active (file_chooser, - have_preview); - } else { - gtk_file_chooser_set_preview_widget_active (file_chooser, FALSE); - } + GtkWidget *preview; + char *filename; + GdkPixbuf *pixbuf; + gboolean have_preview; + + preview = GTK_WIDGET (data); + filename = gtk_file_chooser_get_preview_filename (file_chooser); + + if (filename) { + pixbuf = gdk_pixbuf_new_from_file_at_size (filename, 128, 128, NULL); + have_preview = (pixbuf != NULL); + g_free (filename); + + gtk_image_set_from_pixbuf (GTK_IMAGE (preview), pixbuf); + if (pixbuf) + gdk_pixbuf_unref (pixbuf); + + gtk_file_chooser_set_preview_widget_active (file_chooser, + have_preview); + } else { + gtk_file_chooser_set_preview_widget_active (file_chooser, FALSE); + } } /*--------------------------------------------------------------------------*/ @@ -353,6 +333,8 @@ img_selection_changed_cb (glObjectEditor *editor) { gchar *filename; + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_EDITOR, "START"); filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(editor->priv->img_file_button)); diff --git a/glabels2/src/object-editor-line-page.c b/glabels2/src/object-editor-line-page.c index f7a6bc23..a9daf766 100644 --- a/glabels2/src/object-editor-line-page.c +++ b/glabels2/src/object-editor-line-page.c @@ -132,17 +132,13 @@ gl_object_editor_set_line_width (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->line_width_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; /* Set widget values */ gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->line_width_spin), width); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->line_width_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -176,13 +172,7 @@ gl_object_editor_set_line_color (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->line_color_combo), - gl_object_editor_changed_cb, - editor); - - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->line_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = TRUE; gl_debug (DEBUG_EDITOR, "color field %s(%d) / %X", color_node->key, color_node->field_flag, color_node->color); gtk_widget_set_sensitive (editor->priv->line_key_radio, merge_flag); @@ -216,12 +206,7 @@ gl_object_editor_set_line_color (glObjectEditor *editor, color_node->key); } - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->line_color_combo), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->line_key_combo), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -266,19 +251,21 @@ gl_object_editor_get_line_color (glObjectEditor *editor) static void line_radio_toggled_cb (glObjectEditor *editor) { - gl_debug (DEBUG_EDITOR, "START"); + if (editor->priv->stop_signals) return; + + gl_debug (DEBUG_EDITOR, "START"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->line_color_radio))) { gtk_widget_set_sensitive (editor->priv->line_color_combo, TRUE); gtk_widget_set_sensitive (editor->priv->line_key_combo, FALSE); - } else { + } else { gtk_widget_set_sensitive (editor->priv->line_color_combo, FALSE); gtk_widget_set_sensitive (editor->priv->line_key_combo, TRUE); } - /* Emit our "changed" signal */ - g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0); + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0); - gl_debug (DEBUG_EDITOR, "END"); + gl_debug (DEBUG_EDITOR, "END"); } diff --git a/glabels2/src/object-editor-lsize-page.c b/glabels2/src/object-editor-lsize-page.c index 4a3dd0d3..f2bbadfa 100644 --- a/glabels2/src/object-editor-lsize-page.c +++ b/glabels2/src/object-editor-lsize-page.c @@ -122,12 +122,7 @@ gl_object_editor_set_lsize (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->lsize_r_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->lsize_theta_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; /* save a copy in internal units */ editor->priv->dx = dx; @@ -147,12 +142,7 @@ gl_object_editor_set_lsize (glObjectEditor *editor, gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->lsize_theta_spin), theta); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_r_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_theta_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -169,9 +159,7 @@ gl_object_editor_set_max_lsize (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->lsize_r_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; /* save a copy in internal units */ editor->priv->dx_max = dx_max; @@ -189,9 +177,7 @@ gl_object_editor_set_max_lsize (glObjectEditor *editor, 0.0, 2.0*LENGTH (dx_max, dy_max)); gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin), tmp); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_r_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -244,16 +230,12 @@ lsize_prefs_changed_cb (glObjectEditor *editor) digits = gl_prefs_get_units_precision (); /* Update characteristics of r_spin */ - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->lsize_r_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->lsize_r_spin), digits); gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->lsize_r_spin), climb_rate, 10.0*climb_rate); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_r_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; /* Update r_units_label */ gtk_label_set_text (GTK_LABEL(editor->priv->lsize_r_units_label), diff --git a/glabels2/src/object-editor-position-page.c b/glabels2/src/object-editor-position-page.c index 3f8a2da4..e72036e0 100644 --- a/glabels2/src/object-editor-position-page.c +++ b/glabels2/src/object-editor-position-page.c @@ -119,12 +119,7 @@ gl_object_editor_set_position (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->pos_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->pos_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; /* save a copy in internal units */ editor->priv->x = x; @@ -140,12 +135,7 @@ gl_object_editor_set_position (glObjectEditor *editor, gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->pos_x_spin), x); gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->pos_y_spin), y); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->pos_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->pos_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -162,12 +152,7 @@ gl_object_editor_set_max_position (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->pos_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->pos_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; /* save a copy in internal units */ editor->priv->x_max = x_max; @@ -189,12 +174,7 @@ gl_object_editor_set_max_position (glObjectEditor *editor, -y_max, 2.0*y_max); gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->pos_y_spin), tmp); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->pos_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->pos_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -243,12 +223,7 @@ position_prefs_changed_cb (glObjectEditor *editor) digits = gl_prefs_get_units_precision (); /* Update characteristics of x_spin/y_spin */ - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->pos_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->pos_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->pos_x_spin), digits); gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->pos_y_spin), @@ -257,12 +232,7 @@ position_prefs_changed_cb (glObjectEditor *editor) climb_rate, 10.0*climb_rate); gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->pos_y_spin), climb_rate, 10.0*climb_rate); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->pos_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->pos_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; /* Update units_labels */ gtk_label_set_text (GTK_LABEL(editor->priv->pos_x_units_label), diff --git a/glabels2/src/object-editor-private.h b/glabels2/src/object-editor-private.h index 71a8a572..3a69497b 100644 --- a/glabels2/src/object-editor-private.h +++ b/glabels2/src/object-editor-private.h @@ -151,6 +151,8 @@ struct _glObjectEditorPrivate { gdouble shadow_x_max; gdouble shadow_y_max; + /* Prevent recursion */ + gboolean stop_signals; }; enum { diff --git a/glabels2/src/object-editor-shadow-page.c b/glabels2/src/object-editor-shadow-page.c index 889c08e9..1396d36b 100644 --- a/glabels2/src/object-editor-shadow-page.c +++ b/glabels2/src/object-editor-shadow-page.c @@ -166,17 +166,13 @@ gl_object_editor_set_shadow_state (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_enable_check), - shadow_enable_check_toggled_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_enable_check), state); gtk_widget_set_sensitive (editor->priv->shadow_controls_table, state); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_enable_check), - shadow_enable_check_toggled_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -188,12 +184,7 @@ gl_object_editor_set_shadow_offset (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; /* save a copy in internal units */ editor->priv->shadow_x = x; @@ -209,12 +200,7 @@ gl_object_editor_set_shadow_offset (glObjectEditor *editor, gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_x_spin), x); gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin), y); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -228,12 +214,7 @@ gl_object_editor_set_shadow_color (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_color_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = TRUE; gtk_widget_set_sensitive (editor->priv->shadow_key_radio, merge_flag); @@ -266,12 +247,7 @@ gl_object_editor_set_shadow_color (glObjectEditor *editor, color_node->key); } - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_color_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_key_combo), - G_CALLBACK (gl_object_editor_changed_cb), - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -282,16 +258,12 @@ gl_object_editor_set_shadow_opacity (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_opacity_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_opacity_spin), alpha * 100.0); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_opacity_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -309,12 +281,7 @@ gl_object_editor_set_max_shadow_offset (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; /* save a copy in internal units */ editor->priv->shadow_x_max = x_max; @@ -336,12 +303,7 @@ gl_object_editor_set_max_shadow_offset (glObjectEditor *editor, -y_max, y_max); gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->shadow_y_spin), tmp); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -450,12 +412,7 @@ shadow_prefs_changed_cb (glObjectEditor *editor) digits = gl_prefs_get_units_precision (); /* Update characteristics of x_spin/y_spin */ - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->shadow_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->shadow_x_spin), digits); gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->shadow_y_spin), @@ -464,12 +421,7 @@ shadow_prefs_changed_cb (glObjectEditor *editor) climb_rate, 10.0*climb_rate); gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->shadow_y_spin), climb_rate, 10.0*climb_rate); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_x_spin), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->shadow_y_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; /* Update units_labels */ gtk_label_set_text (GTK_LABEL(editor->priv->shadow_x_units_label), @@ -496,6 +448,8 @@ shadow_enable_check_toggled_cb (glObjectEditor *editor) { gboolean state; + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_EDITOR, "START"); state = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_enable_check)); @@ -515,12 +469,14 @@ shadow_enable_check_toggled_cb (glObjectEditor *editor) static void shadow_color_radio_toggled_cb (glObjectEditor *editor) { - gl_debug (DEBUG_EDITOR, "START"); + if (editor->priv->stop_signals) return; + + gl_debug (DEBUG_EDITOR, "START"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->shadow_color_radio))) { gtk_widget_set_sensitive (editor->priv->shadow_color_combo, TRUE); gtk_widget_set_sensitive (editor->priv->shadow_key_combo, FALSE); - } else { + } else { gtk_widget_set_sensitive (editor->priv->shadow_color_combo, FALSE); gtk_widget_set_sensitive (editor->priv->shadow_key_combo, TRUE); diff --git a/glabels2/src/object-editor-size-page.c b/glabels2/src/object-editor-size-page.c index cdf83e39..4d8b1700 100644 --- a/glabels2/src/object-editor-size-page.c +++ b/glabels2/src/object-editor-size-page.c @@ -143,6 +143,8 @@ aspect_toggle_cb (glObjectEditor *editor) glWdgtChainButton *toggle; gdouble w, h; + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_EDITOR, "START"); toggle = GL_WDGT_CHAIN_BUTTON (editor->priv->size_aspect_checkbutton); @@ -168,6 +170,8 @@ w_spin_cb (glObjectEditor *editor) gdouble w, h; glWdgtChainButton *toggle; + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_EDITOR, "START"); toggle = GL_WDGT_CHAIN_BUTTON (editor->priv->size_aspect_checkbutton); @@ -179,13 +183,9 @@ w_spin_cb (glObjectEditor *editor) h = w * editor->priv->size_aspect_ratio; /* Update our sibling control, blocking recursion. */ - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_h_spin), - G_CALLBACK (h_spin_cb), - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), h); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_h_spin), - G_CALLBACK (h_spin_cb), - editor); + editor->priv->stop_signals = FALSE; } /* Emit our "changed" signal */ @@ -204,6 +204,8 @@ h_spin_cb (glObjectEditor *editor) gdouble w, h; glWdgtChainButton *toggle; + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_EDITOR, "START"); toggle = GL_WDGT_CHAIN_BUTTON (editor->priv->size_aspect_checkbutton); @@ -215,13 +217,9 @@ h_spin_cb (glObjectEditor *editor) w = h / editor->priv->size_aspect_ratio; /* Update our sibling control, blocking recursion. */ - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_w_spin), - G_CALLBACK (w_spin_cb), - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin), w); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_w_spin), - G_CALLBACK (w_spin_cb), - editor); + editor->priv->stop_signals = FALSE; } /* Emit our "changed" signal */ @@ -241,14 +239,11 @@ size_reset_cb (glObjectEditor *editor) gdouble w_max, h_max; gdouble aspect_ratio; + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_w_spin), - G_CALLBACK (w_spin_cb), - editor); - g_signal_handlers_block_by_func (G_OBJECT (editor->priv->size_h_spin), - G_CALLBACK (h_spin_cb), - editor); + editor->priv->stop_signals = TRUE; w_base = editor->priv->w_base; h_base = editor->priv->h_base; @@ -278,16 +273,12 @@ size_reset_cb (glObjectEditor *editor) gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), h_base); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_w_spin), - G_CALLBACK (w_spin_cb), - editor); - g_signal_handlers_unblock_by_func (G_OBJECT (editor->priv->size_h_spin), - G_CALLBACK (h_spin_cb), - editor); /* Emit our "changed" signal */ g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0); g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[SIZE_CHANGED], 0); + editor->priv->stop_signals = FALSE; + gl_debug (DEBUG_EDITOR, "END"); } @@ -301,12 +292,7 @@ gl_object_editor_set_size (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->size_w_spin), - w_spin_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->size_h_spin), - h_spin_cb, - editor); + editor->priv->stop_signals = TRUE; /* save a copy in internal units */ editor->priv->w = w; @@ -322,16 +308,11 @@ gl_object_editor_set_size (glObjectEditor *editor, gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_w_spin), w); gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), h); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->size_w_spin), - w_spin_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->size_h_spin), - h_spin_cb, - editor); - /* Update aspect ratio */ editor->priv->size_aspect_ratio = h / w; + editor->priv->stop_signals = FALSE; + gl_debug (DEBUG_EDITOR, "END"); } @@ -347,12 +328,7 @@ gl_object_editor_set_max_size (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->size_w_spin), - w_spin_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->size_h_spin), - h_spin_cb, - editor); + editor->priv->stop_signals = TRUE; /* save a copy in internal units */ editor->priv->w_max = w_max; @@ -374,12 +350,7 @@ gl_object_editor_set_max_size (glObjectEditor *editor, 0.0, 2.0*h_max); gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->size_h_spin), tmp); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->size_w_spin), - w_spin_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->size_h_spin), - h_spin_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -444,12 +415,7 @@ size_prefs_changed_cb (glObjectEditor *editor) digits = gl_prefs_get_units_precision (); /* Update characteristics of w_spin/h_spin */ - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->size_w_spin), - w_spin_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->size_h_spin), - h_spin_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->size_w_spin), digits); gtk_spin_button_set_digits (GTK_SPIN_BUTTON(editor->priv->size_h_spin), @@ -458,12 +424,7 @@ size_prefs_changed_cb (glObjectEditor *editor) climb_rate, 10.0*climb_rate); gtk_spin_button_set_increments (GTK_SPIN_BUTTON(editor->priv->size_h_spin), climb_rate, 10.0*climb_rate); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->size_w_spin), - w_spin_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->size_h_spin), - h_spin_cb, - editor); + editor->priv->stop_signals = FALSE; /* Update units_labels */ gtk_label_set_text (GTK_LABEL(editor->priv->size_w_units_label), diff --git a/glabels2/src/object-editor-text-page.c b/glabels2/src/object-editor-text-page.c index 535feea9..93aad0a4 100644 --- a/glabels2/src/object-editor-text-page.c +++ b/glabels2/src/object-editor-text-page.c @@ -185,6 +185,8 @@ static void align_toggle_cb (GtkToggleButton *toggle, glObjectEditor *editor) { + if (editor->priv->stop_signals) return; + if (gtk_toggle_button_get_active (toggle)) { if (GTK_WIDGET (toggle) == GTK_WIDGET (editor->priv->text_left_toggle)) { @@ -230,9 +232,7 @@ gl_object_editor_set_font_family (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_family_combo), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; /* Make sure we have a valid font family. if not provide a good default. */ family_names = gl_util_get_font_family_list (); @@ -249,9 +249,7 @@ gl_object_editor_set_font_family (glObjectEditor *editor, gl_util_combo_box_set_active_text (GTK_COMBO_BOX (editor->priv->text_family_combo), good_font_family); g_free (good_font_family); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_family_combo), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -282,16 +280,12 @@ gl_object_editor_set_font_size (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_size_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->text_size_spin), font_size); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_size_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -323,16 +317,12 @@ gl_object_editor_set_font_weight (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_bold_toggle), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_bold_toggle), (font_weight == PANGO_WEIGHT_BOLD)); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_bold_toggle), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -368,17 +358,12 @@ gl_object_editor_set_font_italic_flag (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_italic_toggle), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_italic_toggle), font_italic_flag); - - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_italic_toggle), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -411,15 +396,7 @@ gl_object_editor_set_text_alignment (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_left_toggle), - align_toggle_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_center_toggle), - align_toggle_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_right_toggle), - align_toggle_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_left_toggle), (align == PANGO_ALIGN_LEFT)); @@ -428,15 +405,7 @@ gl_object_editor_set_text_alignment (glObjectEditor *editor, gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_right_toggle), (align == PANGO_ALIGN_RIGHT)); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_left_toggle), - align_toggle_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_center_toggle), - align_toggle_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_right_toggle), - align_toggle_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -483,12 +452,7 @@ gl_object_editor_set_text_color (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_color_combo), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_color_key_combo), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gl_debug (DEBUG_EDITOR, "color field %s(%d) / %X", text_color_node->key, text_color_node->field_flag, text_color_node->color); @@ -523,12 +487,7 @@ gl_object_editor_set_text_color (glObjectEditor *editor, gl_debug (DEBUG_EDITOR, "color field true 2"); } - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_color_combo), - gl_object_editor_changed_cb, - editor); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_color_key_combo), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -580,16 +539,12 @@ gl_object_editor_set_text_line_spacing (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_line_spacing_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->text_line_spacing_spin), text_line_spacing); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_line_spacing_spin), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -621,16 +576,12 @@ gl_object_editor_set_text_auto_shrink (glObjectEditor *editor, { gl_debug (DEBUG_EDITOR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(editor->priv->text_auto_shrink_check), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = TRUE; gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (editor->priv->text_auto_shrink_check), auto_shrink); - g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->text_auto_shrink_check), - gl_object_editor_changed_cb, - editor); + editor->priv->stop_signals = FALSE; gl_debug (DEBUG_EDITOR, "END"); } @@ -658,12 +609,14 @@ gboolean gl_object_editor_get_text_auto_shrink (glObjectEditor *editor) static void text_radio_toggled_cb (glObjectEditor *editor) { - gl_debug (DEBUG_EDITOR, "START"); + if (editor->priv->stop_signals) return; + + gl_debug (DEBUG_EDITOR, "START"); if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (editor->priv->text_color_radio))) { gtk_widget_set_sensitive (editor->priv->text_color_combo, TRUE); gtk_widget_set_sensitive (editor->priv->text_color_key_combo, FALSE); - } else { + } else { gtk_widget_set_sensitive (editor->priv->text_color_combo, FALSE); gtk_widget_set_sensitive (editor->priv->text_color_key_combo, TRUE); diff --git a/glabels2/src/object-editor.c b/glabels2/src/object-editor.c index 375a2958..1f8ab59e 100644 --- a/glabels2/src/object-editor.c +++ b/glabels2/src/object-editor.c @@ -321,6 +321,8 @@ gl_object_notebook_construct_valist (glObjectEditor *editor, void gl_object_editor_changed_cb (glObjectEditor *editor) { + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_EDITOR, "START"); /* Emit our "changed" signal */ @@ -335,6 +337,8 @@ gl_object_editor_changed_cb (glObjectEditor *editor) void gl_object_editor_size_changed_cb (glObjectEditor *editor) { + if (editor->priv->stop_signals) return; + gl_debug (DEBUG_EDITOR, "START"); /* Emit our "size_changed" signal */ diff --git a/glabels2/src/prefs-dialog.c b/glabels2/src/prefs-dialog.c index e9d3dec3..68233510 100644 --- a/glabels2/src/prefs-dialog.c +++ b/glabels2/src/prefs-dialog.c @@ -81,6 +81,9 @@ struct _glPrefsDialogPrivate /* Default fill properties */ GtkWidget *fill_color_combo; + + /* Prevent recursion */ + gboolean stop_signals; }; /*========================================================*/ @@ -140,7 +143,8 @@ gl_prefs_dialog_init (glPrefsDialog *dialog) "prefs_notebook", NULL); - if (!dialog->priv->gui) { + if (!dialog->priv->gui) + { g_critical ("Could not open prefs-dialog.glade. gLabels may not be installed correctly!"); return; } @@ -172,7 +176,8 @@ 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) { + if (dialog->priv->gui) + { g_object_unref (G_OBJECT (dialog->priv->gui)); } g_free (dialog->priv); @@ -401,25 +406,29 @@ static void align_toggle_cb (GtkToggleButton *toggle, glPrefsDialog *dialog) { - if (gtk_toggle_button_get_active (toggle)) { + if (gtk_toggle_button_get_active (toggle)) + { - if (GTK_WIDGET (toggle) == GTK_WIDGET (dialog->priv->text_left_toggle)) { + if (GTK_WIDGET (toggle) == GTK_WIDGET (dialog->priv->text_left_toggle)) + { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_center_toggle), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_right_toggle), FALSE); - } else if (GTK_WIDGET (toggle) == - GTK_WIDGET (dialog->priv->text_center_toggle)) { + } + else if (GTK_WIDGET (toggle) == GTK_WIDGET (dialog->priv->text_center_toggle)) + { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_left_toggle), FALSE); gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_right_toggle), FALSE); - } else if (GTK_WIDGET (toggle) == - GTK_WIDGET (dialog->priv->text_right_toggle)) { + } + else if (GTK_WIDGET (toggle) == GTK_WIDGET (dialog->priv->text_right_toggle)) + { gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->priv->text_left_toggle), FALSE); @@ -440,21 +449,7 @@ align_toggle_cb (GtkToggleButton *toggle, static void update_locale_page_from_prefs (glPrefsDialog *dialog) { - g_signal_handlers_block_by_func ( - 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(dialog->priv->units_inches_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); - g_signal_handlers_block_by_func ( - 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(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(dialog->priv->page_size_a4_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); + dialog->priv->stop_signals = TRUE; switch (gl_prefs->units) { case GL_UNITS_POINT: @@ -477,33 +472,22 @@ update_locale_page_from_prefs (glPrefsDialog *dialog) break; } - if ( g_strcasecmp(gl_prefs->default_page_size, US_LETTER_ID) == 0) { + if ( g_strcasecmp(gl_prefs->default_page_size, US_LETTER_ID) == 0) + { gtk_toggle_button_set_active ( - 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(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(dialog->priv->page_size_a4_radio), - TRUE); - } else { + 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(dialog->priv->units_points_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func ( - 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(dialog->priv->units_mm_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func ( - 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(dialog->priv->page_size_a4_radio), - G_CALLBACK(update_prefs_from_locale_page), G_OBJECT(dialog)); + dialog->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -516,54 +500,25 @@ update_object_page_from_prefs (glPrefsDialog *dialog) gchar *good_font_family; GdkColor *gdk_color; - g_signal_handlers_block_by_func ( - 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(dialog->priv->text_size_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); - g_signal_handlers_block_by_func ( - 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(dialog->priv->text_italic_toggle), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); - g_signal_handlers_block_by_func ( - 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(dialog->priv->text_left_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); - g_signal_handlers_block_by_func ( - G_OBJECT(dialog->priv->text_center_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); - g_signal_handlers_block_by_func ( - G_OBJECT(dialog->priv->text_right_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); - g_signal_handlers_block_by_func ( - 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(dialog->priv->line_width_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); - g_signal_handlers_block_by_func ( - 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(dialog->priv->fill_color_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); + dialog->priv->stop_signals = TRUE; /* Make sure we have a valid font family. if not provide a good default. */ family_names = gl_util_get_font_family_list (); if (g_list_find_custom (family_names, gl_prefs->default_font_family, - (GCompareFunc)g_utf8_collate)) { + (GCompareFunc)g_utf8_collate)) + { good_font_family = g_strdup (gl_prefs->default_font_family); - } else { - if (family_names != NULL) { + } + else + { + if (family_names != NULL) + { good_font_family = g_strdup (family_names->data); /* 1st entry */ - } else { + } + else + { good_font_family = NULL; } } @@ -608,42 +563,7 @@ update_object_page_from_prefs (glPrefsDialog *dialog) g_free (gdk_color); - g_signal_handlers_unblock_by_func ( - 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(dialog->priv->text_size_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func ( - 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(dialog->priv->text_italic_toggle), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func ( - 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(dialog->priv->text_left_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func ( - G_OBJECT(dialog->priv->text_center_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func ( - G_OBJECT(dialog->priv->text_right_toggle), - G_CALLBACK(align_toggle_cb), G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func ( - 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(dialog->priv->line_width_spin), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func ( - 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(dialog->priv->fill_color_combo), - G_CALLBACK(update_prefs_from_object_page), G_OBJECT(dialog)); + dialog->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -652,25 +572,32 @@ update_object_page_from_prefs (glPrefsDialog *dialog) static void update_prefs_from_locale_page (glPrefsDialog *dialog) { + if (dialog->priv->stop_signals) return; + if (gtk_toggle_button_get_active ( - GTK_TOGGLE_BUTTON(dialog->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(dialog->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(dialog->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(dialog->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(dialog->priv->page_size_a4_radio))) { + GTK_TOGGLE_BUTTON(dialog->priv->page_size_a4_radio))) + { gl_prefs->default_page_size = A4_ID; } @@ -686,6 +613,7 @@ update_prefs_from_object_page (glPrefsDialog *dialog) GdkColor *gdk_color; gboolean is_default; + if (dialog->priv->stop_signals) return; g_free (gl_prefs->default_font_family); gl_prefs->default_font_family = @@ -694,9 +622,12 @@ update_prefs_from_object_page (glPrefsDialog *dialog) gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->text_size_spin)); if (gtk_toggle_button_get_active - (GTK_TOGGLE_BUTTON (dialog->priv->text_bold_toggle))) { + (GTK_TOGGLE_BUTTON (dialog->priv->text_bold_toggle))) + { gl_prefs->default_font_weight = PANGO_WEIGHT_BOLD; - } else { + } + else + { gl_prefs->default_font_weight = PANGO_WEIGHT_NORMAL; } @@ -706,22 +637,28 @@ update_prefs_from_object_page (glPrefsDialog *dialog) gdk_color = color_combo_get_color (COLOR_COMBO(dialog->priv->text_color_combo), &is_default); - if (!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 (dialog->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 (dialog->priv->text_right_toggle))) { + } + else if (gtk_toggle_button_get_active + (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 (dialog->priv->text_center_toggle))) { + } + else if (gtk_toggle_button_get_active + (GTK_TOGGLE_BUTTON (dialog->priv->text_center_toggle))) + { gl_prefs->default_text_alignment = GTK_JUSTIFY_CENTER; - } else { + } + else + { /* Should not happen. */ gl_prefs->default_text_alignment = GTK_JUSTIFY_LEFT; } @@ -735,14 +672,16 @@ update_prefs_from_object_page (glPrefsDialog *dialog) gdk_color = color_combo_get_color (COLOR_COMBO(dialog->priv->line_color_combo), &is_default); - if (!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(dialog->priv->fill_color_combo), &is_default); - if (!is_default) { + if (!is_default) + { gl_prefs->default_fill_color = gl_color_from_gdk_color (gdk_color); } diff --git a/glabels2/src/template-designer.c b/glabels2/src/template-designer.c index 490ea2da..30122587 100644 --- a/glabels2/src/template-designer.c +++ b/glabels2/src/template-designer.c @@ -179,6 +179,8 @@ struct _glTemplateDesignerPrivate gdouble climb_rate; gint digits; + /* Prevent recursion */ + gboolean stop_signals; }; /* Page numbers for traversing GtkAssistant */ @@ -1417,7 +1419,7 @@ cd_size_page_prepare_cb (glTemplateDesigner *dialog) } /*--------------------------------------------------------------------------*/ -/* PRIVATE. Layout page widget changed cb. */ +/* PRIVATE. Prepare Layout page cb. */ /*--------------------------------------------------------------------------*/ static void layout_page_prepare_cb (glTemplateDesigner *dialog) @@ -1428,43 +1430,11 @@ layout_page_prepare_cb (glTemplateDesigner *dialog) gint nlayouts; gdouble nx_1, ny_1, x0_1, y0_1, dx_1, dy_1; gdouble nx_2, ny_2, x0_2, y0_2, dx_2, dy_2; + glTemplate *template; + + if (dialog->priv->stop_signals) return; + dialog->priv->stop_signals = TRUE; - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout1_nx_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout1_ny_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout1_x0_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout1_y0_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout1_dx_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout1_dy_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout2_nx_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout2_ny_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout2_x0_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout2_y0_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout2_dx_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_block_by_func (G_OBJECT(dialog->priv->layout2_dy_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); /* Limit ranges based on already chosen page and label sizes. */ page_w = gtk_spin_button_get_value (GTK_SPIN_BUTTON(dialog->priv->pg_w_spin)); @@ -1543,8 +1513,8 @@ layout_page_prepare_cb (glTemplateDesigner *dialog) /* Set visibility of layout2 widgets as appropriate. */ nlayouts = gtk_spin_button_get_value (GTK_SPIN_BUTTON (dialog->priv->nlayouts_spin)); - if ( nlayouts == 1 ) { - + if ( nlayouts == 1 ) + { gtk_widget_hide (dialog->priv->layout1_head_label); gtk_widget_hide (dialog->priv->layout2_head_label); gtk_widget_hide (dialog->priv->layout2_nx_spin); @@ -1553,9 +1523,9 @@ layout_page_prepare_cb (glTemplateDesigner *dialog) gtk_widget_hide (dialog->priv->layout2_y0_spin); gtk_widget_hide (dialog->priv->layout2_dx_spin); gtk_widget_hide (dialog->priv->layout2_dy_spin); - - } else { - + } + else + { gtk_widget_show (dialog->priv->layout1_head_label); gtk_widget_show (dialog->priv->layout2_head_label); gtk_widget_show (dialog->priv->layout2_nx_spin); @@ -1564,47 +1534,15 @@ layout_page_prepare_cb (glTemplateDesigner *dialog) gtk_widget_show (dialog->priv->layout2_y0_spin); gtk_widget_show (dialog->priv->layout2_dx_spin); gtk_widget_show (dialog->priv->layout2_dy_spin); - } - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout1_nx_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout1_ny_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout1_x0_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout1_y0_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout1_dx_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout1_dy_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout2_nx_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout2_ny_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout2_x0_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout2_y0_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout2_dx_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - g_signal_handlers_unblock_by_func (G_OBJECT(dialog->priv->layout2_dy_spin), - G_CALLBACK(layout_page_changed_cb), - G_OBJECT(dialog)); - - layout_page_changed_cb (dialog); + template = build_template (dialog); + gl_wdgt_mini_preview_set_template (GL_WDGT_MINI_PREVIEW(dialog->priv->layout_mini_preview), + template); + gl_template_free (template); + + + dialog->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -1615,12 +1553,17 @@ layout_page_changed_cb (glTemplateDesigner *dialog) { glTemplate *template; + if (dialog->priv->stop_signals) return; + dialog->priv->stop_signals = TRUE; + template = build_template (dialog); gl_wdgt_mini_preview_set_template (GL_WDGT_MINI_PREVIEW(dialog->priv->layout_mini_preview), template); gl_template_free (template); + + dialog->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ diff --git a/glabels2/src/ui-property-bar.c b/glabels2/src/ui-property-bar.c index 2dfbf3f8..ea2d10a4 100644 --- a/glabels2/src/ui-property-bar.c +++ b/glabels2/src/ui-property-bar.c @@ -78,8 +78,8 @@ struct _glUIPropertyBarPrivate { /* Line width */ GtkWidget *line_width_spin; + /* Prevent recursion */ gboolean stop_signals; - }; @@ -191,7 +191,8 @@ gl_ui_property_bar_finalize (GObject *object) g_return_if_fail (object != NULL); g_return_if_fail (GL_IS_UI_PROPERTY_BAR (object)); - if (property_bar->priv->view) { + if (property_bar->priv->view) + { g_object_unref (G_OBJECT(property_bar->priv->view)); } if (property_bar->priv->gui) @@ -242,7 +243,8 @@ gl_ui_property_bar_construct (glUIPropertyBar *property_bar) gui = glade_xml_new (GLABELS_GLADE_DIR "property-bar.glade", "property_toolbar", NULL); - if (!gui) { + if (!gui) + { g_critical ("Could not open property-bar.glade. gLabels may not be installed correctly!"); return; } @@ -289,11 +291,14 @@ gl_ui_property_bar_construct (glUIPropertyBar *property_bar) family_node = g_list_find_custom (family_names, gl_prefs->default_font_family, (GCompareFunc)g_utf8_collate); - if (family_node) { + if (family_node) + { gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo), g_list_position (family_names, family_node)); - } else { + } + else + { gtk_combo_box_set_active (GTK_COMBO_BOX (property_bar->priv->font_family_combo), 0); } gl_util_font_family_list_free (family_names); @@ -383,12 +388,18 @@ reset_to_default_properties (glView *view, family_names = gl_util_get_font_family_list (); if (g_list_find_custom (family_names, view->default_font_family, - (GCompareFunc)g_utf8_collate)) { + (GCompareFunc)g_utf8_collate)) + { good_font_family = g_strdup (view->default_font_family); - } else { - if (family_names != NULL) { + } + else + { + if (family_names != NULL) + { good_font_family = g_strdup (family_names->data); /* 1st entry */ - } else { + } + else + { good_font_family = NULL; } } @@ -475,9 +486,12 @@ gl_ui_property_bar_set_tooltips (glUIPropertyBar *property_bar, data = gtk_tooltips_data_get (property_bar->priv->font_size_spin); g_return_if_fail (data); - if (state) { + if (state) + { gtk_tooltips_enable (data->tooltips); - } else { + } + else + { gtk_tooltips_disable (data->tooltips); } @@ -527,30 +541,41 @@ update_text_properties (glView *view, is_first_object = TRUE; - for (p = view->selected_object_list; p != NULL; p = p->next) { + for (p = view->selected_object_list; p != NULL; p = p->next) + { object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data)); if (!gl_label_object_can_text (object)) continue; font_family = gl_label_object_get_font_family (object); - if (font_family != NULL) { + if (font_family != NULL) + { if (selection_font_family == NULL) + { selection_font_family = g_strdup (font_family); + } else - if (strcmp (font_family, selection_font_family) != 0) + { + if (strcmp (font_family, selection_font_family) != 0) + { is_same_font_family = FALSE; + } + } g_free (font_family); } font_size = gl_label_object_get_font_size (object); text_color_node = gl_label_object_get_text_color (object); - if (text_color_node->field_flag) { + if (text_color_node->field_flag) + { /* If a merge field is set we use the default color for merged color*/ text_color = GL_COLOR_MERGE_DEFAULT; - } else { + } + else + { text_color = text_color_node->color; } gl_color_node_free (&text_color_node); @@ -559,13 +584,16 @@ update_text_properties (glView *view, is_bold = gl_label_object_get_font_weight (object) == PANGO_WEIGHT_BOLD; align = gl_label_object_get_text_alignment (object); - if (is_first_object) { + if (is_first_object) + { selection_font_size = font_size; selection_text_color = text_color; selection_is_italic = is_italic; selection_is_bold = is_bold; selection_align = align; - } else { + } + else + { if (font_size != selection_font_size) is_same_font_size = FALSE; if (text_color != selection_text_color) @@ -587,16 +615,20 @@ update_text_properties (glView *view, is_same_font_family?selection_font_family:""); g_free (selection_font_family); - if (is_same_font_size) { + if (is_same_font_size) + { gl_debug (DEBUG_PROPERTY_BAR, "same font size = %g", selection_font_size); gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->priv->font_size_spin), selection_font_size); - } else { + } + else + { gtk_entry_set_text (GTK_ENTRY (property_bar->priv->font_size_spin), ""); } - if (is_same_text_color) { + if (is_same_text_color) + { gl_debug (DEBUG_PROPERTY_BAR, "same text color = %08x", selection_text_color); gdk_color = gl_color_to_gdk_color (selection_text_color); color_combo_set_color (COLOR_COMBO (property_bar->priv->text_color_combo), @@ -604,15 +636,19 @@ update_text_properties (glView *view, g_free (gdk_color); } - if (is_same_is_italic) + if (is_same_is_italic) + { gl_debug (DEBUG_PROPERTY_BAR, "same italic flag = %d", selection_is_italic); + } gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_italic_toggle), selection_is_italic && is_same_is_italic); - if (is_same_is_bold) + if (is_same_is_bold) + { gl_debug (DEBUG_PROPERTY_BAR, "same bold flag = %d", selection_is_bold); + } gtk_toggle_tool_button_set_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->font_bold_toggle), selection_is_bold && is_same_is_bold); @@ -651,32 +687,42 @@ update_fill_color (glView *view, is_first_object = TRUE; selection_fill_color = 0; - for (p = view->selected_object_list; p != NULL; p = p->next) { + for (p = view->selected_object_list; p != NULL; p = p->next) + { object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data)); if (!gl_label_object_can_fill (object)) continue; fill_color_node = gl_label_object_get_fill_color (object); - if (fill_color_node->field_flag) { + if (fill_color_node->field_flag) + { /* If a merge field is set we use the default color for merged color*/ fill_color = GL_COLOR_FILL_MERGE_DEFAULT; - } else { + } + else + { fill_color = fill_color_node->color; } gl_color_node_free (&fill_color_node); - if (is_first_object) { + if (is_first_object) + { selection_fill_color = fill_color; - } else { + } + else + { if (fill_color != selection_fill_color) + { is_same_fill_color = FALSE; + } } is_first_object = FALSE; } - if (is_same_fill_color) { + if (is_same_fill_color) + { gl_debug (DEBUG_PROPERTY_BAR, "same fill color = %08x", selection_fill_color); gdk_color = gl_color_to_gdk_color (selection_fill_color); color_combo_set_color (COLOR_COMBO (property_bar->priv->fill_color_combo), @@ -707,32 +753,42 @@ update_line_color (glView *view, is_first_object = TRUE; selection_line_color = 0; - for (p = view->selected_object_list; p != NULL; p = p->next) { + for (p = view->selected_object_list; p != NULL; p = p->next) + { object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data)); if (!gl_label_object_can_line_color (object)) continue; line_color_node = gl_label_object_get_line_color (object); - if (line_color_node->field_flag) { + if (line_color_node->field_flag) + { /* If a merge field is set we use the default color for merged color*/ line_color = GL_COLOR_MERGE_DEFAULT; - } else { + } + else + { line_color = line_color_node->color; } gl_color_node_free (&line_color_node); - if (is_first_object) { + if (is_first_object) + { selection_line_color = line_color; - } else { + } + else + { if (line_color != selection_line_color) + { is_same_line_color = FALSE; + } } is_first_object = FALSE; } - if (is_same_line_color) { + if (is_same_line_color) + { gl_debug (DEBUG_PROPERTY_BAR, "same line color = %08x", selection_line_color); gdk_color = gl_color_to_gdk_color (selection_line_color); color_combo_set_color (COLOR_COMBO (property_bar->priv->line_color_combo), @@ -761,7 +817,8 @@ update_line_width (glView *view, is_first_object = TRUE; selection_line_width = 0; - for (p = view->selected_object_list; p != NULL; p = p->next) { + for (p = view->selected_object_list; p != NULL; p = p->next) + { object = gl_view_object_get_object(GL_VIEW_OBJECT (p->data)); if (!gl_label_object_can_line_width (object)) @@ -769,20 +826,28 @@ update_line_width (glView *view, line_width = gl_label_object_get_line_width (object); - if (is_first_object) { + if (is_first_object) + { selection_line_width = line_width; - } else { + } + else + { if (line_width != selection_line_width) + { is_same_line_width = FALSE; + } } is_first_object = FALSE; } - if (is_same_line_width) { + if (is_same_line_width) + { gl_debug (DEBUG_PROPERTY_BAR, "same line width = %g", selection_line_width); gtk_spin_button_set_value (GTK_SPIN_BUTTON (property_bar->priv->line_width_spin), selection_line_width); - } else { + } + else + { gtk_entry_set_text (GTK_ENTRY (property_bar->priv->line_width_spin), ""); } } @@ -792,31 +857,31 @@ selection_changed_cb (glUIPropertyBar *property_bar) { glView *view = property_bar->priv->view; - gl_debug (DEBUG_PROPERTY_BAR, "START"); - g_return_if_fail (view && GL_IS_VIEW (view)); g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar)); + if (property_bar->priv->stop_signals) return; property_bar->priv->stop_signals = TRUE; - if (gl_view_is_selection_empty (view)) { + gl_debug (DEBUG_PROPERTY_BAR, "START"); + if (gl_view_is_selection_empty (view)) + { /* No selection: make all controls active. */ reset_to_default_properties (view, property_bar); set_doc_items_sensitive (property_bar, TRUE); - - } else { - + } + else + { update_text_properties (view, property_bar); update_fill_color (view, property_bar); update_line_color (view, property_bar); update_line_width (view, property_bar); - } - property_bar->priv->stop_signals = FALSE; - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -828,17 +893,14 @@ font_family_changed_cb (GtkComboBox *combo, { gchar *font_family; - if (property_bar->priv->stop_signals) - return; + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - font_family = gtk_combo_box_get_active_text (GTK_COMBO_BOX (combo)); - if ( strlen(font_family) ) { + if ( strlen(font_family) ) + { gl_view_set_selection_font_family (property_bar->priv->view, font_family); gl_view_set_default_font_family (property_bar->priv->view, @@ -846,11 +908,9 @@ font_family_changed_cb (GtkComboBox *combo, } g_free (font_family); - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -862,15 +922,11 @@ font_size_changed_cb (GtkSpinButton *spin, { gdouble font_size; - if (property_bar->priv->stop_signals) - return; + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - font_size = gtk_spin_button_get_value (spin); gl_view_set_selection_font_size (property_bar->priv->view, @@ -878,11 +934,9 @@ font_size_changed_cb (GtkSpinButton *spin, gl_view_set_default_font_size (property_bar->priv->view, font_size); - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -898,16 +952,12 @@ text_color_changed_cb (ColorCombo *cc, { glColorNode *text_color_node; - if (property_bar->priv->stop_signals) - return; - g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar)); - gl_debug (DEBUG_PROPERTY_BAR, "START"); + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); + gl_debug (DEBUG_PROPERTY_BAR, "START"); text_color_node = gl_color_node_new_default (); text_color_node->color = gl_color_from_gdk_color (gdk_color); @@ -915,29 +965,27 @@ text_color_changed_cb (ColorCombo *cc, gl_debug (DEBUG_PROPERTY_BAR, "Color=%08x, Custom=%d, By_User=%d, Is_default=%d", text_color_node->color, custom, by_user, is_default); - if (is_default) { + if (is_default) + { text_color_node->color = gl_prefs->default_text_color; gl_view_set_selection_text_color (property_bar->priv->view, text_color_node); gl_view_set_default_text_color (property_bar->priv->view, gl_prefs->default_text_color); - - } else { - + } + else + { gl_view_set_selection_text_color (property_bar->priv->view, text_color_node); gl_view_set_default_text_color (property_bar->priv->view, text_color_node->color); - } gl_color_node_free (&text_color_node); - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -953,16 +1001,12 @@ fill_color_changed_cb (ColorCombo *cc, { glColorNode *fill_color_node; - if (property_bar->priv->stop_signals) - return; - g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar)); - gl_debug (DEBUG_PROPERTY_BAR, "START"); + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); + gl_debug (DEBUG_PROPERTY_BAR, "START"); fill_color_node = gl_color_node_new_default (); @@ -971,29 +1015,27 @@ fill_color_changed_cb (ColorCombo *cc, gl_debug (DEBUG_PROPERTY_BAR, "Color=%08x, Custom=%d, By_User=%d, Is_default=%d", fill_color_node->color, custom, by_user, is_default); - if (is_default) { + if (is_default) + { fill_color_node->color = GL_COLOR_NONE; gl_view_set_selection_fill_color (property_bar->priv->view, fill_color_node); gl_view_set_default_fill_color (property_bar->priv->view, fill_color_node->color); - - } else { - + } + else + { gl_view_set_selection_fill_color (property_bar->priv->view, fill_color_node); gl_view_set_default_fill_color (property_bar->priv->view, fill_color_node->color); - } gl_color_node_free (&fill_color_node); - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -1009,16 +1051,12 @@ line_color_changed_cb (ColorCombo *cc, { glColorNode *line_color_node; - if (property_bar->priv->stop_signals) - return; - g_return_if_fail (property_bar && GL_IS_UI_PROPERTY_BAR (property_bar)); - gl_debug (DEBUG_PROPERTY_BAR, "START"); + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); + gl_debug (DEBUG_PROPERTY_BAR, "START"); line_color_node = gl_color_node_new_default (); line_color_node->color = gl_color_from_gdk_color (gdk_color); @@ -1026,28 +1064,26 @@ line_color_changed_cb (ColorCombo *cc, gl_debug (DEBUG_PROPERTY_BAR, "Color=%08x, Custom=%d, By_User=%d, Is_default=%d", line_color_node->color, custom, by_user, is_default); - if (is_default) { + if (is_default) + { line_color_node->color = GL_COLOR_NONE; gl_view_set_selection_line_color (property_bar->priv->view, line_color_node); gl_view_set_default_line_color (property_bar->priv->view, line_color_node->color); - - } else { - + } + else + { gl_view_set_selection_line_color (property_bar->priv->view, line_color_node); gl_view_set_default_line_color (property_bar->priv->view, line_color_node->color); - } gl_color_node_free (&line_color_node); - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*--------------------------------------------------------------------------*/ @@ -1059,31 +1095,24 @@ line_width_changed_cb (GtkSpinButton *spin, { gdouble line_width; - if (property_bar->priv->stop_signals) - return; + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); - if (property_bar->priv->view) { - - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - + if (property_bar->priv->view) + { line_width = gtk_spin_button_get_value (spin); gl_view_set_selection_line_width (property_bar->priv->view, line_width); gl_view_set_default_line_width (property_bar->priv->view, line_width); - - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - } gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*---------------------------------------------------------------------------*/ @@ -1097,15 +1126,11 @@ font_bold_toggled_cb (GtkToggleToolButton *toggle, PangoWeight weight; - if (property_bar->priv->stop_signals) - return; + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - state = gtk_toggle_tool_button_get_active (toggle); weight = state ? PANGO_WEIGHT_BOLD : PANGO_WEIGHT_NORMAL; @@ -1113,11 +1138,9 @@ font_bold_toggled_cb (GtkToggleToolButton *toggle, gl_view_set_selection_font_weight (property_bar->priv->view, weight); gl_view_set_default_font_weight (property_bar->priv->view, weight); - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*---------------------------------------------------------------------------*/ @@ -1129,25 +1152,19 @@ font_italic_toggled_cb (GtkToggleToolButton *toggle, { gboolean state; - if (property_bar->priv->stop_signals) - return; + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - state = gtk_toggle_tool_button_get_active (toggle); gl_view_set_selection_font_italic_flag (property_bar->priv->view, state); gl_view_set_default_font_italic_flag (property_bar->priv->view, state); - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } /*---------------------------------------------------------------------------*/ @@ -1157,15 +1174,11 @@ static void text_align_toggled_cb (GtkToggleToolButton *toggle, glUIPropertyBar *property_bar) { - if (property_bar->priv->stop_signals) - return; + if (property_bar->priv->stop_signals) return; + property_bar->priv->stop_signals = TRUE; gl_debug (DEBUG_PROPERTY_BAR, "START"); - g_signal_handlers_block_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - if (gtk_toggle_tool_button_get_active (GTK_TOGGLE_TOOL_BUTTON (property_bar->priv->text_align_left_radio))) { gl_view_set_selection_text_alignment (property_bar->priv->view, @@ -1190,11 +1203,9 @@ text_align_toggled_cb (GtkToggleToolButton *toggle, PANGO_ALIGN_RIGHT); } - g_signal_handlers_unblock_by_func (G_OBJECT(property_bar->priv->view->label), - selection_changed_cb, - property_bar); - gl_debug (DEBUG_PROPERTY_BAR, "END"); + + property_bar->priv->stop_signals = FALSE; } diff --git a/glabels2/src/wdgt-media-select.c b/glabels2/src/wdgt-media-select.c index 9babee7d..8674273c 100644 --- a/glabels2/src/wdgt-media-select.c +++ b/glabels2/src/wdgt-media-select.c @@ -68,6 +68,9 @@ struct _glWdgtMediaSelectPrivate { GtkWidget *template_treeview; GtkListStore *template_store; + + /* Prevent recursion */ + gboolean stop_signals; }; enum { @@ -293,6 +296,8 @@ filter_changed_cb (GtkComboBox *combo, gl_debug (DEBUG_MEDIA_SELECT, "START"); + media_select->priv->stop_signals = TRUE; + /* Update template selections for new page size */ page_size_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->page_size_combo)); category_name = gtk_combo_box_get_active_text (GTK_COMBO_BOX (media_select->priv->category_combo)); @@ -307,13 +312,7 @@ filter_changed_cb (GtkComboBox *combo, gl_debug (DEBUG_MEDIA_SELECT, "category_id = \"%s\"", category_id); template_names = gl_template_get_name_list_all (page_size_id, category_id); selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (media_select->priv->template_treeview)); - g_signal_handlers_block_by_func (G_OBJECT (selection), - template_selection_changed_cb, - media_select); load_list (media_select->priv->template_store, selection, template_names); - g_signal_handlers_unblock_by_func (G_OBJECT (selection), - template_selection_changed_cb, - media_select); gl_template_free_name_list (template_names); g_free (page_size_id); @@ -323,6 +322,9 @@ filter_changed_cb (GtkComboBox *combo, } g_free (page_size_name); + + media_select->priv->stop_signals = FALSE; + gl_debug (DEBUG_MEDIA_SELECT, "END"); } @@ -333,6 +335,10 @@ static void template_selection_changed_cb (GtkTreeSelection *selection, gpointer user_data) { + glWdgtMediaSelect *media_select = GL_WDGT_MEDIA_SELECT (user_data); + + if (media_select->priv->stop_signals) return; + gl_debug (DEBUG_MEDIA_SELECT, "START"); /* Emit our "changed" signal */ -- 2.39.5