]> git.sur5r.net Git - glabels/blobdiff - glabels2/src/object-editor-lsize-page.c
2008-10-18 Jim Evins <evins@snaught.com>
[glabels] / glabels2 / src / object-editor-lsize-page.c
index 4a3dd0d39cabffe0232e4582138f820537ad7be6..2fb29ac1a9a36f3d72d4fbe6964b8e41896cecaa 100644 (file)
@@ -73,14 +73,12 @@ gl_object_editor_prepare_lsize_page (glObjectEditor       *editor)
        gl_debug (DEBUG_EDITOR, "START");
 
        /* Extract widgets from XML tree. */
-       editor->priv->lsize_page_vbox =
-               glade_xml_get_widget (editor->priv->gui, "lsize_page_vbox");
-       editor->priv->lsize_r_spin =
-               glade_xml_get_widget (editor->priv->gui, "lsize_r_spin");
-       editor->priv->lsize_theta_spin =
-               glade_xml_get_widget (editor->priv->gui, "lsize_theta_spin");
-       editor->priv->lsize_r_units_label =
-               glade_xml_get_widget (editor->priv->gui, "lsize_r_units_label");
+        gl_util_get_builder_widgets (editor->priv->gui,
+                                     "lsize_page_vbox",     &editor->priv->lsize_page_vbox,
+                                     "lsize_r_spin",        &editor->priv->lsize_r_spin,
+                                     "lsize_theta_spin",    &editor->priv->lsize_theta_spin,
+                                     "lsize_r_units_label", &editor->priv->lsize_r_units_label,
+                                     NULL);
 
        /* Get configuration information */
        units_string = gl_prefs_get_units_string ();
@@ -122,12 +120,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 +140,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,29 +157,30 @@ 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);
+        if (editor->priv->lsize_page_vbox)
+        {
 
-       /* save a copy in internal units */
-       editor->priv->dx_max = dx_max;
-       editor->priv->dy_max = dy_max;
+                editor->priv->stop_signals = TRUE;
 
-       /* convert internal units to displayed units */
-       gl_debug (DEBUG_EDITOR, "internal dx_max,dy_max = %g, %g", dx_max, dy_max);
-       dx_max *= editor->priv->units_per_point;
-       dy_max *= editor->priv->units_per_point;
-       gl_debug (DEBUG_EDITOR, "display dx_max,dy_max = %g, %g", dx_max, dy_max);
+                /* save a copy in internal units */
+                editor->priv->dx_max = dx_max;
+                editor->priv->dy_max = dy_max;
 
-       /* Set widget values */
-       tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin));
-       gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin),
-                                  0.0, 2.0*LENGTH (dx_max, dy_max));
-       gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin), tmp);
+                /* convert internal units to displayed units */
+                gl_debug (DEBUG_EDITOR, "internal dx_max,dy_max = %g, %g", dx_max, dy_max);
+                dx_max *= editor->priv->units_per_point;
+                dy_max *= editor->priv->units_per_point;
+                gl_debug (DEBUG_EDITOR, "display dx_max,dy_max = %g, %g", dx_max, dy_max);
+
+                /* Set widget values */
+                tmp = gtk_spin_button_get_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin));
+                gtk_spin_button_set_range (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin),
+                                           0.0, 2.0*LENGTH (dx_max, dy_max));
+                gtk_spin_button_set_value (GTK_SPIN_BUTTON (editor->priv->lsize_r_spin), tmp);
+
+                editor->priv->stop_signals = FALSE;
 
-       g_signal_handlers_unblock_by_func (G_OBJECT(editor->priv->lsize_r_spin),
-                                          gl_object_editor_changed_cb,
-                                          editor);
+        }
 
        gl_debug (DEBUG_EDITOR, "END");
 }
@@ -244,16 +233,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),