Commit 031e3dea authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

app/app_procs.c named all public functions document_index_*(). Don't

2000-05-07  Michael Natterer  <mitch@gimp.org>

	* app/app_procs.c
	* app/docindex.[ch]: named all public functions document_index_*().
	Don't loop/segfault when opening an old "ideas" file but silently
	skip the first line.

	* app/fileops.[ch]: do some file access sanity checks before
	actually calling the load/save proc. Show the full file name
	in all error messages. Use a query_boolean_box for the overwrite
	warning. Made file_save() static.
	Also copied some Win32 #define's from libgimp/gimpenv.c for the
	file access stuff. Tor, could you have a look at them please?
parent b1ccf251
2000-05-07 Michael Natterer <mitch@gimp.org>
* app/app_procs.c
* app/docindex.[ch]: named all public functions document_index_*().
Don't loop/segfault when opening an old "ideas" file but silently
skip the first line.
* app/fileops.[ch]: do some file access sanity checks before
actually calling the load/save proc. Show the full file name
in all error messages. Use a query_boolean_box for the overwrite
warning. Made file_save() static.
Also copied some Win32 #define's from libgimp/gimpenv.c for the
file access stuff. Tor, could you have a look at them please?
2000-05-07 Sven Neumann <sven@gimp.org>
 
* gimprc.in
......
......@@ -131,8 +131,8 @@ static gint max_label_length = MAXPATHLEN;
void
gimp_init (int gimp_argc,
char **gimp_argv)
gimp_init (gint gimp_argc,
gchar **gimp_argv)
{
/* Initialize the application */
app_init ();
......@@ -597,11 +597,11 @@ app_init (void)
gchar **filenames = g_new (gchar *, last_opened_size);
gint i;
if ((fp = idea_manager_parse_init ()))
if ((fp = document_index_parse_init ()))
{
/* read the filenames... */
for (i = 0; i < last_opened_size; i++)
if ((filenames[i] = idea_manager_parse_line (fp)) == NULL)
if ((filenames[i] = document_index_parse_line (fp)) == NULL)
break;
/* ...and add them in reverse order */
......
......@@ -158,26 +158,39 @@ document_index_free (void)
}
void
idea_add (gchar *title)
document_index_add (gchar *title)
{
idea_add_in_position (title, 0);
}
FILE *
idea_manager_parse_init (void)
document_index_parse_init (void)
{
FILE *fp;
gchar *desktopfile;
gint dummy;
desktopfile = gimp_personal_rc_file ("ideas");
fp = fopen (desktopfile, "r");
if (fp != NULL)
{
/* eventually strip away the old file format's first line */
if (fscanf (fp, "%i %i %i %i", &dummy, &dummy, &dummy, &dummy) != 4)
{
fclose (fp);
fp = fopen (desktopfile, "r");
}
}
g_free (desktopfile);
return fp;
}
gchar *
idea_manager_parse_line (FILE * fp)
document_index_parse_line (FILE * fp)
{
gint length;
gchar *filename;
......@@ -211,7 +224,7 @@ load_idea_manager (IdeaManager *ideas)
FILE *fp = NULL;
if (! idea_list)
fp = idea_manager_parse_init ();
fp = document_index_parse_init ();
if (idea_list || fp)
{
......@@ -223,7 +236,7 @@ load_idea_manager (IdeaManager *ideas)
clear_white (fp);
while ((title = idea_manager_parse_line (fp)))
while ((title = document_index_parse_line (fp)))
{
idea_add_in_position (title, -1);
g_free (title);
......@@ -414,13 +427,13 @@ idea_add_in_position_with_select (gchar *title,
{
FILE *fp;
fp = idea_manager_parse_init ();
fp = document_index_parse_init ();
if (fp)
{
gchar *filename;
while ((filename = idea_manager_parse_line (fp)))
while ((filename = document_index_parse_line (fp)))
{
idea_list = g_list_append (idea_list, g_strdup (filename));
g_free (filename);
......@@ -807,7 +820,7 @@ open_idea_window (void)
break;
gtk_misc_set_padding (GTK_MISC (GTK_BIN (ops_buttons[i].widget)->child),
8, 0);
12, 0);
}
/* Load and Show window */
......
......@@ -19,12 +19,12 @@
#include <gtk/gtk.h>
void document_index_create (void);
void document_index_free (void);
void document_index_create (void);
void document_index_free (void);
void idea_add (gchar *label);
void document_index_add (gchar *label);
FILE * idea_manager_parse_init (void);
gchar * idea_manager_parse_line (FILE *fp);
FILE * document_index_parse_init (void);
gchar * document_index_parse_line (FILE *fp);
#endif /* __DOCINDEX_H__ */
This diff is collapsed.
......@@ -49,10 +49,6 @@ void file_save_by_extension_callback (GtkWidget *widget,
gint file_open (gchar *filename,
gchar *raw_filename);
gint file_save (GimpImage *gimage,
gchar *filename,
gchar *raw_filename,
RunModeType mode);
PlugInProcDef * file_proc_find (GSList *procs,
gchar *filename);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment