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>
* 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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains);
}

View File

@ -557,8 +557,6 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL },
{ { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
NULL, NULL },
/* <Image>/Script-Fu */
};
static guint n_image_entries = (sizeof (image_entries) /
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,
"/Filters/Filter all Layers...");
if (menu_item && menu_item->parent)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
{
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 */
pos = 2;
@ -1145,6 +1163,9 @@ menus_tools_create (ToolInfo *tool_info)
{
GimpItemFactoryEntry entry;
if (tool_info->menu_path == NULL)
return;
entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback;
@ -1642,9 +1663,7 @@ menus_init (void)
for (i = 0; i < num_tools; i++)
{
/* FIXME this need to use access functions to check a flag */
if (tool_info[i].menu_path)
menus_tools_create (&tool_info[i]);
menus_tools_create (&tool_info[i]);
}
/* 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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains);
}

View File

@ -557,8 +557,6 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL },
{ { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
NULL, NULL },
/* <Image>/Script-Fu */
};
static guint n_image_entries = (sizeof (image_entries) /
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,
"/Filters/Filter all Layers...");
if (menu_item && menu_item->parent)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
{
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 */
pos = 2;
@ -1145,6 +1163,9 @@ menus_tools_create (ToolInfo *tool_info)
{
GimpItemFactoryEntry entry;
if (tool_info->menu_path == NULL)
return;
entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback;
@ -1642,9 +1663,7 @@ menus_init (void)
for (i = 0; i < num_tools; i++)
{
/* FIXME this need to use access functions to check a flag */
if (tool_info[i].menu_path)
menus_tools_create (&tool_info[i]);
menus_tools_create (&tool_info[i]);
}
/* reorder <Image>/Image/Colors */

View File

@ -557,8 +557,6 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL },
{ { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
NULL, NULL },
/* <Image>/Script-Fu */
};
static guint n_image_entries = (sizeof (image_entries) /
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,
"/Filters/Filter all Layers...");
if (menu_item && menu_item->parent)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
{
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 */
pos = 2;
@ -1145,6 +1163,9 @@ menus_tools_create (ToolInfo *tool_info)
{
GimpItemFactoryEntry entry;
if (tool_info->menu_path == NULL)
return;
entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback;
@ -1642,9 +1663,7 @@ menus_init (void)
for (i = 0; i < num_tools; i++)
{
/* FIXME this need to use access functions to check a flag */
if (tool_info[i].menu_path)
menus_tools_create (&tool_info[i]);
menus_tools_create (&tool_info[i]);
}
/* 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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
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,
guint8 *buf,
gulong count);
@ -131,6 +140,9 @@ static void plug_in_query (gchar *filename,
PlugInDef *plug_in_def);
static void plug_in_add_to_db (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,
gpointer client_data);
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;
PlugInProcDef *proc_def;
ProcRecord *proc = NULL;
PlugInMenuEntry *menu_entry;
GSList *tmp = NULL;
GimpItemFactoryEntry entry;
gchar *prog = NULL;
gboolean add_proc_def;
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_val = plug_in_image_types_parse (proc_def->image_types);
/* Install temp one use todays time */
proc_def->mtime = time(NULL);
proc_def->mtime = time (NULL);
proc = &proc_def->db_info;
@ -1924,7 +1936,8 @@ plug_in_handle_proc_install (GPProcInstall *proc_install)
case PDB_TEMPORARY:
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->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 (proc_install->menu_path)
{
gchar *help_page;
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;
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
/* 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
found a way yet ... (Sven) */
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)
menus_create_item_from_full_path (&entry, "gimp-script-fu", proc);
menu_entry->domain = "gimp-script-fu";
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;
}
@ -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
plug_in_make_menu (void)
{
GimpItemFactoryEntry entry;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInDef *plug_in_def;
PlugInProcDef *proc_def;
PlugInMenuEntry *menu_entry;
GSList *domains = NULL;
GSList *procs;
GSList *tmp;
GTree *menu_entries;
#ifdef ENABLE_NLS
bindtextdomain (std_plugins_domain, LOCALEDIR);
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;
while (tmp)
@ -2440,31 +2484,22 @@ plug_in_make_menu (void)
!proc_def->prefixes &&
!proc_def->magics))
{
gchar *help_page;
help_page = g_strconcat ("filters/",
g_basename (proc_def->prog),
".html",
NULL);
g_strdown (help_page);
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);
menu_entry = g_new (PlugInMenuEntry, 1);
menu_entry->proc_def = proc_def;
menu_entry->domain = plug_in_def->locale_domain ?
plug_in_def->locale_domain : std_plugins_domain;
g_tree_insert (menu_entries,
dgettext (menu_entry->domain, proc_def->menu_path),
menu_entry);
}
}
}
g_tree_traverse (menu_entries,
(GTraverseFunc)plug_in_make_menu_entry, G_IN_ORDER, NULL);
g_tree_destroy (menu_entries);
g_slist_free (domains);
}

