Commit b46ab216 authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer
Browse files

removed usage of "the_gimp" by passing around more "Gimp" pointers.

2002-04-12  Michael Natterer  <mitch@gimp.org>

	* app/gimphelp.[ch]: removed usage of "the_gimp" by passing around
	more "Gimp" pointers. Renamed gimp_standard_help_func() to
	_gimp_standard_help_func() and declare it in the header.  Don't
	include "app_procs.h".

	* app/libgimp_glue.[ch]: added gimp_standard_help_func() here.
	Call _gimp_standard_help_func (the_gimp, ...) like all other
	wrappers in this file do. I know this is ugly but better let's
	have all uglyness in one place (here) :-)

	* app/widgets/gimpitemfactory.[ch]: added a "Gimp" member to the
	GimpItemFactory struct. Pass it to gimp_help(),

	* app/gui/menus.c: pass a Gimp to gimp_item_factory_new(), removed
	useless inclusion of "gimphelp.h".

	* tools/pdbgen/pdb/help.pdb: pass a Gimp to gimp_help()

	* app/pdb/help_cmds.c: regenerated.

	* app/gui/tips-dialog.c: removed gtk_quit_add_destroy() here too
	because the tips dialog is created by a dialog factory which takes
	care of dialog destruction.
parent d0429f27
2002-04-12 Michael Natterer <mitch@gimp.org>
* app/gimphelp.[ch]: removed usage of "the_gimp" by passing around
more "Gimp" pointers. Renamed gimp_standard_help_func() to
_gimp_standard_help_func() and declare it in the header. Don't
include "app_procs.h".
* app/libgimp_glue.[ch]: added gimp_standard_help_func() here.
Call _gimp_standard_help_func (the_gimp, ...) like all other
wrappers in this file do. I know this is ugly but better let's
have all uglyness in one place (here) :-)
* app/widgets/gimpitemfactory.[ch]: added a "Gimp" member to the
GimpItemFactory struct. Pass it to gimp_help(),
* app/gui/menus.c: pass a Gimp to gimp_item_factory_new(), removed
useless inclusion of "gimphelp.h".
* tools/pdbgen/pdb/help.pdb: pass a Gimp to gimp_help()
* app/pdb/help_cmds.c: regenerated.
* app/gui/tips-dialog.c: removed gtk_quit_add_destroy() here too
because the tips dialog is created by a dialog factory which takes
care of dialog destruction.
2002-04-12 Sven Neumann <sven@gimp.org>
 
