added a GimpHelpFunc parameter to _gimp_help_init(). Implement

2003-05-25  Michael Natterer  <mitch@gimp.org>

	* libgimpwidgets/gimphelpui.[ch]: added a GimpHelpFunc parameter to
	_gimp_help_init(). Implement gimp_standard_help_func() here and
	use the function pointer passed to _gimp_help_init().

	* libgimpwidgets/gimpwidgets-private.[ch]: removed
	standard_help_func from GimpWidgetsVTable. Require it as paramater
	to gimp_widgets_init() and pass it to _gimp_help_init().

	* libgimpwidgets/gimpunitmenu.c: use gimp_standard_help_func
	directly again.

	* app/libgimp_glue.[ch]: removed gimp_standard_help_func().

	* libgimp/Makefile.am
	* libgimp/gimphelp.c: removed this file (containing
	gimp_standard_help_func()).

	* app/gui/gui.c: added private gimp_help_func() and pass it to
	gimp_widgets_init().

	* libgimp/gimpui.c: added private gimp_ui_help_func() and pass it
	to gimp_widgets_init().
This commit is contained in:
Michael Natterer 2003-05-25 12:13:57 +00:00 committed by Michael Natterer
parent 7860f1c776
commit 253ed7092b
12 changed files with 90 additions and 65 deletions

View File

@ -1,3 +1,28 @@
2003-05-25 Michael Natterer <mitch@gimp.org>
* libgimpwidgets/gimphelpui.[ch]: added a GimpHelpFunc parameter to
_gimp_help_init(). Implement gimp_standard_help_func() here and
use the function pointer passed to _gimp_help_init().
* libgimpwidgets/gimpwidgets-private.[ch]: removed
standard_help_func from GimpWidgetsVTable. Require it as paramater
to gimp_widgets_init() and pass it to _gimp_help_init().
* libgimpwidgets/gimpunitmenu.c: use gimp_standard_help_func
directly again.
* app/libgimp_glue.[ch]: removed gimp_standard_help_func().
* libgimp/Makefile.am
* libgimp/gimphelp.c: removed this file (containing
gimp_standard_help_func()).
* app/gui/gui.c: added private gimp_help_func() and pass it to
gimp_widgets_init().
* libgimp/gimpui.c: added private gimp_ui_help_func() and pass it
to gimp_widgets_init().
2003-05-25 Michael Natterer <mitch@gimp.org>
* data/misc/Makefile.am: forgot some hardcoded "1.3" here.

View File

