From 9dc96ce747ca9cd4063404bae6119d89d1931e4a Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Fri, 9 Nov 2001 01:04:46 +0000 Subject: [PATCH] merged fix for bug #63880 from stable branch and fixed a wrong signal 2001-11-09 Sven Neumann * app/gui/file-open-dialog.c: merged fix for bug #63880 from stable branch and fixed a wrong signal callback signature. * plug-ins/imagemap/imap_main.c: merged fix for bug #64075 from stable branch. * plug-ins/common/gauss_iir.c * plug-ins/common/gauss_rle.c: merged fix for bug #57853 from stable branch. * plug-ins/Lighting/lighting_ui.c: s/gdk_image_unref/g_object_unref/ --- ChangeLog | 14 ++ app/dialogs/file-open-dialog.c | 244 ++++++++++++++------------------ app/gui/file-open-dialog.c | 244 ++++++++++++++------------------ plug-ins/Lighting/lighting_ui.c | 2 +- plug-ins/common/gauss_iir.c | 18 +-- plug-ins/common/gauss_rle.c | 19 +-- plug-ins/imagemap/imap_main.c | 2 +- 7 files changed, 249 insertions(+), 294 deletions(-) diff --git a/ChangeLog b/ChangeLog index cfb2db56fc..281ada6612 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2001-11-09 Sven Neumann + + * app/gui/file-open-dialog.c: merged fix for bug #63880 from stable + branch and fixed a wrong signal callback signature. + + * plug-ins/imagemap/imap_main.c: merged fix for bug #64075 from stable + branch. + + * plug-ins/common/gauss_iir.c + * plug-ins/common/gauss_rle.c: merged fix for bug #57853 from stable + branch. + + * plug-ins/Lighting/lighting_ui.c: s/gdk_image_unref/g_object_unref/ + 2001-11-08 Michael Natterer * app/Makefile.am: build display/ before tools/. diff --git a/app/dialogs/file-open-dialog.c b/app/dialogs/file-open-dialog.c index adc3f4d36f..c7cd5df237 100644 --- a/app/dialogs/file-open-dialog.c +++ b/app/dialogs/file-open-dialog.c @@ -72,6 +72,8 @@ static void file_open_genbutton_callback (GtkWidget *widget, gpointer data); static void file_open_clistrow_callback (GtkWidget *widget, gint row, + gint column, + GdkEvent *event, gpointer data); static void file_open_ok_callback (GtkWidget *widget, gpointer data); @@ -606,6 +608,8 @@ set_preview (Gimp *gimp, static void file_open_clistrow_callback (GtkWidget *widget, gint row, + gint column, + GdkEvent *event, gpointer data) { GtkFileSelection *fileload; @@ -636,9 +640,10 @@ file_open_genbutton_callback (GtkWidget *widget, /* added for multi-file preview generation... */ GtkFileSelection *fs; gchar *full_filename = NULL; - gchar *filedirname = NULL; + gchar *dirname = NULL; struct stat buf; gint err; + GSList *list, *toplist; fs = GTK_FILE_SELECTION (data); @@ -654,89 +659,68 @@ file_open_genbutton_callback (GtkWidget *widget, gtk_widget_set_sensitive (GTK_WIDGET (fileload), FALSE); /* new mult-file preview make: */ - { - GSList *list, *toplist; - /* Have to read the clist before touching anything else */ + /* Have to read the clist before touching anything else */ + toplist = clist_to_slist (GTK_CLIST (fs->file_list)); - list= clist_to_slist(GTK_CLIST(fs->file_list)); - toplist = list; - - /* Find a real base directory for the multiple selection */ + dirname = g_path_get_dirname (gtk_file_selection_get_filename (fs)); + + for (list= toplist; list; list = g_slist_next (list)) + { + full_filename = g_build_filename (dirname, + (gchar *) list->data, + NULL); + + err = stat (full_filename, &buf); + + if (! (err == 0 && (buf.st_mode & S_IFDIR))) + { + /* Is not directory. */ + GimpPDBStatusType dummy; + + gimage_to_be_thumbed = file_open_image (gimp, + full_filename, + list->data, + NULL, + NULL, + RUN_NONINTERACTIVE, + &dummy); + + if (gimage_to_be_thumbed) + { + tempbuf = make_thumb_tempbuf (gimage_to_be_thumbed); + RGBbuf = make_RGBbuf_from_tempbuf (tempbuf, + &RGBbuf_w, + &RGBbuf_h); + if (gimp->config->thumbnail_mode) + { + file_save_thumbnail (gimage_to_be_thumbed, + full_filename, tempbuf); + } + + set_preview (gimp, full_filename, + RGBbuf, RGBbuf_w, RGBbuf_h); + + g_object_unref (G_OBJECT (gimage_to_be_thumbed)); + + if (RGBbuf) + g_free (RGBbuf); + } + else + { + gtk_label_set_text (GTK_LABEL (open_options_label), + _("(could not make preview)")); + } + } + } - gtk_file_selection_set_filename (fs, ""); - filedirname = g_strdup (gtk_file_selection_get_filename (fs)); + g_free (full_filename); - while (list) - { - full_filename = g_build_filename (filedirname, - (gchar *) list->data, - NULL); + for (list = toplist; list; list = g_slist_next (list)) + g_free (list->data); - err = stat (full_filename, &buf); - - if (! (err == 0 && (buf.st_mode & S_IFDIR))) - { - /* Is not directory. */ - GimpPDBStatusType dummy; - - gimage_to_be_thumbed = file_open_image (gimp, - full_filename, - list->data, - NULL, - NULL, - RUN_NONINTERACTIVE, - &dummy); - - if (gimage_to_be_thumbed) - { - tempbuf = make_thumb_tempbuf (gimage_to_be_thumbed); - RGBbuf = make_RGBbuf_from_tempbuf (tempbuf, - &RGBbuf_w, - &RGBbuf_h); - if (gimp->config->thumbnail_mode) - { - file_save_thumbnail (gimage_to_be_thumbed, - full_filename, tempbuf); - } - - set_preview (gimp, full_filename, - RGBbuf, RGBbuf_w, RGBbuf_h); - - g_object_unref (G_OBJECT (gimage_to_be_thumbed)); - - if (RGBbuf) - g_free (RGBbuf); - } - else - { - gtk_label_set_text (GTK_LABEL (open_options_label), - _("(could not make preview)")); - } - } - - g_free (full_filename); - list = g_slist_next (list); - } - - for (list = toplist; list; list = g_slist_next (list)) - { - if (! g_slist_next (list)) - { - full_filename = g_build_filename (filedirname, - (gchar *) list->data, NULL); - gtk_file_selection_set_filename (fs, full_filename); - g_free (full_filename); - } - - g_free (list->data); - } - - g_slist_free (toplist); - toplist = NULL; - - g_free (filedirname); - } + g_slist_free (toplist); + g_free (dirname); gtk_widget_set_sensitive (GTK_WIDGET (fileload), TRUE); gimp_unset_busy (gimp); @@ -750,10 +734,11 @@ file_open_ok_callback (GtkWidget *widget, Gimp *gimp; gchar *full_filename; gchar *raw_filename; - const gchar *filedirname; + gchar *dirname; struct stat buf; gint err; GimpPDBStatusType status; + GSList *list; fs = GTK_FILE_SELECTION (data); @@ -809,64 +794,55 @@ file_open_ok_callback (GtkWidget *widget, * Now deal with multiple selections from the filesel clist */ - { - GSList *list; + /* Have to read the clist before touching anything else */ - /* Have to read the clist before touching anything else */ - - list = clist_to_slist (GTK_CLIST (fs->file_list)); - - /* Find a real base directory for the multiple selection */ - - raw_filename = g_strdup (raw_filename); - - gtk_file_selection_set_filename (fs, ""); - filedirname = gtk_file_selection_get_filename (fs); - - while (list) - { - g_free (full_filename); - - full_filename = g_build_filename (filedirname, - (gchar *) list->data, NULL); - - if (strcmp (list->data, raw_filename)) - { /* don't load current selection twice */ - - err = stat (full_filename, &buf); - - if (! (err == 0 && (buf.st_mode & S_IFDIR))) - { /* Is not directory. */ - - status = file_open_with_proc_and_display (gimp, - full_filename, - (const gchar *) list->data, - load_file_proc); - - if (status == GIMP_PDB_SUCCESS) - { - file_dialog_hide (data); - } - else if (status != GIMP_PDB_CANCEL) - { - g_message (_("Open failed.\n%s"), full_filename); - } - } - } - - g_free (list->data); - list = g_slist_next (list); - } - - g_slist_free (list); - list = NULL; - } - - gtk_file_selection_set_filename (fs, raw_filename); - gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE); + list = clist_to_slist (GTK_CLIST (fs->file_list)); + + raw_filename = g_strdup (raw_filename); + dirname = g_path_get_dirname (full_filename); + + while (list) + { + g_free (full_filename); + + full_filename = g_build_filename (dirname, + (gchar *) list->data, NULL); + + if (strcmp (list->data, raw_filename)) + { /* don't load current selection twice */ + + err = stat (full_filename, &buf); + + if (! (err == 0 && (buf.st_mode & S_IFDIR))) + { /* Is not directory. */ + + status = file_open_with_proc_and_display (gimp, + full_filename, + (const gchar *) list->data, + load_file_proc); + + if (status == GIMP_PDB_SUCCESS) + { + file_dialog_hide (data); + } + else if (status != GIMP_PDB_CANCEL) + { + g_message (_("Open failed.\n%s"), full_filename); + } + } + } + + g_free (list->data); + list = g_slist_next (list); + } + + g_slist_free (list); + g_free (dirname); g_free (full_filename); g_free (raw_filename); + + gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE); } static GSList * diff --git a/app/gui/file-open-dialog.c b/app/gui/file-open-dialog.c index adc3f4d36f..c7cd5df237 100644 --- a/app/gui/file-open-dialog.c +++ b/app/gui/file-open-dialog.c @@ -72,6 +72,8 @@ static void file_open_genbutton_callback (GtkWidget *widget, gpointer data); static void file_open_clistrow_callback (GtkWidget *widget, gint row, + gint column, + GdkEvent *event, gpointer data); static void file_open_ok_callback (GtkWidget *widget, gpointer data); @@ -606,6 +608,8 @@ set_preview (Gimp *gimp, static void file_open_clistrow_callback (GtkWidget *widget, gint row, + gint column, + GdkEvent *event, gpointer data) { GtkFileSelection *fileload; @@ -636,9 +640,10 @@ file_open_genbutton_callback (GtkWidget *widget, /* added for multi-file preview generation... */ GtkFileSelection *fs; gchar *full_filename = NULL; - gchar *filedirname = NULL; + gchar *dirname = NULL; struct stat buf; gint err; + GSList *list, *toplist; fs = GTK_FILE_SELECTION (data); @@ -654,89 +659,68 @@ file_open_genbutton_callback (GtkWidget *widget, gtk_widget_set_sensitive (GTK_WIDGET (fileload), FALSE); /* new mult-file preview make: */ - { - GSList *list, *toplist; - /* Have to read the clist before touching anything else */ + /* Have to read the clist before touching anything else */ + toplist = clist_to_slist (GTK_CLIST (fs->file_list)); - list= clist_to_slist(GTK_CLIST(fs->file_list)); - toplist = list; - - /* Find a real base directory for the multiple selection */ + dirname = g_path_get_dirname (gtk_file_selection_get_filename (fs)); + + for (list= toplist; list; list = g_slist_next (list)) + { + full_filename = g_build_filename (dirname, + (gchar *) list->data, + NULL); + + err = stat (full_filename, &buf); + + if (! (err == 0 && (buf.st_mode & S_IFDIR))) + { + /* Is not directory. */ + GimpPDBStatusType dummy; + + gimage_to_be_thumbed = file_open_image (gimp, + full_filename, + list->data, + NULL, + NULL, + RUN_NONINTERACTIVE, + &dummy); + + if (gimage_to_be_thumbed) + { + tempbuf = make_thumb_tempbuf (gimage_to_be_thumbed); + RGBbuf = make_RGBbuf_from_tempbuf (tempbuf, + &RGBbuf_w, + &RGBbuf_h); + if (gimp->config->thumbnail_mode) + { + file_save_thumbnail (gimage_to_be_thumbed, + full_filename, tempbuf); + } + + set_preview (gimp, full_filename, + RGBbuf, RGBbuf_w, RGBbuf_h); + + g_object_unref (G_OBJECT (gimage_to_be_thumbed)); + + if (RGBbuf) + g_free (RGBbuf); + } + else + { + gtk_label_set_text (GTK_LABEL (open_options_label), + _("(could not make preview)")); + } + } + } - gtk_file_selection_set_filename (fs, ""); - filedirname = g_strdup (gtk_file_selection_get_filename (fs)); + g_free (full_filename); - while (list) - { - full_filename = g_build_filename (filedirname, - (gchar *) list->data, - NULL); + for (list = toplist; list; list = g_slist_next (list)) + g_free (list->data); - err = stat (full_filename, &buf); - - if (! (err == 0 && (buf.st_mode & S_IFDIR))) - { - /* Is not directory. */ - GimpPDBStatusType dummy; - - gimage_to_be_thumbed = file_open_image (gimp, - full_filename, - list->data, - NULL, - NULL, - RUN_NONINTERACTIVE, - &dummy); - - if (gimage_to_be_thumbed) - { - tempbuf = make_thumb_tempbuf (gimage_to_be_thumbed); - RGBbuf = make_RGBbuf_from_tempbuf (tempbuf, - &RGBbuf_w, - &RGBbuf_h); - if (gimp->config->thumbnail_mode) - { - file_save_thumbnail (gimage_to_be_thumbed, - full_filename, tempbuf); - } - - set_preview (gimp, full_filename, - RGBbuf, RGBbuf_w, RGBbuf_h); - - g_object_unref (G_OBJECT (gimage_to_be_thumbed)); - - if (RGBbuf) - g_free (RGBbuf); - } - else - { - gtk_label_set_text (GTK_LABEL (open_options_label), - _("(could not make preview)")); - } - } - - g_free (full_filename); - list = g_slist_next (list); - } - - for (list = toplist; list; list = g_slist_next (list)) - { - if (! g_slist_next (list)) - { - full_filename = g_build_filename (filedirname, - (gchar *) list->data, NULL); - gtk_file_selection_set_filename (fs, full_filename); - g_free (full_filename); - } - - g_free (list->data); - } - - g_slist_free (toplist); - toplist = NULL; - - g_free (filedirname); - } + g_slist_free (toplist); + g_free (dirname); gtk_widget_set_sensitive (GTK_WIDGET (fileload), TRUE); gimp_unset_busy (gimp); @@ -750,10 +734,11 @@ file_open_ok_callback (GtkWidget *widget, Gimp *gimp; gchar *full_filename; gchar *raw_filename; - const gchar *filedirname; + gchar *dirname; struct stat buf; gint err; GimpPDBStatusType status; + GSList *list; fs = GTK_FILE_SELECTION (data); @@ -809,64 +794,55 @@ file_open_ok_callback (GtkWidget *widget, * Now deal with multiple selections from the filesel clist */ - { - GSList *list; + /* Have to read the clist before touching anything else */ - /* Have to read the clist before touching anything else */ - - list = clist_to_slist (GTK_CLIST (fs->file_list)); - - /* Find a real base directory for the multiple selection */ - - raw_filename = g_strdup (raw_filename); - - gtk_file_selection_set_filename (fs, ""); - filedirname = gtk_file_selection_get_filename (fs); - - while (list) - { - g_free (full_filename); - - full_filename = g_build_filename (filedirname, - (gchar *) list->data, NULL); - - if (strcmp (list->data, raw_filename)) - { /* don't load current selection twice */ - - err = stat (full_filename, &buf); - - if (! (err == 0 && (buf.st_mode & S_IFDIR))) - { /* Is not directory. */ - - status = file_open_with_proc_and_display (gimp, - full_filename, - (const gchar *) list->data, - load_file_proc); - - if (status == GIMP_PDB_SUCCESS) - { - file_dialog_hide (data); - } - else if (status != GIMP_PDB_CANCEL) - { - g_message (_("Open failed.\n%s"), full_filename); - } - } - } - - g_free (list->data); - list = g_slist_next (list); - } - - g_slist_free (list); - list = NULL; - } - - gtk_file_selection_set_filename (fs, raw_filename); - gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE); + list = clist_to_slist (GTK_CLIST (fs->file_list)); + + raw_filename = g_strdup (raw_filename); + dirname = g_path_get_dirname (full_filename); + + while (list) + { + g_free (full_filename); + + full_filename = g_build_filename (dirname, + (gchar *) list->data, NULL); + + if (strcmp (list->data, raw_filename)) + { /* don't load current selection twice */ + + err = stat (full_filename, &buf); + + if (! (err == 0 && (buf.st_mode & S_IFDIR))) + { /* Is not directory. */ + + status = file_open_with_proc_and_display (gimp, + full_filename, + (const gchar *) list->data, + load_file_proc); + + if (status == GIMP_PDB_SUCCESS) + { + file_dialog_hide (data); + } + else if (status != GIMP_PDB_CANCEL) + { + g_message (_("Open failed.\n%s"), full_filename); + } + } + } + + g_free (list->data); + list = g_slist_next (list); + } + + g_slist_free (list); + g_free (dirname); g_free (full_filename); g_free (raw_filename); + + gtk_widget_set_sensitive (GTK_WIDGET (fs), TRUE); } static GSList * diff --git a/plug-ins/Lighting/lighting_ui.c b/plug-ins/Lighting/lighting_ui.c index c4672622e6..6688b2301e 100644 --- a/plug-ins/Lighting/lighting_ui.c +++ b/plug-ins/Lighting/lighting_ui.c @@ -1243,7 +1243,7 @@ main_dialog (GimpDrawable *drawable) g_free (preview_rgb_data); if (image != NULL) - gdk_image_unref (image); + g_object_unref (image); gck_visualinfo_destroy (visinfo); gtk_widget_destroy (appwin); diff --git a/plug-ins/common/gauss_iir.c b/plug-ins/common/gauss_iir.c index 033f3f1cf1..d75428591d 100644 --- a/plug-ins/common/gauss_iir.c +++ b/plug-ins/common/gauss_iir.c @@ -603,6 +603,9 @@ gauss_iir (GimpDrawable *drawable, max_progress = (horz < 1.0 ) ? 0 : width * height * horz; max_progress += (vert < 1.0 ) ? 0 : width * height * vert; + if (has_alpha) + multiply_alpha (src, height, bytes); + /* First the vertical pass */ if (vert >= 1.0) { @@ -619,9 +622,6 @@ gauss_iir (GimpDrawable *drawable, gimp_pixel_rgn_get_col (&src_rgn, src, col + x1, y1, (y2 - y1)); - if (has_alpha) - multiply_alpha (src, height, bytes); - sp_p = src; sp_m = src + (height - 1) * bytes; vp = val_p; @@ -674,9 +674,6 @@ gauss_iir (GimpDrawable *drawable, transfer_pixels (val_p, val_m, dest, bytes, height); - if (has_alpha && !horz) - separate_alpha (dest, height, bytes); - gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1)); progress += height * vert; @@ -708,9 +705,6 @@ gauss_iir (GimpDrawable *drawable, gimp_pixel_rgn_get_row (&src_rgn, src, x1, row + y1, (x2 - x1)); - if (has_alpha && !vert) - multiply_alpha (src, height, bytes); - sp_p = src; sp_m = src + (width - 1) * bytes; vp = val_p; @@ -763,9 +757,6 @@ gauss_iir (GimpDrawable *drawable, transfer_pixels (val_p, val_m, dest, bytes, width); - if (has_alpha) - separate_alpha (dest, width, bytes); - gimp_pixel_rgn_set_row (&dest_rgn, dest, x1, row + y1, (x2 - x1)); progress += width * horz; @@ -774,6 +765,9 @@ gauss_iir (GimpDrawable *drawable, } } + if (has_alpha) + separate_alpha (dest, width, bytes); + /* merge the shadow, update the drawable */ gimp_drawable_flush (drawable); gimp_drawable_merge_shadow (drawable->drawable_id, TRUE); diff --git a/plug-ins/common/gauss_rle.c b/plug-ins/common/gauss_rle.c index a83eca13e2..8eb05bc02d 100644 --- a/plug-ins/common/gauss_rle.c +++ b/plug-ins/common/gauss_rle.c @@ -595,6 +595,9 @@ gauss_rle (GimpDrawable *drawable, progress = 0; max_progress = (horz < 1.0 ) ? 0 : width * height * horz; max_progress += (vert < 1.0 ) ? 0 : width * height * vert; + + if (has_alpha) + multiply_alpha (src, height, bytes); /* First the vertical pass */ if (vert >= 1.0) @@ -617,9 +620,6 @@ gauss_rle (GimpDrawable *drawable, { gimp_pixel_rgn_get_col (&src_rgn, src, col + x1, y1, (y2 - y1)); - if (has_alpha) - multiply_alpha (src, height, bytes); - sp = src; dp = dest; @@ -661,9 +661,6 @@ gauss_rle (GimpDrawable *drawable, } } - if (has_alpha && !horz) - separate_alpha (dest, height, bytes); - gimp_pixel_rgn_set_col (&dest_rgn, dest, col + x1, y1, (y2 - y1)); progress += height * vert; if ((col % 5) == 0) @@ -699,9 +696,6 @@ gauss_rle (GimpDrawable *drawable, { gimp_pixel_rgn_get_row (&src_rgn, src, x1, row + y1, (x2 - x1)); - if (has_alpha && vert < 1.0) - multiply_alpha (src, height, bytes); - sp = src; dp = dest; @@ -743,15 +737,16 @@ gauss_rle (GimpDrawable *drawable, } } - if (has_alpha) - separate_alpha (dest, width, bytes); - gimp_pixel_rgn_set_row (&dest_rgn, dest, x1, row + y1, (x2 - x1)); progress += width * horz; if ((row % 5) == 0) gimp_progress_update ((double) progress / (double) max_progress); } } + + if (has_alpha) + separate_alpha (dest, width, bytes); + /* merge the shadow, update the drawable */ gimp_drawable_flush (drawable); diff --git a/plug-ins/imagemap/imap_main.c b/plug-ins/imagemap/imap_main.c index 703ba63a23..22d43f58cd 100644 --- a/plug-ins/imagemap/imap_main.c +++ b/plug-ins/imagemap/imap_main.c @@ -665,7 +665,7 @@ do_data_changed_dialog(void (*continue_cb)(gpointer), gpointer param) default_dialog_set_label( dialog, _("Some data has been changed.\n" - "Do you really want to continue?")); + "Do you really want to discard your changes?")); } default_dialog_set_ok_cb(dialog, continue_cb, param); default_dialog_show(dialog);