check if the file procedure registered a menu path at all. The menu should

2004-05-14  Sven Neumann  <sven@gimp.org>

	* app/menus/file-dialog-menu.c: check if the file procedure
	registered a menu path at all. The menu should probably be created
	from the registered menu path, not from gimp->[load|save]_procs.

	* app/plug-in/plug-in-proc.[ch]
	* app/plug-in/plug-ins.c: removed broken code that used to sort
	the file procedures.

	* plug-ins/common/CEL.c
	* plug-ins/common/bz2.c
	* plug-ins/common/gz.c
	* plug-ins/common/pcx.c
	* plug-ins/common/pix.c
	* plug-ins/common/sunras.c
	* plug-ins/sgi/sgi.c
	* plug-ins/xjt/xjt.c: register a mimetype, set a translatable
	action name (mostly taken from shared-mime-info) and register to
	the <Load> and <Save> menus using gimp_plugin_menu_register().
This commit is contained in:
Sven Neumann 2004-05-14 16:54:33 +00:00 committed by Sven Neumann
parent 91cd15b5e3
commit ad89332fbb
21 changed files with 122 additions and 278 deletions

View File

@ -1,3 +1,24 @@
2004-05-14 Sven Neumann <sven@gimp.org>
* app/menus/file-dialog-menu.c: check if the file procedure
registered a menu path at all. The menu should probably be created
from the registered menu path, not from gimp->[load|save]_procs.
* app/plug-in/plug-in-proc.[ch]
* app/plug-in/plug-ins.c: removed broken code that used to sort
the file procedures.
* plug-ins/common/CEL.c
* plug-ins/common/bz2.c
* plug-ins/common/gz.c
* plug-ins/common/pcx.c
* plug-ins/common/pix.c
* plug-ins/common/sunras.c
* plug-ins/sgi/sgi.c
* plug-ins/xjt/xjt.c: register a mimetype, set a translatable
action name (mostly taken from shared-mime-info) and register to
the <Load> and <Save> menus using gimp_plugin_menu_register().
2004-05-14 Michael Natterer <mitch@gimp.org>
* app/pdb/fileops_cmds.c

View File

@ -47,6 +47,9 @@ file_dialog_menu_setup (GimpUIManager *manager,
PlugInProcDef *file_proc = list->data;
gchar *path;
if (! file_proc->menu_paths)
continue;
if (! strcmp (file_proc->db_info.name, xcf_proc_name))
path = g_strdup_printf ("%s/%s", ui_path, "Internal");
else

View File

@ -139,48 +139,3 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
return help_id;
}
gint
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
Gimp *gimp = GIMP (user_data);
const PlugInProcDef *proc_def_a = a;
const PlugInProcDef *proc_def_b = b;
if (proc_def_a->menu_paths && proc_def_b->menu_paths)
{
const gchar *progname_a;
const gchar *progname_b;
const gchar *domain_a;
const gchar *domain_b;
gchar *menu_path_a;
gchar *menu_path_b;
gint retval;
progname_a = plug_in_proc_def_get_progname (proc_def_a);
progname_b = plug_in_proc_def_get_progname (proc_def_b);
domain_a = plug_ins_locale_domain (gimp, progname_a, NULL);
domain_b = plug_ins_locale_domain (gimp, progname_b, NULL);
menu_path_a = gimp_strip_uline (dgettext (domain_a,
proc_def_a->menu_paths->data));
menu_path_b = gimp_strip_uline (dgettext (domain_b,
proc_def_b->menu_paths->data));
retval = g_utf8_collate (menu_path_a, menu_path_b);
g_free (menu_path_a);
g_free (menu_path_b);
return retval;
}
else if (proc_def_a->menu_paths)
return 1;
else if (proc_def_b->menu_paths)
return -1;
return 0;
}

View File

@ -52,9 +52,5 @@ const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def)
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
const gchar *help_domain);
gint plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data);
#endif /* __PLUG_IN_PROC_H__ */

View File

