made plugin_icon_register() an underscore-prefixed function which needs to

2004-05-19  Michael Natterer  <mitch@gimp.org>

	* tools/pdbgen/pdb/plug_in.pdb: made plugin_icon_register() an
	underscore-prefixed function which needs to be wrapped.

	* libgimp/gimpplugin_pdb.[ch]: regenerated.

	* libgimp/Makefile.am
	* libgimp/gimp.h
	* libgimp/gimpplugin.[ch]: new files containing
	gimp_plugin_icon_register() which has no "icon_data_length"
	parameter and determines it from the passed icon data.

	* libgimp/gimp.def: added gimp_plugin_icon_register.

	* plug-ins/common/plugindetails.c
	* plug-ins/common/screenshot.c
	* plug-ins/common/uniteditor.c
	* plug-ins/print/print.c: don't pass the icon_data_length.
This commit is contained in:
Michael Natterer 2004-05-18 22:54:41 +00:00 committed by Michael Natterer
parent 1ea45f10f3
commit 540aa5ce66
15 changed files with 134 additions and 25 deletions

View File

@ -1,3 +1,23 @@
2004-05-19 Michael Natterer <mitch@gimp.org>
* tools/pdbgen/pdb/plug_in.pdb: made plugin_icon_register() an
underscore-prefixed function which needs to be wrapped.
* libgimp/gimpplugin_pdb.[ch]: regenerated.
* libgimp/Makefile.am
* libgimp/gimp.h
* libgimp/gimpplugin.[ch]: new files containing
gimp_plugin_icon_register() which has no "icon_data_length"
parameter and determines it from the passed icon data.
* libgimp/gimp.def: added gimp_plugin_icon_register.
* plug-ins/common/plugindetails.c
* plug-ins/common/screenshot.c
* plug-ins/common/uniteditor.c
* plug-ins/print/print.c: don't pass the icon_data_length.
2004-05-18 Sven Neumann <sven@gimp.org>
* plug-ins/common/checkerboard.c

View File

@ -179,6 +179,8 @@ libgimp_2_0_la_SOURCES = \
gimppixelfetcher.h \
gimppixelrgn.c \
gimppixelrgn.h \
gimpplugin.c \
gimpplugin.h \
gimpproceduraldb.c \
gimpproceduraldb.h \
gimpregioniterator.c \
@ -231,6 +233,7 @@ gimpinclude_HEADERS = \
gimppatternselect.h \
gimppixelfetcher.h \
gimppixelrgn.h \
gimpplugin.h \
gimpproceduraldb.h \
gimpregioniterator.h \
gimpselection.h \

View File

@ -334,6 +334,7 @@ EXPORTS
gimp_pixel_rgns_register2
gimp_plugin_domain_register
gimp_plugin_help_register
gimp_plugin_icon_register
gimp_plugin_menu_register
gimp_posterize
gimp_procedural_db_dump

View File

@ -41,8 +41,9 @@
#include <libgimp/gimppatternselect.h>
#include <libgimp/gimppixelfetcher.h>
#include <libgimp/gimppixelrgn.h>
#include <libgimp/gimpregioniterator.h>
#include <libgimp/gimpplugin.h>
#include <libgimp/gimpproceduraldb.h>
#include <libgimp/gimpregioniterator.h>
#include <libgimp/gimpselection.h>
#include <libgimp/gimptile.h>

58
libgimp/gimpplugin.c Normal file
View File

@ -0,0 +1,58 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpplugin.c
*
* 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
* Lesser 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 <string.h>
#include "gimp.h"
gboolean
gimp_plugin_icon_register (const gchar *procedure_name,
GimpIconType icon_type,
const guint8 *icon_data)
{
gint icon_data_length;
g_return_val_if_fail (procedure_name != NULL, FALSE);
g_return_val_if_fail (icon_data != NULL, FALSE);
switch (icon_type)
{
case GIMP_ICON_TYPE_STOCK_ID:
case GIMP_ICON_TYPE_IMAGE_FILE:
icon_data_length = strlen (icon_data) + 1;
break;
case GIMP_ICON_TYPE_INLINE_PIXBUF:
g_return_val_if_fail (g_ntohl (*((gint32 *) icon_data)) == 0x47646b50,
FALSE);
icon_data_length = g_ntohl (*((gint32 *) (icon_data + 4)));
break;
default:
g_return_val_if_reached (FALSE);
}
return _gimp_plugin_icon_register (procedure_name,
icon_type, icon_data_length, icon_data);
}

37
libgimp/gimpplugin.h Normal file
View File

@ -0,0 +1,37 @@
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-2003 Peter Mattis and Spencer Kimball
*
* gimpplugin.h
*
* 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
* Lesser 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.
*/
#ifndef __GIMP_PLUG_IN_H__
#define __GIMP_PLUG_IN_H__
G_BEGIN_DECLS
/* For information look into the C source or the html documentation */
gboolean gimp_plugin_icon_register (const gchar *procedure_name,
GimpIconType icon_type,
const guint8 *icon_data);
G_END_DECLS
#endif /* __GIMP_PLUG_IN_H__ */

