strip the menu strings from underlines before matching. Fixed function to

2005-04-05  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/plug_in.pdb (plugins_query): strip the menu
	strings from underlines before matching. Fixed function to not
	match all procedures twice.

	* app/pdb/plug_in_cmds.c: regenerated.
This commit is contained in:
Michael Natterer 2005-04-05 20:12:58 +00:00 committed by Michael Natterer
parent ec4ece7414
commit b07c86050f
3 changed files with 69 additions and 89 deletions

View File

@ -1,3 +1,11 @@
2005-04-05 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/plug_in.pdb (plugins_query): strip the menu
strings from underlines before matching. Fixed function to not
match all procedures twice.
* app/pdb/plug_in_cmds.c: regenerated.
2005-04-05 Sven Neumann <sven@gimp.org>
* plug-ins/dbbrowser/gimpprocbrowser.c: s/Blurb/Description/

View File

@ -85,6 +85,7 @@ plugins_query_invoker (Gimp *gimp,
gint32 *time_ints;
gchar **realname_strs;
GSList *list;
GSList *matched = NULL;
gint i = 0;
regex_t sregex;
@ -121,10 +122,15 @@ plugins_query_invoker (Gimp *gimp,
name = proc_def->menu_paths->data;
}
if (search_str && match_strings (&sregex, name))
continue;
name = gimp_strip_uline (name);
num_plugins++;
if (! search_str || ! match_strings (&sregex, name))
{
num_plugins++;
matched = g_slist_prepend (matched, proc_def);
}
g_free (name);
}
}
@ -135,55 +141,35 @@ plugins_query_invoker (Gimp *gimp,
realname_strs = g_new (gchar *, num_plugins);
time_ints = g_new (gint , num_plugins);
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
matched = g_slist_reverse (matched);
for (list = matched; list; list = g_slist_next (list))
{
PlugInProcDef *proc_def = list->data;
ProcRecord *proc_rec = &proc_def->db_info;
gchar *name;
if (i > num_plugins)
g_error ("Internal error counting plugins");
if (proc_def->menu_label)
name = g_strdup_printf ("%s/%s",
(gchar *) proc_def->menu_paths->data,
proc_def->menu_label);
else
name = g_strdup (proc_def->menu_paths->data);
if (proc_def->prog && proc_def->menu_paths)
{
ProcRecord *pr = &proc_def->db_info;
gchar *name;
menu_strs[i] = gimp_strip_uline (name);
accel_strs[i] = NULL;
prog_strs[i] = g_strdup (proc_def->prog);
types_strs[i] = g_strdup (proc_def->image_types);
realname_strs[i] = g_strdup (proc_rec->name);
time_ints[i] = proc_def->mtime;
if (proc_def->menu_label)
{
name = proc_def->menu_label;
}
else
{
name = strrchr (proc_def->menu_paths->data, '/');
g_free (name);
if (name)
name = name + 1;
else
name = proc_def->menu_paths->data;
}
if (search_str && match_strings (&sregex, name))
continue;
if (proc_def->menu_label)
name = g_strdup_printf ("%s/%s",
(gchar *) proc_def->menu_paths->data,
proc_def->menu_label);
else
name = g_strdup (proc_def->menu_paths->data);
menu_strs[i] = gimp_strip_uline (name);
accel_strs[i] = NULL;
prog_strs[i] = g_strdup (proc_def->prog);
types_strs[i] = g_strdup (proc_def->image_types);
realname_strs[i] = g_strdup (pr->name);
time_ints[i] = proc_def->mtime;
g_free (name);
i++;
}
i++;
}
g_slist_free (matched);
if (search_str)
regfree (&sregex);

View File

@ -65,7 +65,8 @@ sub plugins_query {
%invoke = (
headers => [ qw("libgimpbase/gimpbase.h") ],
vars => [ 'GSList *list', 'gint i = 0', 'regex_t sregex' ],
vars => [ 'GSList *list', 'GSList *matched = NULL', 'gint i = 0',
'regex_t sregex' ],
code => <<'CODE'
{
if (search_str && strlen (search_str))
@ -99,10 +100,15 @@ sub plugins_query {
name = proc_def->menu_paths->data;
}
if (search_str && match_strings (&sregex, name))
continue;
name = gimp_strip_uline (name);
num_plugins++;
if (! search_str || ! match_strings (&sregex, name))
{
num_plugins++;
matched = g_slist_prepend (matched, proc_def);
}
g_free (name);
}
}
@ -113,55 +119,35 @@ sub plugins_query {
realname_strs = g_new (gchar *, num_plugins);
time_ints = g_new (gint , num_plugins);
for (list = gimp->plug_in_proc_defs; list; list = g_slist_next (list))
matched = g_slist_reverse (matched);
for (list = matched; list; list = g_slist_next (list))
{
PlugInProcDef *proc_def = list->data;
ProcRecord *proc_rec = &proc_def->db_info;
gchar *name;
if (i > num_plugins)
g_error ("Internal error counting plugins");
if (proc_def->menu_label)
name = g_strdup_printf ("%s/%s",
(gchar *) proc_def->menu_paths->data,
proc_def->menu_label);
else
name = g_strdup (proc_def->menu_paths->data);
if (proc_def->prog && proc_def->menu_paths)
{
ProcRecord *pr = &proc_def->db_info;
gchar *name;
menu_strs[i] = gimp_strip_uline (name);
accel_strs[i] = NULL;
prog_strs[i] = g_strdup (proc_def->prog);
types_strs[i] = g_strdup (proc_def->image_types);
realname_strs[i] = g_strdup (proc_rec->name);
time_ints[i] = proc_def->mtime;
if (proc_def->menu_label)
{
name = proc_def->menu_label;
}
else
{
name = strrchr (proc_def->menu_paths->data, '/');
g_free (name);
if (name)
name = name + 1;
else
name = proc_def->menu_paths->data;
}
if (search_str && match_strings (&sregex, name))
continue;
if (proc_def->menu_label)
name = g_strdup_printf ("%s/%s",
(gchar *) proc_def->menu_paths->data,
proc_def->menu_label);
else
name = g_strdup (proc_def->menu_paths->data);
menu_strs[i] = gimp_strip_uline (name);
accel_strs[i] = NULL;
prog_strs[i] = g_strdup (proc_def->prog);
types_strs[i] = g_strdup (proc_def->image_types);
realname_strs[i] = g_strdup (pr->name);
time_ints[i] = proc_def->mtime;
g_free (name);
i++;
}
i++;
}
g_slist_free (matched);
if (search_str)
regfree (&sregex);
}