Mercurial > pidgin.yaz
diff src/stock.c @ 10013:f1f239fa8973
[gaim-migrate @ 10930]
Superimpose the version number on the logo from Gary
"What's superimposed...?"
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 11 Sep 2004 15:25:36 +0000 |
parents | 2ce6f1a0016b |
children | e653b2c888f4 |
line wrap: on
line diff
--- a/src/stock.c Sat Sep 11 05:41:50 2004 +0000 +++ b/src/stock.c Sat Sep 11 15:25:36 2004 +0000 @@ -121,6 +121,42 @@ return filename; } +static void +gaim_gtk_stock_versionize(GdkPixbuf **original, GtkWidget *widget) { + GdkPixmap *pixmap; + GtkStyle *style; + PangoContext *context; + PangoLayout *layout; + gchar *markup; + gint width, height; + gint lwidth = 0, lheight = 0; + + style = gtk_widget_get_style(widget); + + gdk_pixbuf_render_pixmap_and_mask(*original, &pixmap, NULL, 255); + width = gdk_pixbuf_get_width(*original); + height = gdk_pixbuf_get_height(*original); + g_object_unref(G_OBJECT(*original)); + + context = gtk_widget_get_pango_context(widget); + layout = pango_layout_new(context); + + markup = g_strdup_printf("<span foreground=\"#FFFFFF\" size=\"larger\">%s</span>", VERSION); + pango_layout_set_font_description(layout, style->font_desc); + pango_layout_set_markup(layout, markup, strlen(markup)); + g_free(markup); + + pango_layout_get_pixel_size(layout, &lwidth, &lheight); + gdk_draw_layout(GDK_DRAWABLE(pixmap), style->bg_gc[GTK_STATE_NORMAL], + width - (lwidth + 3), height - (lheight + 1), layout); + g_object_unref(G_OBJECT(layout)); + + *original = gdk_pixbuf_get_from_drawable(NULL, pixmap, NULL, + 0, 0, 0, 0, + width, height); + g_object_unref(G_OBJECT(pixmap)); +} + void gaim_gtk_stock_init(void) { @@ -166,6 +202,9 @@ g_free(filename); + if (!strcmp(stock_icons[i].name, GAIM_STOCK_LOGO)) + gaim_gtk_stock_versionize(&pixbuf, win); + iconset = gtk_icon_set_new_from_pixbuf(pixbuf); g_object_unref(G_OBJECT(pixbuf));