Preferences dialog now has an option for people who don't like thumbnail

Sun Jun  6 17:22:16 BST 1999 Adam D. Moss <adam@gimp.org>

	* fileops.c gimprc.c gimprc.h preferences_dialog.c:
	Preferences dialog now has an option for people who don't
	like thumbnail files to ever be written.
This commit is contained in:
BST 1999 Adam D. Moss
1999-06-06 16:31:15 +00:00
committed by Adam D. Moss
parent 52ee2c0894
commit 30d6acf42c
7 changed files with 153 additions and 8 deletions

View File

@ -1,3 +1,8 @@
Sun Jun 6 17:22:16 BST 1999 Adam D. Moss <adam@gimp.org>
* Preferences dialog now has an option for people who don't
like thumbnail files to ever be written.
Sun Jun 6 15:41:22 BST 1999 Adam D. Moss <adam@gimp.org>
* app/fileops.c: Extra quality thumbnails when the user manually

View File

@ -100,6 +100,7 @@ static int old_num_processors;
static char * old_image_title_format;
static int old_global_paint_options;
static int old_max_new_image_size;
static int old_thumbnail_mode;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
@ -494,6 +495,8 @@ file_prefs_save_callback (GtkWidget *widget,
}
if (max_new_image_size != old_max_new_image_size)
update = g_list_append (update, "max-new-image-size");
if (thumbnail_mode != old_thumbnail_mode)
update = g_list_append (update, "thumbnail-mode");
save_gimprc (&update, &remove);
@ -556,6 +559,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
using_xserver_resolution = old_using_xserver_resolution;
num_processors = old_num_processors;
max_new_image_size = old_max_new_image_size;
thumbnail_mode = old_thumbnail_mode;
if (preview_size != old_preview_size)
{
@ -649,6 +653,18 @@ file_prefs_toggle_callback (GtkWidget *widget,
}
else if (data == &global_paint_options)
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
else if (data == &thumbnail_mode)
{
val = data;
*val = (long) gtk_object_get_user_data (GTK_OBJECT (widget));
}
else
{
/* Are you a gimp-hacker who is getting this message? You
probably want to do the same as the &thumbnail_mode case
above is doing. */
g_warning("Unknown file_prefs_toggle_callback() invoker - ignored.");
}
}
static void
@ -1418,6 +1434,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size;
old_thumbnail_mode = thumbnail_mode;
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
@ -2100,6 +2117,26 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
frame = gtk_frame_new (_("File Previews/Thumbnails"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
optionmenu =
gimp_option_menu_new (file_prefs_toggle_callback,
(gpointer) thumbnail_mode,
"Always try to write a thumbnail file",
&thumbnail_mode, (gpointer) 1,
"Never try to write a thumbnail file",
&thumbnail_mode, (gpointer) 0,
NULL);
gtk_box_pack_start (GTK_BOX (vbox2), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
/* Session Management */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Session Management"),

View File

@ -971,8 +971,6 @@ file_save (GimpImage* gimage,
if (return_val)
{
TempBuf* tempbuf;
/* set this image to clean */
gimage_clean_all (gimage);
@ -985,8 +983,18 @@ file_save (GimpImage* gimage,
attention --Adam */
/* gimage_set_save_proc(gimage, file_proc); */
tempbuf = make_thumb_tempbuf (gimage);
file_save_thumbnail (gimage, filename, tempbuf);
/* Write a thumbnail for the saved image, where appropriate */
switch (thumbnail_mode)
{
case 0:
break;
default:
{
TempBuf* tempbuf;
tempbuf = make_thumb_tempbuf (gimage);
file_save_thumbnail (gimage, filename, tempbuf);
}
}
/* set the image title */
gimp_image_set_filename (gimage, filename);
@ -1186,8 +1194,20 @@ set_preview (const gchar* fullfname, guchar* RGB_source, gint RGB_w, gint RGB_h)
}
else
{
gtk_label_set_text (GTK_LABEL(open_options_label),
"(could not write thumbnail file)");
switch (thumbnail_mode)
{
case 0:
gtk_label_set_text (GTK_LABEL(open_options_label),
"(thumbnail saving is disabled)");
break;
case 1:
gtk_label_set_text (GTK_LABEL(open_options_label),
"(could not write thumbnail file)");
break;
default:
gtk_label_set_text (GTK_LABEL(open_options_label),
"(thumbnail file not written)");
}
}
gtk_widget_show (GTK_WIDGET(open_options_preview));
gtk_widget_queue_draw (GTK_WIDGET(open_options_preview));
@ -1259,7 +1279,13 @@ genbutton_callback (GtkWidget *w,
tempbuf = make_thumb_tempbuf (gimage_to_be_thumbed);
RGBbuf = make_RGBbuf_from_tempbuf (tempbuf, &RGBbuf_w, &RGBbuf_h);
file_save_thumbnail (gimage_to_be_thumbed, filename, tempbuf);
switch (thumbnail_mode)
{
case 0:
break;
default:
file_save_thumbnail (gimage_to_be_thumbed, filename, tempbuf);
}
set_preview (filename, RGBbuf, RGBbuf_w, RGBbuf_h);
gimage_delete (gimage_to_be_thumbed);

View File

@ -150,6 +150,7 @@ int num_processors = 1;
char * image_title_format = NULL;
int global_paint_options = TRUE;
int max_new_image_size = 33554432; /* 32 MB */
int thumbnail_mode = 1;
extern char * module_db_load_inhibit;
@ -289,7 +290,8 @@ static ParseFunc funcs[] =
{ "global-paint-options", TT_BOOLEAN, &global_paint_options, NULL },
{ "no-global-paint-options", TT_BOOLEAN, NULL, &global_paint_options },
{ "module-load-inhibit", TT_PATH, &module_db_load_inhibit, NULL },
{ "max-new-image-size", TT_MEMSIZE, &max_new_image_size, NULL }
{ "max-new-image-size", TT_MEMSIZE, &max_new_image_size, NULL },
{ "thumbnail-mode", TT_INT, &thumbnail_mode, NULL }
};
static int nfuncs = sizeof (funcs) / sizeof (funcs[0]);

View File

@ -75,6 +75,7 @@ extern int num_processors;
extern char * image_title_format;
extern int global_paint_options;
extern int max_new_image_size;
extern int thumbnail_mode;
/* function prototypes */

View File

@ -100,6 +100,7 @@ static int old_num_processors;
static char * old_image_title_format;
static int old_global_paint_options;
static int old_max_new_image_size;
static int old_thumbnail_mode;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
@ -494,6 +495,8 @@ file_prefs_save_callback (GtkWidget *widget,
}
if (max_new_image_size != old_max_new_image_size)
update = g_list_append (update, "max-new-image-size");
if (thumbnail_mode != old_thumbnail_mode)
update = g_list_append (update, "thumbnail-mode");
save_gimprc (&update, &remove);
@ -556,6 +559,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
using_xserver_resolution = old_using_xserver_resolution;
num_processors = old_num_processors;
max_new_image_size = old_max_new_image_size;
thumbnail_mode = old_thumbnail_mode;
if (preview_size != old_preview_size)
{
@ -649,6 +653,18 @@ file_prefs_toggle_callback (GtkWidget *widget,
}
else if (data == &global_paint_options)
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
else if (data == &thumbnail_mode)
{
val = data;
*val = (long) gtk_object_get_user_data (GTK_OBJECT (widget));
}
else
{
/* Are you a gimp-hacker who is getting this message? You
probably want to do the same as the &thumbnail_mode case
above is doing. */
g_warning("Unknown file_prefs_toggle_callback() invoker - ignored.");
}
}
static void
@ -1418,6 +1434,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size;
old_thumbnail_mode = thumbnail_mode;
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
@ -2100,6 +2117,26 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
frame = gtk_frame_new (_("File Previews/Thumbnails"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
optionmenu =
gimp_option_menu_new (file_prefs_toggle_callback,
(gpointer) thumbnail_mode,
"Always try to write a thumbnail file",
&thumbnail_mode, (gpointer) 1,
"Never try to write a thumbnail file",
&thumbnail_mode, (gpointer) 0,
NULL);
gtk_box_pack_start (GTK_BOX (vbox2), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
/* Session Management */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Session Management"),

View File

@ -100,6 +100,7 @@ static int old_num_processors;
static char * old_image_title_format;
static int old_global_paint_options;
static int old_max_new_image_size;
static int old_thumbnail_mode;
/* variables which can't be changed on the fly */
static int edit_stingy_memory_use;
@ -494,6 +495,8 @@ file_prefs_save_callback (GtkWidget *widget,
}
if (max_new_image_size != old_max_new_image_size)
update = g_list_append (update, "max-new-image-size");
if (thumbnail_mode != old_thumbnail_mode)
update = g_list_append (update, "thumbnail-mode");
save_gimprc (&update, &remove);
@ -556,6 +559,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
using_xserver_resolution = old_using_xserver_resolution;
num_processors = old_num_processors;
max_new_image_size = old_max_new_image_size;
thumbnail_mode = old_thumbnail_mode;
if (preview_size != old_preview_size)
{
@ -649,6 +653,18 @@ file_prefs_toggle_callback (GtkWidget *widget,
}
else if (data == &global_paint_options)
paint_options_set_global (GTK_TOGGLE_BUTTON (widget)->active);
else if (data == &thumbnail_mode)
{
val = data;
*val = (long) gtk_object_get_user_data (GTK_OBJECT (widget));
}
else
{
/* Are you a gimp-hacker who is getting this message? You
probably want to do the same as the &thumbnail_mode case
above is doing. */
g_warning("Unknown file_prefs_toggle_callback() invoker - ignored.");
}
}
static void
@ -1418,6 +1434,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_image_title_format = file_prefs_strdup (image_title_format);
old_global_paint_options = global_paint_options;
old_max_new_image_size = max_new_image_size;
old_thumbnail_mode = thumbnail_mode;
file_prefs_strset (&old_temp_path, edit_temp_path);
file_prefs_strset (&old_swap_path, edit_swap_path);
@ -2100,6 +2117,26 @@ file_pref_cmd_callback (GtkWidget *widget,
gtk_box_pack_start (GTK_BOX (vbox2), button, FALSE, FALSE, 0);
gtk_widget_show (button);
frame = gtk_frame_new (_("File Previews/Thumbnails"));
gtk_box_pack_start (GTK_BOX (vbox), frame, FALSE, FALSE, 0);
gtk_widget_show (frame);
vbox2 = gtk_vbox_new (FALSE, 2);
gtk_container_set_border_width (GTK_CONTAINER (vbox2), 2);
gtk_container_add (GTK_CONTAINER (frame), vbox2);
gtk_widget_show (vbox2);
optionmenu =
gimp_option_menu_new (file_prefs_toggle_callback,
(gpointer) thumbnail_mode,
"Always try to write a thumbnail file",
&thumbnail_mode, (gpointer) 1,
"Never try to write a thumbnail file",
&thumbnail_mode, (gpointer) 0,
NULL);
gtk_box_pack_start (GTK_BOX (vbox2), optionmenu, FALSE, FALSE, 0);
gtk_widget_show (optionmenu);
/* Session Management */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Session Management"),