added new enum GimpThumbnailSize.

2002-04-29  Sven Neumann  <sven@gimp.org>

	* app/core/core-enums.[ch]: added new enum GimpThumbnailSize.

	* app/gimprc.c
	* app/config/gimpcoreconfig.[ch]
	* app/core/gimpcoreconfig.[ch]: replaced old gimprc value
	write_thumbnails with thumbnail_size.

	* app/core/gimpimagefile.[ch]: allow to specify a thumbnail size.

	* app/core/gimpdocuments.c
	* app/file/file-open.c
	* app/file/file-save.c
	* app/gui/preferences-dialog.c
	* app/widgets/gimpdocumentview.c: changed accordingly.

	* app/gui/file-open-dialog.c: create the preview according to the
	users choice of thumbnail size. Doesn't update on changes yet.
This commit is contained in:
Sven Neumann 2002-04-29 19:41:45 +00:00 committed by Sven Neumann
parent 927a100584
commit 9b6cde9da0
20 changed files with 524 additions and 396 deletions

View file

@ -1,3 +1,23 @@
2002-04-29 Sven Neumann <sven@gimp.org>
* app/core/core-enums.[ch]: added new enum GimpThumbnailSize.
* app/gimprc.c
* app/config/gimpcoreconfig.[ch]
* app/core/gimpcoreconfig.[ch]: replaced old gimprc value
write_thumbnails with thumbnail_size.
* app/core/gimpimagefile.[ch]: allow to specify a thumbnail size.
* app/core/gimpdocuments.c
* app/file/file-open.c
* app/file/file-save.c
* app/gui/preferences-dialog.c
* app/widgets/gimpdocumentview.c: changed accordingly.
* app/gui/file-open-dialog.c: create the preview according to the
users choice of thumbnail size. Doesn't update on changes yet.
2002-04-29 Sven Neumann <sven@gimp.org>
* app/core/gimpimagefile.[ch]: save empty thumbnails to

View file

@ -70,7 +70,7 @@ enum
PROP_PLUGINRC_PATH,
PROP_MODULE_LOAD_INHIBIT,
PROP_PREVIEW_SIZE,
PROP_WRITE_THUMBNAILS,
PROP_THUMBNAIL_SIZE,
PROP_GAMMA_CORRECTION,
PROP_INSTALL_COLORMAP,
PROP_MIN_COLORS
@ -193,10 +193,12 @@ gimp_core_config_class_init (GimpCoreConfigClass *klass)
NULL);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_PREVIEW_SIZE,
"preview-size",
GIMP_TYPE_PREVIEW_SIZE, GIMP_PREVIEW_SIZE_SMALL);
GIMP_CONFIG_INSTALL_PROP_BOOLEAN (object_class, PROP_WRITE_THUMBNAILS,
"write-thumbnails",
TRUE);
GIMP_TYPE_PREVIEW_SIZE,
GIMP_PREVIEW_SIZE_SMALL);
GIMP_CONFIG_INSTALL_PROP_ENUM (object_class, PROP_THUMBNAIL_SIZE,
"thumbnail-size",
GIMP_TYPE_THUMBNAIL_SIZE,
GIMP_THUMBNAIL_SIZE_NORMAL);
GIMP_CONFIG_INSTALL_PROP_DOUBLE (object_class, PROP_GAMMA_CORRECTION,
"gamma-correction",
0.0, 100.0, 1.0);
@ -331,8 +333,8 @@ gimp_core_config_set_property (GObject *object,
case PROP_PREVIEW_SIZE:
core_config->preview_size = g_value_get_enum (value);
break;
case PROP_WRITE_THUMBNAILS:
core_config->write_thumbnails = g_value_get_boolean (value);
case PROP_THUMBNAIL_SIZE:
core_config->thumbnail_size = g_value_get_enum (value);
break;
case PROP_GAMMA_CORRECTION:
core_config->gamma_val = g_value_get_double (value);
@ -434,8 +436,8 @@ gimp_core_config_get_property (GObject *object,
case PROP_PREVIEW_SIZE:
g_value_set_enum (value, core_config->preview_size);
break;
case PROP_WRITE_THUMBNAILS:
g_value_set_boolean (value, core_config->write_thumbnails);
case PROP_THUMBNAIL_SIZE:
g_value_set_enum (value, core_config->thumbnail_size);
break;
case PROP_GAMMA_CORRECTION:
g_value_set_double (value, core_config->gamma_val);

View file

@ -65,7 +65,7 @@ struct _GimpCoreConfig
gchar *plug_in_rc_path;
gchar *module_load_inhibit;
GimpPreviewSize preview_size;
gboolean write_thumbnails;
GimpThumbnailSize thumbnail_size;
gdouble gamma_val;
gboolean install_cmap;
gint min_colors;

View file

@ -233,6 +233,26 @@ gimp_selection_control_get_type (void)
}
static const GEnumValue gimp_thumbnail_size_enum_values[] =
{
{ GIMP_THUMBNAIL_SIZE_NONE, N_("No Thumbnails"), "none" },
{ GIMP_THUMBNAIL_SIZE_NORMAL, N_("Normal (128x128)"), "normal" },
{ GIMP_THUMBNAIL_SIZE_LARGE, N_("Large (256x256)"), "large" },
{ 0, NULL, NULL }
};
GType
gimp_thumbnail_size_get_type (void)
{
static GType enum_type = 0;
if (!enum_type)
enum_type = g_enum_register_static ("GimpThumbnailSize", gimp_thumbnail_size_enum_values);
return enum_type;
}
static const GEnumValue gimp_transfer_mode_enum_values[] =
{
{ GIMP_SHADOWS, N_("Shadows"), "shadows" },

View file

@ -186,6 +186,18 @@ typedef enum /*< pdb-skip >*/
} GimpSelectionControl;
#define GIMP_TYPE_THUMBNAIL_SIZE (gimp_thumbnail_size_get_type ())
GType gimp_thumbnail_size_get_type (void) G_GNUC_CONST;
typedef enum /*< pdb-skip >*/
{
GIMP_THUMBNAIL_SIZE_NONE = 0, /*< desc="No Thumbnails" >*/
GIMP_THUMBNAIL_SIZE_NORMAL = 128, /*< desc="Normal (128x128)" >*/
GIMP_THUMBNAIL_SIZE_LARGE = 256 /*< desc="Large (256x256)" >*/
} GimpThumbnailSize;
#define GIMP_TYPE_TRANSFER_MODE (gimp_transfer_mode_get_type ())
GType gimp_transfer_mode_get_type (void) G_GNUC_CONST;

View file

@ -33,6 +33,7 @@
#include "config/gimpscanner.h"
#include "gimp.h"
#include "gimpcoreconfig.h"
#include "gimpdocuments.h"
#include "gimpimagefile.h"
#include "gimplist.h"
@ -111,7 +112,7 @@ gimp_documents_load (Gimp *gimp)
}
imagefile = gimp_imagefile_new (uri);
gimp_imagefile_update (imagefile);
gimp_imagefile_update (imagefile, gimp->config->thumbnail_size);
g_free (uri);

