From: Jim Evins Date: Sun, 25 Mar 2007 01:18:32 +0000 (+0000) Subject: 2007-03-24 Jim Evins X-Git-Tag: glabels-2_3_0~355 X-Git-Url: https://git.sur5r.net/?a=commitdiff_plain;h=a25478bf5ee5750eace1a8e62017dac72ecf908d;p=glabels 2007-03-24 Jim Evins * src/object-editor-image-page.c: (gl_object_editor_prepare_image_page), (gl_object_editor_set_image), (img_selection_changed_cb): Workaround for GtkFileChooserButton bug # 327243. This the root cause for gLabels bug # 1192884. I have actually observed 3 delayed "selection-changed" signals -- the first 2 return NULL -- this is what caused the image to reset to the default followed by setting it back to the original image, trying to fit it into a new bounding box. This sequence of events is much more evident with the new cairo rendering. git-svn-id: https://glabels.svn.sourceforge.net/svnroot/glabels/trunk@641 f5e0f49d-192f-0410-a22d-a8d8700d0965 --- diff --git a/glabels2/ChangeLog b/glabels2/ChangeLog index 9fb147f3..62974603 100644 --- a/glabels2/ChangeLog +++ b/glabels2/ChangeLog @@ -1,3 +1,16 @@ +2007-03-24 Jim Evins + + * src/object-editor-image-page.c: + (gl_object_editor_prepare_image_page), + (gl_object_editor_set_image), (img_selection_changed_cb): + Workaround for GtkFileChooserButton bug # 327243. This the root + cause for gLabels bug # 1192884. I have actually observed 3 delayed + "selection-changed" signals -- the first 2 return NULL -- this is + what caused the image to reset to the default followed by setting + it back to the original image, trying to fit it into a new bounding + box. This sequence of events is much more evident with the new + cairo rendering. + 2007-03-23 Jim Evins Merged all changes from experimental cairo branch to trunk. diff --git a/glabels2/src/object-editor-image-page.c b/glabels2/src/object-editor-image-page.c index a7431ffd..eac7ea66 100644 --- a/glabels2/src/object-editor-image-page.c +++ b/glabels2/src/object-editor-image-page.c @@ -61,6 +61,7 @@ static void update_preview_cb (GtkFileChooser *file_chooser, gpointer data); static void add_image_filters_to_chooser (GtkFileChooser *file_chooser); +static void img_selection_changed_cb (glObjectEditor *editor); /*--------------------------------------------------------------------------*/ @@ -102,7 +103,7 @@ gl_object_editor_prepare_image_page (glObjectEditor *editor) /* Connect signals */ g_signal_connect_swapped (G_OBJECT (editor->priv->img_file_button), "selection-changed", - G_CALLBACK (gl_object_editor_changed_cb), + G_CALLBACK (img_selection_changed_cb), G_OBJECT (editor)); g_signal_connect_swapped (G_OBJECT (editor->priv->img_key_combo), "changed", @@ -158,6 +159,12 @@ gl_object_editor_set_image (glObjectEditor *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); gtk_widget_set_sensitive (editor->priv->img_key_radio, merge_flag); @@ -192,6 +199,12 @@ gl_object_editor_set_image (glObjectEditor *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); gl_debug (DEBUG_EDITOR, "END"); } @@ -331,3 +344,25 @@ add_image_filters_to_chooser (GtkFileChooser *chooser) } g_slist_free (filters); } + +/*--------------------------------------------------------------------------*/ +/* PRIVATE. Selection changed callback. */ +/*--------------------------------------------------------------------------*/ +static void +img_selection_changed_cb (glObjectEditor *editor) +{ + gchar *filename; + + gl_debug (DEBUG_EDITOR, "START"); + + filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER(editor->priv->img_file_button)); + if (filename != NULL) + { + /* Emit our "changed" signal */ + g_signal_emit (G_OBJECT (editor), gl_object_editor_signals[CHANGED], 0); + } + g_free (filename); + + gl_debug (DEBUG_EDITOR, "END"); +} +