31
31
#include "icon_factory.h"
32
#include "icons/pixmap_data.h"
33
35
static GtkIconFactory *icon_factory = NULL;
35
37
void add_icon (GtkIconFactory *factory, const gchar *stock_id, const guint8 *icon_data, GtkIconSize size)
38
GtkIconSource *source;
41
icons = gtk_icon_factory_lookup (factory, stock_id);
44
pixbuf = gdk_pixbuf_new_from_inline (-1, icon_data, FALSE, NULL);
45
source = gtk_icon_source_new ();
46
gtk_icon_source_set_pixbuf (source, pixbuf);
47
gtk_icon_source_set_size (source, size);
49
icons = gtk_icon_set_new ();
50
gtk_icon_set_add_source (icons, source);
52
gtk_icon_factory_add (factory, stock_id, icons);
54
g_object_unref (G_OBJECT (pixbuf));
55
gtk_icon_source_free (source);
56
gtk_icon_set_unref (icons);
59
DEBUG ("Icon %s already exists in factory\n", stock_id);
40
GtkIconSource *source;
43
icons = gtk_icon_factory_lookup (factory, stock_id);
46
pixbuf = gdk_pixbuf_new_from_inline (-1, icon_data, FALSE, NULL);
47
source = gtk_icon_source_new ();
48
gtk_icon_source_set_pixbuf (source, pixbuf);
49
gtk_icon_source_set_size (source, size);
51
icons = gtk_icon_set_new ();
52
gtk_icon_set_add_source (icons, source);
54
gtk_icon_factory_add (factory, stock_id, icons);
56
g_object_unref (G_OBJECT (pixbuf));
57
gtk_icon_source_free (source);
58
gtk_icon_set_unref (icons);
60
DEBUG ("Icon %s already exists in factory\n", stock_id);
63
GtkIconSet* lookup_sflphone_factory (const gchar *stock_id)
66
return gtk_icon_factory_lookup (icon_factory, stock_id);
62
69
void register_sflphone_stock_icons (GtkIconFactory *factory)
64
add_icon (factory, GTK_STOCK_PICKUP, gnome_stock_pickup, GTK_ICON_SIZE_SMALL_TOOLBAR);
65
add_icon (factory, GTK_STOCK_HANGUP, gnome_stock_hangup, GTK_ICON_SIZE_SMALL_TOOLBAR);
66
add_icon (factory, GTK_STOCK_DIAL, gnome_stock_dial, GTK_ICON_SIZE_SMALL_TOOLBAR);
67
add_icon (factory, GTK_STOCK_TRANSFER, gnome_stock_transfer, GTK_ICON_SIZE_SMALL_TOOLBAR);
68
add_icon (factory, GTK_STOCK_ONHOLD, gnome_stock_onhold, GTK_ICON_SIZE_SMALL_TOOLBAR);
69
add_icon (factory, GTK_STOCK_OFFHOLD, gnome_stock_offhold, GTK_ICON_SIZE_SMALL_TOOLBAR);
70
add_icon (factory, GTK_STOCK_CALL_CURRENT, gnome_stock_call_current, GTK_ICON_SIZE_SMALL_TOOLBAR);
71
add_icon (factory, GTK_STOCK_ADDRESSBOOK, gnome_stock_addressbook, GTK_ICON_SIZE_SMALL_TOOLBAR);
72
add_icon (factory, GTK_STOCK_CALLS, gnome_stock_calls, GTK_ICON_SIZE_SMALL_TOOLBAR);
71
add_icon (factory, GTK_STOCK_PICKUP, gnome_stock_pickup, GTK_ICON_SIZE_SMALL_TOOLBAR);
72
add_icon (factory, GTK_STOCK_HANGUP, gnome_stock_hangup, GTK_ICON_SIZE_SMALL_TOOLBAR);
73
add_icon (factory, GTK_STOCK_DIAL, gnome_stock_dial, GTK_ICON_SIZE_SMALL_TOOLBAR);
74
add_icon (factory, GTK_STOCK_TRANSFER, gnome_stock_transfer, GTK_ICON_SIZE_SMALL_TOOLBAR);
75
add_icon (factory, GTK_STOCK_ONHOLD, gnome_stock_onhold, GTK_ICON_SIZE_SMALL_TOOLBAR);
76
add_icon (factory, GTK_STOCK_OFFHOLD, gnome_stock_offhold, GTK_ICON_SIZE_SMALL_TOOLBAR);
77
add_icon (factory, GTK_STOCK_IM, gnome_stock_im, GTK_ICON_SIZE_SMALL_TOOLBAR);
78
add_icon (factory, GTK_STOCK_CALL_CURRENT, gnome_stock_call_current, GTK_ICON_SIZE_SMALL_TOOLBAR);
79
add_icon (factory, GTK_STOCK_ADDRESSBOOK, gnome_stock_addressbook, GTK_ICON_SIZE_SMALL_TOOLBAR);
80
add_icon (factory, GTK_STOCK_CALLS, gnome_stock_calls, GTK_ICON_SIZE_SMALL_TOOLBAR);
81
add_icon (factory, GTK_STOCK_SFLPHONE, gnome_stock_sflphone, GTK_ICON_SIZE_SMALL_TOOLBAR);
82
add_icon (factory, GTK_STOCK_FAIL, gnome_stock_fail, GTK_ICON_SIZE_SMALL_TOOLBAR);
83
add_icon (factory, GTK_STOCK_USER, gnome_stock_user, GTK_ICON_SIZE_SMALL_TOOLBAR);
75
86
void init_icon_factory (void)
78
icon_factory = gtk_icon_factory_new ();
81
register_sflphone_stock_icons (icon_factory);
83
// Specify a default icon set
84
gtk_icon_factory_add_default (icon_factory);
89
icon_factory = gtk_icon_factory_new ();
92
register_sflphone_stock_icons (icon_factory);
94
// Specify a default icon set
95
gtk_icon_factory_add_default (icon_factory);