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.
This commit is contained in:
Michael Natterer
2003-08-23 19:35:05 +00:00
committed by Michael Natterer
parent 9a52f49904
commit ba70ce9a10
72 changed files with 898 additions and 839 deletions

View File

@ -136,7 +136,7 @@ gimp_dialog_close (GtkDialog *dialog)
* gtk_window_set_wmclass(). The @wmclass_class will be
* automatically set to "Gimp".
* @help_func: The function which will be called if the user presses "F1".
* @help_data: The data pointer which will be passed to @help_func.
* @help_id: The help_id which will be passed to @help_func.
* @position: The dialog's initial position which will be set with
* gtk_window_set_position().
* @allow_shrink: The dialog's @allow_shrink flag, ...
@ -158,7 +158,7 @@ GtkWidget *
gimp_dialog_new (const gchar *title,
const gchar *wmclass_name,
GimpHelpFunc help_func,
const gchar *help_data,
const gchar *help_id,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,
@ -184,7 +184,7 @@ gimp_dialog_new (const gchar *title,
dialog = gimp_dialog_newv (title,
wmclass_name,
help_func,
help_data,
help_id,
position,
allow_shrink,
allow_grow,
@ -204,7 +204,7 @@ gimp_dialog_new (const gchar *title,
* gtk_window_set_wmclass(). The @wmclass_class will be
* automatically set to "Gimp".
* @help_func: The function which will be called if the user presses "F1".
* @help_data: The data pointer which will be passed to @help_func.
* @help_id: The help_id which will be passed to @help_func.
* @position: The dialog's initial position which will be set with
* gtk_window_set_position().
* @allow_shrink: The dialog's @allow_shrink flag, ...
@ -226,7 +226,7 @@ GtkWidget *
gimp_dialog_newv (const gchar *title,
const gchar *wmclass_name,
GimpHelpFunc help_func,
const gchar *help_data,
const gchar *help_id,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,
@ -256,7 +256,7 @@ gimp_dialog_newv (const gchar *title,
/* connect the "F1" help key */
if (help_func)
gimp_help_connect (dialog, help_func, help_data);
gimp_help_connect (dialog, help_func, help_id, dialog);
return dialog;
}

View File

@ -56,7 +56,7 @@ GType gimp_dialog_get_type (void) G_GNUC_CONST;
GtkWidget * gimp_dialog_new (const gchar *title,
const gchar *wmclass_name,
GimpHelpFunc help_func,
const gchar *help_data,
const gchar *help_id,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,
@ -78,7 +78,7 @@ GtkWidget * gimp_dialog_new (const gchar *title,
GtkWidget * gimp_dialog_newv (const gchar *title,
const gchar *wmclass_name,
GimpHelpFunc help_func,
const gchar *help_data,
const gchar *help_id,
GtkWindowPosition position,
gint allow_shrink,
gint allow_grow,

View File

@ -8,10 +8,10 @@
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
@ -22,9 +22,8 @@
#include "config.h"
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#ifdef __GNUC__
#warning GTK_DISABLE_DEPRECATED
@ -51,7 +50,8 @@ typedef enum
/* local function prototypes */
static const gchar * gimp_help_get_help_data (GtkWidget *widget,
GtkWidget **help_widget);
GtkWidget **help_widget,
gpointer *ret_data);
static gboolean gimp_help_callback (GtkWidget *widget,
GtkWidgetHelpType help_type,
GimpHelpFunc help_func);
@ -122,7 +122,8 @@ gimp_help_disable_tooltips (void)
}
void
gimp_standard_help_func (const gchar *help_data)
gimp_standard_help_func (const gchar *help_id,
gpointer data)
{
if (! _gimp_standard_help_func)
{
@ -131,7 +132,7 @@ gimp_standard_help_func (const gchar *help_data)
return;
}
(* _gimp_standard_help_func) (help_data);
(* _gimp_standard_help_func) (help_id, data);
}
/**
@ -139,7 +140,8 @@ gimp_standard_help_func (const gchar *help_data)
* @widget: The widget you want to connect the help accelerator for. Will
* be a #GtkWindow in most cases.
* @help_func: The function which will be called if the user presses "F1".
* @help_data: The data pointer which will be passed to @help_func.
* @help_id: The help_id which will be passed to @help_func.
* @help_data: The help_data pointer which will be passed to @help_func.
*
* Note that this function is automatically called by all libgimp dialog
* constructors. You only have to call it for windows/dialogs you created
@ -148,7 +150,8 @@ gimp_standard_help_func (const gchar *help_data)
void
gimp_help_connect (GtkWidget *widget,
GimpHelpFunc help_func,
const gchar *help_data)
const gchar *help_id,
gpointer help_data)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
g_return_if_fail (help_func != NULL);
@ -189,7 +192,9 @@ gimp_help_connect (GtkWidget *widget,
gtk_widget_realize (tips_query);
}
gimp_help_set_help_data (widget, NULL, help_data);
gimp_help_set_help_data (widget, NULL, help_id);
g_object_set_data (G_OBJECT (widget), "gimp-help-data", help_data);
g_signal_connect (widget, "show_help",
G_CALLBACK (gimp_help_callback),
@ -200,45 +205,29 @@ gimp_help_connect (GtkWidget *widget,
/**
* gimp_help_set_help_data:
* @widget: The #GtkWidget you want to set a @tooltip and/or @help_data for.
* @widget: The #GtkWidget you want to set a @tooltip and/or @help_data for.
* @tooltip: The text for this widget's tooltip (or %NULL).
* @help_data: The @help_data for the #GtkTipsQuery tooltips inspector.
* @help_id: The @help_id for the #GtkTipsQuery tooltips inspector.
*
* The reason why we don't use gtk_tooltips_set_tip() is that it's
* impossible to set a @private_tip (aka @help_data) without a visible
* impossible to set a @private_tip (aka @help_id) without a visible
* @tooltip.
*
* This function can be called with %NULL for @tooltip. Use this feature
* if you want to set a HTML help link for a widget which shouldn't have
* if you want to set a help link for a widget which shouldn't have
* a visible tooltip.
*
* You can e.g. set a @help_data string to a complete HTML page for a
* container widget (e.g. a #GtkBox). For the widgets inside the box
* you can set HTML anchors which point inside the container widget's
* help page by setting @help_data strings starting with "#".
*
* If the tooltips inspector (Shift + "F1") is invoked and the user
* clicks on one of the widgets which only contain a "#" link, the
* help system will automatically ascend the widget hierarchy until it
* finds another widget with @help_data attached and concatenates both
* to a complete help path.
**/
void
gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip,
const gchar *help_data)
const gchar *help_id)
{
g_return_if_fail (GTK_IS_WIDGET (widget));
if (tooltip)
{
gtk_tooltips_set_tip (tool_tips, widget, tooltip, help_data);
}
else if (help_data)
{
g_object_set_data (G_OBJECT (widget), "gimp_help_data",
(gpointer) help_data);
}
gtk_tooltips_set_tip (tool_tips, widget, tooltip, help_id);
else
g_object_set_data (G_OBJECT (widget), "gimp-help-id", (gpointer) help_id);
}
/**
@ -249,10 +238,10 @@ gimp_help_set_help_data (GtkWidget *widget,
* The mouse cursor will turn turn into a question mark and the user can
* click on any widget of the application which started the inspector.
*
* If the widget the user clicked on has a @help_data string attached
* (see gimp_help_set_help_data()), the corresponding HTML page will
* If the widget the user clicked on has a @help_id string attached
* (see gimp_help_set_help_data()), the corresponding help page will
* be displayed. Otherwise the help system will ascend the widget hierarchy
* until it finds an attached @help_data string (which should be the
* until it finds an attached @help_id string (which should be the
* case at least for every window/dialog).
**/
void
@ -267,29 +256,36 @@ gimp_context_help (void)
static const gchar *
gimp_help_get_help_data (GtkWidget *widget,
GtkWidget **help_widget)
GtkWidget **help_widget,
gpointer *ret_data)
{
GtkTooltipsData *tooltips_data;
gchar *help_data = NULL;
gchar *help_id = NULL;
gpointer help_data = NULL;
for (; widget; widget = widget->parent)
{
if ((tooltips_data = gtk_tooltips_data_get (widget)) &&
tooltips_data->tip_private)
{
help_data = tooltips_data->tip_private;
help_id = tooltips_data->tip_private;
}
else
{
help_data = g_object_get_data (G_OBJECT (widget), "gimp_help_data");
help_id = g_object_get_data (G_OBJECT (widget), "gimp-help-id");
}
if (help_data)
help_data = g_object_get_data (G_OBJECT (widget), "gimp-help-data");
if (help_id)
{
if (help_widget)
*help_widget = widget;
return (const gchar *) help_data;
if (ret_data)
*ret_data = help_data;
return (const gchar *) help_id;
}
}
@ -306,11 +302,23 @@ gimp_help_callback (GtkWidget *widget,
case GIMP_WIDGET_HELP_TYPE_HELP:
if (help_func)
{
gchar *help_data;
GtkTooltipsData *tooltips_data;
gchar *help_id = NULL;
gpointer help_data = NULL;
help_data = g_object_get_data (G_OBJECT (widget), "gimp_help_data");
if ((tooltips_data = gtk_tooltips_data_get (widget)) &&
tooltips_data->tip_private)
{
help_id = tooltips_data->tip_private;
}
else
{
help_id = g_object_get_data (G_OBJECT (widget), "gimp-help-id");
}
(* help_func) (help_data);
help_data = g_object_get_data (G_OBJECT (widget), "gimp-help-data");
(* help_func) (help_id, help_data);
}
return TRUE;
@ -337,33 +345,14 @@ static gboolean
gimp_help_tips_query_idle_show_help (gpointer data)
{
GtkWidget *help_widget;
const gchar *help_data = NULL;
const gchar *help_id = NULL;
gpointer help_data = NULL;
help_data = gimp_help_get_help_data (GTK_WIDGET (data), &help_widget);
help_id = gimp_help_get_help_data (GTK_WIDGET (data), &help_widget,
&help_data);
if (help_data)
{
if (help_data[0] == '#')
{
const gchar *help_index;
help_index = help_data;
help_data = gimp_help_get_help_data (help_widget->parent, NULL);
if (help_data)
{
gchar *help_text;
help_text = g_strconcat (help_data, help_index, NULL);
gimp_standard_help_func (help_text);
g_free (help_text);
}
}
else
{
gimp_standard_help_func (help_data);
}
}
if (help_id)
gimp_standard_help_func (help_id, help_data);
return FALSE;
}

View File

@ -35,17 +35,19 @@ void gimp_help_disable_tooltips (void);
/* the standard gimp help function
*/
void gimp_standard_help_func (const gchar *help_data);
void gimp_standard_help_func (const gchar *help_id,
gpointer help_data);
/* connect the help callback of a window */
void gimp_help_connect (GtkWidget *widget,
GimpHelpFunc help_func,
const gchar *help_data);
const gchar *help_id,
gpointer help_data);
/* set help data for non-window widgets */
void gimp_help_set_help_data (GtkWidget *widget,
const gchar *tooltip,
const gchar *help_data);
const gchar *help_id);
/* activate the context help inspector */
void gimp_context_help (void);

View File

@ -658,7 +658,7 @@ gimp_scale_entry_new_internal (gboolean color_scale,
gdouble unconstrained_lower,
gdouble unconstrained_upper,
const gchar *tooltip,
const gchar *help_data)
const gchar *help_id)
{
GtkWidget *label;
GtkWidget *scale;
@ -749,10 +749,10 @@ gimp_scale_entry_new_internal (gboolean color_scale,
GTK_SHRINK, GTK_SHRINK, 0, 0);
gtk_widget_show (spinbutton);
if (tooltip || help_data)
if (tooltip || help_id)
{
gimp_help_set_help_data (scale, tooltip, help_data);
gimp_help_set_help_data (spinbutton, tooltip, help_data);
gimp_help_set_help_data (scale, tooltip, help_id);
gimp_help_set_help_data (spinbutton, tooltip, help_id);
}
g_object_set_data (G_OBJECT (return_adj), "label", label);
@ -784,7 +784,7 @@ gimp_scale_entry_new_internal (gboolean color_scale,
* @unconstrained_upper: The spinbutton's upper boundary
* if @constrain == %FALSE.
* @tooltip: A tooltip message for the scale and the spinbutton.
* @help_data: The widgets' help_data (see gimp_help_set_help_data()).
* @help_id: The widgets' help_id (see gimp_help_set_help_data()).
*
* This function creates a #GtkLabel, a #GtkHScale and a #GtkSpinButton and
* attaches them to a 3-column #GtkTable.
@ -808,7 +808,7 @@ gimp_scale_entry_new (GtkTable *table,
gdouble unconstrained_lower,
gdouble unconstrained_upper,
const gchar *tooltip,
const gchar *help_data)
const gchar *help_id)
{
return gimp_scale_entry_new_internal (FALSE,
table, column, row,
@ -819,7 +819,7 @@ gimp_scale_entry_new (GtkTable *table,
constrain,
unconstrained_lower,
unconstrained_upper,
tooltip, help_data);
tooltip, help_id);
}
/**
@ -838,7 +838,7 @@ gimp_scale_entry_new (GtkTable *table,
* @page_increment: The page increment.
* @digits: The number of decimal digits.
* @tooltip: A tooltip message for the scale and the spinbutton.
* @help_data: The widgets' help_data (see gimp_help_set_help_data()).
* @help_id: The widgets' help_id (see gimp_help_set_help_data()).
*
* This function creates a #GtkLabel, a #GimpColorScale and a
* #GtkSpinButton and attaches them to a 3-column #GtkTable.
@ -859,7 +859,7 @@ gimp_color_scale_entry_new (GtkTable *table,
gdouble page_increment,
guint digits,
const gchar *tooltip,
const gchar *help_data)
const gchar *help_id)
{
return gimp_scale_entry_new_internal (TRUE,
table, column, row,
@ -868,7 +868,7 @@ gimp_color_scale_entry_new (GtkTable *table,
step_increment, page_increment,
digits,
TRUE, 0.0, 0.0,
tooltip, help_data);
tooltip, help_id);
}
/**

View File

@ -168,7 +168,7 @@ GtkObject * gimp_scale_entry_new (GtkTable *table,
gdouble unconstrained_lower,
gdouble unconstrained_upper,
const gchar *tooltip,
const gchar *help_data);
const gchar *help_id);
GtkObject * gimp_color_scale_entry_new (GtkTable *table,
gint column,
@ -183,7 +183,7 @@ GtkObject * gimp_color_scale_entry_new (GtkTable *table,
gdouble page_increment,
guint digits,
const gchar *tooltip,
const gchar *help_data);
const gchar *help_id);
void gimp_scale_entry_set_sensitive (GtkObject *adjustment,
gboolean sensitive);

View File

@ -76,7 +76,8 @@ typedef struct _GimpSizeEntry GimpSizeEntry;
typedef struct _GimpUnitMenu GimpUnitMenu;
typedef void (* GimpHelpFunc) (const gchar *help_data);
typedef void (* GimpHelpFunc) (const gchar *help_id,
gpointer data);
G_END_DECLS