Commit 86662cd6 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

Bye bye, "crappy/foo.html":

2003-08-26  Michael Natterer  <mitch@gimp.org>

	Bye bye, "crappy/foo.html":

	* app/widgets/gimphelp-ids.h: replaced "crappy/foo.html" by
	"gimp-proper-identifier".

	* app/plug-in/plug-in-proc.[ch] (plug_in_proc_def_get_help_id):
	added "const gchar *help_path" parameter and return a help ID
	ready for attaching to a menu item.

	The help ID is no longer constructed from the plug-in's executable
	name but from the *procedure* name with '_' replaced by '-'. This
	means we can now have help for each script-fu script and for each
	of a plug-in's individual procedures.

	* app/gui/plug-in-menus.c: removed even more duplicated wrong code
	since plug_in_proc_def_get_help_id() is implemented correctly now.

	* app/gui/file-open-menu.c
	* app/gui/file-save-menu.c: ditto. Reorder the "XCF" menu item
	before the separator and added GIMP_STOCK_WILBER.

	* app/gui/file-dialog-utils.c: added a mnemonic to the
	"Determine File Type:" label.
parent 47571782
2003-08-26 Michael Natterer <mitch@gimp.org>
Bye bye, "crappy/foo.html":
* app/widgets/gimphelp-ids.h: replaced "crappy/foo.html" by
"gimp-proper-identifier".
* app/plug-in/plug-in-proc.[ch] (plug_in_proc_def_get_help_id):
added "const gchar *help_path" parameter and return a help ID
ready for attaching to a menu item.
The help ID is no longer constructed from the plug-in's executable
name but from the *procedure* name with '_' replaced by '-'. This
means we can now have help for each script-fu script and for each
of a plug-in's individual procedures.
* app/gui/plug-in-menus.c: removed even more duplicated wrong code
since plug_in_proc_def_get_help_id() is implemented correctly now.
* app/gui/file-open-menu.c
* app/gui/file-save-menu.c: ditto. Reorder the "XCF" menu item
before the separator and added GIMP_STOCK_WILBER.
* app/gui/file-dialog-utils.c: added a mnemonic to the
"Determine File Type:" label.
2003-08-26 Simon Budig <simon@gimp.org>
* app/vectors/gimpanchor.h: Intruduce casting macro GIMP_ANCHOR.
......@@ -119,9 +119,11 @@ file_dialog_new (Gimp *gimp,
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu),
GTK_ITEM_FACTORY (item_factory)->widget);
label = gtk_label_new (_("Determine File Type:"));
label = gtk_label_new_with_mnemonic (_("Determine File _Type:"));
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);
}
gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier, filesel);
......
......@@ -119,9 +119,11 @@ file_dialog_new (Gimp *gimp,
gtk_option_menu_set_menu (GTK_OPTION_MENU (option_menu),
GTK_ITEM_FACTORY (item_factory)->widget);
label = gtk_label_new (_("Determine File Type:"));
label = gtk_label_new_with_mnemonic (_("Determine File _Type:"));
gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 0);
gtk_widget_show (label);
gtk_label_set_mnemonic_widget (GTK_LABEL (label), option_menu);
}
gimp_dialog_factory_add_foreign (dialog_factory, dialog_identifier, filesel);
......
......@@ -62,36 +62,44 @@ file_open_menu_setup (GimpItemFactory *factory)
for (list = factory->gimp->load_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc;
const gchar *progname;
const gchar *locale_domain;
const gchar *help_path;
GimpItemFactoryEntry entry;
const gchar *locale_domain = NULL;
const gchar *item_type = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
gchar *help_page;
gboolean is_xcf;
file_proc = (PlugInProcDef *) list->data;
progname = plug_in_proc_def_get_progname (file_proc);
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_load") == 0);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_path = plug_ins_help_path (factory->gimp, progname);
if (is_xcf)
{
item_type = "<StockItem>";
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_OPEN_XCF);
}
else
{
const gchar *progname;
const gchar *help_path;
help_id = plug_in_proc_def_get_help_id (file_proc);
progname = plug_in_proc_def_get_progname (file_proc);
if (help_path)
help_page = g_strconcat (help_path, ":", help_id, NULL);
else
help_page = g_strconcat ("filters/", help_id, NULL);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_path = plug_ins_help_path (factory->gimp, progname);
g_free (help_id);
help_id = plug_in_proc_def_get_help_id (file_proc, help_path);
}
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_open_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.entry.item_type = item_type;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_id = help_page;
entry.help_id = help_id;
entry.description = NULL;
gimp_item_factory_create_item (factory,
......@@ -100,6 +108,18 @@ file_open_menu_setup (GimpItemFactory *factory)
file_proc, 2,
TRUE, FALSE);
g_free (help_page);
if (is_xcf)
{
GtkWidget *menu_item;
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
entry.entry.path);
if (menu_item)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, 1);
}
g_free (help_id);
}
}
......@@ -63,36 +63,44 @@ file_save_menu_setup (GimpItemFactory *factory)
for (list = factory->gimp->save_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc;
const gchar *progname;
const gchar *locale_domain;
const gchar *help_path;
GimpItemFactoryEntry entry;
const gchar *locale_domain = NULL;
const gchar *item_type = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
gchar *help_page;
gboolean is_xcf;
file_proc = (PlugInProcDef *) list->data;
progname = plug_in_proc_def_get_progname (file_proc);
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_save") == 0);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_path = plug_ins_help_path (factory->gimp, progname);
if (is_xcf)
{
item_type = "<StockItem>";
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_SAVE_XCF);
}
else
{
const gchar *progname;
const gchar *help_path;
help_id = plug_in_proc_def_get_help_id (file_proc);
progname = plug_in_proc_def_get_progname (file_proc);
if (help_path)
help_page = g_strconcat (help_path, ":", help_id, NULL);
else
help_page = g_strconcat ("filters/", help_id, NULL);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_path = plug_ins_help_path (factory->gimp, progname);
g_free (help_id);
help_id = plug_in_proc_def_get_help_id (file_proc, help_path);
}
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_save_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.entry.item_type = item_type;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_id = help_page;
entry.help_id = help_id;
entry.description = NULL;
gimp_item_factory_create_item (factory,
......@@ -101,7 +109,19 @@ file_save_menu_setup (GimpItemFactory *factory)
file_proc, 2,
TRUE, FALSE);
g_free (help_page);
if (is_xcf)
{
GtkWidget *menu_item;
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
entry.entry.path);
if (menu_item)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, 1);
}
g_free (help_id);
}
}
......
......@@ -170,20 +170,12 @@ plug_in_menus_create_entry (GimpItemFactory *item_factory,
{
GimpItemFactoryEntry entry;
gchar *help_id;
gchar *help_page;
g_return_if_fail (item_factory == NULL ||
GIMP_IS_ITEM_FACTORY (item_factory));
g_return_if_fail (proc_def != NULL);
help_id = plug_in_proc_def_get_help_id (proc_def);
if (help_path)
help_page = g_strconcat (help_path, ":", help_id, NULL);
else
help_page = g_strconcat ("filters/", help_id, NULL);
g_free (help_id);
help_id = plug_in_proc_def_get_help_id (proc_def, help_path);
entry.entry.path = strstr (proc_def->menu_path, "/");
entry.entry.accelerator = proc_def->accelerator;
......@@ -191,7 +183,7 @@ plug_in_menus_create_entry (GimpItemFactory *item_factory,
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_id = help_page;
entry.help_id = help_id;
entry.description = NULL;
if (item_factory)
......@@ -228,7 +220,7 @@ plug_in_menus_create_entry (GimpItemFactory *item_factory,
}
}
g_free (help_page);
g_free (help_id);
}
void
......
......@@ -62,36 +62,44 @@ file_open_menu_setup (GimpItemFactory *factory)
for (list = factory->gimp->load_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc;
const gchar *progname;
const gchar *locale_domain;
const gchar *help_path;
GimpItemFactoryEntry entry;
const gchar *locale_domain = NULL;
const gchar *item_type = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
gchar *help_page;
gboolean is_xcf;
file_proc = (PlugInProcDef *) list->data;
progname = plug_in_proc_def_get_progname (file_proc);
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_load") == 0);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_path = plug_ins_help_path (factory->gimp, progname);
if (is_xcf)
{
item_type = "<StockItem>";
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_OPEN_XCF);
}
else
{
const gchar *progname;
const gchar *help_path;
help_id = plug_in_proc_def_get_help_id (file_proc);
progname = plug_in_proc_def_get_progname (file_proc);
if (help_path)
help_page = g_strconcat (help_path, ":", help_id, NULL);
else
help_page = g_strconcat ("filters/", help_id, NULL);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_path = plug_ins_help_path (factory->gimp, progname);
g_free (help_id);
help_id = plug_in_proc_def_get_help_id (file_proc, help_path);
}
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_open_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.entry.item_type = item_type;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_id = help_page;
entry.help_id = help_id;
entry.description = NULL;
gimp_item_factory_create_item (factory,
......@@ -100,6 +108,18 @@ file_open_menu_setup (GimpItemFactory *factory)
file_proc, 2,
TRUE, FALSE);
g_free (help_page);
if (is_xcf)
{
GtkWidget *menu_item;
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
entry.entry.path);
if (menu_item)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, 1);
}
g_free (help_id);
}
}
......@@ -63,36 +63,44 @@ file_save_menu_setup (GimpItemFactory *factory)
for (list = factory->gimp->save_procs; list; list = g_slist_next (list))
{
PlugInProcDef *file_proc;
const gchar *progname;
const gchar *locale_domain;
const gchar *help_path;
GimpItemFactoryEntry entry;
const gchar *locale_domain = NULL;
const gchar *item_type = NULL;
const gchar *stock_id = NULL;
gchar *help_id;
gchar *help_page;
gboolean is_xcf;
file_proc = (PlugInProcDef *) list->data;
progname = plug_in_proc_def_get_progname (file_proc);
is_xcf = (strcmp (file_proc->db_info.name, "gimp_xcf_save") == 0);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_path = plug_ins_help_path (factory->gimp, progname);
if (is_xcf)
{
item_type = "<StockItem>";
stock_id = GIMP_STOCK_WILBER;
help_id = g_strdup (GIMP_HELP_FILE_SAVE_XCF);
}
else
{
const gchar *progname;
const gchar *help_path;
help_id = plug_in_proc_def_get_help_id (file_proc);
progname = plug_in_proc_def_get_progname (file_proc);
if (help_path)
help_page = g_strconcat (help_path, ":", help_id, NULL);
else
help_page = g_strconcat ("filters/", help_id, NULL);
locale_domain = plug_ins_locale_domain (factory->gimp, progname, NULL);
help_path = plug_ins_help_path (factory->gimp, progname);
g_free (help_id);
help_id = plug_in_proc_def_get_help_id (file_proc, help_path);
}
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
entry.entry.callback = file_save_type_cmd_callback;
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.entry.item_type = item_type;
entry.entry.extra_data = stock_id;
entry.quark_string = NULL;
entry.help_id = help_page;
entry.help_id = help_id;
entry.description = NULL;
gimp_item_factory_create_item (factory,
......@@ -101,7 +109,19 @@ file_save_menu_setup (GimpItemFactory *factory)
file_proc, 2,
TRUE, FALSE);
g_free (help_page);
if (is_xcf)
{
GtkWidget *menu_item;
menu_item = gtk_item_factory_get_widget (GTK_ITEM_FACTORY (factory),
entry.entry.path);
if (menu_item)
gtk_menu_reorder_child (GTK_MENU (menu_item->parent),
menu_item, 1);
}
g_free (help_id);
}
}
......
......@@ -170,20 +170,12 @@ plug_in_menus_create_entry (GimpItemFactory *item_factory,
{
GimpItemFactoryEntry entry;
gchar *help_id;
gchar *help_page;
g_return_if_fail (item_factory == NULL ||
GIMP_IS_ITEM_FACTORY (item_factory));
g_return_if_fail (proc_def != NULL);
help_id = plug_in_proc_def_get_help_id (proc_def);
if (help_path)
help_page = g_strconcat (help_path, ":", help_id, NULL);
else
help_page = g_strconcat ("filters/", help_id, NULL);
g_free (help_id);
help_id = plug_in_proc_def_get_help_id (proc_def, help_path);
entry.entry.path = strstr (proc_def->menu_path, "/");
entry.entry.accelerator = proc_def->accelerator;
......@@ -191,7 +183,7 @@ plug_in_menus_create_entry (GimpItemFactory *item_factory,
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_id = help_page;
entry.help_id = help_id;
entry.description = NULL;
if (item_factory)
......@@ -228,7 +220,7 @@ plug_in_menus_create_entry (GimpItemFactory *item_factory,
}
}
g_free (help_page);
g_free (help_id);
}
void
......
......@@ -106,27 +106,29 @@ plug_in_proc_def_get_progname (PlugInProcDef *proc_def)
}
gchar *
plug_in_proc_def_get_help_id (PlugInProcDef *proc_def)
plug_in_proc_def_get_help_id (PlugInProcDef *proc_def,
const gchar *help_path)
{
const gchar *progname;
gchar *basename;
gchar *lowercase_basename;
gchar *help_id;
gchar *help_id;
gchar *p;
g_return_val_if_fail (proc_def != NULL, NULL);
progname = plug_in_proc_def_get_progname (proc_def);
help_id = g_strdup (proc_def->db_info.name);
basename = g_path_get_basename (progname);
lowercase_basename = g_ascii_strdown (basename, -1);
g_free (basename);
for (p = help_id; p && *p; p++)
if (*p == '_')
*p = '-';
#ifdef __GNUC__
#warning FIXME: fix plug-in menu item help
#endif
help_id = g_strconcat (lowercase_basename, ".html", NULL);
if (help_path)
{
gchar *path_and_id;
path_and_id = g_strconcat (help_path, ":", help_id, NULL);
g_free (help_id);
g_free (lowercase_basename);
return path_and_id;
}
return help_id;
}
......@@ -47,7 +47,8 @@ void plug_in_proc_def_free (PlugInProcDef *proc_def);
ProcRecord * plug_in_proc_def_get_proc (PlugInProcDef *proc_def);
const gchar * plug_in_proc_def_get_progname (PlugInProcDef *proc_def);
gchar * plug_in_proc_def_get_help_id (PlugInProcDef *proc_def);
gchar * plug_in_proc_def_get_help_id (PlugInProcDef *proc_def,
const gchar *help_path);
#endif /* __PLUG_IN_PROC_H__ */
......@@ -106,27 +106,29 @@ plug_in_proc_def_get_progname (PlugInProcDef *proc_def)
}
gchar *
plug_in_proc_def_get_help_id (PlugInProcDef *proc_def)
plug_in_proc_def_get_help_id (PlugInProcDef *proc_def,
const gchar *help_path)
{
const gchar *progname;
gchar *basename;
gchar *lowercase_basename;
gchar *help_id;
gchar *help_id;
gchar *p;
g_return_val_if_fail (proc_def != NULL, NULL);
progname = plug_in_proc_def_get_progname (proc_def);
help_id = g_strdup (proc_def->db_info.name);
basename = g_path_get_basename (progname);
lowercase_basename = g_ascii_strdown (basename, -1);
g_free (basename);
for (p = help_id; p && *p; p++)
if (*p == '_')
*p = '-';
#ifdef __GNUC__
#warning FIXME: fix plug-in menu item help
#endif
help_id = g_strconcat (lowercase_basename, ".html", NULL);
if (help_path)
{
gchar *path_and_id;
path_and_id = g_strconcat (help_path, ":", help_id, NULL);
g_free (help_id);
g_free (lowercase_basename);
return path_and_id;
}
return help_id;
}
......@@ -47,7 +47,8 @@ void plug_in_proc_def_free (PlugInProcDef *proc_def);
ProcRecord * plug_in_proc_def_get_proc (PlugInProcDef *proc_def);
const gchar * plug_in_proc_def_get_progname (PlugInProcDef *proc_def);
gchar * plug_in_proc_def_get_help_id (PlugInProcDef *proc_def);
gchar * plug_in_proc_def_get_help_id (PlugInProcDef *proc_def,
const gchar *help_path);
#endif /* __PLUG_IN_PROC_H__ */
......@@ -106,27 +106,29 @@ plug_in_proc_def_get_progname (PlugInProcDef *proc_def)
}
gchar *
plug_in_proc_def_get_help_id (PlugInProcDef *proc_def)
plug_in_proc_def_get_help_id (PlugInProcDef *proc_def,
const gchar *help_path)
{
const gchar *progname;
gchar *basename;
gchar *lowercase_basename;
gchar *help_id;
gchar *help_id;
gchar *p;
g_return_val_if_fail (proc_def != NULL, NULL);
progname = plug_in_proc_def_get_progname (proc_def);
help_id = g_strdup (proc_def->db_info.name);
basename = g_path_get_basename (progname);
lowercase_basename = g_ascii_strdown (basename, -1);
g_free (basename);
for (p = help_id; p && *p; p++)
if (*p == '_')
*p = '-';
#ifdef __GNUC__
#warning FIXME: fix plug-in menu item help
#endif
help_id = g_strconcat (lowercase_basename, ".html", NULL);
if (help_path)
{
gchar *path_and_id;
path_and_id = g_strconcat (help_path, ":", help_id, NULL);