simplified the mucho weirdo code which obviously wasn't working as

2000-06-27  Sven Neumann  <sven@gimp.org>

        * plug-ins/helpbrowser/helpbrowser.c: simplified the
        mucho weirdo code which obviously wasn't working as
        expected. Should fix bug #15284.
This commit is contained in:
Sven Neumann 2000-06-27 20:21:31 +00:00 committed by Sven Neumann
parent bb1d35d349
commit c231c15089
2 changed files with 47 additions and 57 deletions

View File

@ -1,3 +1,9 @@
2000-06-27 Sven Neumann <sven@gimp.org>
* plug-ins/helpbrowser/helpbrowser.c: simplified the
mucho weirdo code which obviously wasn't working as
expected. Should fix bug #15284.
Sun Jun 25 22:44:12 CEST 2000 Marc Lehmann <pcg@goof.com> Sun Jun 25 22:44:12 CEST 2000 Marc Lehmann <pcg@goof.com>
* paint_funcs.c: Fix small bug in last patch. * paint_funcs.c: Fix small bug in last patch.

View File

@ -982,46 +982,38 @@ run_temp_proc (gchar *name,
{ {
static GParam values[1]; static GParam values[1];
GStatusType status = STATUS_SUCCESS; GStatusType status = STATUS_SUCCESS;
gchar *help_path = NULL; gchar *help_path;
gchar *locale = NULL; gchar *locale;
gchar *help_file = NULL; gchar *help_file;
gchar *path; gchar *path;
/* Make sure all the arguments are there! */ /* set default values */
if ((nparams != 3) ||
!param[1].data.d_string ||
!strlen (param[1].data.d_string) ||
!param[2].data.d_string ||
!strlen (param[2].data.d_string))
{
help_path = g_strconcat (gimp_data_directory(), G_DIR_SEPARATOR_S, help_path = g_strconcat (gimp_data_directory(), G_DIR_SEPARATOR_S,
GIMP_HELP_PREFIX, NULL); GIMP_HELP_PREFIX, NULL);
locale = g_strdup ("C"); locale = g_strdup ("C");
help_file = g_strdup ("welcome.html"); help_file = g_strdup ("welcome.html");
}
/* Make sure all the arguments are there! */
if (nparams == 3) if (nparams == 3)
{ {
if (!param[0].data.d_string || if (param[0].data.d_string && strlen (param[0].data.d_string))
!strlen (param[0].data.d_string))
{
help_path = g_strconcat (gimp_data_directory(),
G_DIR_SEPARATOR_S,
GIMP_HELP_PREFIX, NULL);
locale = g_strdup (param[1].data.d_string);
help_file = g_strdup (param[2].data.d_string);
}
else
{ {
g_free (help_path);
help_path = g_strdup (param[0].data.d_string); help_path = g_strdup (param[0].data.d_string);
locale = g_strdup (param[1].data.d_string);
help_file = g_strdup (param[2].data.d_string);
g_strdelimit (help_path, "/", G_DIR_SEPARATOR); g_strdelimit (help_path, "/", G_DIR_SEPARATOR);
} }
if (param[1].data.d_string && strlen (param[1].data.d_string))
{
g_free (locale);
locale = g_strdup (param[1].data.d_string);
} }
if (param[2].data.d_string && strlen (param[2].data.d_string))
{
g_free (help_file);
help_file = g_strdup (param[2].data.d_string);
g_strdelimit (help_file, "/", G_DIR_SEPARATOR); g_strdelimit (help_file, "/", G_DIR_SEPARATOR);
}
}
path = g_strconcat (help_path, G_DIR_SEPARATOR_S, path = g_strconcat (help_path, G_DIR_SEPARATOR_S,
locale, G_DIR_SEPARATOR_S, locale, G_DIR_SEPARATOR_S,
@ -1166,38 +1158,32 @@ run (gchar *name,
case RUN_INTERACTIVE: case RUN_INTERACTIVE:
case RUN_NONINTERACTIVE: case RUN_NONINTERACTIVE:
case RUN_WITH_LAST_VALS: case RUN_WITH_LAST_VALS:
/* Make sure all the arguments are there! */ /* set default values */
if ((nparams != 4) ||
!param[2].data.d_string ||
!strlen (param[2].data.d_string) ||
!param[3].data.d_string ||
!strlen (param[3].data.d_string))
{
help_path = g_strconcat (gimp_data_directory(), G_DIR_SEPARATOR_S, help_path = g_strconcat (gimp_data_directory(), G_DIR_SEPARATOR_S,
GIMP_HELP_PREFIX, NULL); GIMP_HELP_PREFIX, NULL);
locale = g_strdup ("C"); locale = g_strdup ("C");
help_file = g_strdup ("welcome.html"); help_file = g_strdup ("welcome.html");
}
/* Make sure all the arguments are there! */
if (nparams == 4) if (nparams == 4)
{ {
if (!param[1].data.d_string || if (param[1].data.d_string && strlen (param[1].data.d_string))
!strlen (param[1].data.d_string))
{
help_path = g_strconcat (gimp_data_directory(),
G_DIR_SEPARATOR_S,
GIMP_HELP_PREFIX, NULL);
locale = g_strdup (param[2].data.d_string);
help_file = g_strdup (param[3].data.d_string);
}
else
{ {
g_free (help_path);
help_path = g_strdup (param[1].data.d_string); help_path = g_strdup (param[1].data.d_string);
locale = g_strdup (param[2].data.d_string);
help_file = g_strdup (param[3].data.d_string);
g_strdelimit (help_path, "/", G_DIR_SEPARATOR); g_strdelimit (help_path, "/", G_DIR_SEPARATOR);
} }
if (param[2].data.d_string && strlen (param[2].data.d_string))
{
g_free (locale);
locale = g_strdup (param[2].data.d_string);
}
if (param[3].data.d_string && strlen (param[3].data.d_string))
{
g_free (help_file);
help_file = g_strdup (param[3].data.d_string);
g_strdelimit (help_file, "/", G_DIR_SEPARATOR);
}
} }
break; break;
@ -1208,8 +1194,6 @@ run (gchar *name,
if (status == STATUS_SUCCESS) if (status == STATUS_SUCCESS)
{ {
g_strdelimit (help_file, "/", G_DIR_SEPARATOR);
if (!open_url (help_path, locale, help_file)) if (!open_url (help_path, locale, help_file))
values[0].data.d_status = STATUS_EXECUTION_ERROR; values[0].data.d_status = STATUS_EXECUTION_ERROR;
else else