Commit b07c8605 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

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.
parent ec4ece74
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/
......
......@@ -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->prog && proc_def->menu_paths)
{
ProcRecord *pr = &proc_def->db_info;
gchar *name;
if (proc_def->menu_label)
{
name = proc_def->menu_label;
}
else
{
name = strrchr (proc_def->menu_paths->data, '/');
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);
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 (proc_rec->name);
time_ints[i] = proc_def->mtime;
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);
g_free (name);
i++;
}
i++;
}
g_slist_free (matched);
if (search_str)
regfree (&sregex);
......
......@@ -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->prog && proc_def->menu_paths)
{
ProcRecord *pr = &proc_def->db_info;
gchar *name;
if (proc_def->menu_label)
{
name = proc_def->menu_label;
}
else
{
name = strrchr (proc_def->menu_paths->data, '/');
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);
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 (proc_rec->name);
time_ints[i] = proc_def->mtime;
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);
g_free (name);
i++;
}
i++;
}
g_slist_free (matched);
if (search_str)
regfree (&sregex);
}
......
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