OSDN Git Service

Remove the set cpu count option as it doesn't do anything now
[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         GHashTableIter iter;
10         gchar *name;
11         GValue *gval;
12
13         GValue *icons = ghb_resource_get("icons");
14         ghb_dict_iter_init(&iter, icons);
15         // middle (void*) cast prevents gcc warning "defreferencing type-punned
16         // pointer will break strict-aliasing rules"
17         while (g_hash_table_iter_next(
18                         &iter, (gpointer*)(void*)&name, (gpointer*)(void*)&gval))
19         {
20                 gint colorspace, bps, width, height, rowstride;
21                 gboolean alpha;
22                 ghb_rawdata_t *rd;
23                 gint size;
24                 GdkPixbuf *pb;
25
26                 colorspace = ghb_value_int(ghb_dict_lookup(gval, "colorspace"));
27                 alpha = ghb_value_boolean(ghb_dict_lookup(gval, "alpha"));
28                 bps = ghb_value_int(ghb_dict_lookup(gval, "bps"));
29                 width = ghb_value_int(ghb_dict_lookup(gval, "width"));
30                 height = ghb_value_int(ghb_dict_lookup(gval, "height"));
31                 rowstride = ghb_value_int(ghb_dict_lookup(gval, "rowstride"));
32                 rd = g_value_get_boxed(ghb_dict_lookup(gval, "data"));
33                 pb = gdk_pixbuf_new_from_data(
34                                 rd->data, colorspace, alpha, bps,
35                                 width, height, rowstride,
36                                 NULL, NULL);
37                 size = gdk_pixbuf_get_height(pb);
38                 gtk_icon_theme_add_builtin_icon(name, size, pb);
39                 gdk_pixbuf_unref(pb);
40         }
41 }