View file

@ -62,5 +62,5 @@ gimp_core_config_init (Gimp *gimp)
gimp->config->levels_of_undo = 5;
gimp->config->pluginrc_path = NULL;
gimp->config->module_db_load_inhibit = NULL;
gimp->config->write_thumbnails = TRUE;
gimp->config->thumbnail_size = GIMP_THUMBNAIL_SIZE_NORMAL;
}

View file

@ -50,7 +50,7 @@ struct _GimpCoreConfig
gint levels_of_undo;
gchar *pluginrc_path;
gchar *module_db_load_inhibit;
gboolean write_thumbnails;
GimpThumbnailSize thumbnail_size;
};

View file

@ -33,6 +33,7 @@
#include "config/gimpscanner.h"
#include "gimp.h"
#include "gimpcoreconfig.h"
#include "gimpdocuments.h"
#include "gimpimagefile.h"
#include "gimplist.h"
@ -111,7 +112,7 @@ gimp_documents_load (Gimp *gimp)
}
imagefile = gimp_imagefile_new (uri);
gimp_imagefile_update (imagefile);
gimp_imagefile_update (imagefile, gimp->config->thumbnail_size);
g_free (uri);

View file

@ -33,6 +33,7 @@
#include "config/gimpscanner.h"
#include "gimp.h"
#include "gimpcoreconfig.h"
#include "gimpdocuments.h"
#include "gimpimagefile.h"
#include "gimplist.h"
@ -111,7 +112,7 @@ gimp_documents_load (Gimp *gimp)
}
imagefile = gimp_imagefile_new (uri);
gimp_imagefile_update (imagefile);
gimp_imagefile_update (imagefile, gimp->config->thumbnail_size);
g_free (uri);

View file