View File

@ -196,7 +196,7 @@ gimp_plugin_menu_register (const gchar *procedure_name,
}
/**
* gimp_plugin_icon_register:
* _gimp_plugin_icon_register:
* @procedure_name: The procedure for which to install the icon.
* @icon_type: The type of the icon.
* @icon_data_length: The length of 'icon_data'.
@ -211,10 +211,10 @@ gimp_plugin_menu_register (const gchar *procedure_name,
* Since: GIMP 2.2
*/
gboolean
gimp_plugin_icon_register (const gchar *procedure_name,
GimpIconType icon_type,
gint icon_data_length,
const guint8 *icon_data)
_gimp_plugin_icon_register (const gchar *procedure_name,
GimpIconType icon_type,
gint icon_data_length,
const guint8 *icon_data)
{
GimpParam *return_vals;
gint nreturn_vals;

View File

@ -37,7 +37,7 @@ gboolean gimp_plugin_help_register (const gchar *domain_name,
const gchar *domain_uri);
gboolean gimp_plugin_menu_register (const gchar *procedure_name,
const gchar *menu_path);
gboolean gimp_plugin_icon_register (const gchar *procedure_name,
gboolean _gimp_plugin_icon_register (const gchar *procedure_name,
GimpIconType icon_type,
gint icon_data_length,
const guint8 *icon_data);

View File

@ -159,9 +159,7 @@ query (void)
gimp_plugin_menu_register ("plug_in_plug_in_details",
N_("<Toolbox>/Xtns/Extensions"));
gimp_plugin_icon_register ("plug_in_plug_in_details",
GIMP_ICON_TYPE_STOCK_ID,
strlen (GIMP_STOCK_PLUGIN) + 1,
GIMP_STOCK_PLUGIN);
GIMP_ICON_TYPE_STOCK_ID, GIMP_STOCK_PLUGIN);
}
static void

View File

@ -159,9 +159,7 @@ query (void)
gimp_plugin_menu_register ("plug_in_plug_in_details",
N_("<Toolbox>/Xtns/Extensions"));
gimp_plugin_icon_register ("plug_in_plug_in_details",
GIMP_ICON_TYPE_STOCK_ID,
strlen (GIMP_STOCK_PLUGIN) + 1,
GIMP_STOCK_PLUGIN);
GIMP_ICON_TYPE_STOCK_ID, GIMP_STOCK_PLUGIN);
}
static void

View File

@ -265,8 +265,7 @@ query (void)
/* gimp_plugin_menu_register (PLUG_IN_NAME, N_("<Image>/File/Acquire")); */
gimp_plugin_icon_register (PLUG_IN_NAME,
GIMP_ICON_TYPE_INLINE_PIXBUF,
sizeof (screenshot_icon) - 1, screenshot_icon);
GIMP_ICON_TYPE_INLINE_PIXBUF, screenshot_icon);
}
static void

View File

@ -123,9 +123,7 @@ query (void)
gimp_plugin_menu_register ("plug_in_unit_editor",
N_("<Toolbox>/Xtns/Extensions"));
gimp_plugin_icon_register ("plug_in_unit_editor",
GIMP_ICON_TYPE_STOCK_ID,
strlen (GIMP_STOCK_TOOL_MEASURE) + 1,
GIMP_STOCK_TOOL_MEASURE);
GIMP_ICON_TYPE_STOCK_ID, GIMP_STOCK_TOOL_MEASURE);
}
static void

View File

@ -159,9 +159,7 @@ query (void)
gimp_plugin_menu_register ("plug_in_plug_in_details",
N_("<Toolbox>/Xtns/Extensions"));
gimp_plugin_icon_register ("plug_in_plug_in_details",
GIMP_ICON_TYPE_STOCK_ID,
strlen (GIMP_STOCK_PLUGIN) + 1,
GIMP_STOCK_PLUGIN);
GIMP_ICON_TYPE_STOCK_ID, GIMP_STOCK_PLUGIN);
}
static void

View File

@ -170,9 +170,7 @@ query (void)
gimp_plugin_menu_register ("file_print_gimp",
N_("<Image>/File/Send"));
gimp_plugin_icon_register ("file_print_gimp",
GIMP_ICON_TYPE_STOCK_ID,
strlen (GTK_STOCK_PRINT) + 1,
GTK_STOCK_PRINT);
GIMP_ICON_TYPE_STOCK_ID, GTK_STOCK_PRINT);
}

View File

@ -401,7 +401,7 @@ HELP
$since = '2.2';
@inargs = (
{ name => 'procedure_name', type => 'string',
{ name => 'procedure_name', type => 'string', wrap => 1,
desc => 'The procedure for which to install the icon' },
{ name => 'icon_type', type => 'enum GimpIconType',
desc => 'The type of the icon' },