aboutsummaryrefslogtreecommitdiffstats
path: root/shell/e-activity-handler.c
diff options
context:
space:
mode:
Diffstat (limited to 'shell/e-activity-handler.c')
-rw-r--r--shell/e-activity-handler.c46
1 files changed, 3 insertions, 43 deletions
diff --git a/shell/e-activity-handler.c b/shell/e-activity-handler.c
index 98f75619aa..9e85e44afb 100644
--- a/shell/e-activity-handler.c
+++ b/shell/e-activity-handler.c
@@ -26,6 +26,8 @@
#include "e-activity-handler.h"
+#include "e-shell-corba-icon-utils.h"
+
#include <gtk/gtksignal.h>
#include <gdk-pixbuf/gdk-pixbuf.h>
@@ -64,48 +66,6 @@ struct _EActivityHandlerPrivate {
/* Utility functions. */
-static GdkPixbuf *
-create_gdk_pixbuf_from_corba_icon (const GNOME_Evolution_Icon *icon)
-{
- GdkPixbuf *pixbuf;
- GdkPixbuf *scaled_pixbuf;
- unsigned char *p;
- int src_offset;
- int i, j;
- int rowstride;
- int total_width;
-
- pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, icon->hasAlpha, 8, icon->width, icon->height);
-
- if (icon->hasAlpha)
- total_width = 4 * icon->width;
- else
- total_width = 3 * icon->width;
-
- rowstride = gdk_pixbuf_get_rowstride (pixbuf);
- src_offset = 0;
- p = gdk_pixbuf_get_pixels (pixbuf);
-
- for (i = 0; i < icon->height; i++) {
- for (j = 0; j < total_width; j++)
- p[j] = icon->rgbaData._buffer[src_offset ++];
- p += rowstride;
- }
-
- if (icon->width == ICON_SIZE && icon->height == ICON_SIZE)
- return pixbuf;
-
- scaled_pixbuf = gdk_pixbuf_new (GDK_COLORSPACE_RGB, icon->hasAlpha, 8, ICON_SIZE, ICON_SIZE);
- gdk_pixbuf_scale (pixbuf, scaled_pixbuf,
- 0, 0, ICON_SIZE, ICON_SIZE,
- 0, 0, (double) ICON_SIZE / icon->width, (double) ICON_SIZE / icon->height,
- GDK_INTERP_HYPER);
-
- gdk_pixbuf_unref (pixbuf);
-
- return scaled_pixbuf;
-}
-
static unsigned int
get_new_activity_id (EActivityHandler *activity_handler)
{
@@ -421,7 +381,7 @@ impl_operationStarted (PortableServer_Servant servant,
if (icon->_length > 1)
g_warning ("Animated icons are not supported for activities (yet).");
- icon_pixbuf = create_gdk_pixbuf_from_corba_icon (icon->_buffer);
+ icon_pixbuf = e_new_gdk_pixbuf_from_corba_icon (icon->_buffer, ICON_SIZE, ICON_SIZE);
activity_id = get_new_activity_id (activity_handler);