+2007-05-09 Jim Evins <evins@snaught.com>
+
+ * 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 <evins@snaught.com>
* src/template-designer.c: (apply_cb):
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));
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);
!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");
}
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);
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");
}
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);
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))) {
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);
}
- 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");
}
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);
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");
}
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);
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))) {
{
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);
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");
}
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);
+ }
}
/*--------------------------------------------------------------------------*/
{
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));
{
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");
}
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);
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");
}
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");
}
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;
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");
}
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;
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");
}
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),
{
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;
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");
}
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;
-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");
}
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),
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),
gdouble shadow_x_max;
gdouble shadow_y_max;
+ /* Prevent recursion */
+ gboolean stop_signals;
};
enum {
{
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");
}
{
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;
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");
}
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);
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");
}
{
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");
}
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;
-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");
}
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),
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),
{
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));
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);
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);
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);
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 */
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);
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 */
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;
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");
}
{
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;
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");
}
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;
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");
}
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),
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),
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)) {
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 ();
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");
}
{
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");
}
{
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");
}
{
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");
}
{
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));
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");
}
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);
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");
}
{
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");
}
{
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");
}
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);
void
gl_object_editor_changed_cb (glObjectEditor *editor)
{
+ if (editor->priv->stop_signals) return;
+
gl_debug (DEBUG_EDITOR, "START");
/* Emit our "changed" signal */
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 */
/* Default fill properties */
GtkWidget *fill_color_combo;
+
+ /* Prevent recursion */
+ gboolean stop_signals;
};
/*========================================================*/
"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;
}
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);
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);
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:
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;
}
/*--------------------------------------------------------------------------*/
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;
}
}
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;
}
/*--------------------------------------------------------------------------*/
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;
}
GdkColor *gdk_color;
gboolean is_default;
+ if (dialog->priv->stop_signals) return;
g_free (gl_prefs->default_font_family);
gl_prefs->default_font_family =
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;
}
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;
}
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);
}
gdouble climb_rate;
gint digits;
+ /* Prevent recursion */
+ gboolean stop_signals;
};
/* Page numbers for traversing GtkAssistant */
}
/*--------------------------------------------------------------------------*/
-/* PRIVATE. Layout page widget changed cb. */
+/* PRIVATE. Prepare Layout page cb. */
/*--------------------------------------------------------------------------*/
static void
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));
/* 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);
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);
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;
}
/*--------------------------------------------------------------------------*/
{
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;
}
/*--------------------------------------------------------------------------*/
/* Line width */
GtkWidget *line_width_spin;
+ /* Prevent recursion */
gboolean stop_signals;
-
};
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)
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;
}
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);
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;
}
}
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);
}
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);
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)
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),
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);
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),
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),
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))
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), "");
}
}
{
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;
}
/*--------------------------------------------------------------------------*/
{
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,
}
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;
}
/*--------------------------------------------------------------------------*/
{
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,
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;
}
/*--------------------------------------------------------------------------*/
{
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);
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;
}
/*--------------------------------------------------------------------------*/
{
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 ();
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;
}
/*--------------------------------------------------------------------------*/
{
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);
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;
}
/*--------------------------------------------------------------------------*/
{
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;
}
/*---------------------------------------------------------------------------*/
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;
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;
}
/*---------------------------------------------------------------------------*/
{
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;
}
/*---------------------------------------------------------------------------*/
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,
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;
}
GtkWidget *template_treeview;
GtkListStore *template_store;
+
+ /* Prevent recursion */
+ gboolean stop_signals;
};
enum {
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));
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);
}
g_free (page_size_name);
+
+ media_select->priv->stop_signals = FALSE;
+
gl_debug (DEBUG_MEDIA_SELECT, "END");
}
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 */