Commit e1db698b authored by Nate Summers's avatar Nate Summers

implement a new pluginrc flag, "has-init", so that only plug-ins with init


 	* app/plug-in/plug-in-rc.c: implement a new pluginrc flag,
 	"has-init", so that only plug-ins with init functions are
 	initialized.

	* app/plug-in/plug-in.ch
 	* libgimp/gimp.c
 	* libgimpbase/gimpprotocol.ch: send a new gimpwire message,
 	GP_HAS_INIT during the query stage if the plug-in needs to be
 	initialized.  Only invoke the plug-in in init mode if the plug-in
 	has an init function.
parent 04c995fb
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -72,6 +72,7 @@ struct _PlugInDef
gchar *help_path;
time_t mtime;
gboolean query;
gboolean has_init; /* Does the plug-in need to be initialized? */
};
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -72,6 +72,7 @@ struct _PlugInDef
gchar *help_path;
time_t mtime;
gboolean query;
gboolean has_init; /* Does the plug-in need to be initialized? */
};
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -72,6 +72,7 @@ struct _PlugInDef
gchar *help_path;
time_t mtime;
gboolean query;
gboolean has_init; /* Does the plug-in need to be initialized? */
};
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -72,6 +72,7 @@ struct _PlugInDef
gchar *help_path;
time_t mtime;
gboolean query;
gboolean has_init; /* Does the plug-in need to be initialized? */
};
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -72,6 +72,7 @@ struct _PlugInDef
gchar *help_path;
time_t mtime;
gboolean query;
gboolean has_init; /* Does the plug-in need to be initialized? */
};
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -72,6 +72,7 @@ struct _PlugInDef
gchar *help_path;
time_t mtime;
gboolean query;
gboolean has_init; /* Does the plug-in need to be initialized? */
};
......
......@@ -52,6 +52,8 @@ static GTokenType plug_in_locale_def_deserialize (GScanner *scanner,
PlugInDef *plug_in_def);
static GTokenType plug_in_help_def_deserialize (GScanner *scanner,
PlugInDef *plug_in_def);
static GTokenType plug_in_has_init_deserialize (GScanner *scanner,
PlugInDef *plug_in_def);
static inline gboolean parse_token (GScanner *scanner,
GTokenType token);
......@@ -69,6 +71,7 @@ enum
PROC_DEF,
LOCALE_DEF,
HELP_DEF,
HAS_INIT,
PROC_ARG
};
......@@ -103,6 +106,8 @@ plug_in_rc_parse (const gchar *filename)
"locale-def", GINT_TO_POINTER (LOCALE_DEF));
g_scanner_scope_add_symbol (scanner, 0,
"help-def", GINT_TO_POINTER (HELP_DEF));
g_scanner_scope_add_symbol (scanner, 0,
"has-init", GINT_TO_POINTER (HAS_INIT));
g_scanner_scope_add_symbol (scanner, 0,
"proc-arg", GINT_TO_POINTER (PROC_ARG));
......@@ -207,6 +212,10 @@ plug_in_def_deserialize (GScanner *scanner)
case HELP_DEF:
token = plug_in_help_def_deserialize (scanner, plug_in_def);
break;
case HAS_INIT:
token = plug_in_has_init_deserialize (scanner, plug_in_def);
break;
default:
break;
......@@ -359,6 +368,18 @@ plug_in_help_def_deserialize (GScanner *scanner,
return G_TOKEN_LEFT_PAREN;
}
static GTokenType
plug_in_has_init_deserialize (GScanner *scanner,
PlugInDef *plug_in_def)
{
plug_in_def->has_init = TRUE;
if (!parse_token (scanner, G_TOKEN_RIGHT_PAREN))
return G_TOKEN_RIGHT_PAREN;
return G_TOKEN_LEFT_PAREN;
}
/* helper functions */
......@@ -570,6 +591,11 @@ plug_in_rc_write (GSList *plug_in_defs,
{
fprintf (fp, "\n\t(help-def \"%s\")", plug_in_def->help_path);
}
if (plug_in_def->has_init)
{
fprintf (fp, "\n\t(has-init)");
}
fprintf (fp, ")\n");
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */
/* if (plug_in_def->init) */
if (plug_in_def->has_init)
{
if (gimp->be_verbose)
g_print (_("initializing plug-in: \"%s\"\n"), plug_in_def->prog);
......@@ -1622,6 +1622,8 @@ plug_in_handle_message (WireMessage *msg)
case GP_EXTENSION_ACK:
gimp_main_loop_quit (the_gimp);
break;
case GP_HAS_INIT:
plug_in_handle_has_init();
}
}
......@@ -2196,6 +2198,11 @@ plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall)
}
}
}
static void
plug_in_handle_has_init (void)
{
current_plug_in->user_data->has_init = TRUE;
}
static gboolean
plug_in_write (GIOChannel *channel,
......
......@@ -160,6 +160,7 @@ static void plug_in_handle_proc_run (GPProcRun *proc_run);
static void plug_in_handle_proc_return (GPProcReturn *proc_return);
static void plug_in_handle_proc_install (GPProcInstall *proc_install);
static void plug_in_handle_proc_uninstall (GPProcUninstall *proc_uninstall);
static void plug_in_handle_has_init (void);
static void plug_in_init_file (const gchar *filename,
gpointer loader_data);
static void plug_in_query (PlugInDef *plug_in_def);
......@@ -438,8 +439,7 @@ plug_in_init (Gimp *gimp,
plug_in_def = tmp->data;
tmp = tmp->next;
/* FIXME: only initialize when needed */