diff options
author | jstebbins <[email protected]> | 2009-03-27 15:58:11 +0000 |
---|---|---|
committer | jstebbins <[email protected]> | 2009-03-27 15:58:11 +0000 |
commit | 64dfe58a8f49c8de188fed1dddc76ebabdfeb4b4 (patch) | |
tree | 29eda34a85d74e98f26b46f3e14337543e6ca63c /gtk/src/icons.c | |
parent | a5eab51e9af0ba1cba513ecd323744958e701c65 (diff) |
LinGui:
- add some error handling to resource parser
- modify how icons are deserialized in ghb since the python resource
parser can't easily serialize the old way
git-svn-id: svn://svn.handbrake.fr/HandBrake/trunk@2278 b64f7644-9d1e-0410-96f1-a4d463321fa5
Diffstat (limited to 'gtk/src/icons.c')
-rw-r--r-- | gtk/src/icons.c | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/gtk/src/icons.c b/gtk/src/icons.c index af7d84e05..948213de4 100644 --- a/gtk/src/icons.c +++ b/gtk/src/icons.c @@ -3,6 +3,46 @@ #include "values.h" #include "resources.h" +#if 0 +void +ghb_load_icons() +{ + GHashTableIter iter; + gchar *name; + GValue *gval; + + GValue *icons = ghb_resource_get("icons"); + ghb_dict_iter_init(&iter, icons); + // middle (void*) cast prevents gcc warning "defreferencing type-punned + // pointer will break strict-aliasing rules" + while (g_hash_table_iter_next( + &iter, (gpointer*)(void*)&name, (gpointer*)(void*)&gval)) + { + gint colorspace, bps, width, height, rowstride; + gboolean alpha; + ghb_rawdata_t *rd; + gint size; + GdkPixbuf *pb; + + colorspace = ghb_value_int(ghb_dict_lookup(gval, "colorspace")); + alpha = ghb_value_boolean(ghb_dict_lookup(gval, "alpha")); + bps = ghb_value_int(ghb_dict_lookup(gval, "bps")); + width = ghb_value_int(ghb_dict_lookup(gval, "width")); + height = ghb_value_int(ghb_dict_lookup(gval, "height")); + rowstride = ghb_value_int(ghb_dict_lookup(gval, "rowstride")); + rd = g_value_get_boxed(ghb_dict_lookup(gval, "data")); + pb = gdk_pixbuf_new_from_data( + rd->data, colorspace, alpha, bps, + width, height, rowstride, + NULL, NULL); + size = gdk_pixbuf_get_height(pb); + gtk_icon_theme_add_builtin_icon(name, size, pb); + gdk_pixbuf_unref(pb); + } +} + +#else + void ghb_load_icons() { @@ -27,3 +67,4 @@ ghb_load_icons() gdk_pixbuf_unref(pb); } } +#endif |