plug-ins: port imagemap to named icons from a resource

This commit is contained in:
Michael Natterer 2019-07-21 19:47:39 +02:00
parent d88b90d026
commit 32d789e355
26 changed files with 140 additions and 168 deletions

View File

@ -89,6 +89,8 @@ imagemap_SOURCES = \
imap_file.h \ imap_file.h \
imap_grid.c \ imap_grid.c \
imap_grid.h \ imap_grid.h \
imap_icons.c \
imap_icons.h \
imap_main.c \ imap_main.c \
imap_main.h \ imap_main.h \
imap_menu.c \ imap_menu.c \
@ -120,8 +122,6 @@ imagemap_SOURCES = \
imap_settings.h \ imap_settings.h \
imap_source.c \ imap_source.c \
imap_source.h \ imap_source.h \
imap_stock.c \
imap_stock.h \
imap_statusbar.c \ imap_statusbar.c \
imap_statusbar.h \ imap_statusbar.h \
imap_string.c \ imap_string.c \

View File

@ -1,6 +1,4 @@
/Makefile /Makefile
/Makefile.in /Makefile.in
/.xvpics /imagemap-icon-images.c
/.thumbnails /imagemap-icon-images.h
/stock-icons.list
/imap-stock-pixbufs.h

View File

@ -1,27 +1,31 @@
## Process this file with automake to produce Makefile.in ## Process this file with automake to produce Makefile.in
STOCK_IMAGES = \ ICON_IMAGES = \
stock-circle.png \ imagemap-circle.png \
stock-coord.png \ imagemap-coord.png \
stock-dimension.png \ imagemap-dimension.png \
stock-java.png \ imagemap-java.png \
stock-polygon.png \ imagemap-polygon.png \
stock-rectangle.png \ imagemap-rectangle.png \
stock-to-back.png \ imagemap-to-back.png \
stock-to-front.png imagemap-to-front.png
EXTRA_DIST = $(STOCK_IMAGES) EXTRA_DIST = \
$(ICON_IMAGES) \
imagemap-icon-images.gresource.xml
noinst_DATA = imap-stock-pixbufs.h noinst_DATA = \
CLEANFILES = $(noinst_DATA) stock-icons.list imagemap-icon-images.c \
imagemap-icon-images.h
stock-icons.list: $(STOCK_IMAGES) Makefile.am CLEANFILES = $(noinst_DATA)
( rm -f $@; \
for image in $(STOCK_IMAGES); do \
echo $$image | \
sed -e 's|.*/||' -e 's|-|_|g' -e 's|\.png$$||' >> $@; \
echo " $(srcdir)/$$image" >> $@; \
done )
$(srcdir)/imap-stock-pixbufs.h: stock-icons.list imagemap-icon-images.h: imagemap-icon-images.gresource.xml
$(GDK_PIXBUF_CSOURCE) --raw --build-list `cat stock-icons.list` > $(@F) $(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-header \
--target=$@ $(srcdir)/imagemap-icon-images.gresource.xml
imagemap-icon-images.c: imagemap-icon-images.h
$(AM_V_GEN) $(HOST_GLIB_COMPILE_RESOURCES) \
--sourcedir=$(srcdir) --generate-source \
--target=$@ $(srcdir)/imagemap-icon-images.gresource.xml

View File

Before

Width:  |  Height:  |  Size: 355 B

After

Width:  |  Height:  |  Size: 355 B

View File

Before

Width:  |  Height:  |  Size: 147 B

After

Width:  |  Height:  |  Size: 147 B

View File

Before

Width:  |  Height:  |  Size: 179 B

After

Width:  |  Height:  |  Size: 179 B

View File

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<gresources>
<gresource prefix="/org/gimp/imagemap/icons">
<file preprocess="to-pixdata">imagemap-circle.png</file>
<file preprocess="to-pixdata">imagemap-coord.png</file>
<file preprocess="to-pixdata">imagemap-dimension.png</file>
<file preprocess="to-pixdata">imagemap-java.png</file>
<file preprocess="to-pixdata">imagemap-polygon.png</file>
<file preprocess="to-pixdata">imagemap-rectangle.png</file>
<file preprocess="to-pixdata">imagemap-to-back.png</file>
<file preprocess="to-pixdata">imagemap-to-front.png</file>
</gresource>
</gresources>

View File

Before

Width:  |  Height:  |  Size: 1017 B

After

Width:  |  Height:  |  Size: 1017 B

View File

Before

Width:  |  Height:  |  Size: 291 B

After

Width:  |  Height:  |  Size: 291 B

View File

Before

Width:  |  Height:  |  Size: 221 B

After

Width:  |  Height:  |  Size: 221 B

View File

Before

Width:  |  Height:  |  Size: 305 B

After

Width:  |  Height:  |  Size: 305 B

View File

Before

Width:  |  Height:  |  Size: 261 B

After

Width:  |  Height:  |  Size: 261 B

View File

@ -28,10 +28,10 @@
#include <gtk/gtk.h> #include <gtk/gtk.h>
#include "imap_circle.h" #include "imap_circle.h"
#include "imap_icons.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_object_popup.h" #include "imap_object_popup.h"
#include "imap_stock.h"
#include "imap_ui_grid.h" #include "imap_ui_grid.h"
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
@ -57,7 +57,7 @@ static void circle_write_cern(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void circle_write_ncsa(Object_t* obj, gpointer param, static void circle_write_ncsa(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static const gchar* circle_get_stock_icon_name(void); static const gchar* circle_get_icon_name(void);
static ObjectClass_t circle_class = { static ObjectClass_t circle_class = {
N_("C_ircle"), N_("C_ircle"),
@ -84,7 +84,7 @@ static ObjectClass_t circle_class = {
circle_write_cern, circle_write_cern,
circle_write_ncsa, circle_write_ncsa,
object_do_popup, object_do_popup,
circle_get_stock_icon_name circle_get_icon_name
}; };
Object_t* Object_t*
@ -335,9 +335,9 @@ circle_write_ncsa(Object_t *obj, gpointer param, OutputFunc_t output)
} }
static const gchar* static const gchar*
circle_get_stock_icon_name(void) circle_get_icon_name(void)
{ {
return IMAP_STOCK_CIRCLE; return IMAP_CIRCLE;
} }
static gint _start_x, _start_y; static gint _start_x, _start_y;

View File

@ -32,8 +32,8 @@
#include "imap_commands.h" #include "imap_commands.h"
#include "imap_default_dialog.h" #include "imap_default_dialog.h"
#include "imap_edit_area_info.h" #include "imap_edit_area_info.h"
#include "imap_icons.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_stock.h"
#include "imap_ui_grid.h" #include "imap_ui_grid.h"
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
@ -87,7 +87,7 @@ set_url(GtkWidget *widget, AreaInfoDialog_t *param, const gchar *prefix)
} }
else else
{ {
if (gtk_widget_get_state (widget) & GTK_STATE_SELECTED) if (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_SELECTED)
{ {
char *p; char *p;
gchar *url = g_strdup(gtk_entry_get_text(GTK_ENTRY(param->url))); gchar *url = g_strdup(gtk_entry_get_text(GTK_ENTRY(param->url)));
@ -327,7 +327,7 @@ create_info_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
dialog->infotab = obj->class->create_info_widget(frame); dialog->infotab = obj->class->create_info_widget(frame);
append_page (notebook, vbox, obj->class->get_stock_icon_name (), append_page (notebook, vbox, obj->class->get_icon_name (),
gettext (obj->class->name)); gettext (obj->class->name));
} }
@ -357,7 +357,7 @@ create_java_script_tab(AreaInfoDialog_t *dialog, GtkWidget *notebook)
label = create_label_in_grid (grid, 9, 0, "on_Blur (HTML 4.0):"); label = create_label_in_grid (grid, 9, 0, "on_Blur (HTML 4.0):");
dialog->blur = create_entry_in_grid (grid, label, 10, 0); dialog->blur = create_entry_in_grid (grid, label, 10, 0);
append_page (notebook, vbox, IMAP_STOCK_JAVA, _("_JavaScript")); append_page (notebook, vbox, IMAP_JAVA, _("_JavaScript"));
} }
static gboolean static gboolean

View File

@ -105,7 +105,7 @@ snap_toggled_cb(GtkWidget *widget, gpointer data)
static void static void
type_toggled_cb(GtkWidget *widget, gpointer data) type_toggled_cb(GtkWidget *widget, gpointer data)
{ {
if (gtk_widget_get_state (widget) & GTK_STATE_SELECTED) if (gtk_widget_get_state_flags (widget) & GTK_STATE_FLAG_SELECTED)
{ {
grid_type = GPOINTER_TO_INT (data); grid_type = GPOINTER_TO_INT (data);
preview_redraw(); preview_redraw();

View File

@ -0,0 +1,47 @@
/*
* This is a plug-in for GIMP.
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2005 Maurits Rijk m.rijk@chello.nl
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include <gtk/gtk.h>
#include "imap_icons.h"
#include "images/imagemap-icon-images.h"
#include "images/imagemap-icon-images.c"
void
init_icons (void)
{
static gboolean initialized = FALSE;
GtkIconTheme *icon_theme;
if (initialized)
return;
initialized = TRUE;
icon_theme = gtk_icon_theme_get_default ();
gtk_icon_theme_add_resource_path (icon_theme, "/org/gimp/imagemap/icons");
}

View File

@ -20,20 +20,20 @@
* *
*/ */
#ifndef _IMAP_STOCK_H #ifndef _IMAP_ICONS_H
#define _IMAP_STOCK_H #define _IMAP_ICONS_H
#define IMAP_STOCK_ARROW "imap-arrow" #define IMAP_ARROW "imap-arrow"
#define IMAP_STOCK_CIRCLE "imap-circle" #define IMAP_CIRCLE "imap-circle"
#define IMAP_STOCK_COORD "imap-coord" #define IMAP_COORD "imap-coord"
#define IMAP_STOCK_DIMENSION "imap-dimension" #define IMAP_DIMENSION "imap-dimension"
#define IMAP_STOCK_JAVA "imap-java" #define IMAP_JAVA "imap-java"
#define IMAP_STOCK_LINK "imap-link" #define IMAP_LINK "imap-link"
#define IMAP_STOCK_POLYGON "imap-polygon" #define IMAP_POLYGON "imap-polygon"
#define IMAP_STOCK_RECTANGLE "imap-rectangle" #define IMAP_RECTANGLE "imap-rectangle"
#define IMAP_STOCK_TO_BACK "imap-to-back" #define IMAP_TO_BACK "imap-to-back"
#define IMAP_STOCK_TO_FRONT "imap-to-front" #define IMAP_TO_FRONT "imap-to-front"
void init_stock_icons(void); void init_icons (void);
#endif /* _IMAP_STOCK_H */ #endif /* _IMAP_ICONS_H */

View File

@ -39,6 +39,7 @@
#include "imap_default_dialog.h" #include "imap_default_dialog.h"
#include "imap_edit_area_info.h" #include "imap_edit_area_info.h"
#include "imap_file.h" #include "imap_file.h"
#include "imap_icons.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_menu.h" #include "imap_menu.h"
#include "imap_misc.h" #include "imap_misc.h"
@ -50,7 +51,6 @@
#include "imap_settings.h" #include "imap_settings.h"
#include "imap_source.h" #include "imap_source.h"
#include "imap_statusbar.h" #include "imap_statusbar.h"
#include "imap_stock.h"
#include "imap_string.h" #include "imap_string.h"
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
@ -1245,7 +1245,7 @@ dialog(gint32 drawable_id)
gtk_container_add (GTK_CONTAINER (dlg), main_vbox); gtk_container_add (GTK_CONTAINER (dlg), main_vbox);
gtk_widget_show (main_vbox); gtk_widget_show (main_vbox);
init_stock_icons(); init_icons();
/* Create menu */ /* Create menu */
make_menu(main_vbox, dlg); make_menu(main_vbox, dlg);

View File

@ -29,6 +29,7 @@
#include "imap_circle.h" #include "imap_circle.h"
#include "imap_file.h" #include "imap_file.h"
#include "imap_grid.h" #include "imap_grid.h"
#include "imap_icons.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_menu.h" #include "imap_menu.h"
#include "imap_menu_funcs.h" #include "imap_menu_funcs.h"
@ -36,7 +37,6 @@
#include "imap_preferences.h" #include "imap_preferences.h"
#include "imap_rectangle.h" #include "imap_rectangle.h"
#include "imap_settings.h" #include "imap_settings.h"
#include "imap_stock.h"
#include "imap_source.h" #include "imap_source.h"
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
@ -181,9 +181,9 @@ static const GtkActionEntry entries[] =
{ "Preferences", GIMP_ICON_PREFERENCES_SYSTEM, { "Preferences", GIMP_ICON_PREFERENCES_SYSTEM,
NULL, NULL, N_("Preferences"), NULL, NULL, N_("Preferences"),
do_preferences_dialog}, do_preferences_dialog},
{ "MoveToFront", IMAP_STOCK_TO_FRONT, "", NULL, N_("Move Area to Front"), { "MoveToFront", IMAP_TO_FRONT, "", NULL, N_("Move Area to Front"),
do_move_to_front}, do_move_to_front},
{ "SendToBack", IMAP_STOCK_TO_BACK, "", NULL, N_("Move Area to Bottom"), { "SendToBack", IMAP_TO_BACK, "", NULL, N_("Move Area to Bottom"),
do_send_to_back}, do_send_to_back},
{ "DeleteArea", NULL, N_("Delete Area"), NULL, NULL, NULL}, { "DeleteArea", NULL, N_("Delete Area"), NULL, NULL, NULL},
{ "MoveUp", GIMP_ICON_GO_UP, N_("Move Up"), NULL, NULL, NULL}, { "MoveUp", GIMP_ICON_GO_UP, N_("Move Up"), NULL, NULL, NULL},
@ -231,11 +231,11 @@ static const GtkRadioActionEntry color_entries[] = {
static const GtkRadioActionEntry mapping_entries[] = { static const GtkRadioActionEntry mapping_entries[] = {
{ "Arrow", GIMP_ICON_CURSOR, N_("Arrow"), NULL, { "Arrow", GIMP_ICON_CURSOR, N_("Arrow"), NULL,
N_("Select existing area"), 0}, N_("Select existing area"), 0},
{ "Rectangle", IMAP_STOCK_RECTANGLE, N_("Rectangle"), NULL, { "Rectangle", IMAP_RECTANGLE, N_("Rectangle"), NULL,
N_("Define Rectangle area"), 1}, N_("Define Rectangle area"), 1},
{ "Circle", IMAP_STOCK_CIRCLE, N_("Circle"), NULL, { "Circle", IMAP_CIRCLE, N_("Circle"), NULL,
N_("Define Circle/Oval area"), 2}, N_("Define Circle/Oval area"), 2},
{ "Polygon", IMAP_STOCK_POLYGON, N_("Polygon"), NULL, { "Polygon", IMAP_POLYGON, N_("Polygon"), NULL,
N_("Define Polygon area"), 3}, N_("Define Polygon area"), 3},
}; };

View File

@ -77,7 +77,7 @@ struct ObjectClass_t {
void (*write_ncsa)(Object_t *obj, gpointer param, OutputFunc_t output); void (*write_ncsa)(Object_t *obj, gpointer param, OutputFunc_t output);
void (*do_popup)(Object_t *obj, GdkEventButton *event); void (*do_popup)(Object_t *obj, GdkEventButton *event);
const gchar* (*get_stock_icon_name)(void); const gchar* (*get_icon_name)(void);
}; };
Object_t *object_ref(Object_t *obj); Object_t *object_ref(Object_t *obj);
@ -128,8 +128,8 @@ void object_emit_update_signal(Object_t *obj);
#define object_fill_info_tab(obj, data) \ #define object_fill_info_tab(obj, data) \
((obj)->class->fill_info_tab((obj), (data))) ((obj)->class->fill_info_tab((obj), (data)))
#define object_get_stock_icon_name(obj) \ #define object_get_icon_name(obj) \
((obj)->class->get_stock_icon_name()) ((obj)->class->get_icon_name())
typedef struct { typedef struct {
Object_t *obj; Object_t *obj;

View File

@ -29,12 +29,12 @@
#include "libgimp/gimpui.h" #include "libgimp/gimpui.h"
#include "imap_commands.h" #include "imap_commands.h"
#include "imap_icons.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_menu.h" #include "imap_menu.h"
#include "imap_object_popup.h" #include "imap_object_popup.h"
#include "imap_polygon.h" #include "imap_polygon.h"
#include "imap_stock.h"
#include "imap_ui_grid.h" #include "imap_ui_grid.h"
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
@ -66,7 +66,7 @@ static void polygon_write_cern(Object_t* obj, gpointer param,
static void polygon_write_ncsa(Object_t* obj, gpointer param, static void polygon_write_ncsa(Object_t* obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void polygon_do_popup(Object_t *obj, GdkEventButton *event); static void polygon_do_popup(Object_t *obj, GdkEventButton *event);
static const gchar* polygon_get_stock_icon_name(void); static const gchar* polygon_get_icon_name(void);
static ObjectClass_t polygon_class = { static ObjectClass_t polygon_class = {
N_("_Polygon"), N_("_Polygon"),
@ -93,7 +93,7 @@ static ObjectClass_t polygon_class = {
polygon_write_cern, polygon_write_cern,
polygon_write_ncsa, polygon_write_ncsa,
polygon_do_popup, polygon_do_popup,
polygon_get_stock_icon_name polygon_get_icon_name
}; };
Object_t* Object_t*
@ -751,9 +751,9 @@ polygon_do_popup(Object_t *obj, GdkEventButton *event)
} }
static const gchar* static const gchar*
polygon_get_stock_icon_name(void) polygon_get_icon_name(void)
{ {
return IMAP_STOCK_POLYGON; return IMAP_POLYGON;
} }
static GList *_prev_link; static GList *_prev_link;

View File

@ -29,11 +29,11 @@
#include <libgimp/gimp.h> #include <libgimp/gimp.h>
#include <libgimp/gimpui.h> #include <libgimp/gimpui.h>
#include "imap_icons.h"
#include "imap_main.h" #include "imap_main.h"
#include "imap_misc.h" #include "imap_misc.h"
#include "imap_object_popup.h" #include "imap_object_popup.h"
#include "imap_rectangle.h" #include "imap_rectangle.h"
#include "imap_stock.h"
#include "imap_ui_grid.h" #include "imap_ui_grid.h"
#include "libgimp/stdplugins-intl.h" #include "libgimp/stdplugins-intl.h"
@ -62,7 +62,7 @@ static void rectangle_write_cern(Object_t *obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static void rectangle_write_ncsa(Object_t *obj, gpointer param, static void rectangle_write_ncsa(Object_t *obj, gpointer param,
OutputFunc_t output); OutputFunc_t output);
static const gchar* rectangle_get_stock_icon_name(void); static const gchar* rectangle_get_icon_name(void);
static ObjectClass_t rectangle_class = { static ObjectClass_t rectangle_class = {
N_("_Rectangle"), N_("_Rectangle"),
@ -89,7 +89,7 @@ static ObjectClass_t rectangle_class = {
rectangle_write_cern, rectangle_write_cern,
rectangle_write_ncsa, rectangle_write_ncsa,
object_do_popup, object_do_popup,
rectangle_get_stock_icon_name rectangle_get_icon_name
}; };
Object_t* Object_t*
@ -478,9 +478,9 @@ rectangle_write_ncsa(Object_t *obj, gpointer param, OutputFunc_t output)
} }
static const gchar* static const gchar*
rectangle_get_stock_icon_name(void) rectangle_get_icon_name(void)
{ {
return IMAP_STOCK_RECTANGLE; return IMAP_RECTANGLE;
} }
static gboolean static gboolean

View File

@ -267,7 +267,7 @@ render_image (GtkTreeViewColumn *column, GtkCellRenderer *cell,
GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data) GtkTreeModel *tree_model, GtkTreeIter *iter, gpointer data)
{ {
Object_t *obj = selection_get_object (tree_model, iter); Object_t *obj = selection_get_object (tree_model, iter);
g_object_set(cell, "stock-id", object_get_stock_icon_name(obj), NULL); g_object_set(cell, "icon-name", object_get_icon_name(obj), NULL);
} }
static void static void

View File

@ -28,8 +28,8 @@
#include "libgimp/gimp.h" #include "libgimp/gimp.h"
#include "libgimp/gimpui.h" #include "libgimp/gimpui.h"
#include "imap_icons.h"
#include "imap_statusbar.h" #include "imap_statusbar.h"
#include "imap_stock.h"
StatusBar_t* StatusBar_t*
make_statusbar(GtkWidget *main_vbox, GtkWidget *window) make_statusbar(GtkWidget *main_vbox, GtkWidget *window)
@ -48,8 +48,8 @@ make_statusbar(GtkWidget *main_vbox, GtkWidget *window)
gtk_widget_show(statusbar->status); gtk_widget_show(statusbar->status);
/* (x, y) coordinate */ /* (x, y) coordinate */
iconw = gtk_image_new_from_stock(IMAP_STOCK_COORD, iconw = gtk_image_new_from_icon_name (IMAP_COORD,
GTK_ICON_SIZE_SMALL_TOOLBAR); GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10); gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10);
gtk_widget_show(iconw); gtk_widget_show(iconw);
@ -62,8 +62,8 @@ make_statusbar(GtkWidget *main_vbox, GtkWidget *window)
gtk_widget_show(statusbar->xy); gtk_widget_show(statusbar->xy);
/* Dimension info */ /* Dimension info */
iconw = gtk_image_new_from_stock(IMAP_STOCK_DIMENSION, iconw = gtk_image_new_from_icon_name (IMAP_DIMENSION,
GTK_ICON_SIZE_SMALL_TOOLBAR); GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10); gtk_box_pack_start(GTK_BOX(hbox), iconw, FALSE, FALSE, 10);
gtk_widget_show(iconw); gtk_widget_show(iconw);

View File

@ -1,89 +0,0 @@
/*
* This is a plug-in for GIMP.
*
* Generates clickable image maps.
*
* Copyright (C) 1998-2005 Maurits Rijk m.rijk@chello.nl
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 3 of the License, or
* (at your option) any later version.
*
* This program 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 General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*
*/
#include "config.h"
#include <gtk/gtk.h>
#include "imap_stock.h"
#include "images/imap-stock-pixbufs.h"
static GtkIconFactory *imap_icon_factory = NULL;
static GtkStockItem imap_stock_items[] =
{
{ IMAP_STOCK_CIRCLE, NULL, 0, 0, NULL },
{ IMAP_STOCK_COORD, NULL, 0, 0, NULL },
{ IMAP_STOCK_DIMENSION, NULL, 0, 0, NULL },
{ IMAP_STOCK_JAVA, NULL, 0, 0, NULL },
{ IMAP_STOCK_POLYGON, NULL, 0, 0, NULL },
{ IMAP_STOCK_RECTANGLE, NULL, 0, 0, NULL },
{ IMAP_STOCK_TO_BACK, NULL, 0, 0, NULL },
{ IMAP_STOCK_TO_FRONT, NULL, 0, 0, NULL }
};
static void
add_stock_icon (const gchar *stock_id,
const guint8 *inline_data)
{
GtkIconSource *source;
GtkIconSet *set;
GdkPixbuf *pixbuf;
source = gtk_icon_source_new ();
gtk_icon_source_set_size (source, GTK_ICON_SIZE_SMALL_TOOLBAR);
gtk_icon_source_set_size_wildcarded (source, TRUE);
pixbuf = gdk_pixbuf_new_from_inline (-1, inline_data, FALSE, NULL);
gtk_icon_source_set_pixbuf (source, pixbuf);
g_object_unref (pixbuf);
set = gtk_icon_set_new ();
gtk_icon_set_add_source (set, source);
gtk_icon_source_free (source);
gtk_icon_factory_add (imap_icon_factory, stock_id, set);
gtk_icon_set_unref (set);
}
void
init_stock_icons (void)
{
imap_icon_factory = gtk_icon_factory_new ();
add_stock_icon (IMAP_STOCK_CIRCLE, stock_circle);
add_stock_icon (IMAP_STOCK_COORD, stock_coord);
add_stock_icon (IMAP_STOCK_DIMENSION, stock_dimension);
add_stock_icon (IMAP_STOCK_JAVA, stock_java);
add_stock_icon (IMAP_STOCK_POLYGON, stock_polygon);
add_stock_icon (IMAP_STOCK_RECTANGLE, stock_rectangle);
add_stock_icon (IMAP_STOCK_TO_BACK, stock_to_back);
add_stock_icon (IMAP_STOCK_TO_FRONT, stock_to_front);
gtk_icon_factory_add_default (imap_icon_factory);
gtk_stock_add_static (imap_stock_items, G_N_ELEMENTS (imap_stock_items));
}

View File

@ -200,7 +200,6 @@ plug-ins/imagemap/imap_rectangle.c
plug-ins/imagemap/imap_selection.c plug-ins/imagemap/imap_selection.c
plug-ins/imagemap/imap_settings.c plug-ins/imagemap/imap_settings.c
plug-ins/imagemap/imap_source.c plug-ins/imagemap/imap_source.c
plug-ins/imagemap/imap_stock.c
plug-ins/lighting/lighting-apply.c plug-ins/lighting/lighting-apply.c
plug-ins/lighting/lighting-main.c plug-ins/lighting/lighting-main.c
plug-ins/lighting/lighting-ui.c plug-ins/lighting/lighting-ui.c