@ -264,14 +264,6 @@ plug_ins_init (Gimp *gimp,
/* add the plug-in procs to the procedure database */
plug_ins_add_to_db (gimp, context);
/* sort file procs */
gimp->load_procs = g_slist_sort_with_data (gimp->load_procs,
plug_in_proc_def_compare_menu_path,
gimp);
gimp->save_procs = g_slist_sort_with_data (gimp->save_procs,
plug_in_proc_def_compare_menu_path,
gimp);
/* create help_path and locale_domain lists */
for (list = gimp->plug_in_defs; list; list = list->next)
{

View File

@ -139,48 +139,3 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
return help_id;
}
gint
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
Gimp *gimp = GIMP (user_data);
const PlugInProcDef *proc_def_a = a;
const PlugInProcDef *proc_def_b = b;
if (proc_def_a->menu_paths && proc_def_b->menu_paths)
{
const gchar *progname_a;
const gchar *progname_b;
const gchar *domain_a;
const gchar *domain_b;
gchar *menu_path_a;
gchar *menu_path_b;
gint retval;
progname_a = plug_in_proc_def_get_progname (proc_def_a);
progname_b = plug_in_proc_def_get_progname (proc_def_b);
domain_a = plug_ins_locale_domain (gimp, progname_a, NULL);
domain_b = plug_ins_locale_domain (gimp, progname_b, NULL);
menu_path_a = gimp_strip_uline (dgettext (domain_a,
proc_def_a->menu_paths->data));
menu_path_b = gimp_strip_uline (dgettext (domain_b,
proc_def_b->menu_paths->data));
retval = g_utf8_collate (menu_path_a, menu_path_b);
g_free (menu_path_a);
g_free (menu_path_b);
return retval;
}
else if (proc_def_a->menu_paths)
return 1;
else if (proc_def_b->menu_paths)
return -1;
return 0;
}

View File

@ -52,9 +52,5 @@ const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def)
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
const gchar *help_domain);
gint plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data);
#endif /* __PLUG_IN_PROC_H__ */

View File

@ -139,48 +139,3 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
return help_id;
}
gint
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
Gimp *gimp = GIMP (user_data);
const PlugInProcDef *proc_def_a = a;
const PlugInProcDef *proc_def_b = b;
if (proc_def_a->menu_paths && proc_def_b->menu_paths)
{
const gchar *progname_a;
const gchar *progname_b;
const gchar *domain_a;
const gchar *domain_b;
gchar *menu_path_a;
gchar *menu_path_b;
gint retval;
progname_a = plug_in_proc_def_get_progname (proc_def_a);
progname_b = plug_in_proc_def_get_progname (proc_def_b);
domain_a = plug_ins_locale_domain (gimp, progname_a, NULL);
domain_b = plug_ins_locale_domain (gimp, progname_b, NULL);
menu_path_a = gimp_strip_uline (dgettext (domain_a,
proc_def_a->menu_paths->data));
menu_path_b = gimp_strip_uline (dgettext (domain_b,
proc_def_b->menu_paths->data));
retval = g_utf8_collate (menu_path_a, menu_path_b);
g_free (menu_path_a);
g_free (menu_path_b);
return retval;
}
else if (proc_def_a->menu_paths)
return 1;
else if (proc_def_b->menu_paths)
return -1;
return 0;
}

View File

@ -52,9 +52,5 @@ const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def)
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
const gchar *help_domain);
gint plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data);
#endif /* __PLUG_IN_PROC_H__ */

View File