@ -51,6 +51,7 @@
#include "gimp.h"
#include "gimpcontainer.h"
#include "gimpcoreconfig.h"
#include "gimpimage.h"
#include "gimpimagefile.h"
#include "gimpmarshal.h"
@ -107,6 +108,7 @@ static TempBuf * gimp_imagefile_read_png_thumb (GimpImagefile *imagefile,
static gboolean gimp_imagefile_save_png_thumb (GimpImagefile *imagefile,
GimpImage *gimage,
const gchar *thumb_name,
gint thumb_size,
time_t image_mtime,
off_t image_size);
static void gimp_imagefile_save_fail_thumb (GimpImagefile *imagefile,
@ -132,9 +134,9 @@ static gboolean gimp_imagefile_test (const gchar *filename,
static const ThumbnailSize thumb_sizes[] =
{
{ "fail", GIMP_IMAGEFILE_THUMB_SIZE_FAIL },
{ "normal", GIMP_IMAGEFILE_THUMB_SIZE_NORMAL },
{ "large", GIMP_IMAGEFILE_THUMB_SIZE_LARGE }
{ "fail", GIMP_IMAGEFILE_THUMB_SIZE_FAIL },
{ "normal", GIMP_THUMBNAIL_SIZE_NORMAL },
{ "large", GIMP_THUMBNAIL_SIZE_LARGE }
};
static gchar *thumb_dir = NULL;
@ -258,12 +260,16 @@ gimp_imagefile_new (const gchar *uri)
}
void
gimp_imagefile_update (GimpImagefile *imagefile)
gimp_imagefile_update (GimpImagefile *imagefile,
GimpThumbnailSize size)
{
const gchar *uri;
g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile));
if (size == GIMP_THUMBNAIL_SIZE_NONE)
return;
uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
if (uri)
@ -298,10 +304,7 @@ gimp_imagefile_update (GimpImagefile *imagefile)
imagefile->image_size = image_size;
imagefile->state = GIMP_IMAGEFILE_STATE_THUMBNAIL_NOT_FOUND;
thumbname =
gimp_imagefile_find_png_thumb (uri,
GIMP_IMAGEFILE_THUMB_SIZE_NORMAL,
&thumb_size);
thumbname = gimp_imagefile_find_png_thumb (uri, size, &thumb_size);
if (thumbname)
imagefile->state = GIMP_IMAGEFILE_STATE_THUMBNAIL_EXISTS;
@ -325,18 +328,22 @@ gimp_imagefile_update (GimpImagefile *imagefile)
if (GIMP_IS_IMAGEFILE (documents_imagefile) &&
(documents_imagefile != imagefile))
{
gimp_imagefile_update (GIMP_IMAGEFILE (documents_imagefile));
gimp_imagefile_update (GIMP_IMAGEFILE (documents_imagefile), size);
}
}
}
void
gimp_imagefile_create_thumbnail (GimpImagefile *imagefile)
gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
GimpThumbnailSize size)
{
const gchar *uri;
g_return_if_fail (GIMP_IS_IMAGEFILE (imagefile));
if (size == GIMP_THUMBNAIL_SIZE_NONE)
return;
uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
if (uri)
@ -354,8 +361,7 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile)
if (! filename)
return;
thumb_name =
gimp_imagefile_png_thumb_path (uri, GIMP_IMAGEFILE_THUMB_SIZE_NORMAL);
thumb_name = gimp_imagefile_png_thumb_path (uri, size);
/* the thumbnail directory doesn't exist and couldn't be created */
if (! thumb_name)
@ -377,6 +383,7 @@ gimp_imagefile_create_thumbnail (GimpImagefile *imagefile)
gimp_imagefile_save_png_thumb (imagefile,
gimage,
thumb_name,
size,
image_mtime,
image_size);
@ -452,12 +459,13 @@ gimp_imagefile_save_fail_thumb (GimpImagefile *imagefile,
}
gboolean
gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
GimpImage *gimage)
gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
GimpImage *gimage)
{
const gchar *uri;
const gchar *image_uri;
gchar *filename;
gint thumb_size;
gchar *thumb_name;
time_t image_mtime;
off_t image_size;
@ -465,6 +473,12 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
g_return_val_if_fail (GIMP_IS_IMAGEFILE (imagefile), FALSE);
g_return_val_if_fail (GIMP_IS_IMAGE (gimage), FALSE);
g_return_val_if_fail (GIMP_IS_GIMP (gimage->gimp), FALSE);
thumb_size = gimage->gimp->config->thumbnail_size;
if (thumb_size == GIMP_THUMBNAIL_SIZE_NONE)
return TRUE;
uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
image_uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
@ -477,8 +491,7 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
if (! filename)
return FALSE;
thumb_name =
gimp_imagefile_png_thumb_path (uri, GIMP_IMAGEFILE_THUMB_SIZE_NORMAL);
thumb_name = gimp_imagefile_png_thumb_path (uri, thumb_size);
/* the thumbnail directory doesn't exist and couldn't be created */
if (! thumb_name)
@ -489,6 +502,7 @@ gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
success = gimp_imagefile_save_png_thumb (imagefile,
gimage,
thumb_name,
thumb_size,
image_mtime,
image_size);
}
@ -854,6 +868,7 @@ static gboolean
gimp_imagefile_save_png_thumb (GimpImagefile *imagefile,
GimpImage *gimage,
const gchar *thumb_name,
gint thumb_size,
time_t image_mtime,
off_t image_size)
{
@ -865,8 +880,7 @@ gimp_imagefile_save_png_thumb (GimpImagefile *imagefile,
uri = gimp_object_get_name (GIMP_OBJECT (imagefile));
if (gimage->width <= GIMP_IMAGEFILE_THUMB_SIZE_NORMAL &&
gimage->height <= GIMP_IMAGEFILE_THUMB_SIZE_NORMAL)
if (gimage->width <= thumb_size && gimage->height <= thumb_size)
{
width = gimage->width;
height = gimage->height;
@ -875,15 +889,13 @@ gimp_imagefile_save_png_thumb (GimpImagefile *imagefile,
{
if (gimage->width < gimage->height)
{
height = GIMP_IMAGEFILE_THUMB_SIZE_NORMAL;
width = MAX (1, (GIMP_IMAGEFILE_THUMB_SIZE_NORMAL *
gimage->width) / gimage->height);
height = thumb_size;
width = MAX (1, (thumb_size * gimage->width) / gimage->height);
}
else
{
width = GIMP_IMAGEFILE_THUMB_SIZE_NORMAL;
height = MAX (1, (GIMP_IMAGEFILE_THUMB_SIZE_NORMAL *
gimage->height) / gimage->width);
width = thumb_size;
height = MAX (1, (thumb_size * gimage->height) / gimage->width);
}
}
@ -954,7 +966,7 @@ gimp_imagefile_save_png_thumb (GimpImagefile *imagefile,
g_free (temp_name);
gimp_imagefile_update (imagefile);
gimp_imagefile_update (imagefile, thumb_size);
return success;
}

View file

@ -32,9 +32,6 @@
#include "gimpviewable.h"
#define GIMP_IMAGEFILE_THUMB_SIZE_NORMAL 128
#define GIMP_IMAGEFILE_THUMB_SIZE_LARGE 256
typedef enum
{
GIMP_IMAGEFILE_STATE_UNKNOWN,
@ -87,12 +84,14 @@ struct _GimpImagefileClass
GType gimp_imagefile_get_type (void) G_GNUC_CONST;
GimpImagefile * gimp_imagefile_new (const gchar *uri);
void gimp_imagefile_update (GimpImagefile *imagefile);
void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile);
gboolean gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
GimpImage *gimage);
const gchar * gimp_imagefile_get_description (GimpImagefile *imagefile);
GimpImagefile * gimp_imagefile_new (const gchar *uri);
void gimp_imagefile_update (GimpImagefile *imagefile,
GimpThumbnailSize size);
void gimp_imagefile_create_thumbnail (GimpImagefile *imagefile,
GimpThumbnailSize size);
gboolean gimp_imagefile_save_thumbnail (GimpImagefile *imagefile,
GimpImage *gimage);
const gchar * gimp_imagefile_get_description (GimpImagefile *imagefile);
#endif /* __GIMP_IMAGEFILE_H__ */

View file

@ -199,149 +199,153 @@ file_open_dialog_create (Gimp *gimp)
gtk_file_selection_set_select_multiple (fs, TRUE);
tree_sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (fs->file_list));
/* Catch file-list clicks so we can update the preview thumbnail */
g_signal_connect (G_OBJECT (tree_sel), "changed",
G_CALLBACK (file_open_selchanged_callback),
open_dialog);
/* The preview frame */
{
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *ebox;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *label;
GtkWidget *progress;
GtkStyle *style;
open_options_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (open_options_frame), GTK_SHADOW_IN);
ebox = gtk_event_box_new ();
gtk_widget_ensure_style (ebox);
style = gtk_widget_get_style (ebox);
gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL,
&style->base[GTK_STATE_NORMAL]);
gtk_widget_modify_bg (ebox, GTK_STATE_INSENSITIVE,
&style->base[GTK_STATE_NORMAL]);
gtk_container_add (GTK_CONTAINER (open_options_frame), ebox);
gtk_widget_show (ebox);
g_signal_connect (G_OBJECT (ebox), "button_press_event",
G_CALLBACK (file_open_thumbnail_button_press),
open_dialog);
gimp_help_set_help_data (ebox, _("Click to update preview"), NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (ebox), vbox);
gtk_widget_show (vbox);
button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
label = gtk_label_new_with_mnemonic (_("_Preview"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (button), label);
gtk_widget_show (label);
g_signal_connect (G_OBJECT (button), "button_press_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "button_release_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "enter_notify_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "leave_notify_event",
G_CALLBACK (gtk_true),
NULL);
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (vbox), vbox2);
gtk_widget_show (vbox2);
hbox = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
open_options_imagefile = gimp_imagefile_new (NULL);
open_options_preview =
gimp_preview_new (GIMP_VIEWABLE (open_options_imagefile),
GIMP_IMAGEFILE_THUMB_SIZE_NORMAL, 0, FALSE);
gtk_widget_ensure_style (open_options_preview);
style = gtk_widget_get_style (open_options_preview);
gtk_widget_modify_bg (open_options_preview, GTK_STATE_NORMAL,
&style->base[GTK_STATE_NORMAL]);
gtk_widget_modify_bg (open_options_preview, GTK_STATE_INSENSITIVE,
&style->base[GTK_STATE_NORMAL]);
gtk_box_pack_start (GTK_BOX (hbox), open_options_preview, TRUE, FALSE, 10);
gtk_widget_show (open_options_preview);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), open_options_preview);
g_signal_connect (G_OBJECT (open_options_preview), "clicked",
G_CALLBACK (file_open_thumbnail_clicked),
open_dialog);
open_options_title = gtk_label_new (_("No Selection"));
gtk_box_pack_start (GTK_BOX (vbox2), open_options_title, FALSE, FALSE, 0);
gtk_widget_show (open_options_title);
label = gtk_label_new (" \n \n ");
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.0);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* eek */
if (gimp->config->thumbnail_size > 0)
{
GtkRequisition requisition;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *ebox;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *label;
GtkWidget *progress;
GtkStyle *style;
/* Catch file-list clicks so we can update the preview thumbnail */
g_signal_connect (G_OBJECT (tree_sel), "changed",
G_CALLBACK (file_open_selchanged_callback),
open_dialog);
gtk_widget_size_request (label, &requisition);
gtk_widget_set_size_request (label, -1, requisition.height);
open_options_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (open_options_frame),
GTK_SHADOW_IN);
ebox = gtk_event_box_new ();
gtk_widget_ensure_style (ebox);
style = gtk_widget_get_style (ebox);
gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL,
&style->base[GTK_STATE_NORMAL]);
gtk_widget_modify_bg (ebox, GTK_STATE_INSENSITIVE,
&style->base[GTK_STATE_NORMAL]);
gtk_container_add (GTK_CONTAINER (open_options_frame), ebox);
gtk_widget_show (ebox);
g_signal_connect (G_OBJECT (ebox), "button_press_event",
G_CALLBACK (file_open_thumbnail_button_press),
open_dialog);
gimp_help_set_help_data (ebox, _("Click to update preview"), NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (ebox), vbox);
gtk_widget_show (vbox);
button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
label = gtk_label_new_with_mnemonic (_("_Preview"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (button), label);
gtk_widget_show (label);
g_signal_connect (G_OBJECT (button), "button_press_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "button_release_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "enter_notify_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "leave_notify_event",
G_CALLBACK (gtk_true),
NULL);
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (vbox), vbox2);
gtk_widget_show (vbox2);
hbox = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
open_options_imagefile = gimp_imagefile_new (NULL);
open_options_preview =
gimp_preview_new (GIMP_VIEWABLE (open_options_imagefile),
gimp->config->thumbnail_size, 0, FALSE);
gtk_widget_ensure_style (open_options_preview);
style = gtk_widget_get_style (open_options_preview);
gtk_widget_modify_bg (open_options_preview, GTK_STATE_NORMAL,
&style->base[GTK_STATE_NORMAL]);
gtk_widget_modify_bg (open_options_preview, GTK_STATE_INSENSITIVE,
&style->base[GTK_STATE_NORMAL]);
gtk_box_pack_start (GTK_BOX (hbox),
open_options_preview, TRUE, FALSE, 10);
gtk_widget_show (open_options_preview);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), open_options_preview);
g_signal_connect (G_OBJECT (open_options_preview), "clicked",
G_CALLBACK (file_open_thumbnail_clicked),
open_dialog);
open_options_title = gtk_label_new (_("No Selection"));
gtk_box_pack_start (GTK_BOX (vbox2),
open_options_title, FALSE, FALSE, 0);
gtk_widget_show (open_options_title);
label = gtk_label_new (" \n \n ");
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.0);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* eek */
{
GtkRequisition requisition;
gtk_widget_size_request (label, &requisition);
gtk_widget_set_size_request (label, -1, requisition.height);
}
g_signal_connect (G_OBJECT (open_options_imagefile), "info_changed",
G_CALLBACK (file_open_imagefile_info_changed),
label);
open_options_label = label;
/* pack the containing open_options hbox into the open-dialog */
for (hbox = fs->dir_list; ! GTK_IS_HBOX (hbox); hbox = hbox->parent);
gtk_box_pack_end (GTK_BOX (hbox), open_options_frame, FALSE, FALSE, 0);
gtk_widget_show (open_options_frame);
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), FALSE);
/* The progress bar */
progress = gtk_progress_bar_new ();
gtk_box_pack_end (GTK_BOX (vbox2), progress, FALSE, FALSE, 0);
/* don't gtk_widget_show (progress); */
open_options_progress = GTK_PROGRESS_BAR (progress);
/* eek */
{
GtkRequisition requisition;
gtk_progress_bar_set_text (open_options_progress, "foo");
gtk_widget_size_request (progress, &requisition);
gtk_widget_set_size_request (open_options_title, requisition.width, -1);
}
}
g_signal_connect (G_OBJECT (open_options_imagefile), "info_changed",
G_CALLBACK (file_open_imagefile_info_changed),
label);
open_options_label = label;
/* pack the containing open_options hbox into the open-dialog */
for (hbox = fs->dir_list; ! GTK_IS_HBOX (hbox); hbox = hbox->parent);
gtk_box_pack_end (GTK_BOX (hbox), open_options_frame, FALSE, FALSE, 0);
gtk_widget_show (open_options_frame);
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), FALSE);
/* The progress bar */
progress = gtk_progress_bar_new ();
gtk_box_pack_end (GTK_BOX (vbox2), progress, FALSE, FALSE, 0);
/* don't gtk_widget_show (progress); */
open_options_progress = GTK_PROGRESS_BAR (progress);
/* eek */
{
GtkRequisition requisition;
gtk_progress_bar_set_text (open_options_progress, "foo");
gtk_widget_size_request (progress, &requisition);
gtk_widget_set_size_request (open_options_title, requisition.width, -1);
}
}
return open_dialog;
}
@ -386,18 +390,19 @@ file_open_selchanged_callback (GtkTreeSelection *sel,
gtk_tree_selection_selected_foreach (sel,
selchanged_foreach,
&selected);
fs = GTK_FILE_SELECTION (open_dialog);
gimp = GIMP (g_object_get_data (G_OBJECT (open_dialog), "gimp"));
if (selected)
{
gchar *uri;
gchar *basename;
fs = GTK_FILE_SELECTION (open_dialog);
gimp = GIMP (g_object_get_data (G_OBJECT (open_dialog), "gimp"));
fullfname = gtk_file_selection_get_filename (fs);
uri = file_utils_filename_to_uri (gimp->load_procs, fullfname, NULL);
uri = file_utils_filename_to_uri (gimp->load_procs, fullfname, NULL);
basename = file_utils_uri_to_utf8_basename (uri);
gimp_object_set_name (GIMP_OBJECT (open_options_imagefile), uri);
@ -413,11 +418,12 @@ file_open_selchanged_callback (GtkTreeSelection *sel,
}
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), selected);
gimp_imagefile_update (open_options_imagefile);
gimp_imagefile_update (open_options_imagefile, gimp->config->thumbnail_size);
}
static void
file_open_create_thumbnail (const gchar *filename)
file_open_create_thumbnail (const gchar *filename,
GimpThumbnailSize size)
{
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
{
@ -428,7 +434,7 @@ file_open_create_thumbnail (const gchar *filename)
uri = g_filename_to_uri (filename, NULL, NULL);
imagefile = gimp_imagefile_new (uri);
gimp_imagefile_create_thumbnail (imagefile);
gimp_imagefile_create_thumbnail (imagefile, size);
g_object_unref (G_OBJECT (imagefile));
basename = file_utils_uri_to_utf8_basename (uri);
@ -436,7 +442,7 @@ file_open_create_thumbnail (const gchar *filename)
g_free (basename);
gimp_object_set_name (GIMP_OBJECT (open_options_imagefile), uri);
gimp_imagefile_update (open_options_imagefile);
gimp_imagefile_update (open_options_imagefile, size);
g_free (uri);
}
@ -463,7 +469,7 @@ file_open_thumbnail_clicked (GtkWidget *widget,
gimp = GIMP (g_object_get_data (G_OBJECT (fs), "gimp"));
if (gimp->config->write_thumbnails)
if (gimp->config->thumbnail_size != GIMP_THUMBNAIL_SIZE_NONE)
{
gchar **selections;
gint n_selections;
@ -499,7 +505,8 @@ file_open_thumbnail_clicked (GtkWidget *widget,
g_free (str);
}
file_open_create_thumbnail (selections[i]);
file_open_create_thumbnail (selections[i],
gimp->config->thumbnail_size);
if (n_selections > 1)
{
@ -521,7 +528,8 @@ file_open_thumbnail_clicked (GtkWidget *widget,
g_free (str);
}
file_open_create_thumbnail (selections[0]);
file_open_create_thumbnail (selections[0],
gimp->config->thumbnail_size);
if (n_selections > 1)
{

View file

@ -170,7 +170,7 @@ static gint old_num_processors;
static gchar * old_image_title_format;
static gchar * old_image_status_format;
static guint old_max_new_image_size;
static gboolean old_write_thumbnails;
static GimpThumbnailSize old_thumbnail_size;
static gboolean old_trust_dirty_flag;
static gboolean old_use_help;
static gboolean old_nav_window_per_display;
@ -723,9 +723,9 @@ prefs_save_callback (GtkWidget *widget,
{
update = g_list_append (update, "max-new-image-size");
}
if (gimp->config->write_thumbnails != old_write_thumbnails)
if (gimp->config->thumbnail_size != old_thumbnail_size)
{
update = g_list_append (update, "thumbnail-mode");
update = g_list_append (update, "thumbnail-size");
}
if (gimprc.trust_dirty_flag != old_trust_dirty_flag)
{
@ -914,7 +914,7 @@ prefs_cancel_callback (GtkWidget *widget,
gimp->config->default_yresolution = old_default_yresolution;
gimp->config->default_resolution_units = old_default_resolution_units;
gimp->config->levels_of_undo = old_levels_of_undo;
gimp->config->write_thumbnails = old_write_thumbnails;
gimp->config->thumbnail_size = old_thumbnail_size;
gimprc.marching_speed = old_marching_speed;
gimprc.resize_windows_on_zoom = old_resize_windows_on_zoom;
@ -1051,7 +1051,7 @@ prefs_toggle_callback (GtkWidget *widget,
/* radio buttons */
else if (data == &gimp->config->interpolation_type ||
data == &gimp->config->default_type ||
data == &gimp->config->write_thumbnails ||
data == &gimp->config->thumbnail_size ||
data == &gimprc.trust_dirty_flag ||
data == &gimprc.help_browser ||
data == &gimprc.cursor_mode)
@ -1678,7 +1678,7 @@ preferences_dialog_create (Gimp *gimp)
old_default_yresolution = gimp->config->default_yresolution;
old_default_resolution_units = gimp->config->default_resolution_units;
old_levels_of_undo = gimp->config->levels_of_undo;
old_write_thumbnails = gimp->config->write_thumbnails;
old_thumbnail_size = gimp->config->thumbnail_size;
old_perfectmouse = gimprc.perfectmouse;
old_transparency_type = gimprc.transparency_type;
@ -2699,19 +2699,14 @@ preferences_dialog_create (Gimp *gimp)
_("\"File -> Save\" Saves the Image:"), 1.0, 0.5,
optionmenu, 1, TRUE);
optionmenu =
gimp_option_menu_new2 (FALSE,
G_CALLBACK (prefs_toggle_callback),
&gimp->config->write_thumbnails,
GINT_TO_POINTER (gimp->config->write_thumbnails),
_("Always"), GINT_TO_POINTER (TRUE), NULL,
_("Never"), GINT_TO_POINTER (FALSE), NULL,
NULL);
optionmenu =
gimp_enum_option_menu_new (GIMP_TYPE_THUMBNAIL_SIZE,
G_CALLBACK (prefs_toggle_callback),
&gimp->config->thumbnail_size);
gimp_option_menu_set_history (GTK_OPTION_MENU (optionmenu),
GINT_TO_POINTER (gimp->config->thumbnail_size));
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Try to Write a Thumbnail File:"), 1.0, 0.5,
_("Size of Thumbnails Files:"), 1.0, 0.5,
optionmenu, 1, TRUE);

View file

@ -42,7 +42,6 @@
#include "libgimptool/gimptooltypes.h"
#include "core/gimp.h"
#include "core/gimpcoreconfig.h"
#include "core/gimpimage.h"
#include "core/gimpimagefile.h"
#include "core/gimpdocuments.h"
@ -205,11 +204,8 @@ file_open_with_proc_and_display (Gimp *gimp,
imagefile = gimp_documents_add (gimp, uri);
if (gimp->config->write_thumbnails)
{
/* save a thumbnail of every opened image */
gimp_imagefile_save_thumbnail (imagefile, gimage);
}
/* save a thumbnail of every opened image */
gimp_imagefile_save_thumbnail (imagefile, gimage);
}
else if (*status != GIMP_PDB_CANCEL)
{

View file

@ -177,7 +177,7 @@ file_save (GimpImage *gimage,
}
/* Write a thumbnail for the saved image, where appropriate */
if (gimage->gimp->config->write_thumbnails)
if (gimage->gimp->config->thumbnail_size != GIMP_THUMBNAIL_SIZE_NONE)
{
if (set_uri)
{

View file

@ -90,6 +90,7 @@ typedef enum
TT_XCOLORHISTORY,
TT_XPARASITE,
TT_XNAVPREVSIZE,
TT_XTHUMBSIZE,
TT_XHELPBROWSER,
TT_XCURSORMODE,
TT_XCOMMENT
@ -131,6 +132,7 @@ static gint parse_image_type (gpointer val1p, gpointer val2p)
static gint parse_interpolation_type (gpointer val1p, gpointer val2p);
static gint parse_preview_size (gpointer val1p, gpointer val2p);
static gint parse_nav_preview_size (gpointer val1p, gpointer val2p);
static gint parse_thumbnail_size (gpointer val1p, gpointer val2p);
static gint parse_units (gpointer val1p, gpointer val2p);
static gint parse_device (gpointer val1p, gpointer val2p);
static gint parse_session_info (gpointer val1p, gpointer val2p);
@ -153,6 +155,7 @@ static inline gchar * image_type_to_str (gpointer val1p, gpointer val2p)
static inline gchar * interpolation_type_to_str (gpointer val1p, gpointer val2p);
static inline gchar * preview_size_to_str (gpointer val1p, gpointer val2p);
static inline gchar * nav_preview_size_to_str (gpointer val1p, gpointer val2p);
static inline gchar * thumbnail_size_to_str (gpointer val1p, gpointer val2p);
static inline gchar * units_to_str (gpointer val1p, gpointer val2p);
static inline gchar * help_browser_to_str (gpointer val1p, gpointer val2p);
static inline gchar * cursor_mode_to_str (gpointer val1p, gpointer val2p);
@ -347,7 +350,7 @@ gimprc_init (Gimp *gimp)
{ "undo-levels", TT_INT, NULL, NULL },
{ "pluginrc-path", TT_PATH, NULL, NULL },
{ "module-load-inhibit", TT_PATH, NULL, NULL },
{ "thumbnail-mode", TT_INT, NULL, NULL },
{ "thumbnail-size", TT_XTHUMBSIZE,NULL, NULL },
{ "tool-plug-in-path", TT_PATH, NULL, NULL }
};
@ -380,7 +383,7 @@ gimprc_init (Gimp *gimp)
core_funcs[18].val1p = &gimp->config->levels_of_undo;
core_funcs[19].val1p = &gimp->config->pluginrc_path;
core_funcs[20].val1p = &gimp->config->module_db_load_inhibit;
core_funcs[21].val1p = &gimp->config->write_thumbnails;
core_funcs[21].val1p = &gimp->config->thumbnail_size;
core_funcs[22].val1p = &gimp->config->tool_plug_in_path;
parse_func_hash = g_hash_table_new (g_str_hash, g_str_equal);
@ -894,6 +897,8 @@ parse_statement (void)
return parse_preview_size (func->val1p, func->val2p);
case TT_XNAVPREVSIZE:
return parse_nav_preview_size (func->val1p, func->val2p);
case TT_XTHUMBSIZE:
return parse_thumbnail_size (func->val1p, func->val2p);
case TT_XUNIT:
return parse_units (func->val1p, func->val2p);
case TT_XDEVICE:
@ -1342,6 +1347,39 @@ parse_nav_preview_size (gpointer val1p,
return OK;
}
static gint
parse_thumbnail_size (gpointer val1p,
gpointer val2p)
{
gint token;
token = peek_next_token ();
if (!token || (token != TOKEN_SYMBOL && token != TOKEN_NUMBER))
return ERROR;
token = get_next_token ();
if (token == TOKEN_SYMBOL)
{
if (strcmp (token_sym, "none") == 0)
*((gint *) val1p) = GIMP_THUMBNAIL_SIZE_NONE;
else if (strcmp (token_sym, "normal") == 0)
*((gint *) val1p) = GIMP_THUMBNAIL_SIZE_NORMAL;
else if (strcmp (token_sym, "large") == 0)
*((gint *) val1p) = GIMP_THUMBNAIL_SIZE_LARGE;
else
*((gint *) val1p) = GIMP_THUMBNAIL_SIZE_NONE;
}
else if (token == TOKEN_NUMBER)
*((gint *) val1p) = token_num;
token = peek_next_token ();
if (!token || (token != TOKEN_RIGHT_PAREN))
return ERROR;
token = get_next_token ();
return OK;
}
static gint
parse_units (gpointer val1p,
gpointer val2p)
@ -2250,6 +2288,8 @@ gimprc_value_to_str (const gchar *name)
return preview_size_to_str (func->val1p, func->val2p);
case TT_XNAVPREVSIZE:
return nav_preview_size_to_str (func->val1p, func->val2p);
case TT_XTHUMBSIZE:
return thumbnail_size_to_str (func->val1p, func->val2p);
case TT_XUNIT:
return units_to_str (func->val1p, func->val2p);
case TT_XHELPBROWSER:
@ -2425,6 +2465,22 @@ nav_preview_size_to_str (gpointer val1p,
return g_strdup ("none");
}
static inline gchar *
thumbnail_size_to_str (gpointer val1p,
gpointer val2p)
{
gint size;
size = *((gint *) val1p);
if (size >= GIMP_THUMBNAIL_SIZE_LARGE)
return g_strdup ("large");
else if (size >= GIMP_THUMBNAIL_SIZE_NORMAL)
return g_strdup ("normal");
else
return g_strdup ("none");
}
static inline gchar *
units_to_str (gpointer val1p,

View file

@ -199,149 +199,153 @@ file_open_dialog_create (Gimp *gimp)
gtk_file_selection_set_select_multiple (fs, TRUE);
tree_sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (fs->file_list));
/* Catch file-list clicks so we can update the preview thumbnail */
g_signal_connect (G_OBJECT (tree_sel), "changed",
G_CALLBACK (file_open_selchanged_callback),
open_dialog);
/* The preview frame */
{
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *ebox;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *label;
GtkWidget *progress;
GtkStyle *style;
open_options_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (open_options_frame), GTK_SHADOW_IN);
ebox = gtk_event_box_new ();
gtk_widget_ensure_style (ebox);
style = gtk_widget_get_style (ebox);
gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL,
&style->base[GTK_STATE_NORMAL]);
gtk_widget_modify_bg (ebox, GTK_STATE_INSENSITIVE,
&style->base[GTK_STATE_NORMAL]);
gtk_container_add (GTK_CONTAINER (open_options_frame), ebox);
gtk_widget_show (ebox);
g_signal_connect (G_OBJECT (ebox), "button_press_event",
G_CALLBACK (file_open_thumbnail_button_press),
open_dialog);
gimp_help_set_help_data (ebox, _("Click to update preview"), NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (ebox), vbox);
gtk_widget_show (vbox);
button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
label = gtk_label_new_with_mnemonic (_("_Preview"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (button), label);
gtk_widget_show (label);
g_signal_connect (G_OBJECT (button), "button_press_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "button_release_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "enter_notify_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "leave_notify_event",
G_CALLBACK (gtk_true),
NULL);
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (vbox), vbox2);
gtk_widget_show (vbox2);
hbox = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
open_options_imagefile = gimp_imagefile_new (NULL);
open_options_preview =
gimp_preview_new (GIMP_VIEWABLE (open_options_imagefile),
GIMP_IMAGEFILE_THUMB_SIZE_NORMAL, 0, FALSE);
gtk_widget_ensure_style (open_options_preview);
style = gtk_widget_get_style (open_options_preview);
gtk_widget_modify_bg (open_options_preview, GTK_STATE_NORMAL,
&style->base[GTK_STATE_NORMAL]);
gtk_widget_modify_bg (open_options_preview, GTK_STATE_INSENSITIVE,
&style->base[GTK_STATE_NORMAL]);
gtk_box_pack_start (GTK_BOX (hbox), open_options_preview, TRUE, FALSE, 10);
gtk_widget_show (open_options_preview);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), open_options_preview);
g_signal_connect (G_OBJECT (open_options_preview), "clicked",
G_CALLBACK (file_open_thumbnail_clicked),
open_dialog);
open_options_title = gtk_label_new (_("No Selection"));
gtk_box_pack_start (GTK_BOX (vbox2), open_options_title, FALSE, FALSE, 0);
gtk_widget_show (open_options_title);
label = gtk_label_new (" \n \n ");
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.0);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* eek */
if (gimp->config->thumbnail_size > 0)
{
GtkRequisition requisition;
GtkWidget *vbox;
GtkWidget *vbox2;
GtkWidget *ebox;
GtkWidget *hbox;
GtkWidget *button;
GtkWidget *label;
GtkWidget *progress;
GtkStyle *style;
/* Catch file-list clicks so we can update the preview thumbnail */
g_signal_connect (G_OBJECT (tree_sel), "changed",
G_CALLBACK (file_open_selchanged_callback),
open_dialog);
gtk_widget_size_request (label, &requisition);
gtk_widget_set_size_request (label, -1, requisition.height);
open_options_frame = gtk_frame_new (NULL);
gtk_frame_set_shadow_type (GTK_FRAME (open_options_frame),
GTK_SHADOW_IN);
ebox = gtk_event_box_new ();
gtk_widget_ensure_style (ebox);
style = gtk_widget_get_style (ebox);
gtk_widget_modify_bg (ebox, GTK_STATE_NORMAL,
&style->base[GTK_STATE_NORMAL]);
gtk_widget_modify_bg (ebox, GTK_STATE_INSENSITIVE,
&style->base[GTK_STATE_NORMAL]);
gtk_container_add (GTK_CONTAINER (open_options_frame), ebox);
gtk_widget_show (ebox);
g_signal_connect (G_OBJECT (ebox), "button_press_event",
G_CALLBACK (file_open_thumbnail_button_press),
open_dialog);
gimp_help_set_help_data (ebox, _("Click to update preview"), NULL);
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (ebox), vbox);
gtk_widget_show (vbox);
button = gtk_button_new ();
gtk_box_pack_start (GTK_BOX (vbox), button, FALSE, FALSE, 0);
gtk_widget_show (button);
label = gtk_label_new_with_mnemonic (_("_Preview"));
gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
gtk_container_add (GTK_CONTAINER (button), label);
gtk_widget_show (label);
g_signal_connect (G_OBJECT (button), "button_press_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "button_release_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "enter_notify_event",
G_CALLBACK (gtk_true),
NULL);
g_signal_connect (G_OBJECT (button), "leave_notify_event",
G_CALLBACK (gtk_true),
NULL);
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (vbox), vbox2);
gtk_widget_show (vbox2);
hbox = gtk_hbox_new (TRUE, 0);
gtk_box_pack_start (GTK_BOX (vbox2), hbox, FALSE, FALSE, 0);
gtk_widget_show (hbox);
open_options_imagefile = gimp_imagefile_new (NULL);
open_options_preview =
gimp_preview_new (GIMP_VIEWABLE (open_options_imagefile),
gimp->config->thumbnail_size, 0, FALSE);
gtk_widget_ensure_style (open_options_preview);
style = gtk_widget_get_style (open_options_preview);
gtk_widget_modify_bg (open_options_preview, GTK_STATE_NORMAL,
&style->base[GTK_STATE_NORMAL]);
gtk_widget_modify_bg (open_options_preview, GTK_STATE_INSENSITIVE,
&style->base[GTK_STATE_NORMAL]);
gtk_box_pack_start (GTK_BOX (hbox),
open_options_preview, TRUE, FALSE, 10);
gtk_widget_show (open_options_preview);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), open_options_preview);
g_signal_connect (G_OBJECT (open_options_preview), "clicked",
G_CALLBACK (file_open_thumbnail_clicked),
open_dialog);
open_options_title = gtk_label_new (_("No Selection"));
gtk_box_pack_start (GTK_BOX (vbox2),
open_options_title, FALSE, FALSE, 0);
gtk_widget_show (open_options_title);
label = gtk_label_new (" \n \n ");
gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.0);
gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_CENTER);
gtk_box_pack_start (GTK_BOX (vbox2), label, FALSE, FALSE, 0);
gtk_widget_show (label);
/* eek */
{
GtkRequisition requisition;
gtk_widget_size_request (label, &requisition);
gtk_widget_set_size_request (label, -1, requisition.height);
}
g_signal_connect (G_OBJECT (open_options_imagefile), "info_changed",
G_CALLBACK (file_open_imagefile_info_changed),
label);
open_options_label = label;
/* pack the containing open_options hbox into the open-dialog */
for (hbox = fs->dir_list; ! GTK_IS_HBOX (hbox); hbox = hbox->parent);
gtk_box_pack_end (GTK_BOX (hbox), open_options_frame, FALSE, FALSE, 0);
gtk_widget_show (open_options_frame);
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), FALSE);
/* The progress bar */
progress = gtk_progress_bar_new ();
gtk_box_pack_end (GTK_BOX (vbox2), progress, FALSE, FALSE, 0);
/* don't gtk_widget_show (progress); */
open_options_progress = GTK_PROGRESS_BAR (progress);
/* eek */
{
GtkRequisition requisition;
gtk_progress_bar_set_text (open_options_progress, "foo");
gtk_widget_size_request (progress, &requisition);
gtk_widget_set_size_request (open_options_title, requisition.width, -1);
}
}
g_signal_connect (G_OBJECT (open_options_imagefile), "info_changed",
G_CALLBACK (file_open_imagefile_info_changed),
label);
open_options_label = label;
/* pack the containing open_options hbox into the open-dialog */
for (hbox = fs->dir_list; ! GTK_IS_HBOX (hbox); hbox = hbox->parent);
gtk_box_pack_end (GTK_BOX (hbox), open_options_frame, FALSE, FALSE, 0);
gtk_widget_show (open_options_frame);
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), FALSE);
/* The progress bar */
progress = gtk_progress_bar_new ();
gtk_box_pack_end (GTK_BOX (vbox2), progress, FALSE, FALSE, 0);
/* don't gtk_widget_show (progress); */
open_options_progress = GTK_PROGRESS_BAR (progress);
/* eek */
{
GtkRequisition requisition;
gtk_progress_bar_set_text (open_options_progress, "foo");
gtk_widget_size_request (progress, &requisition);
gtk_widget_set_size_request (open_options_title, requisition.width, -1);
}
}
return open_dialog;
}
@ -386,18 +390,19 @@ file_open_selchanged_callback (GtkTreeSelection *sel,
gtk_tree_selection_selected_foreach (sel,
selchanged_foreach,
&selected);
fs = GTK_FILE_SELECTION (open_dialog);
gimp = GIMP (g_object_get_data (G_OBJECT (open_dialog), "gimp"));
if (selected)
{
gchar *uri;
gchar *basename;
fs = GTK_FILE_SELECTION (open_dialog);
gimp = GIMP (g_object_get_data (G_OBJECT (open_dialog), "gimp"));
fullfname = gtk_file_selection_get_filename (fs);
uri = file_utils_filename_to_uri (gimp->load_procs, fullfname, NULL);
uri = file_utils_filename_to_uri (gimp->load_procs, fullfname, NULL);
basename = file_utils_uri_to_utf8_basename (uri);
gimp_object_set_name (GIMP_OBJECT (open_options_imagefile), uri);
@ -413,11 +418,12 @@ file_open_selchanged_callback (GtkTreeSelection *sel,
}
gtk_widget_set_sensitive (GTK_WIDGET (open_options_frame), selected);
gimp_imagefile_update (open_options_imagefile);
gimp_imagefile_update (open_options_imagefile, gimp->config->thumbnail_size);
}
static void
file_open_create_thumbnail (const gchar *filename)
file_open_create_thumbnail (const gchar *filename,
GimpThumbnailSize size)
{
if (g_file_test (filename, G_FILE_TEST_IS_REGULAR))
{
@ -428,7 +434,7 @@ file_open_create_thumbnail (const gchar *filename)
uri = g_filename_to_uri (filename, NULL, NULL);
imagefile = gimp_imagefile_new (uri);
gimp_imagefile_create_thumbnail (imagefile);
gimp_imagefile_create_thumbnail (imagefile, size);
g_object_unref (G_OBJECT (imagefile));
basename = file_utils_uri_to_utf8_basename (uri);
@ -436,7 +442,7 @@ file_open_create_thumbnail (const gchar *filename)
g_free (basename);
gimp_object_set_name (GIMP_OBJECT (open_options_imagefile), uri);
gimp_imagefile_update (open_options_imagefile);
gimp_imagefile_update (open_options_imagefile, size);
g_free (uri);
}
@ -463,7 +469,7 @@ file_open_thumbnail_clicked (GtkWidget *widget,
gimp = GIMP (g_object_get_data (G_OBJECT (fs), "gimp"));
if (gimp->config->write_thumbnails)
if (gimp->config->thumbnail_size != GIMP_THUMBNAIL_SIZE_NONE)
{
gchar **selections;
gint n_selections;
@ -499,7 +505,8 @@ file_open_thumbnail_clicked (GtkWidget *widget,
g_free (str);
}
file_open_create_thumbnail (selections[i]);
file_open_create_thumbnail (selections[i],
gimp->config->thumbnail_size);
if (n_selections > 1)
{
@ -521,7 +528,8 @@ file_open_thumbnail_clicked (GtkWidget *widget,
g_free (str);
}
file_open_create_thumbnail (selections[0]);
file_open_create_thumbnail (selections[0],
gimp->config->thumbnail_size);
if (n_selections > 1)
{

View file

@ -170,7 +170,7 @@ static gint old_num_processors;
static gchar * old_image_title_format;
static gchar * old_image_status_format;
static guint old_max_new_image_size;
static gboolean old_write_thumbnails;
static GimpThumbnailSize old_thumbnail_size;
static gboolean old_trust_dirty_flag;
static gboolean old_use_help;
static gboolean old_nav_window_per_display;
@ -723,9 +723,9 @@ prefs_save_callback (GtkWidget *widget,
{
update = g_list_append (update, "max-new-image-size");
}
if (gimp->config->write_thumbnails != old_write_thumbnails)
if (gimp->config->thumbnail_size != old_thumbnail_size)
{
update = g_list_append (update, "thumbnail-mode");
update = g_list_append (update, "thumbnail-size");
}
if (gimprc.trust_dirty_flag != old_trust_dirty_flag)
{
@ -914,7 +914,7 @@ prefs_cancel_callback (GtkWidget *widget,
gimp->config->default_yresolution = old_default_yresolution;
gimp->config->default_resolution_units = old_default_resolution_units;
gimp->config->levels_of_undo = old_levels_of_undo;
gimp->config->write_thumbnails = old_write_thumbnails;
gimp->config->thumbnail_size = old_thumbnail_size;
gimprc.marching_speed = old_marching_speed;
gimprc.resize_windows_on_zoom = old_resize_windows_on_zoom;
@ -1051,7 +1051,7 @@ prefs_toggle_callback (GtkWidget *widget,
/* radio buttons */
else if (data == &gimp->config->interpolation_type ||
data == &gimp->config->default_type ||
data == &gimp->config->write_thumbnails ||
data == &gimp->config->thumbnail_size ||
data == &gimprc.trust_dirty_flag ||
data == &gimprc.help_browser ||
data == &gimprc.cursor_mode)
@ -1678,7 +1678,7 @@ preferences_dialog_create (Gimp *gimp)
old_default_yresolution = gimp->config->default_yresolution;
old_default_resolution_units = gimp->config->default_resolution_units;
old_levels_of_undo = gimp->config->levels_of_undo;
old_write_thumbnails = gimp->config->write_thumbnails;
old_thumbnail_size = gimp->config->thumbnail_size;
old_perfectmouse = gimprc.perfectmouse;
old_transparency_type = gimprc.transparency_type;
@ -2699,19 +2699,14 @@ preferences_dialog_create (Gimp *gimp)
_("\"File -> Save\" Saves the Image:"), 1.0, 0.5,
optionmenu, 1, TRUE);
optionmenu =
gimp_option_menu_new2 (FALSE,
G_CALLBACK (prefs_toggle_callback),
&gimp->config->write_thumbnails,
GINT_TO_POINTER (gimp->config->write_thumbnails),
_("Always"), GINT_TO_POINTER (TRUE), NULL,
_("Never"), GINT_TO_POINTER (FALSE), NULL,
NULL);
optionmenu =
gimp_enum_option_menu_new (GIMP_TYPE_THUMBNAIL_SIZE,
G_CALLBACK (prefs_toggle_callback),
&gimp->config->thumbnail_size);
gimp_option_menu_set_history (GTK_OPTION_MENU (optionmenu),
GINT_TO_POINTER (gimp->config->thumbnail_size));
gimp_table_attach_aligned (GTK_TABLE (table), 0, 1,
_("Try to Write a Thumbnail File:"), 1.0, 0.5,
_("Size of Thumbnails Files:"), 1.0, 0.5,
optionmenu, 1, TRUE);

View file

@ -330,7 +330,8 @@ gimp_document_view_refresh_clicked (GtkWidget *widget,
if (imagefile && gimp_container_have (editor->view->container,
GIMP_OBJECT (imagefile)))
{
gimp_imagefile_create_thumbnail (imagefile);
/* FIXME: hardcoded thumbnail size */
gimp_imagefile_create_thumbnail (imagefile, GIMP_THUMBNAIL_SIZE_NORMAL);
}
}
@ -338,7 +339,8 @@ static void
gimp_document_view_delete_dangling_foreach (GimpImagefile *imagefile,
GimpContainer *container)
{
gimp_imagefile_update (imagefile);
/* FIXME: hardcoded thumbnail size */
gimp_imagefile_update (imagefile, GIMP_THUMBNAIL_SIZE_NORMAL);
if (imagefile->state == GIMP_IMAGEFILE_STATE_NOT_FOUND)
{