View File

@ -557,8 +557,6 @@ static GimpItemFactoryEntry image_entries[] =
NULL, NULL },
{ { N_("/Filters/Toys"), NULL, NULL, 0, "<Branch>" },
NULL, NULL },
/* <Image>/Script-Fu */
};
static guint n_image_entries = (sizeof (image_entries) /
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,
"/Filters/Filter all Layers...");
if (menu_item && menu_item->parent)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent), menu_item, 3);
if (menu_item && menu_item->parent && GTK_IS_MENU (menu_item->parent))
{
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 */
pos = 2;
@ -1145,6 +1163,9 @@ menus_tools_create (ToolInfo *tool_info)
{
GimpItemFactoryEntry entry;
if (tool_info->menu_path == NULL)
return;
entry.entry.path = tool_info->menu_path;
entry.entry.accelerator = tool_info->menu_accel;
entry.entry.callback = tools_select_cmd_callback;
@ -1642,9 +1663,7 @@ menus_init (void)
for (i = 0; i < num_tools; i++)
{
/* FIXME this need to use access functions to check a flag */
if (tool_info[i].menu_path)
menus_tools_create (&tool_info[i]);
menus_tools_create (&tool_info[i]);
}
/* reorder <Image>/Image/Colors */

View File

@ -61,7 +61,7 @@ ReadBMP (gchar *name)
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;
}
@ -69,7 +69,7 @@ ReadBMP (gchar *name)
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;
}
@ -87,7 +87,7 @@ ReadBMP (gchar *name)
{
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;
}
@ -101,7 +101,7 @@ ReadBMP (gchar *name)
{
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;
}
Bitmap_Head.biWidth =ToL (&buffer[0x00]); /* 12 */
@ -121,7 +121,7 @@ ReadBMP (gchar *name)
{
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;
}
Bitmap_Head.biWidth =ToL (&buffer[0x00]); /* 12 */
@ -139,7 +139,7 @@ ReadBMP (gchar *name)
}
else
{
g_message (_("%s: error reading BMP file header\n"), prog_name);
g_message (_("%s: error reading BMP file header"), prog_name);
return -1;
}
@ -227,7 +227,7 @@ ReadColorMap (FILE *fd,
{
if (!ReadOK (fd, rgb, size))
{
g_message (_("%s: bad colormap\n"), prog_name);
g_message (_("%s: bad colormap"), prog_name);
return -1;
}

View File

@ -101,7 +101,7 @@ WriteBMP (gchar *filename,
case INDEXED_IMAGE:
break;
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;
break;
}
@ -164,7 +164,7 @@ WriteBMP (gchar *filename,
outfile = fopen (filename, "wb");
if (!outfile)
{
g_message (_("can't open %s\n"), filename);
g_message (_("Can't open %s"), filename);
return STATUS_EXECUTION_ERROR;
}

View File

@ -147,6 +147,7 @@ typedef struct
SFArgValue *arg_defaults;
SFArgValue *arg_values;
gint32 image_based;
GParamDef *args; /* used only temporary until installed */
} SFScript;
typedef struct
@ -164,6 +165,12 @@ extern long nlength (LISP obj);
* 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,
gint nparams,
GParam *params,
@ -245,7 +252,7 @@ static gboolean current_command_enabled = FALSE;
static gint command_count = 0;
static gint consec_command_count = 0;
static gchar *last_command = NULL;
static GList *script_list = NULL;
static GTree *script_list = NULL;
extern gchar siod_err_msg[];
@ -273,22 +280,17 @@ script_fu_find_scripts (void)
/* Make sure to clear any existing scripts */
if (script_list != NULL)
{
GList *list;
SFScript *script;
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;
g_tree_traverse (script_list,
(GTraverseFunc)script_fu_remove_script, G_IN_ORDER, NULL);
g_tree_destroy (script_list);
}
#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",
&nreturn_vals,
PARAM_STRING, "script-fu-path",
@ -381,17 +383,21 @@ script_fu_find_scripts (void)
token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S);
} /* while */
g_free(local_path);
g_free (local_path);
}
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
script_fu_add_script (LISP a)
{
SFScript *script;
GParamDef *args;
SFScript *script;
gchar *val;
gint i;
guchar color[3];
@ -400,7 +406,6 @@ script_fu_add_script (LISP a)
LISP brush_list;
LISP option_list;
gchar *s;
gchar *menu_path = NULL;
/* Check the length of a */
if (nlength (a) < 7)
@ -428,10 +433,6 @@ script_fu_add_script (LISP a)
script->description = g_strdup (val);
a = cdr (a);
/* Allow scripts with no menus */
if (strncmp (val, "<None>", 6) != 0)
menu_path = script->description;
/* Find the script help */
val = get_c_string (car (a));
script->help = g_strdup (val);
@ -475,7 +476,7 @@ script_fu_add_script (LISP a)
script->args_widgets = NULL;
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_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
* default one must hang around.
*/
script->arg_values[i].sfa_brush.name = g_strdup(script->arg_defaults[i].sfa_brush.name);
args[i + 1].type = PARAM_STRING;
@ -729,22 +729,8 @@ script_fu_add_script (LISP a)
}
}
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,
args, NULL,
script_fu_script_proc);
g_free (args);
script_list = g_list_append (script_list, script);
script->args = args;
g_tree_insert (script_list, gettext (script->description), script);
return NIL;
}
@ -780,6 +766,55 @@ script_fu_report_cc (gchar *command)
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
script_fu_script_proc (gchar *name,
gint nparams,
@ -970,23 +1005,34 @@ script_fu_script_proc (gchar *name,
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 *
script_fu_find_script (gchar *pdb_name)
{
GList *list;
SFScript *script;
list = script_list;
while (list)
{
script = (SFScript *) list->data;
if (! strcmp (script->pdb_name, pdb_name))
return script;
list = list->next;
}
return NULL;
gchar *script;
script = pdb_name;
g_tree_traverse (script_list,
(GTraverseFunc)script_fu_lookup_script, G_IN_ORDER, &script);
if (script == pdb_name)
return NULL;
else
return (SFScript *)script;
}
static void

View File

@ -147,6 +147,7 @@ typedef struct
SFArgValue *arg_defaults;
SFArgValue *arg_values;
gint32 image_based;
GParamDef *args; /* used only temporary until installed */
} SFScript;
typedef struct
@ -164,6 +165,12 @@ extern long nlength (LISP obj);
* 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,
gint nparams,
GParam *params,
@ -245,7 +252,7 @@ static gboolean current_command_enabled = FALSE;
static gint command_count = 0;
static gint consec_command_count = 0;
static gchar *last_command = NULL;
static GList *script_list = NULL;
static GTree *script_list = NULL;
extern gchar siod_err_msg[];
@ -273,22 +280,17 @@ script_fu_find_scripts (void)
/* Make sure to clear any existing scripts */
if (script_list != NULL)
{
GList *list;
SFScript *script;
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;
g_tree_traverse (script_list,
(GTraverseFunc)script_fu_remove_script, G_IN_ORDER, NULL);
g_tree_destroy (script_list);
}
#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",
&nreturn_vals,
PARAM_STRING, "script-fu-path",
@ -381,17 +383,21 @@ script_fu_find_scripts (void)
token = strtok (NULL, G_SEARCHPATH_SEPARATOR_S);
} /* while */
g_free(local_path);
g_free (local_path);
}
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
script_fu_add_script (LISP a)
{
SFScript *script;
GParamDef *args;
SFScript *script;
gchar *val;
gint i;
guchar color[3];
@ -400,7 +406,6 @@ script_fu_add_script (LISP a)
LISP brush_list;
LISP option_list;
gchar *s;
gchar *menu_path = NULL;
/* Check the length of a */
if (nlength (a) < 7)
@ -428,10 +433,6 @@ script_fu_add_script (LISP a)
script->description = g_strdup (val);
a = cdr (a);
/* Allow scripts with no menus */
if (strncmp (val, "<None>", 6) != 0)
menu_path = script->description;
/* Find the script help */
val = get_c_string (car (a));
script->help = g_strdup (val);
@ -475,7 +476,7 @@ script_fu_add_script (LISP a)
script->args_widgets = NULL;
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_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
* default one must hang around.
*/
script->arg_values[i].sfa_brush.name = g_strdup(script->arg_defaults[i].sfa_brush.name);
args[i + 1].type = PARAM_STRING;
@ -729,22 +729,8 @@ script_fu_add_script (LISP a)
}
}
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,
args, NULL,
script_fu_script_proc);
g_free (args);
script_list = g_list_append (script_list, script);
script->args = args;
g_tree_insert (script_list, gettext (script->description), script);
return NIL;
}
@ -780,6 +766,55 @@ script_fu_report_cc (gchar *command)
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
script_fu_script_proc (gchar *name,
gint nparams,
@ -970,23 +1005,34 @@ script_fu_script_proc (gchar *name,
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 *
script_fu_find_script (gchar *pdb_name)
{
GList *list;
SFScript *script;
list = script_list;
while (list)
{
script = (SFScript *) list->data;
if (! strcmp (script->pdb_name, pdb_name))
return script;
list = list->next;
}
return NULL;
gchar *script;
script = pdb_name;
g_tree_traverse (script_list,
(GTraverseFunc)script_fu_lookup_script, G_IN_ORDER, &script);
if (script == pdb_name)
return NULL;
else
return (SFScript *)script;
}
static void

View File

@ -337,7 +337,6 @@ init_procedures (void)
convert_string (proc_name);
/* create a new scheme func that calls gimp-proc-db-call */
for (j = 0; j < nparams; j++)
{
arg_name = g_strdup (params[j].name);
@ -516,7 +515,9 @@ marshall_proc_db_call (LISP a)
/* Make sure there are arguments */
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 */
if (TYPEP (a, tc_cons))

View File

@ -1644,7 +1644,7 @@ save_xjt_image (gchar *filename,
l_fp_prp = fopen(l_prop_file, "w");
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;
}
@ -3121,7 +3121,7 @@ t_image_props * p_load_prop_file(gchar *prop_filename)
}
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;
}

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>
* 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>
* no.po: Updated Norwegian translation.

View File

@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: GIMP 1.1.20\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"
"Language-Team: German <de@li.org>\n"
"MIME-Version: 1.0\n"
@ -219,7 +219,7 @@ msgstr "<Image>/Skript-Fu/Animationen/
#: plug-ins/script-fu/scripts/ripply-anim.scm:0
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
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
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
msgid "<Image>/Script-Fu/Animators/Waves..."

View File

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