@ -139,48 +139,3 @@ plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
return help_id;
}
gint
plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data)
{
Gimp *gimp = GIMP (user_data);
const PlugInProcDef *proc_def_a = a;
const PlugInProcDef *proc_def_b = b;
if (proc_def_a->menu_paths && proc_def_b->menu_paths)
{
const gchar *progname_a;
const gchar *progname_b;
const gchar *domain_a;
const gchar *domain_b;
gchar *menu_path_a;
gchar *menu_path_b;
gint retval;
progname_a = plug_in_proc_def_get_progname (proc_def_a);
progname_b = plug_in_proc_def_get_progname (proc_def_b);
domain_a = plug_ins_locale_domain (gimp, progname_a, NULL);
domain_b = plug_ins_locale_domain (gimp, progname_b, NULL);
menu_path_a = gimp_strip_uline (dgettext (domain_a,
proc_def_a->menu_paths->data));
menu_path_b = gimp_strip_uline (dgettext (domain_b,
proc_def_b->menu_paths->data));
retval = g_utf8_collate (menu_path_a, menu_path_b);
g_free (menu_path_a);
g_free (menu_path_b);
return retval;
}
else if (proc_def_a->menu_paths)
return 1;
else if (proc_def_b->menu_paths)
return -1;
return 0;
}

View File

@ -52,9 +52,5 @@ const gchar * plug_in_proc_def_get_progname (const PlugInProcDef *proc_def)
gchar * plug_in_proc_def_get_help_id (const PlugInProcDef *proc_def,
const gchar *help_domain);
gint plug_in_proc_def_compare_menu_path (gconstpointer a,
gconstpointer b,
gpointer user_data);
#endif /* __PLUG_IN_PROC_H__ */

View File

