Commit 807405f9 authored by Asbjørn Pettersen's avatar Asbjørn Pettersen

fix module_db_write_modulerc() open

parent 701d725b
Fri Nov 12 17:23:05 1999 ape@gandalf.spacetec.no (Asbjorn Pettersen)
* app/unittest/gimpmodule.c : Unit test program for module_db.c and
modules.
* app/module_db.c (module_db_write_modulerc): open file with "wt" so
it's works on OS/2 and WIN.
module_db_write_modulerc() now return TRUE if it succeed.
Global variable "need_to_rewrite_modulerc" is moved out of the function.
Logic is still the same and it's tested with unittest/gimpmodule prog..
Fri Nov 12 01:52:49 CET 1999 Marc Lehmann <pcg@goof.com>
* plug-ins/common/nlfilt.c: rename ROUND => SROUND to avoid clash.
......
......@@ -213,16 +213,14 @@ add_to_inhibit_string (gpointer data,
}
static void
static gboolean
module_db_write_modulerc (void)
{
GString *str;
gchar *p;
char *filename;
FILE *fp;
if (!need_to_rewrite_modulerc)
return;
gboolean saved = FALSE;
str = g_string_new (NULL);
gimp_set_foreach (modules, add_to_inhibit_string, str);
......@@ -232,24 +230,30 @@ module_db_write_modulerc (void)
p = "";
filename = gimp_personal_rc_file ("modulerc");
fp = fopen (filename, "w");
fp = fopen (filename, "wt");
g_free (filename);
if (fp)
{
fprintf (fp, "(module-load-inhibit \"%s\")\n", p);
fclose (fp);
need_to_rewrite_modulerc = FALSE;
saved = TRUE;
}
g_string_free (str, TRUE);
return (saved);
}
void
module_db_free (void)
{
module_db_write_modulerc ();
if (need_to_rewrite_modulerc)
{
if (module_db_write_modulerc ())
{
need_to_rewrite_modulerc = FALSE;
}
}
gimp_set_foreach (modules, free_a_single_module, NULL);
}
......
......@@ -213,16 +213,14 @@ add_to_inhibit_string (gpointer data,
}
static void
static gboolean
module_db_write_modulerc (void)
{
GString *str;
gchar *p;
char *filename;
FILE *fp;
if (!need_to_rewrite_modulerc)
return;
gboolean saved = FALSE;
str = g_string_new (NULL);
gimp_set_foreach (modules, add_to_inhibit_string, str);
......@@ -232,24 +230,30 @@ module_db_write_modulerc (void)
p = "";
filename = gimp_personal_rc_file ("modulerc");
fp = fopen (filename, "w");
fp = fopen (filename, "wt");
g_free (filename);
if (fp)
{
fprintf (fp, "(module-load-inhibit \"%s\")\n", p);
fclose (fp);
need_to_rewrite_modulerc = FALSE;
saved = TRUE;
}
g_string_free (str, TRUE);
return (saved);
}
void
module_db_free (void)
{
module_db_write_modulerc ();
if (need_to_rewrite_modulerc)
{
if (module_db_write_modulerc ())
{
need_to_rewrite_modulerc = FALSE;
}
}
gimp_set_foreach (modules, free_a_single_module, NULL);
}
......
......@@ -213,16 +213,14 @@ add_to_inhibit_string (gpointer data,
}
static void
static gboolean
module_db_write_modulerc (void)
{
GString *str;
gchar *p;
char *filename;
FILE *fp;
if (!need_to_rewrite_modulerc)
return;
gboolean saved = FALSE;
str = g_string_new (NULL);
gimp_set_foreach (modules, add_to_inhibit_string, str);
......@@ -232,24 +230,30 @@ module_db_write_modulerc (void)
p = "";
filename = gimp_personal_rc_file ("modulerc");
fp = fopen (filename, "w");
fp = fopen (filename, "wt");
g_free (filename);
if (fp)
{
fprintf (fp, "(module-load-inhibit \"%s\")\n", p);
fclose (fp);
need_to_rewrite_modulerc = FALSE;
saved = TRUE;
}
g_string_free (str, TRUE);
return (saved);
}
void
module_db_free (void)
{
module_db_write_modulerc ();
if (need_to_rewrite_modulerc)
{
if (module_db_write_modulerc ())
{
need_to_rewrite_modulerc = FALSE;
}
}
gimp_set_foreach (modules, free_a_single_module, NULL);
}
......
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