@ -45,6 +45,7 @@
#include "widgets/gimpdevices.h"
#include "widgets/gimpdialogfactory.h"
#include "widgets/gimphelp.h"
#include "widgets/gimpitemfactory.h"
#include "widgets/gimpmenufactory.h"
#include "widgets/gimpwidgets-utils.h"
@ -57,11 +58,15 @@
#include "menus.h"
#include "session.h"
#include "app_procs.h" /* FIXME */
#include "gimp-intl.h"
/* local function prototypes */
static void gui_help_func (const gchar *help_data);
static void gui_threads_enter (Gimp *gimp);
static void gui_threads_leave (Gimp *gimp);
static void gui_set_busy (Gimp *gimp);
@ -118,8 +123,6 @@ gui_libs_init (gint *argc,
return FALSE;
/* Initialize the eeky vtable needed by libgimpwidgets */
vtable.standard_help_func = gimp_standard_help_func;
vtable.palette_get_background = gimp_palette_get_background;
vtable.palette_get_foreground = gimp_palette_get_foreground;
@ -133,7 +136,7 @@ gui_libs_init (gint *argc,
vtable.unit_get_singular = gimp_unit_get_singular;
vtable.unit_get_plural = gimp_unit_get_plural;
gimp_widgets_init (&vtable);
gimp_widgets_init (&vtable, gui_help_func);
g_type_class_ref (GIMP_TYPE_COLOR_SELECT);
@ -397,6 +400,12 @@ gui_get_screen_resolution (gdouble *xres,
/* private functions */
static void
gui_help_func (const gchar *help_data)
{
gimp_help (the_gimp, NULL, help_data);
}
static void
gui_threads_enter (Gimp *gimp)
{

View File

@ -28,8 +28,6 @@
#include "core/gimpcontext.h"
#include "core/gimpunit.h"
#include "widgets/gimphelp.h"
#include "app_procs.h"
#define __LIBGIMP_GLUE_C__
@ -163,9 +161,3 @@ gimp_unit_get_plural (GimpUnit unit)
{
return _gimp_unit_get_plural (the_gimp, unit);
}
void
gimp_standard_help_func (const gchar *help_data)
{
gimp_help (the_gimp, NULL, help_data);
}

View File

@ -55,7 +55,5 @@ const gchar * gimp_unit_get_abbreviation (GimpUnit unit);
const gchar * gimp_unit_get_singular (GimpUnit unit);
const gchar * gimp_unit_get_plural (GimpUnit unit);
void gimp_standard_help_func (const gchar *help_data);
#endif /* __LIBGIMP_GLUE_H__ */

View File

@ -157,7 +157,6 @@ libgimp_1_3_la_SOURCES = \
gimpchannel.h \
gimpdrawable.c \
gimpdrawable.h \
gimphelp.c \
gimpimage.c \
gimpimage.h \
gimplayer.c \

View File

@ -1,31 +0,0 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995 Spencer Kimball and Peter Mattis
*
* gimphelp.c
* Copyright (C) 2000 Michael Natterer <mitch@gimp.org>
*
* This library is free software; you can redistribute it and/or
* 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
* Library General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include "gimp.h"
void
gimp_standard_help_func (gchar *help_data)
{
gimp_help (gimp_get_progname (), help_data);
}

View File

@ -25,6 +25,14 @@
#include "libgimpwidgets/gimpwidgets.h"
#include "libgimpwidgets/gimpwidgets-private.h"
/* local function prototypes */
static void gimp_ui_help_func (const gchar *help_data);
/* public functions */
/**
* gimp_ui_init:
* @prog_name: The name of the plug-in which will be passed as argv[0] to
@ -82,7 +90,6 @@ gimp_ui_init (const gchar *prog_name,
gtk_preview_set_gamma (gimp_gamma ());
/* Initialize the eeky vtable needed by libgimpwidgets */
vtable.standard_help_func = gimp_standard_help_func;
vtable.palette_get_background = gimp_palette_get_background;
vtable.palette_get_foreground = gimp_palette_get_foreground;
vtable.unit_get_number_of_units = gimp_unit_get_number_of_units;
@ -95,10 +102,19 @@ gimp_ui_init (const gchar *prog_name,
vtable.unit_get_singular = gimp_unit_get_singular;
vtable.unit_get_plural = gimp_unit_get_plural;
gimp_widgets_init (&vtable);
gimp_widgets_init (&vtable, gimp_ui_help_func);
if (! gimp_show_tool_tips ())
gimp_help_disable_tooltips ();
initialized = TRUE;
}
/* private functions */
static void
gimp_ui_help_func (const gchar *help_data)
{
gimp_help (gimp_get_progname (), (gchar *) help_data);
}

View File

@ -39,7 +39,6 @@
#include "gimpdialog.h"
#include "gimphelpui.h"
#include "gimpwidgets-private.h"
typedef enum
@ -67,8 +66,9 @@ static gboolean gimp_help_tips_query_idle_start (gpointer tips_query
/* local variables */
static GtkTooltips *tool_tips = NULL;
static GtkWidget *tips_query = NULL;
static GimpHelpFunc the_help_func = NULL;
static GtkTooltips *tool_tips = NULL;
static GtkWidget *tips_query = NULL;
/* public functions */
@ -84,8 +84,15 @@ static GtkWidget *tips_query = NULL;
* Nota that this function is called automatically by gimp_widgets_init().
**/
void
_gimp_help_init (void)
_gimp_help_init (GimpHelpFunc standard_help_func)
{
g_return_if_fail (standard_help_func != NULL);
if (the_help_func)
g_error ("_gimp_help_init() must only be called once!");
the_help_func = standard_help_func;
tool_tips = gtk_tooltips_new ();
/* take ownership of the tooltips */
@ -115,6 +122,19 @@ gimp_help_disable_tooltips (void)
gtk_tooltips_disable (tool_tips);
}
void
gimp_standard_help_func (const gchar *help_data)
{
if (! the_help_func)
{
g_warning ("gimp_standard_help_func(): you must call _gimp_help_init() "
"before using the help system");
return;
}
(* the_help_func) (help_data);
}
/**
* gimp_help_connect:
* @widget: The widget you want to connect the help accelerator for. Will
@ -336,13 +356,13 @@ gimp_help_tips_query_idle_show_help (gpointer data)
gchar *help_text;
help_text = g_strconcat (help_data, help_index, NULL);
_gimp_eek.standard_help_func (help_text);
gimp_standard_help_func (help_text);
g_free (help_text);
}
}
else
{
_gimp_eek.standard_help_func (help_data);
gimp_standard_help_func (help_data);
}
}

View File

@ -28,13 +28,12 @@ G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
void _gimp_help_init (void);
void _gimp_help_init (GimpHelpFunc standard_help_func);
void gimp_help_enable_tooltips (void);
void gimp_help_disable_tooltips (void);
/* the standard gimp help function
* (has different implementations in the main app and in libgimp)
*/
void gimp_standard_help_func (const gchar *help_data);

View File

@ -525,7 +525,7 @@ gimp_unit_menu_create_selection (GimpUnitMenu *menu)
menu->selection =
gimp_dialog_new (_("Unit Selection"), "unit_selection",
_gimp_eek.standard_help_func,
gimp_standard_help_func,
"dialogs/unit_selection.html",
GTK_WIN_POS_MOUSE,
FALSE, TRUE, FALSE,

View File

@ -39,7 +39,8 @@ GimpWidgetsVTable _gimp_eek;
void
gimp_widgets_init (GimpWidgetsVTable *vtable)
gimp_widgets_init (GimpWidgetsVTable *vtable,
GimpHelpFunc standard_help_func)
{
static gboolean gimp_widgets_initialized = FALSE;
@ -56,12 +57,10 @@ gimp_widgets_init (GimpWidgetsVTable *vtable)
};
g_return_if_fail (vtable != NULL);
g_return_if_fail (standard_help_func != NULL);
if (gimp_widgets_initialized)
{
g_error ("gimp_widgets_init() must only be called once!");
return;
}
g_error ("gimp_widgets_init() must only be called once!");
_gimp_eek = *vtable;
@ -78,7 +77,7 @@ gimp_widgets_init (GimpWidgetsVTable *vtable)
g_list_foreach (icon_list, (GFunc) g_object_unref, NULL);
g_list_free (icon_list);
_gimp_help_init ();
_gimp_help_init (standard_help_func);
gimp_widgets_initialized = TRUE;
}

View File

@ -28,8 +28,6 @@ typedef struct _GimpWidgetsVTable GimpWidgetsVTable;
struct _GimpWidgetsVTable
{
void (* standard_help_func) (const gchar *help_data);
gboolean (* palette_get_background) (GimpRGB *background);
gboolean (* palette_get_foreground) (GimpRGB *background);
@ -55,7 +53,8 @@ extern GimpWidgetsVTable _gimp_eek;
G_BEGIN_DECLS
void gimp_widgets_init (GimpWidgetsVTable *vtable);
void gimp_widgets_init (GimpWidgetsVTable *vtable,
GimpHelpFunc standard_help_func);
G_END_DECLS