diff options
-rw-r--r-- | battstat/battstat_applet.c | 1 | ||||
-rw-r--r-- | cpufreq/src/cpufreq-applet.c | 24 | ||||
-rw-r--r-- | drivemount/drive-button.c | 97 | ||||
-rw-r--r-- | netspeed/src/netspeed.c | 104 | ||||
-rw-r--r-- | stickynotes/stickynotes_applet.c | 81 | ||||
-rw-r--r-- | stickynotes/stickynotes_applet.h | 6 |
6 files changed, 178 insertions, 135 deletions
diff --git a/battstat/battstat_applet.c b/battstat/battstat_applet.c index 2a550fab..e45b246a 100644 --- a/battstat/battstat_applet.c +++ b/battstat/battstat_applet.c @@ -214,6 +214,7 @@ static GdkColor darkred[] = { their XPM format (as stored in pixmaps.h). This should only be done once since they are global variables. */ +/* FIXME: We should be using named icons here... */ static void initialise_global_pixmaps( void ) { diff --git a/cpufreq/src/cpufreq-applet.c b/cpufreq/src/cpufreq-applet.c index c667eda6..d40ae0b4 100644 --- a/cpufreq/src/cpufreq-applet.c +++ b/cpufreq/src/cpufreq-applet.c @@ -62,7 +62,7 @@ struct _CPUFreqApplet { GtkWidget *box; GtkWidget *labels_box; GtkWidget *container; - GdkPixbuf *pixbufs[5]; + cairo_surface_t *surfaces[5]; gint max_label_width; gint max_perc_width; @@ -245,9 +245,9 @@ cpufreq_applet_dispose (GObject *widget) } for (i = 0; i <= 3; i++) { - if (applet->pixbufs[i]) { - g_object_unref (G_OBJECT (applet->pixbufs[i])); - applet->pixbufs[i] = NULL; + if (applet->surfaces[i]) { + cairo_surface_destroy (applet->surfaces[i]); + applet->surfaces[i] = NULL; } } @@ -646,6 +646,8 @@ static void cpufreq_applet_pixmap_set_image (CPUFreqApplet *applet, gint perc) { gint image; + gint scale; + gint size = 24; /* FIXME */ /* 0-29 -> 25% * 30-69 -> 50% @@ -663,12 +665,18 @@ cpufreq_applet_pixmap_set_image (CPUFreqApplet *applet, gint perc) else image = 4; - if (applet->pixbufs[image] == NULL) { - applet->pixbufs[image] = gdk_pixbuf_new_from_file_at_size (cpufreq_icons[image], - 24, 24, NULL); + scale = gtk_widget_get_scale_factor (GTK_WIDGET (applet->icon)); + + if (applet->surfaces[image] == NULL) { + GdkPixbuf *pixbuf = gdk_pixbuf_new_from_file_at_scale (cpufreq_icons[image], + size * scale, + size * scale, + TRUE, + NULL); + applet->surfaces[image] = gdk_cairo_surface_create_from_pixbuf (pixbuf, scale, NULL); } - gtk_image_set_from_pixbuf (GTK_IMAGE (applet->icon), applet->pixbufs[image]); + gtk_image_set_from_surface (GTK_IMAGE (applet->icon), applet->surfaces[image]); } static gboolean diff --git a/drivemount/drive-button.c b/drivemount/drive-button.c index 1b1a758c..ecdf3320 100644 --- a/drivemount/drive-button.c +++ b/drivemount/drive-button.c @@ -339,9 +339,10 @@ drive_button_update (gpointer user_data) GtkIconTheme *icon_theme; GtkIconInfo *icon_info; GIcon *icon; - int width, height; - GdkPixbuf *pixbuf = NULL, *scaled; - GdkPixbuf *tmp_pixbuf = NULL; + int width, height, scale; + cairo_t *cr; + cairo_surface_t *surface = NULL; + cairo_surface_t *tmp_surface = NULL; GtkRequisition button_req, image_req; char *display_name, *tip; @@ -351,10 +352,11 @@ drive_button_update (gpointer user_data) /* base the icon size on the desired button size */ drive_button_reset_popup (self); + scale = gtk_widget_get_scale_factor (GTK_WIDGET (self)); gtk_widget_get_preferred_size (GTK_WIDGET (self), NULL, &button_req); gtk_widget_get_preferred_size (gtk_bin_get_child (GTK_BIN (self)), NULL, &image_req); - width = self->icon_size - (button_req.width - image_req.width); - height = self->icon_size - (button_req.height - image_req.height); + width = (self->icon_size - (button_req.width - image_req.width)) / scale; + height = (self->icon_size - (button_req.height - image_req.height)) / scale; /* if no volume or mount, display general image */ if (!self->volume && !self->mount) @@ -363,23 +365,20 @@ drive_button_update (gpointer user_data) screen = gtk_widget_get_screen (GTK_WIDGET (self)); icon_theme = gtk_icon_theme_get_for_screen (screen); //m // note - other good icon would be emblem-unreadable - icon_info = gtk_icon_theme_lookup_icon (icon_theme, "media-floppy", - MIN (width, height), - GTK_ICON_LOOKUP_USE_BUILTIN); + icon_info = gtk_icon_theme_lookup_icon_for_scale (icon_theme, "media-floppy", + MIN (width, height), scale, + GTK_ICON_LOOKUP_USE_BUILTIN); if (icon_info) { - pixbuf = gtk_icon_info_load_icon (icon_info, NULL); + surface = gtk_icon_info_load_surface (icon_info, NULL, NULL); g_object_unref (icon_info); } - if (!pixbuf) + if (!surface) return FALSE; - scaled = gdk_pixbuf_scale_simple (pixbuf, width, height, GDK_INTERP_BILINEAR); - if (scaled) { - g_object_unref (pixbuf); - pixbuf = scaled; - } + if (gtk_bin_get_child (GTK_BIN (self)) != NULL) - gtk_image_set_from_pixbuf (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (self))), pixbuf); + gtk_image_set_from_surface (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (self))), surface); + return FALSE; } @@ -396,19 +395,15 @@ drive_button_update (gpointer user_data) { is_mounted = TRUE; tip = g_strdup_printf ("%s\n%s", display_name, _("(mounted)")); + icon = g_mount_get_icon (mount); + g_object_unref (mount); } else { is_mounted = FALSE; tip = g_strdup_printf ("%s\n%s", display_name, _("(not mounted)")); - } - if (mount) - icon = g_mount_get_icon (mount); - else icon = g_volume_get_icon (self->volume); - - if (mount) - g_object_unref (mount); + } } else { is_mounted = TRUE; @@ -423,41 +418,43 @@ drive_button_update (gpointer user_data) screen = gtk_widget_get_screen (GTK_WIDGET (self)); icon_theme = gtk_icon_theme_get_for_screen (screen); - icon_info = gtk_icon_theme_lookup_by_gicon (icon_theme, icon, - MIN (width, height), - GTK_ICON_LOOKUP_USE_BUILTIN); + icon_info = gtk_icon_theme_lookup_by_gicon_for_scale (icon_theme, icon, + MIN (width, height), scale, + GTK_ICON_LOOKUP_USE_BUILTIN); if (icon_info) { - pixbuf = gtk_icon_info_load_icon (icon_info, NULL); + surface = gtk_icon_info_load_surface (icon_info, NULL, NULL); g_object_unref (icon_info); } g_object_unref (icon); - if (!pixbuf) + if (!surface) return FALSE; - // make a copy of pixbuf becasue icon image can be shared by system - tmp_pixbuf = gdk_pixbuf_copy (pixbuf); - g_object_unref (pixbuf); - g_assert (tmp_pixbuf != NULL); + // create a new surface because icon image can be shared by system + tmp_surface = cairo_surface_create_similar (surface, + cairo_surface_get_content (surface), + cairo_image_surface_get_width (surface) / scale, + cairo_image_surface_get_height (surface) / scale); // if mounted, change icon if (is_mounted) { int icon_width, icon_height, rowstride, n_channels, x, y; guchar *pixels, *p; + gboolean has_alpha; + + has_alpha = cairo_surface_get_content (tmp_surface) != CAIRO_CONTENT_COLOR; + n_channels = 3; + if (has_alpha) + n_channels++; - n_channels = gdk_pixbuf_get_n_channels (tmp_pixbuf); - g_assert (gdk_pixbuf_get_colorspace (tmp_pixbuf) == GDK_COLORSPACE_RGB); - g_assert (gdk_pixbuf_get_bits_per_sample (tmp_pixbuf) == 8); - g_assert (gdk_pixbuf_get_has_alpha (tmp_pixbuf)); - g_assert (n_channels == 4); - icon_width = gdk_pixbuf_get_width (tmp_pixbuf); - icon_height = gdk_pixbuf_get_height (tmp_pixbuf); + icon_width = cairo_image_surface_get_width (tmp_surface); + icon_height = cairo_image_surface_get_height (tmp_surface); - rowstride = gdk_pixbuf_get_rowstride (tmp_pixbuf); - pixels = gdk_pixbuf_get_pixels (tmp_pixbuf); + rowstride = cairo_image_surface_get_stride (tmp_surface); + pixels = cairo_image_surface_get_data (tmp_surface); GdkRGBA color; gchar *color_string = g_settings_get_string (settings, "drivemount-checkmark-color"); @@ -481,18 +478,20 @@ drive_button_update (gpointer user_data) p[0] = red; p[1] = green; p[2] = blue; - p[3] = 255; + if (has_alpha) + p[3] = 255; } } - scaled = gdk_pixbuf_scale_simple (tmp_pixbuf, width, height, GDK_INTERP_BILINEAR); - if (scaled) { - g_object_unref (tmp_pixbuf); - tmp_pixbuf = scaled; - } + cr = cairo_create (tmp_surface); + cairo_set_operator (cr, CAIRO_OPERATOR_OVERLAY); + cairo_set_source_surface (cr, surface, 0, 0); + cairo_paint (cr); + + gtk_image_set_from_surface (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (self))), tmp_surface); - gtk_image_set_from_pixbuf (GTK_IMAGE (gtk_bin_get_child (GTK_BIN (self))), tmp_pixbuf); - g_object_unref (tmp_pixbuf); + cairo_surface_destroy (surface); + cairo_surface_destroy (tmp_surface); gtk_widget_get_preferred_size (GTK_WIDGET (self), NULL, &button_req); diff --git a/netspeed/src/netspeed.c b/netspeed/src/netspeed.c index 5adbcfa6..558b103a 100644 --- a/netspeed/src/netspeed.c +++ b/netspeed/src/netspeed.c @@ -75,7 +75,7 @@ typedef struct *in_box, *in_label, *in_pix, *out_box, *out_label, *out_pix, *sum_box, *sum_label, *dev_pix, *qual_pix; - GdkPixbuf *qual_pixbufs[4]; + cairo_surface_t *qual_surfaces[4]; GtkWidget *signalbar; @@ -238,65 +238,81 @@ applet_change_size_or_orient(MatePanelApplet *applet_widget, int arg1, MateNetsp static void change_icons(MateNetspeedApplet *applet) { - GdkPixbuf *dev, *down; - GdkPixbuf *in_arrow, *out_arrow; + cairo_surface_t *dev, *down; + cairo_surface_t *in_arrow, *out_arrow; GtkIconTheme *icon_theme; + gint icon_scale; + + /* FIXME: Add larger icon files. */ + gint icon_size = 16; icon_theme = gtk_icon_theme_get_default(); + icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (applet->applet)); /* If the user wants a different icon than current, we load it */ if (applet->show_icon && applet->change_icon) { - dev = gtk_icon_theme_load_icon(icon_theme, + dev = gtk_icon_theme_load_surface(icon_theme, dev_type_icon[applet->devinfo.type], - 16, 0, NULL); + icon_size, icon_scale, NULL, 0, NULL); } else { - dev = gtk_icon_theme_load_icon(icon_theme, + dev = gtk_icon_theme_load_surface(icon_theme, dev_type_icon[DEV_UNKNOWN], - 16, 0, NULL); + icon_size, icon_scale, NULL, 0, NULL); } /* We need a fallback */ if (dev == NULL) - dev = gtk_icon_theme_load_icon(icon_theme, + dev = gtk_icon_theme_load_surface(icon_theme, dev_type_icon[DEV_UNKNOWN], - 16, 0, NULL); + icon_size, icon_scale, NULL, 0, NULL); - in_arrow = gtk_icon_theme_load_icon(icon_theme, IN_ICON, 16, 0, NULL); - out_arrow = gtk_icon_theme_load_icon(icon_theme, OUT_ICON, 16, 0, NULL); + in_arrow = gtk_icon_theme_load_surface(icon_theme, IN_ICON, icon_size, icon_scale, NULL, 0, NULL); + out_arrow = gtk_icon_theme_load_surface(icon_theme, OUT_ICON, icon_size, icon_scale, NULL, 0, NULL); /* Set the windowmanager icon for the applet */ gtk_window_set_default_icon_name(LOGO_ICON); - gtk_image_set_from_pixbuf(GTK_IMAGE(applet->out_pix), out_arrow); - gtk_image_set_from_pixbuf(GTK_IMAGE(applet->in_pix), in_arrow); - g_object_unref(in_arrow); - g_object_unref(out_arrow); + gtk_image_set_from_surface(GTK_IMAGE(applet->out_pix), out_arrow); + gtk_image_set_from_surface(GTK_IMAGE(applet->in_pix), in_arrow); + cairo_surface_destroy(in_arrow); + cairo_surface_destroy(out_arrow); if (applet->devinfo.running) { gtk_widget_show(applet->in_box); gtk_widget_show(applet->out_box); } else { - GdkPixbuf *copy; + cairo_t *cr; + cairo_surface_t *copy; gtk_widget_hide(applet->in_box); gtk_widget_hide(applet->out_box); /* We're not allowed to modify "dev" */ - copy = gdk_pixbuf_copy(dev); - - down = gtk_icon_theme_load_icon(icon_theme, ERROR_ICON, 16, 0, NULL); - gdk_pixbuf_composite(down, copy, 8, 8, 8, 8, 8, 8, 0.5, 0.5, GDK_INTERP_BILINEAR, 0xFF); - g_object_unref(down); - g_object_unref(dev); + copy = cairo_surface_create_similar (dev, + cairo_surface_get_content (dev), + cairo_image_surface_get_width (dev) / icon_scale, + cairo_image_surface_get_height (dev) / icon_scale); + cr = cairo_create (copy); + cairo_set_source_surface (cr, dev, 0, 0); + cairo_paint (cr); + + down = gtk_icon_theme_load_surface(icon_theme, ERROR_ICON, icon_size, icon_scale, NULL, 0, NULL); + cairo_scale (cr, 0.5, 0.5); + cairo_set_operator (cr, CAIRO_OPERATOR_OVER); + cairo_set_source_surface (cr, down, 8 * icon_scale, 8 * icon_scale); + cairo_paint (cr); + + cairo_surface_destroy(down); + cairo_surface_destroy(dev); dev = copy; } if (applet->show_icon) { gtk_widget_show(applet->dev_pix); - gtk_image_set_from_pixbuf(GTK_IMAGE(applet->dev_pix), dev); + gtk_image_set_from_surface(GTK_IMAGE(applet->dev_pix), dev); } else { gtk_widget_hide(applet->dev_pix); } - g_object_unref(dev); + cairo_surface_destroy(dev); } /* Change visibility of signal quality icon for wireless devices @@ -323,30 +339,42 @@ update_quality_icon(MateNetspeedApplet *applet) q = (applet->devinfo.qual); q /= 25; - q = CLAMP(q, 0, 3); /* q out of range would crash when accessing qual_pixbufs[q] */ - gtk_image_set_from_pixbuf (GTK_IMAGE(applet->qual_pix), applet->qual_pixbufs[q]); + q = CLAMP(q, 0, 3); /* q out of range would crash when accessing qual_surfaces[q] */ + gtk_image_set_from_surface (GTK_IMAGE(applet->qual_pix), applet->qual_surfaces[q]); } static void -init_quality_pixbufs(MateNetspeedApplet *applet) +init_quality_surfaces(MateNetspeedApplet *applet) { GtkIconTheme *icon_theme; int i; - GdkPixbuf *pixbuf; + cairo_surface_t *surface; + gint icon_scale; + + /* FIXME: Add larger icon files. */ + gint icon_size = 24; icon_theme = gtk_icon_theme_get_default(); + icon_scale = gtk_widget_get_scale_factor (GTK_WIDGET (applet->applet)); for (i = 0; i < 4; i++) { - if (applet->qual_pixbufs[i]) - g_object_unref(applet->qual_pixbufs[i]); - pixbuf = gtk_icon_theme_load_icon(icon_theme, - wireless_quality_icon[i], 24, 0, NULL); - if (pixbuf) { - applet->qual_pixbufs[i] = gdk_pixbuf_copy(pixbuf); - g_object_unref(pixbuf); + if (applet->qual_surfaces[i]) + cairo_surface_destroy(applet->qual_surfaces[i]); + surface = gtk_icon_theme_load_surface(icon_theme, + wireless_quality_icon[i], icon_size, icon_scale, NULL, 0, NULL); + if (surface) { + cairo_t *cr; + applet->qual_surfaces[i] = cairo_surface_create_similar (surface, + cairo_surface_get_content (surface), + cairo_image_surface_get_width (surface) / icon_scale, + cairo_image_surface_get_height (surface) / icon_scale); + cr = cairo_create (applet->qual_surfaces[i]); + cairo_set_source_surface (cr, surface, 0, 0); + cairo_paint (cr); + cairo_surface_destroy(surface); } else { - applet->qual_pixbufs[i] = NULL; + applet->qual_surfaces[i] = NULL; } } } @@ -357,7 +385,7 @@ icon_theme_changed_cb(GtkIconTheme *icon_theme, gpointer user_data) { MateNetspeedApplet *applet = (MateNetspeedApplet*)user_data; - init_quality_pixbufs(user_data); + init_quality_surfaces(user_data); if (applet->devinfo.type == DEV_WIRELESS && applet->devinfo.up) update_quality_icon(user_data); change_icons(user_data); @@ -1668,7 +1696,7 @@ mate_netspeed_applet_factory(MatePanelApplet *applet_widget, const gchar *iid, g gtk_box_pack_start(GTK_BOX(spacer_box), applet->qual_pix, FALSE, FALSE, 0); gtk_box_pack_start(GTK_BOX(spacer_box), applet->dev_pix, FALSE, FALSE, 0); - init_quality_pixbufs(applet); + init_quality_surfaces(applet); applet_change_size_or_orient(applet_widget, -1, (gpointer)applet); gtk_widget_show_all(GTK_WIDGET(applet_widget)); diff --git a/stickynotes/stickynotes_applet.c b/stickynotes/stickynotes_applet.c index 34f91965..70f62727 100644 --- a/stickynotes/stickynotes_applet.c +++ b/stickynotes/stickynotes_applet.c @@ -83,9 +83,9 @@ static gboolean stickynotes_applet_factory(MatePanelApplet *mate_panel_applet, c MATE_PANEL_APPLET_OUT_PROCESS_FACTORY("StickyNotesAppletFactory", PANEL_TYPE_APPLET, "stickynotes_applet", stickynotes_applet_factory, NULL) -/* colorshift a pixbuf */ +/* colorshift a surface */ static void -stickynotes_make_prelight_icon (GdkPixbuf *dest, GdkPixbuf *src, int shift) +stickynotes_make_prelight_icon (cairo_surface_t *dest, cairo_surface_t *src, int shift) { gint i, j; gint width, height, has_alpha, srcrowstride, destrowstride; @@ -96,13 +96,13 @@ stickynotes_make_prelight_icon (GdkPixbuf *dest, GdkPixbuf *src, int shift) int val; guchar r,g,b; - has_alpha = gdk_pixbuf_get_has_alpha (src); - width = gdk_pixbuf_get_width (src); - height = gdk_pixbuf_get_height (src); - srcrowstride = gdk_pixbuf_get_rowstride (src); - destrowstride = gdk_pixbuf_get_rowstride (dest); - target_pixels = gdk_pixbuf_get_pixels (dest); - original_pixels = gdk_pixbuf_get_pixels (src); + has_alpha = cairo_surface_get_content (src) != CAIRO_CONTENT_COLOR; + width = cairo_image_surface_get_width (src); + height = cairo_image_surface_get_height (src); + srcrowstride = cairo_image_surface_get_stride (src); + destrowstride = cairo_image_surface_get_stride (dest); + original_pixels = cairo_image_surface_get_data (src); + target_pixels = cairo_image_surface_get_data (dest); for (i = 0; i < height; i++) { pixdest = target_pixels + i*destrowstride; @@ -155,30 +155,37 @@ stickynotes_destroy (GtkWidget *widget, void stickynotes_applet_init (MatePanelApplet *mate_panel_applet) { + cairo_t *cr; + gint size, scale; + stickynotes = g_new(StickyNotes, 1); stickynotes->notes = NULL; stickynotes->applets = NULL; stickynotes->last_timeout_data = 0; - g_set_application_name (_("Sticky Notes")); + size = mate_panel_applet_get_size (mate_panel_applet); + scale = gtk_widget_get_scale_factor (GTK_WIDGET (mate_panel_applet)); + g_set_application_name (_("Sticky Notes")); gtk_window_set_default_icon_name ("mate-sticky-notes-applet"); - stickynotes->icon_normal = gtk_icon_theme_load_icon ( + stickynotes->icon_normal = gtk_icon_theme_load_surface ( gtk_icon_theme_get_default (), "mate-sticky-notes-applet", - 48, 0, NULL); - - stickynotes->icon_prelight = gdk_pixbuf_new ( - gdk_pixbuf_get_colorspace (stickynotes->icon_normal), - gdk_pixbuf_get_has_alpha (stickynotes->icon_normal), - gdk_pixbuf_get_bits_per_sample ( - stickynotes->icon_normal), - gdk_pixbuf_get_width (stickynotes->icon_normal), - gdk_pixbuf_get_height (stickynotes->icon_normal)); - stickynotes_make_prelight_icon (stickynotes->icon_prelight, - stickynotes->icon_normal, 30); + size, scale, NULL, 0, NULL); + + stickynotes->icon_prelight = cairo_surface_create_similar (stickynotes->icon_normal, + cairo_surface_get_content (stickynotes->icon_normal), + cairo_image_surface_get_width (stickynotes->icon_normal), + cairo_image_surface_get_height (stickynotes->icon_normal)); + + stickynotes_make_prelight_icon (stickynotes->icon_prelight, stickynotes->icon_normal, 30); + + cr = cairo_create (stickynotes->icon_prelight); + cairo_set_operator (cr, CAIRO_OPERATOR_DEST_IN); + cairo_mask_surface (cr, stickynotes->icon_normal, 0, 0); + stickynotes->settings = g_settings_new (STICKYNOTES_SCHEMA); stickynotes->visible = TRUE; @@ -343,7 +350,6 @@ stickynotes_applet_new(MatePanelApplet *mate_panel_applet) applet->w_image = gtk_image_new(); applet->destroy_all_dialog = NULL; applet->prelighted = FALSE; - applet->pressed = FALSE; applet->menu_tip = NULL; @@ -413,29 +419,32 @@ stickynotes_applet_new(MatePanelApplet *mate_panel_applet) void stickynotes_applet_update_icon(StickyNotesApplet *applet) { - GdkPixbuf *pixbuf1, *pixbuf2; + cairo_t *cr; + cairo_surface_t *surface; gint size = applet->panel_size; - if (size > 3) - size = size -3; + if (size > 3) + size = size - 3; /* Choose appropriate icon and size it */ if (applet->prelighted) - pixbuf1 = gdk_pixbuf_scale_simple(stickynotes->icon_prelight, size, size, GDK_INTERP_BILINEAR); + surface = cairo_surface_create_similar (stickynotes->icon_prelight, + cairo_surface_get_content (stickynotes->icon_prelight), + size, size); else - pixbuf1 = gdk_pixbuf_scale_simple(stickynotes->icon_normal, size, size, GDK_INTERP_BILINEAR); + surface = cairo_surface_create_similar (stickynotes->icon_normal, + cairo_surface_get_content (stickynotes->icon_normal), + size, size); - /* Shift the icon if pressed */ - pixbuf2 = gdk_pixbuf_copy(pixbuf1); - if (applet->pressed) - gdk_pixbuf_scale(pixbuf1, pixbuf2, 0, 0, size, size, 1, 1, 1, 1, GDK_INTERP_BILINEAR); + cr = cairo_create (surface); + cairo_set_source_surface (cr, applet->prelighted ? stickynotes->icon_prelight : stickynotes->icon_normal, 0, 0); + cairo_paint (cr); - /* Apply the finished pixbuf to the applet image */ - gtk_image_set_from_pixbuf(GTK_IMAGE(applet->w_image), pixbuf2); + /* Apply the finished surface to the applet image */ + gtk_image_set_from_surface(GTK_IMAGE(applet->w_image), surface); - g_object_unref(pixbuf1); - g_object_unref(pixbuf2); + cairo_surface_destroy(surface); } void diff --git a/stickynotes/stickynotes_applet.h b/stickynotes/stickynotes_applet.h index 6a1663d0..18364655 100644 --- a/stickynotes/stickynotes_applet.h +++ b/stickynotes/stickynotes_applet.h @@ -22,7 +22,6 @@ #include <glib/gi18n.h> #include <gdk/gdk.h> -#include <gdk-pixbuf/gdk-pixbuf.h> #include <gtk/gtk.h> #include <gio/gio.h> #include <mate-panel-applet.h> @@ -57,8 +56,8 @@ typedef struct GList *notes; /* Linked-List of all the sticky notes */ GList *applets; /* Linked-List of all the applets */ - GdkPixbuf *icon_normal; /* Normal applet icon */ - GdkPixbuf *icon_prelight; /* Prelighted applet icon */ + cairo_surface_t *icon_normal; /* Normal applet icon */ + cairo_surface_t *icon_prelight; /* Prelighted applet icon */ GSettings *settings; /* Shared GSettings */ @@ -77,7 +76,6 @@ typedef struct GtkWidget *destroy_all_dialog; /* The applet it's destroy all dialog */ gboolean prelighted; /* Whether applet is prelighted */ - gboolean pressed; /* Whether applet is pressed */ gint panel_size; MatePanelAppletOrient panel_orient; |