MessageTray: rework icon handling to split model and view

To allow more than one summary icon actor for a source we split
the model of the source icon (which is iconName, if the default
implementation is used, or a GIcon otherwise) and replace
createNotificationIcon() with a generic createIcon(size). Also,
the actual source actor is split into a separate class, that handles
the notification counter automatically.

https://bugzilla.gnome.org/show_bug.cgi?id=619955
This commit is contained in:
Giovanni Campagna
2012-07-19 15:05:17 +02:00
parent 26d3b1929e
commit ac6c808124
7 changed files with 139 additions and 71 deletions

View File

@ -8,6 +8,7 @@
#include "shell-util.h"
#include <glib/gi18n-lib.h>
#include <gtk/gtk.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
#ifdef HAVE__NL_TIME_FIRST_WEEKDAY
#include <langinfo.h>
@ -818,3 +819,33 @@ shell_util_wifexited (int status,
return ret;
}
/**
* shell_util_create_pixbuf_from_data:
* @data: (array length=len) (element-type guint8) (transfer full):
* @len:
* @colorspace:
* @has_alpha:
* @bits_per_sample:
* @width:
* @height:
* @rowstride:
*
* Workaround for non-introspectability of gdk_pixbuf_from_data().
*
* Returns: (transfer full):
*/
GdkPixbuf *
shell_util_create_pixbuf_from_data (const guchar *data,
gsize len,
GdkColorspace colorspace,
gboolean has_alpha,
int bits_per_sample,
int width,
int height,
int rowstride)
{
return gdk_pixbuf_new_from_data (data, colorspace, has_alpha,
bits_per_sample, width, height, rowstride,
(GdkPixbufDestroyNotify) g_free, NULL);
}