* app/gui/file-open-dialog.c
......
......@@ -115,9 +115,6 @@ tips_dialog_create (void)
G_CALLBACK (tips_dialog_destroy),
NULL);
/* destroy the tips window if the mainlevel gtk_main() function is left */
gtk_quit_add_destroy (1, GTK_OBJECT (tips_dialog));
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (tips_dialog), vbox);
gtk_widget_show (vbox);
......
......@@ -34,12 +34,13 @@
#include "core/core-types.h"
#include "core/gimp.h"
#include "pdb/procedural_db.h"
#include "plug-in/plug-ins.h"
#include "plug-in/plug-in.h"
#include "app_procs.h"
#include "gimphelp.h"
#include "gimprc.h"
......@@ -54,6 +55,7 @@ typedef struct _GimpIdleHelp GimpIdleHelp;
struct _GimpIdleHelp
{
Gimp *gimp;
gchar *help_path;
gchar *help_data;
};
......@@ -62,10 +64,12 @@ struct _GimpIdleHelp
/* local function prototypes */
static gint gimp_idle_help (gpointer data);
static gboolean gimp_help_internal (const gchar *help_path,
static gboolean gimp_help_internal (Gimp *gimp,
const gchar *help_path,
const gchar *current_locale,
const gchar *help_data);
static void gimp_help_netscape (const gchar *help_path,
static void gimp_help_netscape (Gimp *gimp,
const gchar *help_path,
const gchar *current_locale,
const gchar *help_data);
......@@ -74,22 +78,30 @@ static void gimp_help_netscape (const gchar *help_path,
/* The standard help function */
void
gimp_standard_help_func (const gchar *help_data)
_gimp_standard_help_func (Gimp *gimp,
const gchar *help_data)
{
gimp_help (NULL, help_data);
g_return_if_fail (GIMP_IS_GIMP (gimp));
gimp_help (gimp, NULL, help_data);
}
/* the main help function */
void
gimp_help (const gchar *help_path,
gimp_help (Gimp *gimp,
const gchar *help_path,
const gchar *help_data)
{
g_return_if_fail (GIMP_IS_GIMP (gimp));
if (gimprc.use_help)
{
GimpIdleHelp *idle_help;
idle_help = g_new0 (GimpIdleHelp, 1);
idle_help->gimp = gimp;
if (help_path && strlen (help_path))
idle_help->help_path = g_strdup (help_path);
......@@ -131,13 +143,15 @@ gimp_idle_help (gpointer data)
switch (gimprc.help_browser)
{
case HELP_BROWSER_GIMP:
if (gimp_help_internal (idle_help->help_path,
if (gimp_help_internal (idle_help->gimp,
idle_help->help_path,
current_locale,
idle_help->help_data))
break;
case HELP_BROWSER_NETSCAPE:
gimp_help_netscape (idle_help->help_path,
gimp_help_netscape (idle_help->gimp,
idle_help->help_path,
current_locale,
idle_help->help_data);
break;
......@@ -175,22 +189,21 @@ gimp_help_internal_not_found_callback (GtkWidget *widget,
}
static gboolean
gimp_help_internal (const gchar *help_path,
gimp_help_internal (Gimp *gimp,
const gchar *help_path,
const gchar *current_locale,
const gchar *help_data)
{
ProcRecord *proc_rec;
/* Check if a help browser is already running */
proc_rec = procedural_db_lookup (the_gimp,
"extension_gimp_help_browser_temp");
proc_rec = procedural_db_lookup (gimp, "extension_gimp_help_browser_temp");
if (proc_rec == NULL)
{
Argument *args = NULL;
proc_rec = procedural_db_lookup (the_gimp,
"extension_gimp_help_browser");
proc_rec = procedural_db_lookup (gimp, "extension_gimp_help_browser");
if (proc_rec == NULL)
{
......@@ -221,7 +234,7 @@ gimp_help_internal (const gchar *help_path,
args[3].arg_type = GIMP_PDB_STRING;
args[3].value.pdb_pointer = (gpointer) help_data;
plug_in_run (the_gimp, proc_rec, args, 4, FALSE, TRUE, 0);
plug_in_run (gimp, proc_rec, args, 4, FALSE, TRUE, 0);
g_free (args);
}
......@@ -231,7 +244,7 @@ gimp_help_internal (const gchar *help_path,
gint nreturn_vals;
return_vals =
procedural_db_run_proc (the_gimp,
procedural_db_run_proc (gimp,
"extension_gimp_help_browser_temp",
&nreturn_vals,
GIMP_PDB_STRING, help_path,
......@@ -246,7 +259,8 @@ gimp_help_internal (const gchar *help_path,
}
static void
gimp_help_netscape (const gchar *help_path,
gimp_help_netscape (Gimp *gimp,
const gchar *help_path,
const gchar *current_locale,
const gchar *help_data)
{
......@@ -282,7 +296,7 @@ gimp_help_netscape (const gchar *help_path,
}
return_vals =
procedural_db_run_proc (the_gimp,
procedural_db_run_proc (gimp,
"extension_web_browser",
&nreturn_vals,
GIMP_PDB_INT32, GIMP_RUN_NONINTERACTIVE,
......
......@@ -30,9 +30,14 @@ enum
};
/* The standard help function */
void _gimp_standard_help_func (Gimp *gimp,
const gchar *help_data);
/* the main help function */
void gimp_help (const gchar *help_path,
const gchar *help_data);
void gimp_help (Gimp *gimp,
const gchar *help_path,
const gchar *help_data);
#endif /* __GIMP_HELP_H__ */
......@@ -64,7 +64,6 @@
#include "vectors-commands.h"
#include "view-commands.h"
#include "gimphelp.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
......@@ -1937,7 +1936,8 @@ menus_init (Gimp *gimp)
#define ADD_FACTORY(f) (all_factories = g_list_append (all_factories, (f)));
toolbox_factory = gimp_item_factory_new (GTK_TYPE_MENU_BAR,
toolbox_factory = gimp_item_factory_new (gimp,
GTK_TYPE_MENU_BAR,
"<Toolbox>", "toolbox",
NULL,
G_N_ELEMENTS (toolbox_entries),
......@@ -1947,7 +1947,8 @@ menus_init (Gimp *gimp)
menus_last_opened_add (toolbox_factory, gimp);
ADD_FACTORY (toolbox_factory);
image_factory = gimp_item_factory_new (GTK_TYPE_MENU,
image_factory = gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Image>", "image",
NULL,
G_N_ELEMENTS (image_entries),
......@@ -1957,119 +1958,136 @@ menus_init (Gimp *gimp)
menus_last_opened_add (image_factory, gimp);
ADD_FACTORY (image_factory);
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Load>", "open",
NULL,
G_N_ELEMENTS (load_entries),
load_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Save>", "save",
NULL,
G_N_ELEMENTS (save_entries),
save_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Layers>", "layers",
layers_menu_update,
G_N_ELEMENTS (layers_entries),
layers_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Channels>", "channels",
channels_menu_update,
G_N_ELEMENTS (channels_entries),
channels_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Vectors>", "vectors",
vectors_menu_update,
G_N_ELEMENTS (vectors_entries),
vectors_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Paths>", "paths",
NULL,
G_N_ELEMENTS (paths_entries),
paths_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Dialogs>", "dialogs",
dialogs_menu_update,
G_N_ELEMENTS (dialogs_entries),
dialogs_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Brushes>", "brushes",
brushes_menu_update,
G_N_ELEMENTS (brushes_entries),
brushes_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Patterns>", "patterns",
patterns_menu_update,
G_N_ELEMENTS (patterns_entries),
patterns_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<GradientEditor>", "gradient_editor",
gradient_editor_menu_update,
G_N_ELEMENTS (gradient_editor_entries),
gradient_editor_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Gradients>", "gradients",
gradients_menu_update,
G_N_ELEMENTS (gradients_entries),
gradients_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<PaletteEditor>", "palette_editor",
palette_editor_menu_update,
G_N_ELEMENTS (palette_editor_entries),
palette_editor_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Palettes>", "palettes",
palettes_menu_update,
G_N_ELEMENTS (palettes_entries),
palettes_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Buffers>", "buffers",
buffers_menu_update,
G_N_ELEMENTS (buffers_entries),
buffers_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Documents>", "documents",
documents_menu_update,
G_N_ELEMENTS (documents_entries),
documents_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<ColormapEditor>", "colormap_editor",
colormap_editor_menu_update,
G_N_ELEMENTS (colormap_editor_entries),
colormap_editor_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<QMask>", "qmask",
qmask_menu_update,
G_N_ELEMENTS (qmask_entries),
......
......@@ -115,9 +115,6 @@ tips_dialog_create (void)
G_CALLBACK (tips_dialog_destroy),
NULL);
/* destroy the tips window if the mainlevel gtk_main() function is left */
gtk_quit_add_destroy (1, GTK_OBJECT (tips_dialog));
vbox = gtk_vbox_new (FALSE, 0);
gtk_container_add (GTK_CONTAINER (tips_dialog), vbox);
gtk_widget_show (vbox);
......
......@@ -29,6 +29,7 @@
#include "core/gimpunit.h"
#include "app_procs.h"
#include "gimphelp.h"
#define __LIBGIMP_GLUE_C__
#include "libgimp_glue.h"
......@@ -74,6 +75,7 @@ gimp_palette_get_background (GimpRGB *color)
return TRUE;
}
gint
gimp_unit_get_number_of_units (void)
{
......@@ -119,51 +121,50 @@ gimp_unit_set_deletion_flag (GimpUnit unit,
_gimp_unit_set_deletion_flag (the_gimp, unit, deletion_flag);
}
gdouble
gimp_unit_get_factor (GimpUnit unit)
{
return _gimp_unit_get_factor (the_gimp, unit);
}
gint
gimp_unit_get_digits (GimpUnit unit)
{
return _gimp_unit_get_digits (the_gimp, unit);
}
const gchar *
gimp_unit_get_identifier (GimpUnit unit)
{
return _gimp_unit_get_identifier (the_gimp, unit);
}
const gchar *
gimp_unit_get_symbol (GimpUnit unit)
{
return _gimp_unit_get_symbol (the_gimp, unit);
}
const gchar *
gimp_unit_get_abbreviation (GimpUnit unit)
{
return _gimp_unit_get_abbreviation (the_gimp, unit);
}
const gchar *
gimp_unit_get_singular (GimpUnit unit)
{
return _gimp_unit_get_singular (the_gimp, unit);
}
const gchar *
gimp_unit_get_plural (GimpUnit unit)
{
return _gimp_unit_get_plural (the_gimp, unit);
}
void
gimp_standard_help_func (const gchar *help_data)
{
_gimp_standard_help_func (the_gimp, help_data);
}
......@@ -56,5 +56,7 @@ 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__ */
......@@ -64,7 +64,6 @@
#include "vectors-commands.h"
#include "view-commands.h"
#include "gimphelp.h"
#include "gimprc.h"
#include "libgimp/gimpintl.h"
......@@ -1937,7 +1936,8 @@ menus_init (Gimp *gimp)
#define ADD_FACTORY(f) (all_factories = g_list_append (all_factories, (f)));
toolbox_factory = gimp_item_factory_new (GTK_TYPE_MENU_BAR,
toolbox_factory = gimp_item_factory_new (gimp,
GTK_TYPE_MENU_BAR,
"<Toolbox>", "toolbox",
NULL,
G_N_ELEMENTS (toolbox_entries),
......@@ -1947,7 +1947,8 @@ menus_init (Gimp *gimp)
menus_last_opened_add (toolbox_factory, gimp);
ADD_FACTORY (toolbox_factory);
image_factory = gimp_item_factory_new (GTK_TYPE_MENU,
image_factory = gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Image>", "image",
NULL,
G_N_ELEMENTS (image_entries),
......@@ -1957,119 +1958,136 @@ menus_init (Gimp *gimp)
menus_last_opened_add (image_factory, gimp);
ADD_FACTORY (image_factory);
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Load>", "open",
NULL,
G_N_ELEMENTS (load_entries),
load_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Save>", "save",
NULL,
G_N_ELEMENTS (save_entries),
save_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Layers>", "layers",
layers_menu_update,
G_N_ELEMENTS (layers_entries),
layers_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Channels>", "channels",
channels_menu_update,
G_N_ELEMENTS (channels_entries),
channels_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Vectors>", "vectors",
vectors_menu_update,
G_N_ELEMENTS (vectors_entries),
vectors_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Paths>", "paths",
NULL,
G_N_ELEMENTS (paths_entries),
paths_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Dialogs>", "dialogs",
dialogs_menu_update,
G_N_ELEMENTS (dialogs_entries),
dialogs_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Brushes>", "brushes",
brushes_menu_update,
G_N_ELEMENTS (brushes_entries),
brushes_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Patterns>", "patterns",
patterns_menu_update,
G_N_ELEMENTS (patterns_entries),
patterns_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<GradientEditor>", "gradient_editor",
gradient_editor_menu_update,
G_N_ELEMENTS (gradient_editor_entries),
gradient_editor_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Gradients>", "gradients",
gradients_menu_update,
G_N_ELEMENTS (gradients_entries),
gradients_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<PaletteEditor>", "palette_editor",
palette_editor_menu_update,
G_N_ELEMENTS (palette_editor_entries),
palette_editor_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Palettes>", "palettes",
palettes_menu_update,
G_N_ELEMENTS (palettes_entries),
palettes_entries,
gimp,
FALSE));
ADD_FACTORY (gimp_item_factory_new (GTK_TYPE_MENU,
ADD_FACTORY (gimp_item_factory_new (gimp,
GTK_TYPE_MENU,
"<Buffers>", "buffers",
buffers_menu_update,