aboutsummaryrefslogtreecommitdiff
path: root/libindicate/indicator.c
diff options
context:
space:
mode:
authorTed Gould <ted@canonical.com>2009-02-12 14:17:18 -0600
committerTed Gould <ted@canonical.com>2009-02-12 14:17:18 -0600
commita2e77d6839d9236118886f2cdc761ff298ff43c1 (patch)
treed4a218076f012fd16135a0f4bf3ff436440b7d46 /libindicate/indicator.c
parent1a8b895c2815ad2055fbd579df4f6f53189f702c (diff)
downloadlibayatana-indicator-a2e77d6839d9236118886f2cdc761ff298ff43c1.tar.gz
libayatana-indicator-a2e77d6839d9236118886f2cdc761ff298ff43c1.tar.bz2
libayatana-indicator-a2e77d6839d9236118886f2cdc761ff298ff43c1.zip
Adding in the function to take a pixbuf, turn it into a png, base64 encode it and then send it across the wire.
Diffstat (limited to 'libindicate/indicator.c')
-rw-r--r--libindicate/indicator.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/libindicate/indicator.c b/libindicate/indicator.c
index 1c6225e..d647930 100644
--- a/libindicate/indicator.c
+++ b/libindicate/indicator.c
@@ -240,8 +240,24 @@ indicate_indicator_set_property (IndicateIndicator * indicator, const gchar * ke
void
indicate_indicator_set_property_icon (IndicateIndicator * indicator, const gchar * key, const GdkPixbuf * data)
{
+ GOutputStream * output = g_memory_output_stream_new(NULL, 0, g_realloc, g_free);
+ if (!gdk_pixbuf_save_to_stream(data, output, "png", NULL, NULL, "compress", 9)) {
+ g_output_stream_close(output, NULL, NULL);
+ g_warning("Unable to create pixbuf data stream");
+ return;
+ }
+
+ gpointer png_data = g_memory_output_stream_get_data(output);
+ gsize png_data_len = g_memory_output_stream_get_data_size(output);
+ gchar * prop_str = g_base64_encode(png_data, png_data_len);
+ indicate_indicator_set_property(indicator, key, prop_str);
+
+ g_free(prop_str);
+ g_output_stream_close(output, NULL, NULL);
+
+ return;
}
void