changeset 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 a38881ec9c0f
children 41ef089e3df8
files src/gtkimhtml.c src/status.c src/stock.c
diffstat 3 files changed, 42 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkimhtml.c	Sat Sep 11 05:41:50 2004 +0000
+++ b/src/gtkimhtml.c	Sat Sep 11 15:25:36 2004 +0000
@@ -366,11 +366,9 @@
 		g_free(tmp);
 
 		return FALSE;
-		
 	}
 
 	font_metrics = pango_font_get_metrics(font, NULL);
-	
 
 	pango_layout_get_pixel_size(layout, &scr_w, NULL);
 	gap = PANGO_PIXELS((pango_font_metrics_get_ascent(font_metrics) +
@@ -618,7 +616,7 @@
 	GtkTextIter start, end;
 	GtkTextMark *sel = gtk_text_buffer_get_selection_bound(imhtml->text_buffer);
 	GtkTextMark *ins = gtk_text_buffer_get_insert(imhtml->text_buffer);
-	
+
 	gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &start, sel);
 	gtk_text_buffer_get_iter_at_mark(imhtml->text_buffer, &end, ins);
 	primary = gtk_widget_get_clipboard(GTK_WIDGET(imhtml), GDK_SELECTION_PRIMARY) == clipboard;
@@ -629,7 +627,7 @@
 		GString *str = g_string_new(NULL);
 		if (primary) {
 			text = gtk_imhtml_get_markup_range(imhtml, &start, &end);
-		} else 
+		} else
 			text = imhtml->clipboard_html_string;
 
 		/* Mozilla asks that we start our text/html with the Unicode byte order mark */
--- a/src/status.c	Sat Sep 11 05:41:50 2004 +0000
+++ b/src/status.c	Sat Sep 11 15:25:36 2004 +0000
@@ -649,7 +649,7 @@
 			temp_status = (GaimStatus *)g_hash_table_lookup(
 												presence->status_table,
 												gaim_status_type_get_id(temp_type));
-			
+
 			if (gaim_status_is_active(temp_status))
 			{
 				/*
--- 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));