in Image/Filters move all entries that are not submenus to the top of the

* app/menus.c: in Image/Filters move all entries that are not
  submenus to the top of the menu.

* app/plug_in.c: order all plugin menu-entries alphabetically
  (in the current locale) before sending them to menus.c.

* plug-ins/script-fu/script-fu-scripts.c: order all script-fu
  menu-entries alphabetically (in the current locale) before
  registering them.

* plug-ins/script-fu/script-fu.c: minor cleanups

* plug-ins/bmp/bmpread.c
* plug-ins/bmp/bmpwrite.c
* plug-ins/xjt/xjt.c: strings used with g_message do not need
  a trailing newline


--Sven
This commit is contained in:
Sven Neumann 2000-05-07 22:04:51 +00:00
parent cbc2cd199e
commit dc5da262a3
36 changed files with 2415 additions and 1342 deletions

View File

@ -1,3 +1,26 @@
2000-05-07 Sven Neumann <sven@gimp.org>
* app/menus.c: in Image/Filters move all entries that are not
submenus to the top of the menu.
* app/plug_in.c: order all plugin menu-entries alphabetically
(in the current locale) before sending them to menus.c. This does
not yet work perfectly since gimp-perl i18n seems to be broken
(at least on my box). This was already the case _before_ this
change and I have checked carefully, that the gimp-perl domain
gets passed through to menus_create_item_...() correctly.
* plug-ins/script-fu/script-fu-scripts.c: order all script-fu
menu-entries alphabetically (in the current locale) before
registering them.
* plug-ins/script-fu/script-fu.c: minor cleanups
* plug-ins/bmp/bmpread.c
* plug-ins/bmp/bmpwrite.c
* plug-ins/xjt/xjt.c: strings used with g_message do not need
a trailing newline
2000-05-07 Michael Natterer <mitch@gimp.org> 2000-05-07 Michael Natterer <mitch@gimp.org>
* app/app_procs.c * app/app_procs.c

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -557,8 +557,6 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL }, NULL, NULL },
{ { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" }, { { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
NULL, NULL }, NULL, NULL },
/* <Image>/Script-Fu */
}; };
static guint n_image_entries = (sizeof (image_entries) / static guint n_image_entries = (sizeof (image_entries) /
sizeof (image_entries[0])); sizeof (image_entries[0]));
@ -1020,11 +1018,31 @@ menus_reorder_plugins (void)
} }
} }
/* Move "<Image>/Filters/Filter all Layers..." before the separator */ /* Move all menu items under "<Image>/Filters" which are not submenus or
* separators to the top of the menu
*/
pos = 3;
menu_item = gtk_item_factory_get_widget (image_factory, menu_item = gtk_item_factory_get_widget (image_factory,
"/Filters/Filter all Layers..."); "/Filters/Filter all Layers...");
if (menu_item && menu_item->parent) if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3); {
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
if (! GTK_MENU_ITEM (menu_item)->submenu &&
GTK_IS_LABEL (GTK_BIN (menu_item)->child))
{
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, pos);
list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
pos++;
}
}
}
/* Reorder Rotate plugin menu entries */ /* Reorder Rotate plugin menu entries */
pos = 2; pos = 2;
@ -1145,6 +1163,9 @@ menus_tools_create (ToolInfo *tool_info)
{ {
GimpItemFactoryEntry entry; GimpItemFactoryEntry entry;
if (tool_info->menu_path == NULL)
return;
entry.entry.path = tool_info->menu_path; entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel; entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback; entry.entry.callback = tools_select_cmd_callback;
@ -1642,9 +1663,7 @@ menus_init (void)
for (i = 0; i < num_tools; i++) for (i = 0; i < num_tools; i++)
{ {
/* FIXME this need to use access functions to check a flag */ menus_tools_create (&tool_info[i]);
if (tool_info[i].menu_path)
menus_tools_create (&tool_info[i]);
} }
/* reorder <Image>/Image/Colors */ /* reorder <Image>/Image/Colors */

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -557,8 +557,6 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL }, NULL, NULL },
{ { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" }, { { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
NULL, NULL }, NULL, NULL },
/* <Image>/Script-Fu */
}; };
static guint n_image_entries = (sizeof (image_entries) / static guint n_image_entries = (sizeof (image_entries) /
sizeof (image_entries[0])); sizeof (image_entries[0]));
@ -1020,11 +1018,31 @@ menus_reorder_plugins (void)
} }
} }
/* Move "<Image>/Filters/Filter all Layers..." before the separator */ /* Move all menu items under "<Image>/Filters" which are not submenus or
* separators to the top of the menu
*/
pos = 3;
menu_item = gtk_item_factory_get_widget (image_factory, menu_item = gtk_item_factory_get_widget (image_factory,
"/Filters/Filter all Layers..."); "/Filters/Filter all Layers...");
if (menu_item && menu_item->parent) if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3); {
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
if (! GTK_MENU_ITEM (menu_item)->submenu &&
GTK_IS_LABEL (GTK_BIN (menu_item)->child))
{
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, pos);
list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
pos++;
}
}
}
/* Reorder Rotate plugin menu entries */ /* Reorder Rotate plugin menu entries */
pos = 2; pos = 2;
@ -1145,6 +1163,9 @@ menus_tools_create (ToolInfo *tool_info)
{ {
GimpItemFactoryEntry entry; GimpItemFactoryEntry entry;
if (tool_info->menu_path == NULL)
return;
entry.entry.path = tool_info->menu_path; entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel; entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback; entry.entry.callback = tools_select_cmd_callback;
@ -1642,9 +1663,7 @@ menus_init (void)
for (i = 0; i < num_tools; i++) for (i = 0; i < num_tools; i++)
{ {
/* FIXME this need to use access functions to check a flag */ menus_tools_create (&tool_info[i]);
if (tool_info[i].menu_path)
menus_tools_create (&tool_info[i]);
} }
/* reorder <Image>/Image/Colors */ /* reorder <Image>/Image/Colors */

View File

@ -557,8 +557,6 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL }, NULL, NULL },
{ { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" }, { { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
NULL, NULL }, NULL, NULL },
/* <Image>/Script-Fu */
}; };
static guint n_image_entries = (sizeof (image_entries) / static guint n_image_entries = (sizeof (image_entries) /
sizeof (image_entries[0])); sizeof (image_entries[0]));
@ -1020,11 +1018,31 @@ menus_reorder_plugins (void)
} }
} }
/* Move "<Image>/Filters/Filter all Layers..." before the separator */ /* Move all menu items under "<Image>/Filters" which are not submenus or
* separators to the top of the menu
*/
pos = 3;
menu_item = gtk_item_factory_get_widget (image_factory, menu_item = gtk_item_factory_get_widget (image_factory,
"/Filters/Filter all Layers..."); "/Filters/Filter all Layers...");
if (menu_item && menu_item->parent) if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3); {
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
if (! GTK_MENU_ITEM (menu_item)->submenu &&
GTK_IS_LABEL (GTK_BIN (menu_item)->child))
{
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, pos);
list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
pos++;
}
}
}
/* Reorder Rotate plugin menu entries */ /* Reorder Rotate plugin menu entries */
pos = 2; pos = 2;
@ -1145,6 +1163,9 @@ menus_tools_create (ToolInfo *tool_info)
{ {
GimpItemFactoryEntry entry; GimpItemFactoryEntry entry;
if (tool_info->menu_path == NULL)
return;
entry.entry.path = tool_info->menu_path; entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel; entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback; entry.entry.callback = tools_select_cmd_callback;
@ -1642,9 +1663,7 @@ menus_init (void)
for (i = 0; i < num_tools; i++) for (i = 0; i < num_tools; i++)
{ {
/* FIXME this need to use access functions to check a flag */ menus_tools_create (&tool_info[i]);
if (tool_info[i].menu_path)
menus_tools_create (&tool_info[i]);
} }
/* reorder <Image>/Image/Colors */ /* reorder <Image>/Image/Colors */

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -109,6 +109,15 @@ struct _PlugInBlocked
}; };
typedef struct _PlugInMenuEntry PlugInMenuEntry;
struct _PlugInMenuEntry
{
PlugInProcDef *proc_def;
gchar *domain;
};
static gboolean plug_in_write (GIOChannel *channel, static gboolean plug_in_write (GIOChannel *channel,
guint8 *buf, guint8 *buf,
gulong count); gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def); PlugInDef *plug_in_def);
static void plug_in_add_to_db (void); static void plug_in_add_to_db (void);
static void plug_in_make_menu (void); static void plug_in_make_menu (void);
static gint plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar);
static void plug_in_callback (GtkWidget *widget, static void plug_in_callback (GtkWidget *widget,
gpointer client_data); gpointer client_data);
static void plug_in_proc_def_insert (PlugInProcDef *proc_def, static void plug_in_proc_def_insert (PlugInProcDef *proc_def,
@ -1726,8 +1738,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
PlugInDef *plug_in_def = NULL; PlugInDef *plug_in_def = NULL;
PlugInProcDef *proc_def; PlugInProcDef *proc_def;
ProcRecord *proc = NULL; ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL; GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL; gchar *prog = NULL;
gboolean add_proc_def; gboolean add_proc_def;
gint i; gint i;
@ -1879,7 +1891,7 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
proc_def->image_types = g_strdup (proc_install->image_types); proc_def->image_types = g_strdup (proc_install->image_types);
proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types); proc_def->image_types_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */ /* Install temp one use todays time */
proc_def->mtime = time(NULL); proc_def->mtime = time (NULL);
proc = &proc_def->db_info; proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY: case PDB_TEMPORARY:
if (add_proc_def) if (add_proc_def)
current_plug_in->temp_proc_defs = g_slist_prepend (current_plug_in->temp_proc_defs, proc_def); current_plug_in->temp_proc_defs =
g_slist_prepend (current_plug_in->temp_proc_defs, proc_def);
proc_defs = g_slist_append (proc_defs, proc_def); proc_defs = g_slist_append (proc_defs, proc_def);
proc->exec_method.temporary.plug_in = (void *) current_plug_in; proc->exec_method.temporary.plug_in = (void *) current_plug_in;
@ -1933,32 +1946,21 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
/* If there is a menu path specified, create a menu entry */ /* If there is a menu path specified, create a menu entry */
if (proc_install->menu_path) if (proc_install->menu_path)
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = proc_install->menu_path;
entry.entry.accelerator = NULL;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
/* Below we use a hack to allow translations of Script-Fu paths. /* Below we use a hack to allow translations of Script-Fu paths.
Would be nice if we could solve this properly, but I haven't Would be nice if we could solve this properly, but I haven't
found a way yet ... (Sven) */ found a way yet ... (Sven) */
if (plug_in_def && plug_in_def->locale_domain) if (plug_in_def && plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain, proc); menu_entry->domain = plug_in_def->locale_domain;
else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0) else if (strncmp (proc_def->db_info.name, "script_fu", 9) == 0)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc); menu_entry->domain = "gimp-script-fu";
else else
menus_create_item_from_full_path (&entry, std_plugins_domain, proc); menu_entry->domain = std_plugins_domain;
/* plug_in_make_menu_entry frees the menu_entry for us */
plug_in_make_menu_entry (NULL, menu_entry, NULL);
} }
break; break;
} }
@ -2379,20 +2381,62 @@ plug_in_add_to_db (void)
} }
} }
/*
* The following function has to be a GTraverseFunction,
* but is also called directly. Please note that it frees the
* menu_entry strcuture. --Sven
*/
static gint
plug_in_make_menu_entry (gpointer foo,
PlugInMenuEntry *menu_entry,
gpointer bar)
{
GimpItemFactoryEntry entry;
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (menu_entry->proc_def->prog),
".html",
NULL);
g_strdown (help_page);
entry.entry.path = menu_entry->proc_def->menu_path;
entry.entry.accelerator = menu_entry->proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
menus_create_item_from_full_path (&entry,
menu_entry->domain,
&menu_entry->proc_def->db_info);
g_free (menu_entry);
return FALSE;
}
static void static void
plug_in_make_menu (void) plug_in_make_menu (void)
{ {
GimpItemFactoryEntry entry; PlugInDef *plug_in_def;
PlugInDef *plug_in_def; PlugInProcDef *proc_def;
PlugInProcDef *proc_def; PlugInMenuEntry *menu_entry;
GSList *domains = NULL; GSList *domains = NULL;
GSList *procs; GSList *procs;
GSList *tmp; GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS #ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR); bindtextdomain (std_plugins_domain, LOCALEDIR);
domains = g_slist_append (domains, std_plugins_domain); domains = g_slist_append (domains, std_plugins_domain);
#endif #endif
#ifdef ENABLE_NLS
menu_entries = g_tree_new ((GCompareFunc)strcoll);
#else
menu_entries = g_tree_new ((GCompareFunc)strcmp);
#endif
tmp = plug_in_defs; tmp = plug_in_defs;
while (tmp) while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes && !proc_def->prefixes &&
!proc_def->magics)) !proc_def->magics))
{ {
gchar *help_page; menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
help_page = g_strconcat ("filters/", menu_entry->domain = plug_in_def->locale_domain ?
g_basename (proc_def->prog), plug_in_def->locale_domain : std_plugins_domain;
".html",
NULL); g_tree_insert (menu_entries,
g_strdown (help_page); dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
entry.entry.path = proc_def->menu_path;
entry.entry.accelerator = proc_def->accelerator;
entry.entry.callback = plug_in_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.help_page = help_page;
entry.description = NULL;
if (plug_in_def->locale_domain)
menus_create_item_from_full_path (&entry, plug_in_def->locale_domain,
&proc_def->db_info);
else
menus_create_item_from_full_path (&entry, std_plugins_domain,
&proc_def->db_info);
} }
} }
} }
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains); g_slist_free (domains);
} }

