Commit 6feb0330 authored by Sven Neumann's avatar Sven Neumann
Browse files

provided gimp_strescape() which is the glib-1.3 g_strescape function

added a default_comment which gets attached to all new images


--Sven
parent d85f3585
Sun Mar 12 01:09:27 CET 2000 Sven Neumann <sven@gimp.org>
* libgimp/Makefile.am
* libgimp/gimp.h
* libgimp/gimputils.[ch]: new files providing gimp_strescape(),
which is the glib-1.3 g_strescape function
* plug-ins/script-fu/script-fu-scripts.c: use gimp_strescape()
* app/gimprc.[ch]
* app/image_new.c
* app/preferences_dialog.c: allow to specify a default comment
which gets attached to new images (fulfills wish #5963)
* docs/parasites.txt: added a note that gserialize is not included
in the libgimp build
2000-03-11 Shirasaki Yasuhiro <yasuhiro@gnome.gr.jp> 2000-03-11 Shirasaki Yasuhiro <yasuhiro@gnome.gr.jp>
   
* plug-ins/common/mpeg.c: added missing comma for * plug-ins/common/mpeg.c: added missing comma for
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
/* gimprc will be parsed with a buffer size of 1024,
so don't set this too large */
#define MAX_COMMENT_LENGTH 512
typedef enum typedef enum
{ {
...@@ -61,6 +64,7 @@ static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer); ...@@ -61,6 +64,7 @@ static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_callback (GtkWidget *, gpointer); static void file_prefs_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer); static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_string_callback (GtkWidget *, gpointer); static void file_prefs_string_callback (GtkWidget *, gpointer);
static void file_prefs_text_callback (GtkWidget *, gpointer);
static void file_prefs_filename_callback (GtkWidget *, gpointer); static void file_prefs_filename_callback (GtkWidget *, gpointer);
static void file_prefs_path_callback (GtkWidget *, gpointer); static void file_prefs_path_callback (GtkWidget *, gpointer);
static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer); static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer);
...@@ -97,6 +101,7 @@ static gdouble old_default_xresolution; ...@@ -97,6 +101,7 @@ static gdouble old_default_xresolution;
static gdouble old_default_yresolution; static gdouble old_default_yresolution;
static GimpUnit old_default_resolution_units; static GimpUnit old_default_resolution_units;
static gint old_default_type; static gint old_default_type;
static gchar * old_default_comment;
static gint old_default_dot_for_dot; static gint old_default_dot_for_dot;
static gint old_stingy_memory_use; static gint old_stingy_memory_use;
static gint old_tile_cache_size; static gint old_tile_cache_size;
...@@ -589,6 +594,10 @@ file_prefs_save_callback (GtkWidget *widget, ...@@ -589,6 +594,10 @@ file_prefs_save_callback (GtkWidget *widget,
{ {
update = g_list_append (update, "default-image-type"); update = g_list_append (update, "default-image-type");
} }
if (file_prefs_strcmp (default_comment, old_default_comment))
{
update = g_list_append (update, "default-comment");
}
if (default_dot_for_dot != old_default_dot_for_dot) if (default_dot_for_dot != old_default_dot_for_dot)
{ {
update = g_list_append (update, "default-dot-for-dot"); update = g_list_append (update, "default-dot-for-dot");
...@@ -858,6 +867,7 @@ file_prefs_cancel_callback (GtkWidget *widget, ...@@ -858,6 +867,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
} }
file_prefs_strset (&image_title_format, old_image_title_format); file_prefs_strset (&image_title_format, old_image_title_format);
file_prefs_strset (&default_comment, old_default_comment);
context_manager_set_global_paint_options (old_global_paint_options); context_manager_set_global_paint_options (old_global_paint_options);
...@@ -1043,6 +1053,27 @@ file_prefs_string_callback (GtkWidget *widget, ...@@ -1043,6 +1053,27 @@ file_prefs_string_callback (GtkWidget *widget,
file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget))); file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
} }
static void
file_prefs_text_callback (GtkWidget *widget,
gpointer data)
{
gchar **val;
gchar *text;
val = data;
text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
if (strlen (text) > MAX_COMMENT_LENGTH)
{
g_message (_("The default comments is limited to %d characters."),
MAX_COMMENT_LENGTH);
gtk_editable_delete_text (GTK_EDITABLE (widget), MAX_COMMENT_LENGTH, -1);
g_free (text);
}
else
file_prefs_strset (val, text);
}
static void static void
file_prefs_filename_callback (GtkWidget *widget, file_prefs_filename_callback (GtkWidget *widget,
gpointer data) gpointer data)
...@@ -1349,6 +1380,7 @@ file_pref_cmd_callback (GtkWidget *widget, ...@@ -1349,6 +1380,7 @@ file_pref_cmd_callback (GtkWidget *widget,
GtkObject *adjustment; GtkObject *adjustment;
GtkWidget *sizeentry; GtkWidget *sizeentry;
GtkWidget *sizeentry2; GtkWidget *sizeentry2;
GtkWidget *text;
GSList *group; GSList *group;
gint i; gint i;
...@@ -1430,6 +1462,7 @@ file_pref_cmd_callback (GtkWidget *widget, ...@@ -1430,6 +1462,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_help_browser = help_browser; old_help_browser = help_browser;
file_prefs_strset (&old_image_title_format, image_title_format); file_prefs_strset (&old_image_title_format, image_title_format);
file_prefs_strset (&old_default_comment, default_comment);
/* values which will need a restart */ /* values which will need a restart */
old_stingy_memory_use = edit_stingy_memory_use; old_stingy_memory_use = edit_stingy_memory_use;
...@@ -1686,6 +1719,35 @@ file_pref_cmd_callback (GtkWidget *widget, ...@@ -1686,6 +1719,35 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Maximum Image Size:"), 1.0, 0.5, _("Maximum Image Size:"), 1.0, 0.5,
hbox, 1, TRUE); hbox, 1, TRUE);
/* Default Comment page */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Default Comment"),
GTK_CTREE (ctree),
_("Default Comment"),
"dialogs/preferences/default_comment.html",
NULL,
&top_insert,
page_index);
gtk_widget_show (vbox);
page_index++;
frame = gtk_frame_new (_("Comment Used for New Images"));
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
text = gtk_text_new (NULL, NULL);
gtk_text_set_editable (GTK_TEXT (text), TRUE);
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, default_comment, -1);
gtk_signal_connect (GTK_OBJECT (text), "changed",
GTK_SIGNAL_FUNC (file_prefs_text_callback),
&default_comment);
gtk_container_add (GTK_CONTAINER (hbox), text);
gtk_widget_show (text);
/* Display page */ /* Display page */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook), vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
......
...@@ -47,9 +47,10 @@ ...@@ -47,9 +47,10 @@
#include "session.h" #include "session.h"
#include "tools.h" #include "tools.h"
#include "libgimp/parasite.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimpenv.h" #include "libgimp/gimpenv.h"
#include "libgimp/gimpintl.h"
#include "libgimp/gimputils.h"
#include "libgimp/parasite.h"
#define ERROR 0 #define ERROR 0
#define DONE 1 #define DONE 1
...@@ -78,7 +79,8 @@ typedef enum { ...@@ -78,7 +79,8 @@ typedef enum {
TT_XUNITINFO, TT_XUNITINFO,
TT_XPARASITE, TT_XPARASITE,
TT_XNAVPREVSIZE, TT_XNAVPREVSIZE,
TT_XHELPBROWSER TT_XHELPBROWSER,
TT_XCOMMENT
} TokenType; } TokenType;
typedef struct _ParseFunc ParseFunc; typedef struct _ParseFunc ParseFunc;
...@@ -148,6 +150,7 @@ int default_type = RGB; ...@@ -148,6 +150,7 @@ int default_type = RGB;
double default_xresolution = 72.0; double default_xresolution = 72.0;
double default_yresolution = 72.0; double default_yresolution = 72.0;
GimpUnit default_resolution_units = GIMP_UNIT_INCH; GimpUnit default_resolution_units = GIMP_UNIT_INCH;
char * default_comment = NULL;
int default_dot_for_dot = TRUE; int default_dot_for_dot = TRUE;
int show_tips = TRUE; int show_tips = TRUE;
int last_tip = -1; int last_tip = -1;
...@@ -219,6 +222,7 @@ static inline char * preview_size_to_str (gpointer val1p, gpointer val2p); ...@@ -219,6 +222,7 @@ static inline char * preview_size_to_str (gpointer val1p, gpointer val2p);
static inline char * nav_preview_size_to_str (gpointer val1p, gpointer val2p); static inline char * nav_preview_size_to_str (gpointer val1p, gpointer val2p);
static inline char * units_to_str (gpointer val1p, gpointer val2p); static inline char * units_to_str (gpointer val1p, gpointer val2p);
static inline char * help_browser_to_str (gpointer val1p, gpointer val2p); static inline char * help_browser_to_str (gpointer val1p, gpointer val2p);
static inline char * comment_to_str (gpointer val1p, gpointer val2p);
static char* transform_path (char *path, int destroy); static char* transform_path (char *path, int destroy);
static void gimprc_set_token (char *token, char *value); static void gimprc_set_token (char *token, char *value);
...@@ -300,6 +304,7 @@ static ParseFunc funcs[] = ...@@ -300,6 +304,7 @@ static ParseFunc funcs[] =
{ "default-xresolution", TT_DOUBLE, &default_xresolution, NULL }, { "default-xresolution", TT_DOUBLE, &default_xresolution, NULL },
{ "default-yresolution", TT_DOUBLE, &default_yresolution, NULL }, { "default-yresolution", TT_DOUBLE, &default_yresolution, NULL },
{ "default-resolution-units", TT_XUNIT, &default_resolution_units, NULL }, { "default-resolution-units", TT_XUNIT, &default_resolution_units, NULL },
{ "default-comment", TT_XCOMMENT, &default_comment, NULL },
{ "default-dot-for-dot", TT_BOOLEAN, &default_dot_for_dot, NULL }, { "default-dot-for-dot", TT_BOOLEAN, &default_dot_for_dot, NULL },
{ "plug-in", TT_XPLUGIN, NULL, NULL }, { "plug-in", TT_XPLUGIN, NULL, NULL },
{ "plug-in-def", TT_XPLUGINDEF, NULL, NULL }, { "plug-in-def", TT_XPLUGINDEF, NULL, NULL },
...@@ -350,6 +355,7 @@ extern char* alternate_gimprc; ...@@ -350,6 +355,7 @@ extern char* alternate_gimprc;
extern char* alternate_system_gimprc; extern char* alternate_system_gimprc;
#define DEFAULT_IMAGE_TITLE_FORMAT "%f-%p.%i (%t)" #define DEFAULT_IMAGE_TITLE_FORMAT "%f-%p.%i (%t)"
#define DEFAULT_COMMENT "Created with The GIMP"
static char * static char *
gimp_system_rc_file (void) gimp_system_rc_file (void)
...@@ -416,7 +422,9 @@ parse_gimprc (void) ...@@ -416,7 +422,9 @@ parse_gimprc (void)
g_free (libfilename); g_free (libfilename);
if (!image_title_format) if (!image_title_format)
image_title_format = g_strdup(DEFAULT_IMAGE_TITLE_FORMAT); image_title_format = g_strdup (DEFAULT_IMAGE_TITLE_FORMAT);
if (!default_comment)
default_comment = g_strdup (DEFAULT_COMMENT);
} }
gboolean gboolean
...@@ -859,6 +867,8 @@ parse_statement (void) ...@@ -859,6 +867,8 @@ parse_statement (void)
return parse_parasite (funcs[i].val1p, funcs[i].val2p); return parse_parasite (funcs[i].val1p, funcs[i].val2p);
case TT_XHELPBROWSER: case TT_XHELPBROWSER:
return parse_help_browser (funcs[i].val1p, funcs[i].val2p); return parse_help_browser (funcs[i].val1p, funcs[i].val2p);
case TT_XCOMMENT:
return parse_string (funcs[i].val1p, funcs[i].val2p);
} }
return parse_unknown (token_sym); return parse_unknown (token_sym);
...@@ -2562,6 +2572,8 @@ value_to_str (char *name) ...@@ -2562,6 +2572,8 @@ value_to_str (char *name)
return units_to_str (funcs[i].val1p, funcs[i].val2p); return units_to_str (funcs[i].val1p, funcs[i].val2p);
case TT_XHELPBROWSER: case TT_XHELPBROWSER:
return help_browser_to_str (funcs[i].val1p, funcs[i].val2p); return help_browser_to_str (funcs[i].val1p, funcs[i].val2p);
case TT_XCOMMENT:
return comment_to_str (funcs[i].val1p, funcs[i].val2p);
case TT_XPLUGIN: case TT_XPLUGIN:
case TT_XPLUGINDEF: case TT_XPLUGINDEF:
case TT_XMENUPATH: case TT_XMENUPATH:
...@@ -2578,11 +2590,7 @@ static inline char * ...@@ -2578,11 +2590,7 @@ static inline char *
string_to_str (gpointer val1p, string_to_str (gpointer val1p,
gpointer val2p) gpointer val2p)
{ {
#if defined (GLIB_CHECK_VERSION) && GLIB_CHECK_VERSION (1,3,1) gchar *str = gimp_strescape (*((char **)val1p), NULL);
gchar *str = g_strescape (*((char **)val1p), NULL);
#else
gchar *str = g_strescape (*((char **)val1p));
#endif
gchar *retval; gchar *retval;
retval = g_strdup_printf ("%c%s%c", '"', str, '"'); retval = g_strdup_printf ("%c%s%c", '"', str, '"');
...@@ -2749,6 +2757,24 @@ help_browser_to_str (gpointer val1p, ...@@ -2749,6 +2757,24 @@ help_browser_to_str (gpointer val1p,
return g_strdup ("gimp"); return g_strdup ("gimp");
} }
static inline char *
comment_to_str (gpointer val1p,
gpointer val2p)
{
gchar **str_array;
gchar *retval;
gchar *str = gimp_strescape (*((char **)val1p), NULL);
str_array = g_strsplit (str, "\n", 0);
g_free (str);
str = g_strjoinv ("\\n", str_array);
g_strfreev (str_array);
retval = g_strdup_printf ("%c%s%c", '"', str, '"');
g_free (str);
return retval;
}
static void static void
add_gimp_directory_token (char *gimp_dir) add_gimp_directory_token (char *gimp_dir)
{ {
......
...@@ -65,6 +65,7 @@ extern int default_type; ...@@ -65,6 +65,7 @@ extern int default_type;
extern GimpUnit default_resolution_units; extern GimpUnit default_resolution_units;
extern double default_xresolution; extern double default_xresolution;
extern double default_yresolution; extern double default_yresolution;
extern char * default_comment;
extern int default_dot_for_dot; extern int default_dot_for_dot;
extern int save_session_info; extern int save_session_info;
extern int save_device_status; extern int save_device_status;
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
/* gimprc will be parsed with a buffer size of 1024,
so don't set this too large */
#define MAX_COMMENT_LENGTH 512
typedef enum typedef enum
{ {
...@@ -61,6 +64,7 @@ static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer); ...@@ -61,6 +64,7 @@ static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_callback (GtkWidget *, gpointer); static void file_prefs_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer); static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_string_callback (GtkWidget *, gpointer); static void file_prefs_string_callback (GtkWidget *, gpointer);
static void file_prefs_text_callback (GtkWidget *, gpointer);
static void file_prefs_filename_callback (GtkWidget *, gpointer); static void file_prefs_filename_callback (GtkWidget *, gpointer);
static void file_prefs_path_callback (GtkWidget *, gpointer); static void file_prefs_path_callback (GtkWidget *, gpointer);
static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer); static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer);
...@@ -97,6 +101,7 @@ static gdouble old_default_xresolution; ...@@ -97,6 +101,7 @@ static gdouble old_default_xresolution;
static gdouble old_default_yresolution; static gdouble old_default_yresolution;
static GimpUnit old_default_resolution_units; static GimpUnit old_default_resolution_units;
static gint old_default_type; static gint old_default_type;
static gchar * old_default_comment;
static gint old_default_dot_for_dot; static gint old_default_dot_for_dot;
static gint old_stingy_memory_use; static gint old_stingy_memory_use;
static gint old_tile_cache_size; static gint old_tile_cache_size;
...@@ -589,6 +594,10 @@ file_prefs_save_callback (GtkWidget *widget, ...@@ -589,6 +594,10 @@ file_prefs_save_callback (GtkWidget *widget,
{ {
update = g_list_append (update, "default-image-type"); update = g_list_append (update, "default-image-type");
} }
if (file_prefs_strcmp (default_comment, old_default_comment))
{
update = g_list_append (update, "default-comment");
}
if (default_dot_for_dot != old_default_dot_for_dot) if (default_dot_for_dot != old_default_dot_for_dot)
{ {
update = g_list_append (update, "default-dot-for-dot"); update = g_list_append (update, "default-dot-for-dot");
...@@ -858,6 +867,7 @@ file_prefs_cancel_callback (GtkWidget *widget, ...@@ -858,6 +867,7 @@ file_prefs_cancel_callback (GtkWidget *widget,
} }
file_prefs_strset (&image_title_format, old_image_title_format); file_prefs_strset (&image_title_format, old_image_title_format);
file_prefs_strset (&default_comment, old_default_comment);
context_manager_set_global_paint_options (old_global_paint_options); context_manager_set_global_paint_options (old_global_paint_options);
...@@ -1043,6 +1053,27 @@ file_prefs_string_callback (GtkWidget *widget, ...@@ -1043,6 +1053,27 @@ file_prefs_string_callback (GtkWidget *widget,
file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget))); file_prefs_strset (val, gtk_entry_get_text (GTK_ENTRY (widget)));
} }
static void
file_prefs_text_callback (GtkWidget *widget,
gpointer data)
{
gchar **val;
gchar *text;
val = data;
text = gtk_editable_get_chars (GTK_EDITABLE (widget), 0, -1);
if (strlen (text) > MAX_COMMENT_LENGTH)
{
g_message (_("The default comments is limited to %d characters."),
MAX_COMMENT_LENGTH);
gtk_editable_delete_text (GTK_EDITABLE (widget), MAX_COMMENT_LENGTH, -1);
g_free (text);
}
else
file_prefs_strset (val, text);
}
static void static void
file_prefs_filename_callback (GtkWidget *widget, file_prefs_filename_callback (GtkWidget *widget,
gpointer data) gpointer data)
...@@ -1349,6 +1380,7 @@ file_pref_cmd_callback (GtkWidget *widget, ...@@ -1349,6 +1380,7 @@ file_pref_cmd_callback (GtkWidget *widget,
GtkObject *adjustment; GtkObject *adjustment;
GtkWidget *sizeentry; GtkWidget *sizeentry;
GtkWidget *sizeentry2; GtkWidget *sizeentry2;
GtkWidget *text;
GSList *group; GSList *group;
gint i; gint i;
...@@ -1430,6 +1462,7 @@ file_pref_cmd_callback (GtkWidget *widget, ...@@ -1430,6 +1462,7 @@ file_pref_cmd_callback (GtkWidget *widget,
old_help_browser = help_browser; old_help_browser = help_browser;
file_prefs_strset (&old_image_title_format, image_title_format); file_prefs_strset (&old_image_title_format, image_title_format);
file_prefs_strset (&old_default_comment, default_comment);
/* values which will need a restart */ /* values which will need a restart */
old_stingy_memory_use = edit_stingy_memory_use; old_stingy_memory_use = edit_stingy_memory_use;
...@@ -1686,6 +1719,35 @@ file_pref_cmd_callback (GtkWidget *widget, ...@@ -1686,6 +1719,35 @@ file_pref_cmd_callback (GtkWidget *widget,
_("Maximum Image Size:"), 1.0, 0.5, _("Maximum Image Size:"), 1.0, 0.5,
hbox, 1, TRUE); hbox, 1, TRUE);
/* Default Comment page */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
_("Default Comment"),
GTK_CTREE (ctree),
_("Default Comment"),
"dialogs/preferences/default_comment.html",
NULL,
&top_insert,
page_index);
gtk_widget_show (vbox);
page_index++;
frame = gtk_frame_new (_("Comment Used for New Images"));
gtk_box_pack_start (GTK_BOX (vbox), frame, TRUE, TRUE, 0);
gtk_widget_show (frame);
hbox = gtk_hbox_new (FALSE, 0);
gtk_container_set_border_width (GTK_CONTAINER (hbox), 2);
gtk_container_add (GTK_CONTAINER (frame), hbox);
gtk_widget_show (hbox);
text = gtk_text_new (NULL, NULL);
gtk_text_set_editable (GTK_TEXT (text), TRUE);
gtk_text_insert (GTK_TEXT (text), NULL, NULL, NULL, default_comment, -1);
gtk_signal_connect (GTK_OBJECT (text), "changed",
GTK_SIGNAL_FUNC (file_prefs_text_callback),
&default_comment);
gtk_container_add (GTK_CONTAINER (hbox), text);
gtk_widget_show (text);
/* Display page */ /* Display page */
vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook), vbox = file_prefs_notebook_append_page (GTK_NOTEBOOK (notebook),
......
...@@ -27,6 +27,7 @@ ...@@ -27,6 +27,7 @@
#include "gimage.h" #include "gimage.h"
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
#include "libgimp/parasite.h"
static GList *image_base_type_names = NULL; static GList *image_base_type_names = NULL;
static GList *fill_type_names = NULL; static GList *fill_type_names = NULL;
...@@ -190,6 +191,7 @@ image_new_create_image (const GimpImageNewValues *values) ...@@ -190,6 +191,7 @@ image_new_create_image (const GimpImageNewValues *values)
GDisplay *display; GDisplay *display;
Layer *layer; Layer *layer;
GimpImageType type; GimpImageType type;
Parasite *comment_parasite;
gint width, height; gint width, height;
g_return_if_fail (values != NULL); g_return_if_fail (values != NULL);
...@@ -216,6 +218,15 @@ image_new_create_image (const GimpImageNewValues *values) ...@@ -216,6 +218,15 @@ image_new_create_image (const GimpImageNewValues *values)
gimp_image_set_resolution (image, values->xresolution, values->yresolution); gimp_image_set_resolution (image, values->xresolution, values->yresolution);
gimp_image_set_unit (image, values->unit); gimp_image_set_unit (image, values->unit);
if (default_comment)
{
comment_parasite = parasite_new ("gimp-comment", PARASITE_PERSISTENT,
strlen (default_comment)+1,
(gpointer) default_comment);
gimp_image_parasite_attach (image, comment_parasite);
parasite_free (comment_parasite);
}
/* Make the background (or first) layer */ /* Make the background (or first) layer */
width = gimp_image_get_width (image); width = gimp_image_get_width (image);
height = gimp_image_get_height(image); height = gimp_image_get_height(image);
......
...@@ -40,6 +40,9 @@ ...@@ -40,6 +40,9 @@
#include "libgimp/gimpintl.h" #include "libgimp/gimpintl.h"
/* gimprc will be parsed with a buffer size of 1024,
so don't set this too large */
#define MAX_COMMENT_LENGTH 512
typedef enum typedef enum
{ {
...@@ -61,6 +64,7 @@ static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer); ...@@ -61,6 +64,7 @@ static void file_prefs_nav_preview_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_callback (GtkWidget *, gpointer); static void file_prefs_mem_size_callback (GtkWidget *, gpointer);
static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer); static void file_prefs_mem_size_unit_callback (GtkWidget *, gpointer);
static void file_prefs_string_callback (GtkWidget *, gpointer); static void file_prefs_string_callback (GtkWidget *, gpointer);
static void file_prefs_text_callback (GtkWidget *, gpointer);
static void file_prefs_filename_callback (GtkWidget *, gpointer); static void file_prefs_filename_callback (GtkWidget *, gpointer);
static void file_prefs_path_callback (GtkWidget *, gpointer); static void file_prefs_path_callback (GtkWidget *, gpointer);
static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer); static void file_prefs_clear_session_info_callback (GtkWidget *, gpointer);
...@@ -97,6 +101,7 @@ static gdouble old_default_xresolution; ...@@ -97,6 +101,7 @@ static gdouble old_default_xresolution;
static gdouble old_default_yresolution; static gdouble old_default_yresolution;
static GimpUnit old_default_resolution_units; static GimpUnit old_default_resolution_units;
static gint old_default_type; static gint old_default_type;
static gchar * old_default_comment;