aboutsummaryrefslogtreecommitdiff
path: root/libdbusmenu-gtk
diff options
context:
space:
mode:
authorAurélien Gâteau <aurelien.gateau@canonical.com>2012-01-23 14:38:36 +0100
committerAurélien Gâteau <aurelien.gateau@canonical.com>2012-01-23 14:38:36 +0100
commit9a01ce5b74bd5d2012a59e9d55a49531da1c4d14 (patch)
tree28b8c527405819911020bc463caeb2e76e62203e /libdbusmenu-gtk
parent57befc99feb45329551f956beeb594df3b541835 (diff)
downloadlibdbusmenu-9a01ce5b74bd5d2012a59e9d55a49531da1c4d14.tar.gz
libdbusmenu-9a01ce5b74bd5d2012a59e9d55a49531da1c4d14.tar.bz2
libdbusmenu-9a01ce5b74bd5d2012a59e9d55a49531da1c4d14.zip
Change icon-data to contains raw png bytes, without base64 encoding
Reasons: - base64 encoding is not necessary because dbusmenu properties can use any dbus-supported types. - faster: no need to base64 decode/encode images - more efficient: base64-encoded data is 1/3 bigger than raw data
Diffstat (limited to 'libdbusmenu-gtk')
-rw-r--r--libdbusmenu-gtk/menuitem.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/libdbusmenu-gtk/menuitem.c b/libdbusmenu-gtk/menuitem.c
index 0f511bc..19ea1a0 100644
--- a/libdbusmenu-gtk/menuitem.c
+++ b/libdbusmenu-gtk/menuitem.c
@@ -66,11 +66,9 @@ dbusmenu_menuitem_property_set_image (DbusmenuMenuitem * menuitem, const gchar *
return FALSE;
}
- gchar * prop_str = g_base64_encode((guchar *)png_data, png_data_len);
gboolean propreturn = FALSE;
- propreturn = dbusmenu_menuitem_property_set(menuitem, property, prop_str);
+ propreturn = dbusmenu_menuitem_property_set_byte_array(menuitem, property, (guchar *)png_data, png_data_len);
- g_free(prop_str);
g_free(png_data);
return propreturn;
@@ -94,20 +92,17 @@ dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar *
g_return_val_if_fail(DBUSMENU_IS_MENUITEM(menuitem), NULL);
g_return_val_if_fail(property != NULL && property[0] != '\0', NULL);
- const gchar * value = dbusmenu_menuitem_property_get(menuitem, property);
+ gsize length = 0;
+ const guchar * icondata = dbusmenu_menuitem_property_get_byte_array(menuitem, property, &length);
/* There is no icon */
- if (value == NULL || value[0] == '\0') {
+ if (length == 0) {
return NULL;
}
-
- gsize length = 0;
- guchar * icondata = g_base64_decode(value, &length);
GInputStream * input = g_memory_input_stream_new_from_data(icondata, length, NULL);
if (input == NULL) {
g_warning("Cound not create input stream from icon property data");
- g_free(icondata);
return NULL;
}
@@ -120,7 +115,6 @@ dbusmenu_menuitem_property_get_image (DbusmenuMenuitem * menuitem, const gchar *
}
g_object_unref(input);
- g_free(icondata);
return icon;
}