From 7643d5e971f331210d5c116052c9f05105891282 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Sat, 27 Nov 2004 22:07:23 +0000 Subject: [PATCH] delay the creation of the display for the export image preview until the 2004-11-27 Sven Neumann * plug-ins/common/jpeg.c: delay the creation of the display for the export image preview until the user requests a preview. Fixes bug #159376. --- ChangeLog | 6 ++++++ plug-ins/common/jpeg.c | 26 ++++++++++++++------------ plug-ins/jpeg/jpeg-load.c | 26 ++++++++++++++------------ plug-ins/jpeg/jpeg-load.h | 26 ++++++++++++++------------ plug-ins/jpeg/jpeg-save.c | 26 ++++++++++++++------------ plug-ins/jpeg/jpeg-save.h | 26 ++++++++++++++------------ plug-ins/jpeg/jpeg.c | 26 ++++++++++++++------------ plug-ins/jpeg/jpeg.h | 26 ++++++++++++++------------ 8 files changed, 104 insertions(+), 84 deletions(-) diff --git a/ChangeLog b/ChangeLog index 873dee1247..aa5eab74f5 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2004-11-27 Sven Neumann + + * plug-ins/common/jpeg.c: delay the creation of the display for + the export image preview until the user requests a preview. Fixes + bug #159376. + 2004-11-27 Øyvind Kolås * libgimp/gimpexport.c: minor layout adjustments for HIG compliance. diff --git a/plug-ins/common/jpeg.c b/plug-ins/common/jpeg.c index 900d5b142e..4a72876714 100644 --- a/plug-ins/common/jpeg.c +++ b/plug-ins/common/jpeg.c @@ -196,13 +196,15 @@ #define DEFAULT_THUMBNAIL FALSE /* sg - these should not be global... */ -static gint32 volatile image_ID_global = -1; -static gint32 orig_image_ID_global = -1; -static gint32 drawable_ID_global = -1; -static gint32 layer_ID_global = -1; -static GtkWidget *preview_size = NULL; -static GimpDrawable *drawable_global = NULL; -static gboolean undo_touched = FALSE; +static gint32 volatile image_ID_global = -1; +static gint32 orig_image_ID_global = -1; +static gint32 drawable_ID_global = -1; +static gint32 layer_ID_global = -1; +static GtkWidget *preview_size = NULL; +static GimpDrawable *drawable_global = NULL; +static gboolean undo_touched = FALSE; +static gint32 display_ID = 0; + typedef struct { @@ -428,7 +430,6 @@ run (const gchar *name, gint32 image_ID; gint32 drawable_ID; gint32 orig_image_ID; - gint32 display_ID = -1; GimpParasite *parasite; gboolean err; GimpExportReturn export = GIMP_EXPORT_CANCEL; @@ -520,8 +521,7 @@ run (const gchar *name, g_free (tmp); } - display_ID = gimp_display_new (image_ID); - gimp_displays_flush (); + display_ID = -1; } break; case GIMP_EXPORT_IGNORE: @@ -732,7 +732,7 @@ run (const gchar *name, /* If the image was exported, delete the new display. */ /* This also deletes the image. */ - if (display_ID > -1) + if (display_ID != -1) gimp_display_delete (display_ID); else gimp_image_delete (image_ID); @@ -1798,11 +1798,13 @@ make_preview (void) drawable_ID_global, orig_image_ID_global, TRUE); + + if (display_ID == -1) + display_ID = gimp_display_new (image_ID_global); } else { gtk_label_set_text (GTK_LABEL (preview_size), _("File size: unknown")); - gimp_displays_flush (); } diff --git a/plug-ins/jpeg/jpeg-load.c b/plug-ins/jpeg/jpeg-load.c index 900d5b142e..4a72876714 100644 --- a/plug-ins/jpeg/jpeg-load.c +++ b/plug-ins/jpeg/jpeg-load.c @@ -196,13 +196,15 @@ #define DEFAULT_THUMBNAIL FALSE /* sg - these should not be global... */ -static gint32 volatile image_ID_global = -1; -static gint32 orig_image_ID_global = -1; -static gint32 drawable_ID_global = -1; -static gint32 layer_ID_global = -1; -static GtkWidget *preview_size = NULL; -static GimpDrawable *drawable_global = NULL; -static gboolean undo_touched = FALSE; +static gint32 volatile image_ID_global = -1; +static gint32 orig_image_ID_global = -1; +static gint32 drawable_ID_global = -1; +static gint32 layer_ID_global = -1; +static GtkWidget *preview_size = NULL; +static GimpDrawable *drawable_global = NULL; +static gboolean undo_touched = FALSE; +static gint32 display_ID = 0; + typedef struct { @@ -428,7 +430,6 @@ run (const gchar *name, gint32 image_ID; gint32 drawable_ID; gint32 orig_image_ID; - gint32 display_ID = -1; GimpParasite *parasite; gboolean err; GimpExportReturn export = GIMP_EXPORT_CANCEL; @@ -520,8 +521,7 @@ run (const gchar *name, g_free (tmp); } - display_ID = gimp_display_new (image_ID); - gimp_displays_flush (); + display_ID = -1; } break; case GIMP_EXPORT_IGNORE: @@ -732,7 +732,7 @@ run (const gchar *name, /* If the image was exported, delete the new display. */ /* This also deletes the image. */ - if (display_ID > -1) + if (display_ID != -1) gimp_display_delete (display_ID); else gimp_image_delete (image_ID); @@ -1798,11 +1798,13 @@ make_preview (void) drawable_ID_global, orig_image_ID_global, TRUE); + + if (display_ID == -1) + display_ID = gimp_display_new (image_ID_global); } else { gtk_label_set_text (GTK_LABEL (preview_size), _("File size: unknown")); - gimp_displays_flush (); } diff --git a/plug-ins/jpeg/jpeg-load.h b/plug-ins/jpeg/jpeg-load.h index 900d5b142e..4a72876714 100644 --- a/plug-ins/jpeg/jpeg-load.h +++ b/plug-ins/jpeg/jpeg-load.h @@ -196,13 +196,15 @@ #define DEFAULT_THUMBNAIL FALSE /* sg - these should not be global... */ -static gint32 volatile image_ID_global = -1; -static gint32 orig_image_ID_global = -1; -static gint32 drawable_ID_global = -1; -static gint32 layer_ID_global = -1; -static GtkWidget *preview_size = NULL; -static GimpDrawable *drawable_global = NULL; -static gboolean undo_touched = FALSE; +static gint32 volatile image_ID_global = -1; +static gint32 orig_image_ID_global = -1; +static gint32 drawable_ID_global = -1; +static gint32 layer_ID_global = -1; +static GtkWidget *preview_size = NULL; +static GimpDrawable *drawable_global = NULL; +static gboolean undo_touched = FALSE; +static gint32 display_ID = 0; + typedef struct { @@ -428,7 +430,6 @@ run (const gchar *name, gint32 image_ID; gint32 drawable_ID; gint32 orig_image_ID; - gint32 display_ID = -1; GimpParasite *parasite; gboolean err; GimpExportReturn export = GIMP_EXPORT_CANCEL; @@ -520,8 +521,7 @@ run (const gchar *name, g_free (tmp); } - display_ID = gimp_display_new (image_ID); - gimp_displays_flush (); + display_ID = -1; } break; case GIMP_EXPORT_IGNORE: @@ -732,7 +732,7 @@ run (const gchar *name, /* If the image was exported, delete the new display. */ /* This also deletes the image. */ - if (display_ID > -1) + if (display_ID != -1) gimp_display_delete (display_ID); else gimp_image_delete (image_ID); @@ -1798,11 +1798,13 @@ make_preview (void) drawable_ID_global, orig_image_ID_global, TRUE); + + if (display_ID == -1) + display_ID = gimp_display_new (image_ID_global); } else { gtk_label_set_text (GTK_LABEL (preview_size), _("File size: unknown")); - gimp_displays_flush (); } diff --git a/plug-ins/jpeg/jpeg-save.c b/plug-ins/jpeg/jpeg-save.c index 900d5b142e..4a72876714 100644 --- a/plug-ins/jpeg/jpeg-save.c +++ b/plug-ins/jpeg/jpeg-save.c @@ -196,13 +196,15 @@ #define DEFAULT_THUMBNAIL FALSE /* sg - these should not be global... */ -static gint32 volatile image_ID_global = -1; -static gint32 orig_image_ID_global = -1; -static gint32 drawable_ID_global = -1; -static gint32 layer_ID_global = -1; -static GtkWidget *preview_size = NULL; -static GimpDrawable *drawable_global = NULL; -static gboolean undo_touched = FALSE; +static gint32 volatile image_ID_global = -1; +static gint32 orig_image_ID_global = -1; +static gint32 drawable_ID_global = -1; +static gint32 layer_ID_global = -1; +static GtkWidget *preview_size = NULL; +static GimpDrawable *drawable_global = NULL; +static gboolean undo_touched = FALSE; +static gint32 display_ID = 0; + typedef struct { @@ -428,7 +430,6 @@ run (const gchar *name, gint32 image_ID; gint32 drawable_ID; gint32 orig_image_ID; - gint32 display_ID = -1; GimpParasite *parasite; gboolean err; GimpExportReturn export = GIMP_EXPORT_CANCEL; @@ -520,8 +521,7 @@ run (const gchar *name, g_free (tmp); } - display_ID = gimp_display_new (image_ID); - gimp_displays_flush (); + display_ID = -1; } break; case GIMP_EXPORT_IGNORE: @@ -732,7 +732,7 @@ run (const gchar *name, /* If the image was exported, delete the new display. */ /* This also deletes the image. */ - if (display_ID > -1) + if (display_ID != -1) gimp_display_delete (display_ID); else gimp_image_delete (image_ID); @@ -1798,11 +1798,13 @@ make_preview (void) drawable_ID_global, orig_image_ID_global, TRUE); + + if (display_ID == -1) + display_ID = gimp_display_new (image_ID_global); } else { gtk_label_set_text (GTK_LABEL (preview_size), _("File size: unknown")); - gimp_displays_flush (); } diff --git a/plug-ins/jpeg/jpeg-save.h b/plug-ins/jpeg/jpeg-save.h index 900d5b142e..4a72876714 100644 --- a/plug-ins/jpeg/jpeg-save.h +++ b/plug-ins/jpeg/jpeg-save.h @@ -196,13 +196,15 @@ #define DEFAULT_THUMBNAIL FALSE /* sg - these should not be global... */ -static gint32 volatile image_ID_global = -1; -static gint32 orig_image_ID_global = -1; -static gint32 drawable_ID_global = -1; -static gint32 layer_ID_global = -1; -static GtkWidget *preview_size = NULL; -static GimpDrawable *drawable_global = NULL; -static gboolean undo_touched = FALSE; +static gint32 volatile image_ID_global = -1; +static gint32 orig_image_ID_global = -1; +static gint32 drawable_ID_global = -1; +static gint32 layer_ID_global = -1; +static GtkWidget *preview_size = NULL; +static GimpDrawable *drawable_global = NULL; +static gboolean undo_touched = FALSE; +static gint32 display_ID = 0; + typedef struct { @@ -428,7 +430,6 @@ run (const gchar *name, gint32 image_ID; gint32 drawable_ID; gint32 orig_image_ID; - gint32 display_ID = -1; GimpParasite *parasite; gboolean err; GimpExportReturn export = GIMP_EXPORT_CANCEL; @@ -520,8 +521,7 @@ run (const gchar *name, g_free (tmp); } - display_ID = gimp_display_new (image_ID); - gimp_displays_flush (); + display_ID = -1; } break; case GIMP_EXPORT_IGNORE: @@ -732,7 +732,7 @@ run (const gchar *name, /* If the image was exported, delete the new display. */ /* This also deletes the image. */ - if (display_ID > -1) + if (display_ID != -1) gimp_display_delete (display_ID); else gimp_image_delete (image_ID); @@ -1798,11 +1798,13 @@ make_preview (void) drawable_ID_global, orig_image_ID_global, TRUE); + + if (display_ID == -1) + display_ID = gimp_display_new (image_ID_global); } else { gtk_label_set_text (GTK_LABEL (preview_size), _("File size: unknown")); - gimp_displays_flush (); } diff --git a/plug-ins/jpeg/jpeg.c b/plug-ins/jpeg/jpeg.c index 900d5b142e..4a72876714 100644 --- a/plug-ins/jpeg/jpeg.c +++ b/plug-ins/jpeg/jpeg.c @@ -196,13 +196,15 @@ #define DEFAULT_THUMBNAIL FALSE /* sg - these should not be global... */ -static gint32 volatile image_ID_global = -1; -static gint32 orig_image_ID_global = -1; -static gint32 drawable_ID_global = -1; -static gint32 layer_ID_global = -1; -static GtkWidget *preview_size = NULL; -static GimpDrawable *drawable_global = NULL; -static gboolean undo_touched = FALSE; +static gint32 volatile image_ID_global = -1; +static gint32 orig_image_ID_global = -1; +static gint32 drawable_ID_global = -1; +static gint32 layer_ID_global = -1; +static GtkWidget *preview_size = NULL; +static GimpDrawable *drawable_global = NULL; +static gboolean undo_touched = FALSE; +static gint32 display_ID = 0; + typedef struct { @@ -428,7 +430,6 @@ run (const gchar *name, gint32 image_ID; gint32 drawable_ID; gint32 orig_image_ID; - gint32 display_ID = -1; GimpParasite *parasite; gboolean err; GimpExportReturn export = GIMP_EXPORT_CANCEL; @@ -520,8 +521,7 @@ run (const gchar *name, g_free (tmp); } - display_ID = gimp_display_new (image_ID); - gimp_displays_flush (); + display_ID = -1; } break; case GIMP_EXPORT_IGNORE: @@ -732,7 +732,7 @@ run (const gchar *name, /* If the image was exported, delete the new display. */ /* This also deletes the image. */ - if (display_ID > -1) + if (display_ID != -1) gimp_display_delete (display_ID); else gimp_image_delete (image_ID); @@ -1798,11 +1798,13 @@ make_preview (void) drawable_ID_global, orig_image_ID_global, TRUE); + + if (display_ID == -1) + display_ID = gimp_display_new (image_ID_global); } else { gtk_label_set_text (GTK_LABEL (preview_size), _("File size: unknown")); - gimp_displays_flush (); } diff --git a/plug-ins/jpeg/jpeg.h b/plug-ins/jpeg/jpeg.h index 900d5b142e..4a72876714 100644 --- a/plug-ins/jpeg/jpeg.h +++ b/plug-ins/jpeg/jpeg.h @@ -196,13 +196,15 @@ #define DEFAULT_THUMBNAIL FALSE /* sg - these should not be global... */ -static gint32 volatile image_ID_global = -1; -static gint32 orig_image_ID_global = -1; -static gint32 drawable_ID_global = -1; -static gint32 layer_ID_global = -1; -static GtkWidget *preview_size = NULL; -static GimpDrawable *drawable_global = NULL; -static gboolean undo_touched = FALSE; +static gint32 volatile image_ID_global = -1; +static gint32 orig_image_ID_global = -1; +static gint32 drawable_ID_global = -1; +static gint32 layer_ID_global = -1; +static GtkWidget *preview_size = NULL; +static GimpDrawable *drawable_global = NULL; +static gboolean undo_touched = FALSE; +static gint32 display_ID = 0; + typedef struct { @@ -428,7 +430,6 @@ run (const gchar *name, gint32 image_ID; gint32 drawable_ID; gint32 orig_image_ID; - gint32 display_ID = -1; GimpParasite *parasite; gboolean err; GimpExportReturn export = GIMP_EXPORT_CANCEL; @@ -520,8 +521,7 @@ run (const gchar *name, g_free (tmp); } - display_ID = gimp_display_new (image_ID); - gimp_displays_flush (); + display_ID = -1; } break; case GIMP_EXPORT_IGNORE: @@ -732,7 +732,7 @@ run (const gchar *name, /* If the image was exported, delete the new display. */ /* This also deletes the image. */ - if (display_ID > -1) + if (display_ID != -1) gimp_display_delete (display_ID); else gimp_image_delete (image_ID); @@ -1798,11 +1798,13 @@ make_preview (void) drawable_ID_global, orig_image_ID_global, TRUE); + + if (display_ID == -1) + display_ID = gimp_display_new (image_ID_global); } else { gtk_label_set_text (GTK_LABEL (preview_size), _("File size: unknown")); - gimp_displays_flush (); }