View File

@ -557,8 +557,6 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL }, NULL, NULL },
{ { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" }, { { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
NULL, NULL }, NULL, NULL },
/* <Image>/Script-Fu */
}; };
static guint n_image_entries = (sizeof (image_entries) / static guint n_image_entries = (sizeof (image_entries) /
sizeof (image_entries[0])); sizeof (image_entries[0]));
@ -1020,11 +1018,31 @@ menus_reorder_plugins (void)
} }
} }
/* Move "<Image>/Filters/Filter all Layers..." before the separator */ /* Move all menu items under "<Image>/Filters" which are not submenus or
* separators to the top of the menu
*/
pos = 3;
menu_item = gtk_item_factory_get_widget (image_factory, menu_item = gtk_item_factory_get_widget (image_factory,
"/Filters/Filter all Layers..."); "/Filters/Filter all Layers...");
if (menu_item && menu_item->parent) if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3); {
menu = menu_item->parent;
for (list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos); list;
list = g_list_next (list))
{
menu_item = GTK_WIDGET (list->data);
if (! GTK_MENU_ITEM (menu_item)->submenu &&
GTK_IS_LABEL (GTK_BIN (menu_item)->child))
{
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, pos);
list = g_list_nth (GTK_MENU_SHELL (menu)->children, pos);
pos++;
}
}
}
/* Reorder Rotate plugin menu entries */ /* Reorder Rotate plugin menu entries */
pos = 2; pos = 2;
@ -1145,6 +1163,9 @@ menus_tools_create (ToolInfo *tool_info)
{ {
GimpItemFactoryEntry entry; GimpItemFactoryEntry entry;
if (tool_info->menu_path == NULL)
return;
entry.entry.path = tool_info->menu_path; entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel; entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback; entry.entry.callback = tools_select_cmd_callback;
@ -1642,9 +1663,7 @@ menus_init (void)
for (i = 0; i < num_tools; i++) for (i = 0; i < num_tools; i++)
{ {
/* FIXME this need to use access functions to check a flag */ menus_tools_create (&tool_info[i]);
if (tool_info[i].menu_path)
menus_tools_create (&tool_info[i]);
} }
/* reorder <Image>/Image/Colors */ /* reorder <Image>/Image/Colors */

View File

@ -61,7 +61,7 @@ ReadBMP (gchar *name)
if (!fd) if (!fd)
{ {
g_message (_("%s: can't open \"%s\"\n"), prog_name, filename); g_message (_("%s: can't open \"%s\""), prog_name, filename);
return -1; return -1;
} }
@ -69,7 +69,7 @@ ReadBMP (gchar *name)
if (!ReadOK(fd, buffer, 18) || (strncmp(buffer,"BM",2))) if (!ReadOK(fd, buffer, 18) || (strncmp(buffer,"BM",2)))
{ {
g_message (_("%s: %s is not a valid BMP file\n"), prog_name, filename); g_message (_("%s: %s is not a valid BMP file"), prog_name, filename);
return -1; return -1;
} }
@ -87,7 +87,7 @@ ReadBMP (gchar *name)
{ {
if (!ReadOK (fd, buffer, 8)) if (!ReadOK (fd, buffer, 8))
{ {
g_message (_("%s: error reading BMP file header\n"), prog_name); g_message (_("%s: error reading BMP file header"), prog_name);
return -1; return -1;
} }
@ -101,7 +101,7 @@ ReadBMP (gchar *name)
{ {
if (!ReadOK (fd, buffer, Bitmap_File_Head.biSize - 4)) if (!ReadOK (fd, buffer, Bitmap_File_Head.biSize - 4))
{ {
g_message (_("%s: error reading BMP file header\n"), prog_name); g_message (_("%s: error reading BMP file header"), prog_name);
return -1; return -1;
} }
Bitmap_Head.biWidth =ToL (&buffer[0x00]); /* 12 */ Bitmap_Head.biWidth =ToL (&buffer[0x00]); /* 12 */
@ -121,7 +121,7 @@ ReadBMP (gchar *name)
{ {
if (!ReadOK (fd, buffer, Bitmap_File_Head.biSize - 4)) if (!ReadOK (fd, buffer, Bitmap_File_Head.biSize - 4))
{ {
g_message (_("%s: error reading BMP file header\n"), prog_name); g_message (_("%s: error reading BMP file header"), prog_name);
return -1; return -1;
} }
Bitmap_Head.biWidth =ToL (&buffer[0x00]); /* 12 */ Bitmap_Head.biWidth =ToL (&buffer[0x00]); /* 12 */
@ -139,7 +139,7 @@ ReadBMP (gchar *name)
} }
else else
{ {
g_message (_("%s: error reading BMP file header\n"), prog_name); g_message (_("%s: error reading BMP file header"), prog_name);
return -1; return -1;
} }
@ -227,7 +227,7 @@ ReadColorMap (FILE *fd,
{ {
if (!ReadOK (fd, rgb, size)) if (!ReadOK (fd, rgb, size))
{ {
g_message (_("%s: bad colormap\n"), prog_name); g_message (_("%s: bad colormap"), prog_name);
return -1; return -1;
} }

View File

@ -101,7 +101,7 @@ WriteBMP (gchar *filename,
case INDEXED_IMAGE: case INDEXED_IMAGE:
break; break;
default: default:
g_message(_("bmp: cannot operate on unknown image types or alpha images")); g_message(_("BMP: cannot operate on unknown image types or alpha images"));
return STATUS_EXECUTION_ERROR; return STATUS_EXECUTION_ERROR;
break; break;
} }
@ -164,7 +164,7 @@ WriteBMP (gchar *filename,
outfile = fopen (filename, "wb"); outfile = fopen (filename, "wb");
if (!outfile) if (!outfile)
{ {
g_message (_("can't open %s\n"), filename); g_message (_("Can't open %s"), filename);
return STATUS_EXECUTION_ERROR; return STATUS_EXECUTION_ERROR;
} }

View File

@ -147,6 +147,7 @@ typedef struct
SFArgValue *arg_defaults; SFArgValue *arg_defaults;
SFArgValue *arg_values; SFArgValue *arg_values;
gint32 image_based; gint32 image_based;
GParamDef *args; /* used only temporary until installed */
} SFScript; } SFScript;
typedef struct typedef struct
@ -164,6 +165,12 @@ extern long nlength (LISP obj);
* Local Functions * Local Functions
*/ */
static gint script_fu_install_script (gpointer foo,
SFScript *script,
gpointer bar);
static gint script_fu_remove_script (gpointer foo,
SFScript *script,
gpointer bar);
static void script_fu_script_proc (gchar *name, static void script_fu_script_proc (gchar *name,
gint nparams, gint nparams,
GParam *params, GParam *params,
@ -245,7 +252,7 @@ static gboolean current_command_enabled = FALSE;
static gint command_count = 0; static gint command_count = 0;
static gint consec_command_count = 0; static gint consec_command_count = 0;
static gchar *last_command = NULL; static gchar *last_command = NULL;
static GList *script_list = NULL; static GTree *script_list = NULL;
extern gchar siod_err_msg[]; extern gchar siod_err_msg[];
@ -273,22 +280,17 @@ script_fu_find_scripts (void)
/* Make sure to clear any existing scripts */ /* Make sure to clear any existing scripts */
if (script_list != NULL) if (script_list != NULL)
{ {
GList *list; g_tree_traverse (script_list,
SFScript *script; (GTraverseFunc)script_fu_remove_script, G_IN_ORDER, NULL);
g_tree_destroy (script_list);
list = script_list;
while (list)
{
script = (SFScript *) list->data;
script_fu_free_script (script);
list = list->next;
}
if (script_list)
g_list_free (script_list);
script_list = NULL;
} }
#ifdef ENABLE_NLS
script_list = g_tree_new ((GCompareFunc)strcoll);
#else
script_list = g_tree_new ((GCompareFunc)strcmp);
#endif
return_vals = gimp_run_procedure ("gimp_gimprc_query", return_vals = gimp_run_procedure ("gimp_gimprc_query",
&nreturn_vals, &nreturn_vals,
PARAM_STRING, "script-fu-path", PARAM_STRING, "script-fu-path",
@ -381,17 +383,21 @@ script_fu_find_scripts (void)
token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S); token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S);
} /* while */ } /* while */
g_free(local_path); g_free (local_path);
} }
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
/* now that all scripts are read in and sorted, tell gimp about them */
g_tree_traverse (script_list,
(GTraverseFunc)script_fu_install_script, G_IN_ORDER, NULL);
} }
LISP LISP
script_fu_add_script (LISP a) script_fu_add_script (LISP a)
{ {
SFScript *script;
GParamDef *args; GParamDef *args;
SFScript *script;
gchar *val; gchar *val;
gint i; gint i;
guchar color[3]; guchar color[3];
@ -400,7 +406,6 @@ script_fu_add_script (LISP a)
LISP brush_list; LISP brush_list;
LISP option_list; LISP option_list;
gchar *s; gchar *s;
gchar *menu_path = NULL;
/* Check the length of a */ /* Check the length of a */
if (nlength (a) < 7) if (nlength (a) < 7)
@ -428,10 +433,6 @@ script_fu_add_script (LISP a)
script->description = g_strdup (val); script->description = g_strdup (val);
a = cdr (a); a = cdr (a);
/* Allow scripts with no menus */
if (strncmp (val, "<None>", 6) != 0)
menu_path = script->description;
/* Find the script help */ /* Find the script help */
val = get_c_string (car (a)); val = get_c_string (car (a));
script->help = g_strdup (val); script->help = g_strdup (val);
@ -475,7 +476,7 @@ script_fu_add_script (LISP a)
script->args_widgets = NULL; script->args_widgets = NULL;
script->arg_types = g_new (SFArgType, script->num_args); script->arg_types = g_new (SFArgType, script->num_args);
script->arg_labels = g_new (char *, script->num_args); script->arg_labels = g_new (gchar *, script->num_args);
script->arg_defaults = g_new0 (SFArgValue, script->num_args); script->arg_defaults = g_new0 (SFArgValue, script->num_args);
script->arg_values = g_new0 (SFArgValue, script->num_args); script->arg_values = g_new0 (SFArgValue, script->num_args);
@ -682,7 +683,6 @@ script_fu_add_script (LISP a)
* in the values area. We could free it later but the * in the values area. We could free it later but the
* default one must hang around. * default one must hang around.
*/ */
script->arg_values[i].sfa_brush.name = g_strdup(script->arg_defaults[i].sfa_brush.name); script->arg_values[i].sfa_brush.name = g_strdup(script->arg_defaults[i].sfa_brush.name);
args[i + 1].type = PARAM_STRING; args[i + 1].type = PARAM_STRING;
@ -729,22 +729,8 @@ script_fu_add_script (LISP a)
} }
} }
gimp_install_temp_proc (script->pdb_name, script->args = args;
script->description, g_tree_insert (script_list, gettext (script->description), script);
script->help,
script->author,
script->copyright,
script->date,
menu_path,
script->img_types,
PROC_TEMPORARY,
script->num_args + 1, 0,
args, NULL,
script_fu_script_proc);
g_free (args);
script_list = g_list_append (script_list, script);
return NIL; return NIL;
} }
@ -780,6 +766,55 @@ script_fu_report_cc (gchar *command)
gdk_flush (); gdk_flush ();
} }
/*
* The following function is a GTraverseFunction, Please
* note that it frees the script->args strcuture. --Sven
*/
static gint
script_fu_install_script (gpointer foo,
SFScript *script,
gpointer bar)
{
gchar *menu_path = NULL;
/* Allow scripts with no menus */
if (strncmp (script->description, "<None>", 6) != 0)
menu_path = script->description;
gimp_install_temp_proc (script->pdb_name,
script->description,
script->help,
script->author,
script->copyright,
script->date,
menu_path,
script->img_types,
PROC_TEMPORARY,
script->num_args + 1, 0,
script->args, NULL,
script_fu_script_proc);
g_free (script->args);
script->args = NULL;
return FALSE;
}
/*
* The following function is a GTraverseFunction.
*/
static gint
script_fu_remove_script (gpointer foo,
SFScript *script,
gpointer bar)
{
script_fu_free_script (script);
return FALSE;
}
static void static void
script_fu_script_proc (gchar *name, script_fu_script_proc (gchar *name,
gint nparams, gint nparams,
@ -970,23 +1005,34 @@ script_fu_script_proc (gchar *name,
values[0].data.d_status = status; values[0].data.d_status = status;
} }
/* this is a GTraverseFunction */
static gint
script_fu_lookup_script (gpointer *foo,
SFScript *script,
gchar **name)
{
if (strcmp (script->pdb_name, *name) == 0)
{
/* store the script in the name pointer and stop the traversal */
*name = (gchar *)script;
return TRUE;
}
else
return FALSE;
}
static SFScript * static SFScript *
script_fu_find_script (gchar *pdb_name) script_fu_find_script (gchar *pdb_name)
{ {
GList *list; gchar *script;
SFScript *script;
script = pdb_name;
list = script_list; g_tree_traverse (script_list,
while (list) (GTraverseFunc)script_fu_lookup_script, G_IN_ORDER, &script);
{ if (script == pdb_name)
script = (SFScript *) list->data; return NULL;
if (! strcmp (script->pdb_name, pdb_name)) else
return script; return (SFScript *)script;
list = list->next;
}
return NULL;
} }
static void static void

View File

@ -147,6 +147,7 @@ typedef struct
SFArgValue *arg_defaults; SFArgValue *arg_defaults;
SFArgValue *arg_values; SFArgValue *arg_values;
gint32 image_based; gint32 image_based;
GParamDef *args; /* used only temporary until installed */
} SFScript; } SFScript;
typedef struct typedef struct
@ -164,6 +165,12 @@ extern long nlength (LISP obj);
* Local Functions * Local Functions
*/ */
static gint script_fu_install_script (gpointer foo,
SFScript *script,
gpointer bar);
static gint script_fu_remove_script (gpointer foo,
SFScript *script,
gpointer bar);
static void script_fu_script_proc (gchar *name, static void script_fu_script_proc (gchar *name,
gint nparams, gint nparams,
GParam *params, GParam *params,
@ -245,7 +252,7 @@ static gboolean current_command_enabled = FALSE;
static gint command_count = 0; static gint command_count = 0;
static gint consec_command_count = 0; static gint consec_command_count = 0;
static gchar *last_command = NULL; static gchar *last_command = NULL;
static GList *script_list = NULL; static GTree *script_list = NULL;
extern gchar siod_err_msg[]; extern gchar siod_err_msg[];
@ -273,22 +280,17 @@ script_fu_find_scripts (void)
/* Make sure to clear any existing scripts */ /* Make sure to clear any existing scripts */
if (script_list != NULL) if (script_list != NULL)
{ {
GList *list; g_tree_traverse (script_list,
SFScript *script; (GTraverseFunc)script_fu_remove_script, G_IN_ORDER, NULL);
g_tree_destroy (script_list);
list = script_list;
while (list)
{
script = (SFScript *) list->data;
script_fu_free_script (script);
list = list->next;
}
if (script_list)
g_list_free (script_list);
script_list = NULL;
} }
#ifdef ENABLE_NLS
script_list = g_tree_new ((GCompareFunc)strcoll);
#else
script_list = g_tree_new ((GCompareFunc)strcmp);
#endif
return_vals = gimp_run_procedure ("gimp_gimprc_query", return_vals = gimp_run_procedure ("gimp_gimprc_query",
&nreturn_vals, &nreturn_vals,
PARAM_STRING, "script-fu-path", PARAM_STRING, "script-fu-path",
@ -381,17 +383,21 @@ script_fu_find_scripts (void)
token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S); token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S);
} /* while */ } /* while */
g_free(local_path); g_free (local_path);
} }
gimp_destroy_params (return_vals, nreturn_vals); gimp_destroy_params (return_vals, nreturn_vals);
/* now that all scripts are read in and sorted, tell gimp about them */
g_tree_traverse (script_list,
(GTraverseFunc)script_fu_install_script, G_IN_ORDER, NULL);
} }
LISP LISP
script_fu_add_script (LISP a) script_fu_add_script (LISP a)
{ {
SFScript *script;
GParamDef *args; GParamDef *args;
SFScript *script;
gchar *val; gchar *val;
gint i; gint i;
guchar color[3]; guchar color[3];
@ -400,7 +406,6 @@ script_fu_add_script (LISP a)
LISP brush_list; LISP brush_list;
LISP option_list; LISP option_list;
gchar *s; gchar *s;
gchar *menu_path = NULL;
/* Check the length of a */ /* Check the length of a */
if (nlength (a) < 7) if (nlength (a) < 7)
@ -428,10 +433,6 @@ script_fu_add_script (LISP a)
script->description = g_strdup (val); script->description = g_strdup (val);
a = cdr (a); a = cdr (a);
/* Allow scripts with no menus */
if (strncmp (val, "<None>", 6) != 0)
menu_path = script->description;
/* Find the script help */ /* Find the script help */
val = get_c_string (car (a)); val = get_c_string (car (a));
script->help = g_strdup (val); script->help = g_strdup (val);
@ -475,7 +476,7 @@ script_fu_add_script (LISP a)
script->args_widgets = NULL; script->args_widgets = NULL;
script->arg_types = g_new (SFArgType, script->num_args); script->arg_types = g_new (SFArgType, script->num_args);
script->arg_labels = g_new (char *, script->num_args); script->arg_labels = g_new (gchar *, script->num_args);
script->arg_defaults = g_new0 (SFArgValue, script->num_args); script->arg_defaults = g_new0 (SFArgValue, script->num_args);
script->arg_values = g_new0 (SFArgValue, script->num_args); script->arg_values = g_new0 (SFArgValue, script->num_args);
@ -682,7 +683,6 @@ script_fu_add_script (LISP a)
* in the values area. We could free it later but the * in the values area. We could free it later but the
* default one must hang around. * default one must hang around.
*/ */
script->arg_values[i].sfa_brush.name = g_strdup(script->arg_defaults[i].sfa_brush.name); script->arg_values[i].sfa_brush.name = g_strdup(script->arg_defaults[i].sfa_brush.name);
args[i + 1].type = PARAM_STRING; args[i + 1].type = PARAM_STRING;
@ -729,22 +729,8 @@ script_fu_add_script (LISP a)
} }
} }
gimp_install_temp_proc (script->pdb_name, script->args = args;
script->description, g_tree_insert (script_list, gettext (script->description), script);
script->help,
script->author,
script->copyright,
script->date,
menu_path,
script->img_types,
PROC_TEMPORARY,
script->num_args + 1, 0,
args, NULL,
script_fu_script_proc);
g_free (args);
script_list = g_list_append (script_list, script);
return NIL; return NIL;
} }
@ -780,6 +766,55 @@ script_fu_report_cc (gchar *command)
gdk_flush (); gdk_flush ();
} }
/*
* The following function is a GTraverseFunction, Please
* note that it frees the script->args strcuture. --Sven
*/
static gint
script_fu_install_script (gpointer foo,
SFScript *script,
gpointer bar)
{
gchar *menu_path = NULL;
/* Allow scripts with no menus */
if (strncmp (script->description, "<None>", 6) != 0)
menu_path = script->description;
gimp_install_temp_proc (script->pdb_name,
script->description,
script->help,
script->author,
script->copyright,
script->date,
menu_path,
script->img_types,
PROC_TEMPORARY,
script->num_args + 1, 0,
script->args, NULL,
script_fu_script_proc);
g_free (script->args);
script->args = NULL;
return FALSE;
}
/*
* The following function is a GTraverseFunction.
*/
static gint
script_fu_remove_script (gpointer foo,
SFScript *script,
gpointer bar)
{
script_fu_free_script (script);
return FALSE;
}
static void static void
script_fu_script_proc (gchar *name, script_fu_script_proc (gchar *name,
gint nparams, gint nparams,
@ -970,23 +1005,34 @@ script_fu_script_proc (gchar *name,
values[0].data.d_status = status; values[0].data.d_status = status;
} }
/* this is a GTraverseFunction */
static gint
script_fu_lookup_script (gpointer *foo,
SFScript *script,
gchar **name)
{
if (strcmp (script->pdb_name, *name) == 0)
{
/* store the script in the name pointer and stop the traversal */
*name = (gchar *)script;
return TRUE;
}
else
return FALSE;
}
static SFScript * static SFScript *
script_fu_find_script (gchar *pdb_name) script_fu_find_script (gchar *pdb_name)
{ {
GList *list; gchar *script;
SFScript *script;
script = pdb_name;
list = script_list; g_tree_traverse (script_list,
while (list) (GTraverseFunc)script_fu_lookup_script, G_IN_ORDER, &script);
{ if (script == pdb_name)
script = (SFScript *) list->data; return NULL;
if (! strcmp (script->pdb_name, pdb_name)) else
return script; return (SFScript *)script;
list = list->next;
}
return NULL;
} }
static void static void

View File

@ -337,7 +337,6 @@ init_procedures (void)
convert_string (proc_name); convert_string (proc_name);
/* create a new scheme func that calls gimp-proc-db-call */ /* create a new scheme func that calls gimp-proc-db-call */
for (j = 0; j < nparams; j++) for (j = 0; j < nparams; j++)
{ {
arg_name = g_strdup (params[j].name); arg_name = g_strdup (params[j].name);
@ -516,7 +515,9 @@ marshall_proc_db_call (LISP a)
/* Make sure there are arguments */ /* Make sure there are arguments */
if (a == NIL) if (a == NIL)
return my_err ("Procedure database argument marshaller was called with no arguments. The procedure to be executed and the arguments it requires (possibly none) must be specified.", NIL); return my_err ("Procedure database argument marshaller was called with no arguments. "
"The procedure to be executed and the arguments it requires "
"(possibly none) must be specified.", NIL);
/* Derive the pdb procedure name from the argument or first argument of a list */ /* Derive the pdb procedure name from the argument or first argument of a list */
if (TYPEP (a, tc_cons)) if (TYPEP (a, tc_cons))

View File

@ -1644,7 +1644,7 @@ save_xjt_image (gchar *filename,
l_fp_prp = fopen(l_prop_file, "w"); l_fp_prp = fopen(l_prop_file, "w");
if(l_fp_prp == NULL) if(l_fp_prp == NULL)
{ {
g_message (_("Can't open : %s"), l_prop_file); g_message (_("Can't open: %s"), l_prop_file);
goto cleanup; goto cleanup;
} }
@ -3121,7 +3121,7 @@ t_image_props * p_load_prop_file(gchar *prop_filename)
} }
if(l_filesize == 0) if(l_filesize == 0)
{ {
g_message(_("Error, XJT propertyfile %s is empty"), prop_filename); g_message(_("Error: XJT propertyfile %s is empty"), prop_filename);
goto cleanup; goto cleanup;
} }

View File

@ -1,3 +1,7 @@
2000-05-07 Sven Neumann <sven@gimp.org>
* de.po: updated german translation
2000-05-07 Michael Natterer <mitch@gimp.org> 2000-05-07 Michael Natterer <mitch@gimp.org>
* da.po: made it compile. * da.po: made it compile.

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,7 @@
2000-05-07 Sven Neumann <sven@gimp.org>
* de.po: fixed german translation
2000-05-04 Kjartan Maraas <kmaraas@online.no> 2000-05-04 Kjartan Maraas <kmaraas@online.no>
* no.po: Updated Norwegian translation. * no.po: Updated Norwegian translation.

View File

@ -7,7 +7,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: GIMP 1.1.20\n" "Project-Id-Version: GIMP 1.1.20\n"
"POT-Creation-Date: 2000-04-30 11:43-0700\n" "POT-Creation-Date: 2000-04-30 11:43-0700\n"
"PO-Revision-Date: 2000-04-28 01:58+02:00\n" "PO-Revision-Date: 2000-05-07 23:09+02:00\n"
"Last-Translator: Sven Neumann <sven@gimp.org>\n" "Last-Translator: Sven Neumann <sven@gimp.org>\n"
"Language-Team: German <de@li.org>\n" "Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n" "MIME-Version: 1.0\n"
@ -219,7 +219,7 @@ msgstr "<Image>/Skript-Fu/Animationen/
#: plug-ins/script-fu/scripts/ripply-anim.scm:0 #: plug-ins/script-fu/scripts/ripply-anim.scm:0
msgid "<Image>/Script-Fu/Animators/Rippling..." msgid "<Image>/Script-Fu/Animators/Rippling..."
msgstr "<Image>/Script-Fu/Animation/Flattern..." msgstr "<Image>/Skript-Fu/Animation/Flattern..."
#: plug-ins/gap/sel-to-anim-img.scm:0 #: plug-ins/gap/sel-to-anim-img.scm:0
msgid "<Image>/Script-Fu/Animators/Selection to AnimImage..." msgid "<Image>/Script-Fu/Animators/Selection to AnimImage..."
@ -227,7 +227,7 @@ msgstr "<Image>/Skript-Fu/Animation/Auswahl zu Animation..."
#: plug-ins/script-fu/scripts/spinning_globe.scm:0 #: plug-ins/script-fu/scripts/spinning_globe.scm:0
msgid "<Image>/Script-Fu/Animators/Spinning Globe..." msgid "<Image>/Script-Fu/Animators/Spinning Globe..."
msgstr "<Image>/Script-Fu/Animation/Drehender Globus..." msgstr "<Image>/Skript-Fu/Animation/Drehender Globus..."
#: plug-ins/script-fu/scripts/waves-anim.scm:0 #: plug-ins/script-fu/scripts/waves-anim.scm:0
msgid "<Image>/Script-Fu/Animators/Waves..." msgid "<Image>/Script-Fu/Animators/Waves..."

View File

@ -6,7 +6,7 @@
# ist. Fühlt Euch frei, diese Datei entsprechend zu ändern ;-) # ist. Fühlt Euch frei, diese Datei entsprechend zu ändern ;-)
Willkommen bei GIMP ! Willkommen bei GIMP !
Fast alle Operationen werden durch Drücken der rechten Maustaste Fast alle Operationen werden durch Drücken der rechten Maustaste
in einem Bild ausgeführt. Keine Angst, fast alle Fehler können in einem Bild ausgeführt. Keine Angst, fast alle Fehler können
rückgängig gemacht werden... rückgängig gemacht werden...
@ -92,7 +92,7 @@ Wird beim Erstellen einer Selektion w
Shift-Taste gedrückt, so wird die neue Selektion einer bestehenden Shift-Taste gedrückt, so wird die neue Selektion einer bestehenden
hinzugefügt. Wird die Ctrl-Taste (bzw. Strg-Taste) gedrückt, so hinzugefügt. Wird die Ctrl-Taste (bzw. Strg-Taste) gedrückt, so
wird die neue Selektion von der bestehenden subtrahiert. wird die neue Selektion von der bestehenden subtrahiert.
Durch Drücken der Shift- bzw. der Ctrl-Taste während des Erstellens Durch Drücken der Shift- bzw. der Ctrl-Taste während des Erstellens
einer Selektion kann ein Quadrat oder ein Kreis erzeugt werden, einer Selektion kann ein Quadrat oder ein Kreis erzeugt werden,
beziehungsweise die Selektion auf den Startpunkt zentriert werden. beziehungsweise die Selektion auf den Startpunkt zentriert werden.