]> git.sur5r.net Git - glabels/commitdiff
2007-03-24 Jim Evins <evins@snaught.com>
authorJim Evins <evins@snaught.com>
Sun, 25 Mar 2007 01:18:32 +0000 (01:18 +0000)
committerJim Evins <evins@snaught.com>
Sun, 25 Mar 2007 01:18:32 +0000 (01:18 +0000)
* 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

glabels2/ChangeLog
glabels2/src/object-editor-image-page.c

index 9fb147f3ffbf49a8c6139595245ae22ec64bf1ef..629746031bfd5d579124c63555ed13393986399e 100644 (file)
@@ -1,3 +1,16 @@
+2007-03-24  Jim Evins  <evins@snaught.com>
+
+       * 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  <evins@snaught.com>
 
        Merged all changes from experimental cairo branch to trunk.
index a7431ffda83882ad14344ba375e9f879b54910cd..eac7ea66913b0d7dfed11600b837f91973b606c6 100644 (file)
@@ -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);
 
 \f
 /*--------------------------------------------------------------------------*/
@@ -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");
+}
+