Back to index

libindicate  12.10.0
Functions
indicator.c File Reference
#include "indicator.h"

Go to the source code of this file.

Functions

void indicate_gtk_indicator_set_property_icon (IndicateIndicator *indicator, const gchar *key, const GdkPixbuf *data)
 indicate_indicator_set_property_icon: : a #IndicateIndicator to act on : name of the property : icon to set property with

Function Documentation

void indicate_gtk_indicator_set_property_icon ( IndicateIndicator *  indicator,
const gchar *  key,
const GdkPixbuf *  data 
)

indicate_indicator_set_property_icon: : a #IndicateIndicator to act on : name of the property : icon to set property with

This is a helper function that wraps around indicate_indicator_set_property but takes an #GdkPixbuf parameter. It then takes the parameter, turns it into a PNG, base64 encodes it and then uses that data to call indicate_indicator_set_property.

Definition at line 44 of file indicator.c.

{
       if (!GDK_IS_PIXBUF(data)) {
              g_warning("Invalide GdkPixbuf");
              return;
       }

       GError * error = NULL;
       gchar * png_data;
       gsize png_data_len;

       if (!gdk_pixbuf_save_to_buffer((GdkPixbuf *)data, &png_data, &png_data_len, "png", &error, NULL)) {
              if (error == NULL) {
                     g_warning("Unable to create pixbuf data stream: %d", (gint)png_data_len);
              } else {
                     g_warning("Unable to create pixbuf data stream: %s", error->message);
                     g_error_free(error);
                     error = NULL;
              }

              return;
       }

       gchar * prop_str = g_base64_encode((guchar *)png_data, png_data_len);
       indicate_indicator_set_property(indicator, key, prop_str);

       g_free(prop_str);
       g_free(png_data);

       return;
}

Here is the call graph for this function:

Here is the caller graph for this function: