added a static boolean "busy" variable to make sure we handle only one

2003-07-24  Michael Natterer  <mitch@gimp.org>

	* app/widgets/gimphelp.c (gimp_help_internal): added a static
	boolean "busy" variable to make sure we handle only one help
	request at a time. Together with the now synchronous
	GIMP_EXTENSION starting this keeps us from showing multiple help
	browsers.

	Pass the help_locale around instead oh hardcoding it to "C" at the
	bottom (now it's hardcoded a few functions above ;)
This commit is contained in:
Michael Natterer 2003-07-24 17:30:14 +00:00 committed by Michael Natterer
parent f77a01a52d
commit 5ac4af9223
2 changed files with 30 additions and 7 deletions

View File

@ -1,3 +1,14 @@
2003-07-24 Michael Natterer <mitch@gimp.org>
* app/widgets/gimphelp.c (gimp_help_internal): added a static
boolean "busy" variable to make sure we handle only one help
request at a time. Together with the now synchronous
GIMP_EXTENSION starting this keeps us from showing multiple help
browsers.
Pass the help_locale around instead oh hardcoding it to "C" at the
bottom (now it's hardcoded a few functions above ;)
2003-07-24 Michael Natterer <mitch@gimp.org>
* app/widgets/gimpcontainertreeview.c: removed some old #if 0'ed

View File

@ -57,6 +57,7 @@ struct _GimpIdleHelp
{
Gimp *gimp;
gchar *help_path;
gchar *help_locale;
gchar *help_data;
};
@ -94,6 +95,8 @@ gimp_help (Gimp *gimp,
if (help_path && strlen (help_path))
idle_help->help_path = g_strdup (help_path);
idle_help->help_locale = g_strdup ("C");
if (help_data && strlen (help_data))
idle_help->help_data = g_strdup (help_data);
@ -109,7 +112,6 @@ gimp_idle_help (gpointer data)
{
GimpIdleHelp *idle_help;
GimpHelpBrowserType browser;
static gchar *current_locale = "C";
idle_help = (GimpIdleHelp *) data;
@ -134,14 +136,14 @@ gimp_idle_help (gpointer data)
case GIMP_HELP_BROWSER_GIMP:
if (gimp_help_internal (idle_help->gimp,
idle_help->help_path,
current_locale,
idle_help->help_locale,
idle_help->help_data))
break;
case GIMP_HELP_BROWSER_NETSCAPE:
gimp_help_netscape (idle_help->gimp,
idle_help->help_path,
current_locale,
idle_help->help_locale,
idle_help->help_data);
break;
@ -149,10 +151,9 @@ gimp_idle_help (gpointer data)
break;
}
if (idle_help->help_path)
g_free (idle_help->help_path);
if (idle_help->help_data)
g_free (idle_help->help_data);
g_free (idle_help->help_path);
g_free (idle_help->help_locale);
g_free (idle_help->help_data);
g_free (idle_help);
return FALSE;
@ -181,6 +182,13 @@ gimp_help_internal (Gimp *gimp,
{
ProcRecord *proc_rec;
static gboolean busy = FALSE;
if (busy)
return TRUE;
busy = TRUE;
/* Check if a help browser is already running */
proc_rec = procedural_db_lookup (gimp, "extension_gimp_help_browser_temp");
@ -206,6 +214,8 @@ gimp_help_internal (Gimp *gimp,
gtk_widget_show (not_found);
gtk_main ();
busy = FALSE;
return (GIMP_GUI_CONFIG (gimp->config)->help_browser
!= GIMP_HELP_BROWSER_NETSCAPE);
}
@ -241,6 +251,8 @@ gimp_help_internal (Gimp *gimp,
procedural_db_destroy_args (return_vals, nreturn_vals);
}
busy = FALSE;
return TRUE;
}