mirror of
https://gitlab.gnome.org/GNOME/gimp.git
synced 2025-07-03 17:33:25 +00:00
Simplify the plug-in query API and fix plugin-browser
- remove the menu path and image types from "gimp-plugins-query", they are available via GimpProcedure, also reorder and rename its remaining return values to make sense - remove the "menu_path" parameter to gimp_proc_view_new(), it can also ask GimpProcedure - adapt plugin-browser to the new API and make it use GimpProcedure - fix plugin-browser's tree view to show all menu hierarchies completely, it was still expecting menu paths that contain the menu label too
This commit is contained in:
parent
f2db331fb7
commit
388776df07
8 changed files with 86 additions and 195 deletions
|
@ -58,38 +58,30 @@ plugins_query_invoker (GimpProcedure *procedure,
|
||||||
GimpValueArray *return_vals;
|
GimpValueArray *return_vals;
|
||||||
const gchar *search_string;
|
const gchar *search_string;
|
||||||
gint num_plugins = 0;
|
gint num_plugins = 0;
|
||||||
gchar **menu_path = NULL;
|
gchar **plugin_procedure = NULL;
|
||||||
gchar **plugin_accelerator = NULL;
|
gchar **plugin_accelerator = NULL;
|
||||||
gchar **plugin_location = NULL;
|
gchar **plugin_location = NULL;
|
||||||
gchar **plugin_image_type = NULL;
|
|
||||||
gint32 *plugin_install_time = NULL;
|
gint32 *plugin_install_time = NULL;
|
||||||
gchar **plugin_real_name = NULL;
|
|
||||||
|
|
||||||
search_string = g_value_get_string (gimp_value_array_index (args, 0));
|
search_string = g_value_get_string (gimp_value_array_index (args, 0));
|
||||||
|
|
||||||
num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
|
num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
|
||||||
search_string,
|
search_string,
|
||||||
&menu_path,
|
&plugin_procedure,
|
||||||
&plugin_accelerator,
|
&plugin_accelerator,
|
||||||
&plugin_location,
|
&plugin_location,
|
||||||
&plugin_image_type,
|
|
||||||
&plugin_real_name,
|
|
||||||
&plugin_install_time);
|
&plugin_install_time);
|
||||||
|
|
||||||
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
return_vals = gimp_procedure_get_return_values (procedure, TRUE, NULL);
|
||||||
|
|
||||||
g_value_set_int (gimp_value_array_index (return_vals, 1), num_plugins);
|
g_value_set_int (gimp_value_array_index (return_vals, 1), num_plugins);
|
||||||
gimp_value_take_string_array (gimp_value_array_index (return_vals, 2), menu_path, num_plugins);
|
gimp_value_take_string_array (gimp_value_array_index (return_vals, 2), plugin_procedure, num_plugins);
|
||||||
g_value_set_int (gimp_value_array_index (return_vals, 3), num_plugins);
|
g_value_set_int (gimp_value_array_index (return_vals, 3), num_plugins);
|
||||||
gimp_value_take_string_array (gimp_value_array_index (return_vals, 4), plugin_accelerator, num_plugins);
|
gimp_value_take_string_array (gimp_value_array_index (return_vals, 4), plugin_accelerator, num_plugins);
|
||||||
g_value_set_int (gimp_value_array_index (return_vals, 5), num_plugins);
|
g_value_set_int (gimp_value_array_index (return_vals, 5), num_plugins);
|
||||||
gimp_value_take_string_array (gimp_value_array_index (return_vals, 6), plugin_location, num_plugins);
|
gimp_value_take_string_array (gimp_value_array_index (return_vals, 6), plugin_location, num_plugins);
|
||||||
g_value_set_int (gimp_value_array_index (return_vals, 7), num_plugins);
|
g_value_set_int (gimp_value_array_index (return_vals, 7), num_plugins);
|
||||||
gimp_value_take_string_array (gimp_value_array_index (return_vals, 8), plugin_image_type, num_plugins);
|
gimp_value_take_int32_array (gimp_value_array_index (return_vals, 8), plugin_install_time, num_plugins);
|
||||||
g_value_set_int (gimp_value_array_index (return_vals, 9), num_plugins);
|
|
||||||
gimp_value_take_int32_array (gimp_value_array_index (return_vals, 10), plugin_install_time, num_plugins);
|
|
||||||
g_value_set_int (gimp_value_array_index (return_vals, 11), num_plugins);
|
|
||||||
gimp_value_take_string_array (gimp_value_array_index (return_vals, 12), plugin_real_name, num_plugins);
|
|
||||||
|
|
||||||
return return_vals;
|
return return_vals;
|
||||||
}
|
}
|
||||||
|
@ -359,9 +351,9 @@ register_plug_in_procs (GimpPDB *pdb)
|
||||||
0, G_MAXINT32, 0,
|
0, G_MAXINT32, 0,
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
gimp_procedure_add_return_value (procedure,
|
gimp_procedure_add_return_value (procedure,
|
||||||
gimp_param_spec_string_array ("menu-path",
|
gimp_param_spec_string_array ("plugin-procedure",
|
||||||
"menu path",
|
"plugin procedure",
|
||||||
"The menu path of the plug-in",
|
"The plug-in procedure name",
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
gimp_procedure_add_return_value (procedure,
|
gimp_procedure_add_return_value (procedure,
|
||||||
g_param_spec_int ("num-plugins",
|
g_param_spec_int ("num-plugins",
|
||||||
|
@ -391,33 +383,11 @@ register_plug_in_procs (GimpPDB *pdb)
|
||||||
"The number of plug-ins",
|
"The number of plug-ins",
|
||||||
0, G_MAXINT32, 0,
|
0, G_MAXINT32, 0,
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
gimp_procedure_add_return_value (procedure,
|
|
||||||
gimp_param_spec_string_array ("plugin-image-type",
|
|
||||||
"plugin image type",
|
|
||||||
"Type of image that this plug-in will work on",
|
|
||||||
GIMP_PARAM_READWRITE));
|
|
||||||
gimp_procedure_add_return_value (procedure,
|
|
||||||
g_param_spec_int ("num-plugins",
|
|
||||||
"num plugins",
|
|
||||||
"The number of plug-ins",
|
|
||||||
0, G_MAXINT32, 0,
|
|
||||||
GIMP_PARAM_READWRITE));
|
|
||||||
gimp_procedure_add_return_value (procedure,
|
gimp_procedure_add_return_value (procedure,
|
||||||
gimp_param_spec_int32_array ("plugin-install-time",
|
gimp_param_spec_int32_array ("plugin-install-time",
|
||||||
"plugin install time",
|
"plugin install time",
|
||||||
"Time that the plug-in was installed",
|
"Time that the plug-in was installed",
|
||||||
GIMP_PARAM_READWRITE));
|
GIMP_PARAM_READWRITE));
|
||||||
gimp_procedure_add_return_value (procedure,
|
|
||||||
g_param_spec_int ("num-plugins",
|
|
||||||
"num plugins",
|
|
||||||
"The number of plug-ins",
|
|
||||||
0, G_MAXINT32, 0,
|
|
||||||
GIMP_PARAM_READWRITE));
|
|
||||||
gimp_procedure_add_return_value (procedure,
|
|
||||||
gimp_param_spec_string_array ("plugin-real-name",
|
|
||||||
"plugin real name",
|
|
||||||
"The internal name of the plug-in",
|
|
||||||
GIMP_PARAM_READWRITE));
|
|
||||||
gimp_pdb_register_procedure (pdb, procedure);
|
gimp_pdb_register_procedure (pdb, procedure);
|
||||||
g_object_unref (procedure);
|
g_object_unref (procedure);
|
||||||
|
|
||||||
|
|
|
@ -43,32 +43,26 @@ match_string (GRegex *regex,
|
||||||
gint
|
gint
|
||||||
gimp_plug_in_manager_query (GimpPlugInManager *manager,
|
gimp_plug_in_manager_query (GimpPlugInManager *manager,
|
||||||
const gchar *search_str,
|
const gchar *search_str,
|
||||||
gchar ***menu_strs,
|
gchar ***procedure_strs,
|
||||||
gchar ***accel_strs,
|
gchar ***accel_strs,
|
||||||
gchar ***prog_strs,
|
gchar ***prog_strs,
|
||||||
gchar ***types_strs,
|
|
||||||
gchar ***realname_strs,
|
|
||||||
gint32 **time_ints)
|
gint32 **time_ints)
|
||||||
{
|
{
|
||||||
gint32 num_plugins = 0;
|
gint num_plugins = 0;
|
||||||
GSList *list;
|
|
||||||
GSList *matched = NULL;
|
|
||||||
gint i = 0;
|
|
||||||
GRegex *sregex = NULL;
|
GRegex *sregex = NULL;
|
||||||
|
GSList *matched = NULL;
|
||||||
|
GSList *list;
|
||||||
|
gint i;
|
||||||
|
|
||||||
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), 0);
|
g_return_val_if_fail (GIMP_IS_PLUG_IN_MANAGER (manager), 0);
|
||||||
g_return_val_if_fail (menu_strs != NULL, 0);
|
g_return_val_if_fail (procedure_strs != NULL, 0);
|
||||||
g_return_val_if_fail (accel_strs != NULL, 0);
|
g_return_val_if_fail (accel_strs != NULL, 0);
|
||||||
g_return_val_if_fail (prog_strs != NULL, 0);
|
g_return_val_if_fail (prog_strs != NULL, 0);
|
||||||
g_return_val_if_fail (types_strs != NULL, 0);
|
|
||||||
g_return_val_if_fail (realname_strs != NULL, 0);
|
|
||||||
g_return_val_if_fail (time_ints != NULL, 0);
|
g_return_val_if_fail (time_ints != NULL, 0);
|
||||||
|
|
||||||
*menu_strs = NULL;
|
*procedure_strs = NULL;
|
||||||
*accel_strs = NULL;
|
*accel_strs = NULL;
|
||||||
*prog_strs = NULL;
|
*prog_strs = NULL;
|
||||||
*types_strs = NULL;
|
|
||||||
*realname_strs = NULL;
|
|
||||||
*time_ints = NULL;
|
*time_ints = NULL;
|
||||||
|
|
||||||
if (search_str && ! strlen (search_str))
|
if (search_str && ! strlen (search_str))
|
||||||
|
@ -92,21 +86,7 @@ gimp_plug_in_manager_query (GimpPlugInManager *manager,
|
||||||
|
|
||||||
if (proc->file && proc->menu_paths)
|
if (proc->file && proc->menu_paths)
|
||||||
{
|
{
|
||||||
gchar *name;
|
gchar *name = proc->menu_label;
|
||||||
|
|
||||||
if (proc->menu_label)
|
|
||||||
{
|
|
||||||
name = proc->menu_label;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
name = strrchr (proc->menu_paths->data, '/');
|
|
||||||
|
|
||||||
if (name)
|
|
||||||
name = name + 1;
|
|
||||||
else
|
|
||||||
name = proc->menu_paths->data;
|
|
||||||
}
|
|
||||||
|
|
||||||
name = gimp_strip_uline (name);
|
name = gimp_strip_uline (name);
|
||||||
|
|
||||||
|
@ -120,37 +100,23 @@ gimp_plug_in_manager_query (GimpPlugInManager *manager,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*menu_strs = g_new (gchar *, num_plugins);
|
*procedure_strs = g_new (gchar *, num_plugins);
|
||||||
*accel_strs = g_new (gchar *, num_plugins);
|
*accel_strs = g_new (gchar *, num_plugins);
|
||||||
*prog_strs = g_new (gchar *, num_plugins);
|
*prog_strs = g_new (gchar *, num_plugins);
|
||||||
*types_strs = g_new (gchar *, num_plugins);
|
|
||||||
*realname_strs = g_new (gchar *, num_plugins);
|
|
||||||
*time_ints = g_new (gint, num_plugins);
|
*time_ints = g_new (gint, num_plugins);
|
||||||
|
|
||||||
matched = g_slist_reverse (matched);
|
matched = g_slist_reverse (matched);
|
||||||
|
|
||||||
for (list = matched; list; list = g_slist_next (list))
|
for (list = matched, i = 0;
|
||||||
|
list;
|
||||||
|
list = g_slist_next (list), i++)
|
||||||
{
|
{
|
||||||
GimpPlugInProcedure *proc = list->data;
|
GimpPlugInProcedure *proc = list->data;
|
||||||
gchar *name;
|
|
||||||
|
|
||||||
if (proc->menu_label)
|
(*procedure_strs)[i] = g_strdup (gimp_object_get_name (proc));
|
||||||
name = g_strdup_printf ("%s/%s",
|
|
||||||
(gchar *) proc->menu_paths->data,
|
|
||||||
proc->menu_label);
|
|
||||||
else
|
|
||||||
name = g_strdup (proc->menu_paths->data);
|
|
||||||
|
|
||||||
(*menu_strs)[i] = gimp_strip_uline (name);
|
|
||||||
(*accel_strs)[i] = NULL;
|
(*accel_strs)[i] = NULL;
|
||||||
(*prog_strs)[i] = g_file_get_path (proc->file);
|
(*prog_strs)[i] = g_file_get_path (proc->file);
|
||||||
(*types_strs)[i] = g_strdup (proc->image_types);
|
|
||||||
(*realname_strs)[i] = g_strdup (gimp_object_get_name (proc));
|
|
||||||
(*time_ints)[i] = proc->mtime;
|
(*time_ints)[i] = proc->mtime;
|
||||||
|
|
||||||
g_free (name);
|
|
||||||
|
|
||||||
i++;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
g_slist_free (matched);
|
g_slist_free (matched);
|
||||||
|
|
|
@ -23,11 +23,9 @@
|
||||||
|
|
||||||
gint gimp_plug_in_manager_query (GimpPlugInManager *manager,
|
gint gimp_plug_in_manager_query (GimpPlugInManager *manager,
|
||||||
const gchar *search_str,
|
const gchar *search_str,
|
||||||
gchar ***menu_strs,
|
gchar ***procedure_strs,
|
||||||
gchar ***accel_strs,
|
gchar ***accel_strs,
|
||||||
gchar ***prog_strs,
|
gchar ***prog_strs,
|
||||||
gchar ***types_strs,
|
|
||||||
gchar ***realname_strs,
|
|
||||||
gint32 **time_ints);
|
gint32 **time_ints);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -330,7 +330,7 @@ browser_selection_changed (GtkTreeSelection *sel,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
gimp_browser_set_widget (GIMP_BROWSER (dialog->priv->browser),
|
gimp_browser_set_widget (GIMP_BROWSER (dialog->priv->browser),
|
||||||
gimp_proc_view_new (proc_name, NULL));
|
gimp_proc_view_new (proc_name));
|
||||||
|
|
||||||
g_free (proc_name);
|
g_free (proc_name);
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,7 +72,6 @@ static GtkWidget * gimp_proc_view_create_args (GimpProcedure *procedure,
|
||||||
/**
|
/**
|
||||||
* gimp_proc_view_new:
|
* gimp_proc_view_new:
|
||||||
* @procedure_name: The name of a procedure.
|
* @procedure_name: The name of a procedure.
|
||||||
* @menu_path: (nullable): The procedure's menu path, or %NULL.
|
|
||||||
*
|
*
|
||||||
* Returns: (transfer full): a new widget providing a view on a
|
* Returns: (transfer full): a new widget providing a view on a
|
||||||
* GIMP procedure
|
* GIMP procedure
|
||||||
|
@ -80,8 +79,7 @@ static GtkWidget * gimp_proc_view_create_args (GimpProcedure *procedure,
|
||||||
* Since: 2.4
|
* Since: 2.4
|
||||||
**/
|
**/
|
||||||
GtkWidget *
|
GtkWidget *
|
||||||
gimp_proc_view_new (const gchar *procedure_name,
|
gimp_proc_view_new (const gchar *procedure_name)
|
||||||
const gchar *menu_path)
|
|
||||||
{
|
{
|
||||||
GimpProcedure *procedure;
|
GimpProcedure *procedure;
|
||||||
GtkWidget *main_vbox;
|
GtkWidget *main_vbox;
|
||||||
|
@ -151,16 +149,6 @@ gimp_proc_view_new (const gchar *procedure_name,
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
||||||
gtk_widget_show (label);
|
gtk_widget_show (label);
|
||||||
|
|
||||||
if (menu_path)
|
|
||||||
{
|
|
||||||
label = gtk_label_new_with_mnemonic (menu_path);
|
|
||||||
gtk_label_set_selectable (GTK_LABEL (label), TRUE);
|
|
||||||
gtk_label_set_xalign (GTK_LABEL (label), 0.0);
|
|
||||||
gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
|
|
||||||
gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
|
|
||||||
gtk_widget_show (label);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (blurb)
|
if (blurb)
|
||||||
{
|
{
|
||||||
label = gtk_label_new (blurb);
|
label = gtk_label_new (blurb);
|
||||||
|
|
|
@ -31,8 +31,7 @@ G_BEGIN_DECLS
|
||||||
/* For information look into the C source or the html documentation */
|
/* For information look into the C source or the html documentation */
|
||||||
|
|
||||||
|
|
||||||
GtkWidget * gimp_proc_view_new (const gchar *procedure_name,
|
GtkWidget * gimp_proc_view_new (const gchar *procedure_name);
|
||||||
const gchar *menu_path);
|
|
||||||
|
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
|
@ -30,8 +30,8 @@ sub plugins_query {
|
||||||
);
|
);
|
||||||
|
|
||||||
@outargs = (
|
@outargs = (
|
||||||
{ name => 'menu_path', type => 'stringarray',
|
{ name => 'plugin_procedure', type => 'stringarray',
|
||||||
desc => 'The menu path of the plug-in',
|
desc => 'The plug-in procedure name',
|
||||||
array => { name => 'num_plugins',
|
array => { name => 'num_plugins',
|
||||||
desc => 'The number of plug-ins' } },
|
desc => 'The number of plug-ins' } },
|
||||||
{ name => 'plugin_accelerator', type => 'stringarray',
|
{ name => 'plugin_accelerator', type => 'stringarray',
|
||||||
|
@ -43,16 +43,8 @@ sub plugins_query {
|
||||||
desc => 'Location of the plug-in program',
|
desc => 'Location of the plug-in program',
|
||||||
array => { name => 'num_plugins', no_declare => 1,
|
array => { name => 'num_plugins', no_declare => 1,
|
||||||
desc => 'The number of plug-ins' } },
|
desc => 'The number of plug-ins' } },
|
||||||
{ name => 'plugin_image_type', type => 'stringarray',
|
|
||||||
desc => 'Type of image that this plug-in will work on',
|
|
||||||
array => { name => 'num_plugins', no_declare => 1,
|
|
||||||
desc => 'The number of plug-ins' } },
|
|
||||||
{ name => 'plugin_install_time', type => 'int32array',
|
{ name => 'plugin_install_time', type => 'int32array',
|
||||||
desc => 'Time that the plug-in was installed',
|
desc => 'Time that the plug-in was installed',
|
||||||
array => { name => 'num_plugins', no_declare => 1,
|
|
||||||
desc => 'The number of plug-ins' } },
|
|
||||||
{ name => 'plugin_real_name', type => 'stringarray',
|
|
||||||
desc => 'The internal name of the plug-in',
|
|
||||||
array => { name => 'num_plugins', no_declare => 1,
|
array => { name => 'num_plugins', no_declare => 1,
|
||||||
desc => 'The number of plug-ins' } }
|
desc => 'The number of plug-ins' } }
|
||||||
);
|
);
|
||||||
|
@ -62,11 +54,9 @@ sub plugins_query {
|
||||||
{
|
{
|
||||||
num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
|
num_plugins = gimp_plug_in_manager_query (gimp->plug_in_manager,
|
||||||
search_string,
|
search_string,
|
||||||
&menu_path,
|
&plugin_procedure,
|
||||||
&plugin_accelerator,
|
&plugin_accelerator,
|
||||||
&plugin_location,
|
&plugin_location,
|
||||||
&plugin_image_type,
|
|
||||||
&plugin_real_name,
|
|
||||||
&plugin_install_time);
|
&plugin_install_time);
|
||||||
}
|
}
|
||||||
CODE
|
CODE
|
||||||
|
|
|
@ -78,8 +78,7 @@ typedef struct
|
||||||
gchar *menu;
|
gchar *menu;
|
||||||
gchar *accel;
|
gchar *accel;
|
||||||
gchar *prog;
|
gchar *prog;
|
||||||
gchar *types;
|
gchar *procedure;
|
||||||
gchar *realname;
|
|
||||||
gint instime;
|
gint instime;
|
||||||
} PInfo;
|
} PInfo;
|
||||||
|
|
||||||
|
@ -335,7 +334,7 @@ insert_into_tree_view (PluginBrowser *browser,
|
||||||
const gchar *name,
|
const gchar *name,
|
||||||
gint64 xtime,
|
gint64 xtime,
|
||||||
const gchar *xtimestr,
|
const gchar *xtimestr,
|
||||||
const gchar *menu_str,
|
const gchar *menu_path,
|
||||||
const gchar *types_str,
|
const gchar *types_str,
|
||||||
PInfo *pinfo)
|
PInfo *pinfo)
|
||||||
{
|
{
|
||||||
|
@ -344,29 +343,12 @@ insert_into_tree_view (PluginBrowser *browser,
|
||||||
GtkTreeIter parent, iter;
|
GtkTreeIter parent, iter;
|
||||||
GtkTreeStore *tree_store;
|
GtkTreeStore *tree_store;
|
||||||
|
|
||||||
/* Find all nodes */
|
get_parent (browser, menu_path, &parent);
|
||||||
/* Last one is the leaf part */
|
|
||||||
|
|
||||||
tmp_ptr = g_strdup (menu_str);
|
|
||||||
|
|
||||||
str_ptr = strrchr (tmp_ptr, '/');
|
|
||||||
|
|
||||||
if (str_ptr == NULL)
|
|
||||||
{
|
|
||||||
g_free (tmp_ptr);
|
|
||||||
return; /* No node */
|
|
||||||
}
|
|
||||||
|
|
||||||
*str_ptr = '\0';
|
|
||||||
|
|
||||||
/* printf("inserting %s...\n",menu_str); */
|
|
||||||
|
|
||||||
get_parent (browser, tmp_ptr, &parent);
|
|
||||||
|
|
||||||
tree_store = GTK_TREE_STORE (gtk_tree_view_get_model (browser->tree_view));
|
tree_store = GTK_TREE_STORE (gtk_tree_view_get_model (browser->tree_view));
|
||||||
gtk_tree_store_append (tree_store, &iter, &parent);
|
gtk_tree_store_append (tree_store, &iter, &parent);
|
||||||
gtk_tree_store_set (tree_store, &iter,
|
gtk_tree_store_set (tree_store, &iter,
|
||||||
TREE_COLUMN_MPATH, menu_str,
|
TREE_COLUMN_MPATH, menu_path,
|
||||||
TREE_COLUMN_PATH_NAME, name,
|
TREE_COLUMN_PATH_NAME, name,
|
||||||
TREE_COLUMN_IMAGE_TYPES, types_str,
|
TREE_COLUMN_IMAGE_TYPES, types_str,
|
||||||
TREE_COLUMN_DATE, xtime,
|
TREE_COLUMN_DATE, xtime,
|
||||||
|
@ -434,47 +416,48 @@ browser_search (GimpBrowser *gimp_browser,
|
||||||
{
|
{
|
||||||
GtkTreeSelection *sel;
|
GtkTreeSelection *sel;
|
||||||
GtkTreeIter iter;
|
GtkTreeIter iter;
|
||||||
const gchar **menu_strs;
|
const gchar **procedure_strs;
|
||||||
const gchar **accel_strs;
|
const gchar **accel_strs;
|
||||||
const gchar **prog_strs;
|
const gchar **prog_strs;
|
||||||
const gchar **types_strs;
|
|
||||||
const gchar **realname_strs;
|
|
||||||
const gint *time_ints;
|
const gint *time_ints;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
menu_strs = GIMP_VALUES_GET_STRING_ARRAY (return_vals, 2);
|
procedure_strs = GIMP_VALUES_GET_STRING_ARRAY (return_vals, 2);
|
||||||
accel_strs = GIMP_VALUES_GET_STRING_ARRAY (return_vals, 4);
|
accel_strs = GIMP_VALUES_GET_STRING_ARRAY (return_vals, 4);
|
||||||
prog_strs = GIMP_VALUES_GET_STRING_ARRAY (return_vals, 6);
|
prog_strs = GIMP_VALUES_GET_STRING_ARRAY (return_vals, 6);
|
||||||
types_strs = GIMP_VALUES_GET_STRING_ARRAY (return_vals, 8);
|
time_ints = GIMP_VALUES_GET_INT32_ARRAY (return_vals, 8);
|
||||||
time_ints = GIMP_VALUES_GET_INT32_ARRAY (return_vals, 10);
|
|
||||||
realname_strs = GIMP_VALUES_GET_STRING_ARRAY (return_vals, 12);
|
|
||||||
|
|
||||||
for (i = 0; i < num_plugins; i++)
|
for (i = 0; i < num_plugins; i++)
|
||||||
{
|
{
|
||||||
|
GimpProcedure *procedure;
|
||||||
|
const gchar *types;
|
||||||
PInfo *pinfo;
|
PInfo *pinfo;
|
||||||
gchar *menu_str = g_strdup (menu_strs[i]);
|
gchar *menu_label;
|
||||||
gchar *name;
|
gchar *tmp;
|
||||||
|
GList *menu_paths;
|
||||||
|
const gchar *menu_path;
|
||||||
gchar xtimestr[50];
|
gchar xtimestr[50];
|
||||||
struct tm *x;
|
struct tm *x;
|
||||||
time_t tx;
|
time_t tx;
|
||||||
gint ret;
|
gint ret;
|
||||||
|
|
||||||
|
procedure = gimp_pdb_lookup_procedure (gimp_get_pdb (),
|
||||||
|
procedure_strs[i]);
|
||||||
|
|
||||||
|
types = gimp_procedure_get_image_types (procedure);
|
||||||
|
menu_label = g_strdup (gimp_procedure_get_menu_label (procedure));
|
||||||
|
menu_paths = gimp_procedure_get_menu_paths (procedure);
|
||||||
|
|
||||||
|
menu_path = menu_paths->data;
|
||||||
|
|
||||||
/* Strip off trailing ellipsis */
|
/* Strip off trailing ellipsis */
|
||||||
name = strstr (menu_str, "...");
|
tmp = strstr (menu_label, "...");
|
||||||
if (name && name == (menu_str + strlen (menu_str) - 3))
|
if (tmp && tmp == (menu_label + strlen (menu_label) - 3))
|
||||||
*name = '\0';
|
*tmp = '\0';
|
||||||
|
|
||||||
name = strrchr (menu_str, '/');
|
tmp = gimp_strip_uline (menu_label);
|
||||||
|
g_free (menu_label);
|
||||||
if (name)
|
menu_label = tmp;
|
||||||
{
|
|
||||||
*name = '\0';
|
|
||||||
name = name + 1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
name = menu_str;
|
|
||||||
}
|
|
||||||
|
|
||||||
tx = time_ints[i];
|
tx = time_ints[i];
|
||||||
if (tx)
|
if (tx)
|
||||||
|
@ -499,33 +482,32 @@ browser_search (GimpBrowser *gimp_browser,
|
||||||
|
|
||||||
pinfo = g_new0 (PInfo, 1);
|
pinfo = g_new0 (PInfo, 1);
|
||||||
|
|
||||||
pinfo->menu = g_strdup (menu_str);
|
pinfo->menu = g_strdup (menu_path);
|
||||||
pinfo->accel = g_strdup (accel_strs[i]);
|
pinfo->accel = g_strdup (accel_strs[i]);
|
||||||
pinfo->prog = g_strdup (prog_strs[i]);
|
pinfo->prog = g_strdup (prog_strs[i]);
|
||||||
pinfo->types = g_strdup (types_strs[i]);
|
|
||||||
pinfo->instime = time_ints[i];
|
pinfo->instime = time_ints[i];
|
||||||
pinfo->realname = g_strdup (realname_strs[i]);
|
pinfo->procedure = g_strdup (procedure_strs[i]);
|
||||||
|
|
||||||
gtk_list_store_append (list_store, &iter);
|
gtk_list_store_append (list_store, &iter);
|
||||||
gtk_list_store_set (list_store, &iter,
|
gtk_list_store_set (list_store, &iter,
|
||||||
LIST_COLUMN_NAME, name,
|
LIST_COLUMN_NAME, menu_label,
|
||||||
LIST_COLUMN_DATE, (gint64) tx,
|
LIST_COLUMN_DATE, (gint64) tx,
|
||||||
LIST_COLUMN_DATE_STRING, xtimestr,
|
LIST_COLUMN_DATE_STRING, xtimestr,
|
||||||
LIST_COLUMN_PATH, menu_str,
|
LIST_COLUMN_PATH, menu_path,
|
||||||
LIST_COLUMN_IMAGE_TYPES, types_strs[i],
|
LIST_COLUMN_IMAGE_TYPES, types,
|
||||||
LIST_COLUMN_PINFO, pinfo,
|
LIST_COLUMN_PINFO, pinfo,
|
||||||
-1);
|
-1);
|
||||||
|
|
||||||
/* Now do the tree view.... */
|
/* Now do the tree view.... */
|
||||||
insert_into_tree_view (browser,
|
insert_into_tree_view (browser,
|
||||||
name,
|
menu_label,
|
||||||
(gint64) tx,
|
(gint64) tx,
|
||||||
xtimestr,
|
xtimestr,
|
||||||
menu_str,
|
menu_path,
|
||||||
types_strs[i],
|
types,
|
||||||
pinfo);
|
pinfo);
|
||||||
|
|
||||||
g_free (menu_str);
|
g_free (menu_label);
|
||||||
}
|
}
|
||||||
|
|
||||||
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (browser->list_view));
|
gtk_tree_view_columns_autosize (GTK_TREE_VIEW (browser->list_view));
|
||||||
|
@ -815,8 +797,7 @@ browser_list_selection_changed (GtkTreeSelection *selection,
|
||||||
g_free (mpath);
|
g_free (mpath);
|
||||||
|
|
||||||
gimp_browser_set_widget (GIMP_BROWSER (browser->browser),
|
gimp_browser_set_widget (GIMP_BROWSER (browser->browser),
|
||||||
gimp_proc_view_new (pinfo->realname,
|
gimp_proc_view_new (pinfo->procedure));
|
||||||
pinfo->menu));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
|
@ -893,6 +874,5 @@ browser_tree_selection_changed (GtkTreeSelection *selection,
|
||||||
}
|
}
|
||||||
|
|
||||||
gimp_browser_set_widget (GIMP_BROWSER (browser->browser),
|
gimp_browser_set_widget (GIMP_BROWSER (browser->browser),
|
||||||
gimp_proc_view_new (pinfo->realname,
|
gimp_proc_view_new (pinfo->procedure));
|
||||||
pinfo->menu));
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue