{
limage->private = g_new0 (glLabelImagePrivate, 1);
+ limage->private->filename = g_new0 (glTextNode, 1);
+
limage->private->pixbuf =
- gdk_pixbuf_new_from_xpm_data ((const char **)
- checkerboard_xpm);
+ gdk_pixbuf_new_from_xpm_data ((const char **)checkerboard_xpm);
}
static void
limage = GL_LABEL_IMAGE (object);
+ gl_text_node_free (&limage->private->filename);
+ g_object_unref (G_OBJECT(limage->private->pixbuf));
g_free (limage->private);
G_OBJECT_CLASS (parent_class)->finalize (object);
g_return_if_fail (limage && GL_IS_LABEL_IMAGE (limage));
- if ( (filename == NULL) || filename->field_flag ) {
+ if ( (filename == NULL) || filename->field_flag || (filename->data == NULL) ) {
gl_text_node_free (&limage->private->filename);
limage->private->filename = gl_text_node_dup(filename);
gl_label_object_emit_changed (GL_LABEL_OBJECT(limage));
} else {
- if ( (limage->private->filename == NULL) ||
- (strcmp (limage->private->filename->data, filename->data) != 0) ) {
+ if ( limage->private->filename == NULL) {
+
+ limage->private->filename = gl_text_node_dup (filename);
+
+ pixbuf = gdk_pixbuf_new_from_file (filename->data, NULL);
+ g_object_unref (limage->private->pixbuf);
+ if ( pixbuf != NULL ) {
+ limage->private->pixbuf = pixbuf;
+ } else {
+ limage->private->pixbuf =
+ gdk_pixbuf_new_from_xpm_data ((const char **)
+ checkerboard_xpm);
+ }
+
+ gl_label_object_emit_changed (GL_LABEL_OBJECT(limage));
+
+ } else if ( (limage->private->filename->data == NULL) ||
+ strcmp (limage->private->filename->data, filename->data) != 0) {
gl_text_node_free (&limage->private->filename);
limage->private->filename = gl_text_node_dup (filename);
/* Otherwise, leave it in the last directory that we got an image. */
gnome_pixmap_entry_set_pixmap_subdir (GNOME_PIXMAP_ENTRY(image_select->file_entry),
image_path);
- g_signal_connect ( G_OBJECT(gnome_file_entry_gtk_entry
- (GNOME_FILE_ENTRY (image_select->file_entry))),
- "changed", G_CALLBACK (changed_cb), image_select);
+ g_signal_connect_swapped ( G_OBJECT(gnome_file_entry_gtk_entry
+ (GNOME_FILE_ENTRY (image_select->file_entry))),
+ "changed", G_CALLBACK (changed_cb), image_select);
gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), image_select->file_entry);
G_OBJECT (image_select));
gl_hig_hbox_add_widget (GL_HIG_HBOX(whbox), image_select->key_combo);
+
+ gl_wdgt_image_select_set_data (image_select,
+ (merge != NULL),
+ text_node);
+
gl_debug (DEBUG_WDGT, "END");
}
/* PRIVATE. Callback to handle toggling of radio buttons */
/*--------------------------------------------------------------------------*/
static void
-radio_toggled_cb (GtkToggleButton *togglebutton,
- glWdgtImageSelect *image_select)
+radio_toggled_cb (GtkToggleButton *togglebutton,
+ glWdgtImageSelect *image_select)
{
gl_debug (DEBUG_WDGT, "START");
/****************************************************************************/
void
gl_wdgt_image_select_set_field_defs (glWdgtImageSelect *image_select,
- glMerge *merge)
+ glMerge *merge)
{
GList *keys;
/****************************************************************************/
void
gl_wdgt_image_select_set_data (glWdgtImageSelect *image_select,
- gboolean merge_flag,
- glTextNode *text_node)
+ gboolean merge_flag,
+ glTextNode *text_node)
{
gint pos;
gtk_widget_set_sensitive (image_select->file_entry, TRUE);
gtk_widget_set_sensitive (image_select->key_combo, FALSE);
- gnome_file_entry_set_filename (GNOME_FILE_ENTRY(image_select->file_entry),
- text_node->data);
+ if (text_node->data != NULL ) {
+ gnome_file_entry_set_filename (GNOME_FILE_ENTRY(image_select->file_entry),
+ text_node->data);
+ } else {
+ gnome_file_entry_set_filename (GNOME_FILE_ENTRY(image_select->file_entry),
+ "");
+ }
} else {
gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON
/****************************************************************************/
void
gl_wdgt_image_select_set_label_size_group (glWdgtImageSelect *image_select,
- GtkSizeGroup *label_size_group)
+ GtkSizeGroup *label_size_group)
{
gl_debug (DEBUG_WDGT, "START");