OSDN Git Service

LinGui: consolidate all resources into one stringified plist file that gets
[handbrake-jp/handbrake-jp-git.git] / gtk / src / icons.c
1 #include <gtk/gtk.h>
2 #include "icon_tools.h"
3 #include "values.h"
4 #include "resources.h"
5
6 void
7 ghb_load_icons()
8 {
9         GdkPixbuf *pb;
10         GHashTableIter iter;
11         gchar *name;
12         GValue *gval;
13         ghb_rawdata_t *rd;
14         gint size;
15
16         GValue *icons = ghb_resource_get("icons");
17         ghb_dict_iter_init(&iter, icons);
18         // middle (void*) cast prevents gcc warning "defreferencing type-punned
19         // pointer will break strict-aliasing rules"
20         while (g_hash_table_iter_next(
21                         &iter, (gpointer*)(void*)&name, (gpointer*)(void*)&gval))
22         {
23                 rd = g_value_get_boxed(gval);
24                 pb = icon_deserialize(rd->data, rd->size);
25                 size = gdk_pixbuf_get_height(pb);
26                 gtk_icon_theme_add_builtin_icon(name, size, pb);
27                 gdk_pixbuf_unref(pb);
28         }
29 }