Commit ba70ce9a authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

changed GimpHelpFunc typedef: - renamed "const gchar *help_data" to "const

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

	* libgimpwidgets/gimpwidgetstypes.h: changed GimpHelpFunc typedef:
	- renamed "const gchar *help_data" to "const gchar *help_id".
	- added "gpointer help_data".

	* libgimpwidgets/gimphelpui.[ch]: added "gpointer help_data" to
	gimp_help_connect(). Removed all fiddling with html links and
	treat all help IDs as opaque identifiers.

	* app/core/gimptoolinfo.[ch]: changed "help_data" member to
	"help_id".

	* app/widgets/gimpitemfactory.[ch]: removed the "help_path"
	parameter from gimp_item_factory_new() since we don't fiddle with
	html file paths any more. Simplifies menu item help a lot.
	Renamed "help_data" member of struct GimpItemFactoryEntry to
	"help_id".

	* app/gui/plug-in-menus.c: changed accordingly. 3rd party
	plug-ins' menu item help IDs are now encoded as
	"help_path:help_id".

	* app/gui/file-open-menu.c
	* app/gui/file-save-menu.c: when constructing the <Load> and
	<Save> menus, take the resp. procedures' locale_domain and
	help_path into account. Fixes translation of 3rd party menu items.
	Also do the right thing for load/save procs which are implemented
	as temporary procedures (they are impossible to implement
	currently but it's nice to do the right thing anyway...).

	* app/widgets/gimphelp-ids.h: added GIMP_HELP_MAIN identifier.

	* libgimpwidgets/gimpdialog.[ch]
	* libgimpwidgets/gimpwidgets.[ch]
	* libgimp/gimpui.c
	* app/display/gimpdisplayshell.c
	* app/gui/gui.c
	* app/gui/about-dialog.c
	* app/gui/color-notebook.c
	* app/gui/dialogs-constructors.c
	* app/gui/file-dialog-utils.[ch]
	* app/gui/gradients-commands.c
	* app/gui/help-commands.c
	* app/gui/image-menu.c
	* app/gui/menus.c
	* app/gui/preferences-dialog.c
	* app/gui/tips-dialog.c
	* app/tools/gimpcolorpickertool.c
	* app/tools/gimpcroptool.c
	* app/tools/gimpcurvestool.c
	* app/tools/gimphistogramtool.c
	* app/tools/gimpimagemaptool.c
	* app/tools/gimplevelstool.c
	* app/tools/gimpmeasuretool.c
	* app/tools/gimptransformtool.c
	* app/widgets/gimperrorconsole.c
	* app/widgets/gimphelp.[ch]
	* app/widgets/gimpmenufactory.[ch]
	* app/widgets/gimptexteditor.c
	* app/widgets/gimptoolbox.c
	* app/widgets/gimpviewabledialog.[ch]
	* plug-ins/common/CEL.c
	* plug-ins/common/CML_explorer.c
	* plug-ins/common/gee.c
	* plug-ins/common/gee_zoom.c
	* plug-ins/common/gqbist.c
	* plug-ins/common/spheredesigner.c
	* plug-ins/flame/flame.c
	* plug-ins/fp/fp_gtk.c
	* plug-ins/helpbrowser/helpbrowser.c
	* plug-ins/ifscompose/ifscompose.c
	* plug-ins/imagemap/imap_main.c: changed accordingly. Removed
	trailing whitespace all over the place.
parent 9a52f499
2003-08-23 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimpwidgetstypes.h: changed GimpHelpFunc typedef:
- renamed "const gchar *help_data" to "const gchar *help_id".
- added "gpointer help_data".
* libgimpwidgets/gimphelpui.[ch]: added "gpointer help_data" to
gimp_help_connect(). Removed all fiddling with html links and
treat all help IDs as opaque identifiers.
* app/core/gimptoolinfo.[ch]: changed "help_data" member to
"help_id".
* app/widgets/gimpitemfactory.[ch]: removed the "help_path"
parameter from gimp_item_factory_new() since we don't fiddle with
html file paths any more. Simplifies menu item help a lot.
Renamed "help_data" member of struct GimpItemFactoryEntry to
"help_id".
* app/gui/plug-in-menus.c: changed accordingly. 3rd party
plug-ins' menu item help IDs are now encoded as
"help_path:help_id".
* app/gui/file-open-menu.c
* app/gui/file-save-menu.c: when constructing the <Load> and
<Save> menus, take the resp. procedures' locale_domain and
help_path into account. Fixes translation of 3rd party menu items.
Also do the right thing for load/save procs which are implemented
as temporary procedures (they are impossible to implement
currently but it's nice to do the right thing anyway...).
* app/widgets/gimphelp-ids.h: added GIMP_HELP_MAIN identifier.
* libgimpwidgets/gimpdialog.[ch]
* libgimpwidgets/gimpwidgets.[ch]
* libgimp/gimpui.c
* app/display/gimpdisplayshell.c
* app/gui/gui.c
* app/gui/about-dialog.c
* app/gui/color-notebook.c
* app/gui/dialogs-constructors.c
* app/gui/file-dialog-utils.[ch]
* app/gui/gradients-commands.c
* app/gui/help-commands.c
* app/gui/image-menu.c
* app/gui/menus.c
* app/gui/preferences-dialog.c
* app/gui/tips-dialog.c
* app/tools/gimpcolorpickertool.c
* app/tools/gimpcroptool.c
* app/tools/gimpcurvestool.c
* app/tools/gimphistogramtool.c
* app/tools/gimpimagemaptool.c
* app/tools/gimplevelstool.c
* app/tools/gimpmeasuretool.c
* app/tools/gimptransformtool.c
* app/widgets/gimperrorconsole.c
* app/widgets/gimphelp.[ch]
* app/widgets/gimpmenufactory.[ch]
* app/widgets/gimptexteditor.c
* app/widgets/gimptoolbox.c
* app/widgets/gimpviewabledialog.[ch]
* plug-ins/common/CEL.c
* plug-ins/common/CML_explorer.c
* plug-ins/common/gee.c
* plug-ins/common/gee_zoom.c
* plug-ins/common/gqbist.c
* plug-ins/common/spheredesigner.c
* plug-ins/flame/flame.c
* plug-ins/fp/fp_gtk.c
* plug-ins/helpbrowser/helpbrowser.c
* plug-ins/ifscompose/ifscompose.c
* plug-ins/imagemap/imap_main.c: changed accordingly. Removed
trailing whitespace all over the place.
2003-06-22 Manish Singh <yosh@gimp.org>
* configure.in: disallow libgimpprint >= 4.3.0, addresses bug #120162.
......@@ -104,7 +104,7 @@ gradients_save_as_pov_query (GimpContainerEditor *editor)
G_CONNECT_SWAPPED);
gimp_help_connect (GTK_WIDGET (filesel), gimp_standard_help_func,
GIMP_HELP_GRADIENT_SAVE_AS_POV);
GIMP_HELP_GRADIENT_SAVE_AS_POV, NULL);
gtk_widget_show (GTK_WIDGET (filesel));
}
......
......@@ -24,10 +24,6 @@
#include "gui-types.h"
#include "core/gimpobject.h"
#include "plug-in/plug-in.h"
#include "help-commands.h"
......@@ -36,7 +32,7 @@ help_help_cmd_callback (GtkWidget *widget,
gpointer data,
guint action)
{
gimp_standard_help_func (NULL);
gimp_standard_help_func (NULL, NULL);
}
void
......
......@@ -104,7 +104,7 @@ gimp_tool_info_init (GimpToolInfo *tool_info)
tool_info->menu_accel = NULL;
tool_info->help_domain = NULL;
tool_info->help_data = NULL;
tool_info->help_id = NULL;
tool_info->in_toolbox = TRUE;
tool_info->tool_options = NULL;
......@@ -145,10 +145,10 @@ gimp_tool_info_finalize (GObject *object)
g_free (tool_info->help_domain);
tool_info->help_domain = NULL;
}
if (tool_info->help_data)
if (tool_info->help_id)
{
g_free (tool_info->help_data);
tool_info->help_data = NULL;
g_free (tool_info->help_id);
tool_info->help_id = NULL;
}
if (tool_info->tool_options)
......@@ -185,7 +185,7 @@ gimp_tool_info_new (Gimp *gimp,
const gchar *menu_path,
const gchar *menu_accel,
const gchar *help_domain,
const gchar *help_data,
const gchar *help_id,
const gchar *paint_core_name,
const gchar *stock_id)
{
......@@ -227,7 +227,7 @@ gimp_tool_info_new (Gimp *gimp,
tool_info->menu_accel = g_strdup (menu_accel);
tool_info->help_domain = g_strdup (help_domain);
tool_info->help_data = g_strdup (help_data);
tool_info->help_id = g_strdup (help_id);
gimp_viewable_set_stock_id (viewable, stock_id);
......
......@@ -50,7 +50,7 @@ struct _GimpToolInfo
gchar *menu_accel;
gchar *help_domain;
gchar *help_data;
gchar *help_id;
gboolean in_toolbox;
GimpToolOptions *tool_options;
......@@ -75,7 +75,7 @@ GimpToolInfo * gimp_tool_info_new (Gimp *gimp,
const gchar *menu_path,
const gchar *menu_accel,
const gchar *help_domain,
const gchar *help_data,
const gchar *help_id,
const gchar *paint_core_name,
const gchar *stock_id);
......
......@@ -242,7 +242,7 @@ about_dialog_create (void)
gtk_window_set_resizable (GTK_WINDOW (about_dialog), FALSE);
gimp_help_connect (about_dialog, gimp_standard_help_func,
GIMP_HELP_ABOUT_DIALOG);
GIMP_HELP_ABOUT_DIALOG, NULL);
g_signal_connect (about_dialog, "destroy",
G_CALLBACK (about_dialog_destroy),
......
......@@ -95,7 +95,8 @@ static ColorNotebook *
gboolean wants_updates,
gboolean show_alpha);
static void color_notebook_help_func (const gchar *help_data);
static void color_notebook_help_func (const gchar *help_id,
gpointer help_data);
static void color_notebook_ok_callback (GtkWidget *widget,
ColorNotebook *cnp);
......@@ -322,22 +323,22 @@ color_notebook_new_internal (GimpViewable *viewable,
cnp->shell = gimp_viewable_dialog_new (viewable,
title, wmclass_name,
stock_id, desc,
color_notebook_help_func,
(const gchar *) cnp,
color_notebook_help_func, NULL,
NULL);
gtk_window_set_resizable (GTK_WINDOW (cnp->shell), FALSE);
}
else
{
cnp->shell = gimp_dialog_new (title, wmclass_name,
color_notebook_help_func,
(const gchar *) cnp,
GTK_WIN_POS_NONE,
FALSE, TRUE, TRUE,
NULL);
cnp->shell = gimp_dialog_new (title, wmclass_name,
color_notebook_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, TRUE,
NULL);
}
g_object_set_data (G_OBJECT (cnp->shell), "color-notebook", cnp);
gimp_dialog_create_action_area (GIMP_DIALOG (cnp->shell),
GTK_STOCK_CANCEL,
......@@ -535,21 +536,19 @@ color_notebook_new_internal (GimpViewable *viewable,
}
static void
color_notebook_help_func (const gchar *data)
color_notebook_help_func (const gchar *help_id,
gpointer help_data)
{
ColorNotebook *cnp;
GimpColorNotebook *notebook;
gchar *help_path;
cnp = (ColorNotebook *) data;
cnp = g_object_get_data (G_OBJECT (help_data), "color-notebook");
notebook = GIMP_COLOR_NOTEBOOK (cnp->notebook);
help_path = g_strconcat ("dialogs/color_selectors/",
GIMP_COLOR_SELECTOR_GET_CLASS (notebook->cur_page)->help_page,
NULL);
gimp_standard_help_func (help_path);
g_free (help_path);
help_id = GIMP_COLOR_SELECTOR_GET_CLASS (notebook->cur_page)->help_page;
gimp_standard_help_func (help_id, NULL);
}
static void
......
......@@ -1110,8 +1110,7 @@ dialogs_tool_options_tool_changed (GimpContext *context,
gtk_label_set_text (label, tool_info->blurb);
gimp_help_set_help_data (GTK_WIDGET (label)->parent->parent,
tool_info->help,
tool_info->help_data);
tool_info->help, tool_info->help_id);
}
static GtkWidget *
......
......@@ -48,7 +48,7 @@ file_dialog_new (Gimp *gimp,
const gchar *menu_identifier,
const gchar *title,
const gchar *wmclass_name,
const gchar *help_data,
const gchar *help_id,
GCallback ok_callback)
{
GtkWidget *filesel;
......@@ -61,7 +61,7 @@ file_dialog_new (Gimp *gimp,
g_return_val_if_fail (menu_identifier != NULL, NULL);
g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (wmclass_name != NULL, NULL);
g_return_val_if_fail (help_data != NULL, NULL);
g_return_val_if_fail (help_id != NULL, NULL);
g_return_val_if_fail (ok_callback != NULL, NULL);
filesel = gtk_file_selection_new (title);
......@@ -73,7 +73,7 @@ file_dialog_new (Gimp *gimp,
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
gtk_window_set_wmclass (GTK_WINDOW (filesel), wmclass_name, "Gimp");
gimp_help_connect (filesel, gimp_standard_help_func, help_data);
gimp_help_connect (filesel, gimp_standard_help_func, help_id, NULL);
gtk_container_set_border_width (GTK_CONTAINER (fs->button_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (filesel), 2);
......
......@@ -27,7 +27,7 @@ GtkWidget * file_dialog_new (Gimp *gimp,
const gchar *menu_identifier,
const gchar *title,
const gchar *wmclass_name,
const gchar *help_data,
const gchar *help_id,
GCallback ok_callback);
void file_dialog_show (GtkWidget *filesel);
......
......@@ -464,7 +464,7 @@ prefs_notebook_append_page (Gimp *gimp,
const gchar *notebook_icon,
GtkTreeStore *tree,
const gchar *tree_label,
const gchar *help_data,
const gchar *help_id,
GtkTreeIter *parent,
GtkTreeIter *iter,
gint page_index)
......@@ -478,7 +478,7 @@ prefs_notebook_append_page (Gimp *gimp,
gtk_notebook_append_page (notebook, event_box, NULL);
gtk_widget_show (event_box);
gimp_help_set_help_data (event_box, NULL, help_data);
gimp_help_set_help_data (event_box, NULL, help_id);
vbox = gtk_vbox_new (FALSE, 6);
gtk_container_set_border_width (GTK_CONTAINER (vbox), 6);
......@@ -824,21 +824,19 @@ prefs_memsize_entry_add (GObject *config,
}
static void
prefs_help_func (const gchar *help_data)
prefs_help_func (const gchar *help_id,
gpointer help_data)
{
if (prefs_dialog)
{
GtkWidget *notebook;
GtkWidget *event_box;
gint page_num;
GtkWidget *notebook;
GtkWidget *event_box;
gint page_num;
notebook = g_object_get_data (G_OBJECT (prefs_dialog), "notebook");
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
event_box = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num);
notebook = g_object_get_data (G_OBJECT (help_data), "notebook");
page_num = gtk_notebook_get_current_page (GTK_NOTEBOOK (notebook));
event_box = gtk_notebook_get_nth_page (GTK_NOTEBOOK (notebook), page_num);
help_data = g_object_get_data (G_OBJECT (event_box), "gimp_help_data");
gimp_standard_help_func (help_data);
}
help_id = g_object_get_data (G_OBJECT (event_box), "gimp-help-id");
gimp_standard_help_func (help_id, NULL);
}
static GtkWidget *
......
......@@ -217,9 +217,8 @@ tips_dialog_create (Gimp *gimp)
G_CALLBACK (tips_show_next),
NULL);
/* Connect the "F1" help key */
gimp_help_connect (tips_dialog, gimp_standard_help_func,
GIMP_HELP_TIPS_DIALOG);
GIMP_HELP_TIPS_DIALOG, NULL);
tips_set_labels (current_tip->data);
......
......@@ -242,7 +242,7 @@ about_dialog_create (void)
gtk_window_set_resizable (GTK_WINDOW (about_dialog), FALSE);
gimp_help_connect (about_dialog, gimp_standard_help_func,
GIMP_HELP_ABOUT_DIALOG);
GIMP_HELP_ABOUT_DIALOG, NULL);
g_signal_connect (about_dialog, "destroy",
G_CALLBACK (about_dialog_destroy),
......
......@@ -95,7 +95,8 @@ static ColorNotebook *
gboolean wants_updates,
gboolean show_alpha);
static void color_notebook_help_func (const gchar *help_data);
static void color_notebook_help_func (const gchar *help_id,
gpointer help_data);
static void color_notebook_ok_callback (GtkWidget *widget,
ColorNotebook *cnp);
......@@ -322,22 +323,22 @@ color_notebook_new_internal (GimpViewable *viewable,
cnp->shell = gimp_viewable_dialog_new (viewable,
title, wmclass_name,
stock_id, desc,
color_notebook_help_func,
(const gchar *) cnp,
color_notebook_help_func, NULL,
NULL);
gtk_window_set_resizable (GTK_WINDOW (cnp->shell), FALSE);
}
else
{
cnp->shell = gimp_dialog_new (title, wmclass_name,
color_notebook_help_func,
(const gchar *) cnp,
GTK_WIN_POS_NONE,
FALSE, TRUE, TRUE,
NULL);
cnp->shell = gimp_dialog_new (title, wmclass_name,
color_notebook_help_func, NULL,
GTK_WIN_POS_NONE,
FALSE, TRUE, TRUE,
NULL);
}
g_object_set_data (G_OBJECT (cnp->shell), "color-notebook", cnp);
gimp_dialog_create_action_area (GIMP_DIALOG (cnp->shell),
GTK_STOCK_CANCEL,
......@@ -535,21 +536,19 @@ color_notebook_new_internal (GimpViewable *viewable,
}
static void
color_notebook_help_func (const gchar *data)
color_notebook_help_func (const gchar *help_id,
gpointer help_data)
{
ColorNotebook *cnp;
GimpColorNotebook *notebook;
gchar *help_path;
cnp = (ColorNotebook *) data;
cnp = g_object_get_data (G_OBJECT (help_data), "color-notebook");
notebook = GIMP_COLOR_NOTEBOOK (cnp->notebook);
help_path = g_strconcat ("dialogs/color_selectors/",
GIMP_COLOR_SELECTOR_GET_CLASS (notebook->cur_page)->help_page,
NULL);
gimp_standard_help_func (help_path);
g_free (help_path);
help_id = GIMP_COLOR_SELECTOR_GET_CLASS (notebook->cur_page)->help_page;
gimp_standard_help_func (help_id, NULL);
}
static void
......
......@@ -1110,8 +1110,7 @@ dialogs_tool_options_tool_changed (GimpContext *context,
gtk_label_set_text (label, tool_info->blurb);
gimp_help_set_help_data (GTK_WIDGET (label)->parent->parent,
tool_info->help,
tool_info->help_data);
tool_info->help, tool_info->help_id);
}
static GtkWidget *
......
......@@ -48,7 +48,7 @@ file_dialog_new (Gimp *gimp,
const gchar *menu_identifier,
const gchar *title,
const gchar *wmclass_name,
const gchar *help_data,
const gchar *help_id,
GCallback ok_callback)
{
GtkWidget *filesel;
......@@ -61,7 +61,7 @@ file_dialog_new (Gimp *gimp,
g_return_val_if_fail (menu_identifier != NULL, NULL);
g_return_val_if_fail (title != NULL, NULL);
g_return_val_if_fail (wmclass_name != NULL, NULL);
g_return_val_if_fail (help_data != NULL, NULL);
g_return_val_if_fail (help_id != NULL, NULL);
g_return_val_if_fail (ok_callback != NULL, NULL);
filesel = gtk_file_selection_new (title);
......@@ -73,7 +73,7 @@ file_dialog_new (Gimp *gimp,
gtk_window_set_position (GTK_WINDOW (filesel), GTK_WIN_POS_MOUSE);
gtk_window_set_wmclass (GTK_WINDOW (filesel), wmclass_name, "Gimp");
gimp_help_connect (filesel, gimp_standard_help_func, help_data);
gimp_help_connect (filesel, gimp_standard_help_func, help_id, NULL);
gtk_container_set_border_width (GTK_CONTAINER (fs->button_area), 2);
gtk_container_set_border_width (GTK_CONTAINER (filesel), 2);
......
......@@ -27,7 +27,7 @@ GtkWidget * file_dialog_new (Gimp *gimp,
const gchar *menu_identifier,
const gchar *title,
const gchar *wmclass_name,
const gchar *help_data,
const gchar *help_id,
GCallback ok_callback);
void file_dialog_show (GtkWidget *filesel);
......
......@@ -29,6 +29,7 @@
#include "core/gimp.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-ins.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
......@@ -56,31 +57,48 @@ gint n_file_open_menu_entries = G_N_ELEMENTS (file_open_menu_entries);
void
file_open_menu_setup (GimpItemFactory *factory)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
GSList *list;
GSList *list;
for (list = factory->gimp->load_procs; list; list = g_slist_next (list))
{
gchar *basename;
gchar *lowercase_basename;
gchar *help_page;
PlugInProcDef *file_proc;
const gchar *progname;
const gchar *locale_domain;
const gchar *help_path;
GimpItemFactoryEntry entry;
gchar *help_id;
gchar *help_page;
file_proc = (PlugInProcDef *) list->data;
basename = g_path_get_basename (file_proc->prog);
progname = plug_in_proc_def_get_progname (file_proc);
lowercase_basename = g_ascii_strdown (basename, -1);
locale_domain = plug_ins_locale_domain (factory->gimp,
progname, NULL);
help_path = plug_ins_help_path (factory->gimp,
progname);
g_free (basename);
#ifdef __GNUC__
#warning FIXME: fix plug-in menu item help
#endif
{
gchar *basename;
gchar *lowercase_basename;
/* NOT g_build_filename() because this is a relative URI */
help_page = g_strconcat ("filters/",
lowercase_basename,
".html",
NULL);
basename = g_path_get_basename (file_proc->prog);
lowercase_basename = g_ascii_strdown (basename, -1);
g_free (lowercase_basename);
help_id = g_strconcat (lowercase_basename, ".html", NULL);
g_free (lowercase_basename);
}
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);
entry.entry.path = strstr (file_proc->menu_path, "/");
entry.entry.accelerator = NULL;
......@@ -88,12 +106,12 @@ file_open_menu_setup (GimpItemFactory *factory)
entry.entry.callback_action = 0;
entry.entry.item_type = NULL;
entry.quark_string = NULL;
entry.help_page = help_page;
entry.help_id = help_page;
entry.description = NULL;
gimp_item_factory_create_item (factory,
&entry,
NULL,
locale_domain,
file_proc, 2,
TRUE, FALSE);
......
......@@ -30,6 +30,7 @@
#include "core/gimpdrawable.h"
#include "plug-in/plug-in-proc.h"
#include "plug-in/plug-ins.h"
#include "widgets/gimphelp-ids.h"
#include "widgets/gimpitemfactory.h"
......@@ -57,31 +58,48 @@ gint n_file_save_menu_entries = G_N_ELEMENTS (file_save_menu_entries);
void
file_save_menu_setup (GimpItemFactory *factory)
{
GimpItemFactoryEntry entry;
PlugInProcDef *file_proc;
GSList *list;
GSList *list;
for (list = factory->gimp->save_procs; list; list = g_slist_next (list))
{
gchar *basename;
gchar *lowercase_basename;
gchar *help_page;
PlugInProcDef *file_proc;
const gchar *progname;
const gchar *locale_domain;
const gchar *help_path;
GimpItemFactoryEntry entry;
gchar *help_id;
gchar *help_page;
file_proc = (PlugInProcDef *) list->data;