@ -264,14 +264,6 @@ plug_ins_init (Gimp *gimp,
/* add the plug-in procs to the procedure database */
plug_ins_add_to_db (gimp, context);
/* sort file procs */
gimp->load_procs = g_slist_sort_with_data (gimp->load_procs,
plug_in_proc_def_compare_menu_path,
gimp);
gimp->save_procs = g_slist_sort_with_data (gimp->save_procs,
plug_in_proc_def_compare_menu_path,
gimp);
/* create help_path and locale_domain lists */
for (list = gimp->plug_in_defs; list; list = list->next)
{

View File

@ -39,6 +39,7 @@
#include "libgimp/stdplugins-intl.h"
static void query (void);
static void run (const gchar *name,
gint nparams,
@ -108,32 +109,35 @@ query (void)
"Nick Lamb",
"Nick Lamb <njl195@zepler.org.uk>",
"May 1998",
"<Load>/CEL",
N_("KISS CEL"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_cel_load", "<Load>");
gimp_register_magic_load_handler ("file_cel_load",
"cel",
"",
"0,string,KiSS\\040");
gimp_install_procedure ("file_cel_save",
"Saves files in KISS CEL file format",
"This plug-in saves individual KISS cell files.",
"Nick Lamb",
"Nick Lamb <njl195@zepler.org.uk>",
"May 1998",
"<Save>/CEL",
N_("KISS CEL"),
"RGB*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_cel_load",
"cel",
"",
"0,string,KiSS\\040");
gimp_register_save_handler ("file_cel_save",
"cel",
"");
gimp_plugin_menu_register ("file_cel_save", "<Save>");
gimp_register_save_handler ("file_cel_save",
"cel",
"");
}
static void

View File

@ -106,29 +106,33 @@ query (void)
"Daniel Risacher",
"Daniel Risacher, Spencer Kimball and Peter Mattis",
"1995-1997",
"<Load>/bzip2",
N_("bzip archive"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_bz2_load", "<Load>");
gimp_register_file_handler_mime ("file_bz2_load", "application/x-bzip");
gimp_register_magic_load_handler ("file_bz2_load",
"xcf.bz2,bz2,xcfbz2",
"",
"0,string,BZh");
gimp_install_procedure ("file_bz2_save",
"saves files compressed with bzip2",
"You need to have bzip2 installed",
"Daniel Risacher",
"Daniel Risacher, Spencer Kimball and Peter Mattis",
"1995-1997",
"<Save>/bzip2",
N_("bzip archive"),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_bz2_load",
"xcf.bz2,bz2,xcfbz2",
"",
"0,string,BZh");
gimp_register_file_handler_mime ("file_bz2_save", "application/x-bzip");
gimp_register_save_handler ("file_bz2_save",
"xcf.bz2,bz2,xcfbz2",
"");

View File

@ -154,32 +154,36 @@ query (void)
"Daniel Risacher",
"Daniel Risacher, Spencer Kimball and Peter Mattis",
"1995-1997",
"<Load>/gzip",
N_("gzip archive"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_gz_load", "<Load>");
gimp_register_file_handler_mime ("file_gz_load", "application/x-gzip");
gimp_register_magic_load_handler ("file_gz_load",
"xcf.gz,gz,xcfgz",
"",
"0,string,\037\213");
gimp_install_procedure ("file_gz_save",
"saves files compressed with gzip",
"You need to have gzip installed.",
"Daniel Risacher",
"Daniel Risacher, Spencer Kimball and Peter Mattis",
"1995-1997",
"<Save>/gzip",
N_("gzip archive"),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_gz_load",
"xcf.gz,gz,xcfgz",
"",
"0,string,\037\213");
gimp_register_save_handler ("file_gz_save",
"xcf.gz,gz,xcfgz",
"");
gimp_register_file_handler_mime ("file_gz_save", "application/x-gzip");
gimp_register_save_handler ("file_gz_save",
"xcf.gz,gz,xcfgz",
"");
}
static void

View File

@ -154,32 +154,36 @@ query (void)
"Daniel Risacher",
"Daniel Risacher, Spencer Kimball and Peter Mattis",
"1995-1997",
"<Load>/gzip",
N_("gzip archive"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_gz_load", "<Load>");
gimp_register_file_handler_mime ("file_gz_load", "application/x-gzip");
gimp_register_magic_load_handler ("file_gz_load",
"xcf.gz,gz,xcfgz",
"",
"0,string,\037\213");
gimp_install_procedure ("file_gz_save",
"saves files compressed with gzip",
"You need to have gzip installed.",
"Daniel Risacher",
"Daniel Risacher, Spencer Kimball and Peter Mattis",
"1995-1997",
"<Save>/gzip",
N_("gzip archive"),
"RGB*, GRAY*, INDEXED*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_gz_load",
"xcf.gz,gz,xcfgz",
"",
"0,string,\037\213");
gimp_register_save_handler ("file_gz_save",
"xcf.gz,gz,xcfgz",
"");
gimp_register_file_handler_mime ("file_gz_save", "application/x-gzip");
gimp_register_save_handler ("file_gz_save",
"xcf.gz,gz,xcfgz",
"");
}
static void

View File

@ -93,32 +93,37 @@ query (void)
"Francisco Bustamante & Nick Lamb",
"Nick Lamb <njl195@zepler.org.uk>",
"January 1997",
"<Load>/PCX",
N_("ZSoft PCX image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_pcx_load", "<Load>");
gimp_register_file_handler_mime ("file_pcx_load", "image/x-pcx");
gimp_register_magic_load_handler ("file_pcx_load",
"pcx,pcc",
"",
"0&,byte,10,2&,byte,1,3&,byte,>0,3,byte,<9");
gimp_install_procedure ("file_pcx_save",
"Saves files in ZSoft PCX file format",
"FIXME: write help for pcx_save",
"Francisco Bustamante & Nick Lamb",
"Nick Lamb <njl195@zepler.org.uk>",
"January 1997",
"<Save>/PCX",
N_("ZSoft PCX image"),
"INDEXED, RGB, GRAY",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_pcx_load",
"pcx,pcc",
"",
"0&,byte,10,2&,byte,1,3&,byte,>0,3,byte,<9");
gimp_register_save_handler ("file_pcx_save",
"pcx,pcc",
"");
gimp_plugin_menu_register ("file_pcx_save", "<Save>");
gimp_register_file_handler_mime ("file_pcx_save", "image/x-pcx");
gimp_register_save_handler ("file_pcx_save",
"pcx,pcc",
"");
}
/* Declare internal functions. */

View File

@ -138,28 +138,31 @@ query (void)
"Michael Taylor",
"Michael Taylor",
"1997",
"<Load>/PIX",
N_("Alias|Wavefront PIX image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_pix_load", "<Load>");
gimp_register_load_handler ("file_pix_load",
"pix,matte,mask,alpha,als",
"");
gimp_install_procedure ("file_pix_save",
"save file in the Alias|Wavefront pix/matte file format",
"save file in the Alias|Wavefront pix/matte file format",
"Michael Taylor",
"Michael Taylor",
"1997",
"<Save>/PIX",
N_("Alias|Wavefront PIX image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_load_handler ("file_pix_load",
"pix,matte,mask,alpha,als",
"");
gimp_plugin_menu_register ("file_pix_save", "<Save>");
gimp_register_save_handler ("file_pix_save",
"pix,matte,mask,alpha,als",
"");

View File

@ -241,7 +241,7 @@ query (void)
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_plugin_menu_register ("file_sunrad_save", "<Save>");
gimp_plugin_menu_register ("file_sunras_save", "<Save>");
gimp_register_file_handler_mime ("file_sunras_save", "image/x-sun-raster");
gimp_register_save_handler ("file_sunras_save",
"im1,im8,im24,im32,rs,ras",

View File

@ -119,7 +119,7 @@ query (void)
"Michael Sweet <mike@easysw.com>",
"Copyright 1997-1998 by Michael Sweet",
PLUG_IN_VERSION,
"<Load>/SGI",
N_("Silicon Graphics IRIS image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
@ -127,13 +127,20 @@ query (void)
load_args,
load_return_vals);
gimp_plugin_menu_register ("file_sgi_load", "<Load>");
gimp_register_file_handler_mime ("file_sgi_load", "image/x-sgi");
gimp_register_magic_load_handler ("file_sgi_load",
"sgi,rgb,bw,icon",
"",
"0,short,474");
gimp_install_procedure ("file_sgi_save",
"Saves files in SGI image file format",
"This plug-in saves SGI image files.",
"Michael Sweet <mike@easysw.com>",
"Copyright 1997-1998 by Michael Sweet",
PLUG_IN_VERSION,
"<Save>/SGI",
N_("Silicon Graphics IRIS image"),
"RGB*,GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args),
@ -141,13 +148,11 @@ query (void)
save_args,
NULL);
gimp_register_magic_load_handler ("file_sgi_load",
"rgb,bw,sgi,icon",
"",
"0,short,474");
gimp_register_save_handler ("file_sgi_save",
"rgb,bw,sgi,icon",
"");
gimp_plugin_menu_register ("file_sgi_save", "<Save>");
gimp_register_file_handler_mime ("file_sgi_save", "image/x-sgi");
gimp_register_save_handler ("file_sgi_save",
"sgi,rgb,bw,icon",
"");
}
static void

View File

@ -472,32 +472,35 @@ query (void)
"Wolfgang Hofer",
"Wolfgang Hofer",
"2000-Mar-07",
"<Load>/xjt",
N_("GIMP compressed XJT image"),
NULL,
GIMP_PLUGIN,
G_N_ELEMENTS (load_args),
G_N_ELEMENTS (load_return_vals),
load_args, load_return_vals);
gimp_plugin_menu_register ("file_xjt_load", "<Load>");
gimp_register_magic_load_handler ("file_xjt_load",
"xjt,xjtgz,xjtbz2",
"",
"");
gimp_install_procedure ("file_xjt_save",
"saves files in the jpeg-tar file format",
"saves files in the jpeg-tar file format",
"Wolfgang Hofer",
"Wolfgang Hofer",
"2000-Mar-07",
"<Save>/xjt",
N_("GIMP compressed XJT image"),
"RGB*, GRAY*",
GIMP_PLUGIN,
G_N_ELEMENTS (save_args), 0,
save_args, NULL);
gimp_register_magic_load_handler ("file_xjt_load",
"xjt,xjtgz,xjtbz2",
"",
"");
gimp_register_save_handler ("file_xjt_save",
"xjt,xjtgz,xjtbz2",
"");
gimp_plugin_menu_register ("file_xjt_save", "<Save>");
gimp_register_save_handler ("file_xjt_save",
"xjt,xjtgz,xjtbz2",
"");
}
static void