diff src/gtkimhtml.c @ 9007:0a08f671b591

[gaim-migrate @ 9783] You can now use gtk to theme your hyperlink colors. It works something like this: style "mystyle" { GtkIMHtml::hyperlink-color = "#00FF00" } widget_class "*" style "mystyle" If you change it while gaim is running, old hyperlinks won't change color, but new ones should, assuming you use a program that sends the right event to make things reparse their gtkrcs. Old hyperlinks will change color if you restart Gaim and view them in the logs or something. Actually using bright green for hyperlinks is discourged. committer: Tailor Script <tailor@pidgin.im>
author Tim Ringenbach <marv@pidgin.im>
date Sat, 22 May 2004 06:35:13 +0000
parents 4ff4c34b7500
children 6dc1f052edc0
line wrap: on
line diff
--- a/src/gtkimhtml.c	Sat May 22 04:39:44 2004 +0000
+++ b/src/gtkimhtml.c	Sat May 22 06:35:13 2004 +0000
@@ -944,6 +944,7 @@
 /* Boring GTK stuff */
 static void gtk_imhtml_class_init (GtkIMHtmlClass *klass)
 {
+	GtkWidgetClass *widget_class = (GtkWidgetClass *) klass;
 	GtkObjectClass *object_class;
 	GObjectClass   *gobject_class;
 	object_class = (GtkObjectClass*) klass;
@@ -993,6 +994,11 @@
 							g_cclosure_marshal_VOID__VOID,
 							G_TYPE_NONE, 0);
 	gobject_class->finalize = gtk_imhtml_finalize;
+
+	gtk_widget_class_install_style_property(widget_class, g_param_spec_boxed("hyperlink-color",
+	                                        _("Hyperlink color"),
+	                                        _("Color to draw hyperlinks."),
+	                                        GDK_TYPE_COLOR, G_PARAM_READABLE));
 }
 
 static void gtk_imhtml_init (GtkIMHtml *imhtml)
@@ -3438,6 +3444,7 @@
 	GtkTextTag *linktag;
 	static guint linkno = 0;
 	gchar str[48];
+	GdkColor *color = NULL;
 
 	imhtml->edit.link = NULL;
 
@@ -3447,7 +3454,11 @@
 		g_snprintf(str, sizeof(str), "LINK %d", linkno++);
 		str[47] = '\0';
 
-		imhtml->edit.link = linktag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL);
+		gtk_widget_style_get(GTK_WIDGET(imhtml), "hyperlink-color", &color, NULL);
+		if (color)
+			imhtml->edit.link = linktag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "foreground-gdk", color, "underline", PANGO_UNDERLINE_SINGLE, NULL);
+		else
+			imhtml->edit.link = linktag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL);
 		g_object_set_data_full(G_OBJECT(linktag), "link_url", g_strdup(url), g_free);
 		g_signal_connect(G_OBJECT(linktag), "event", G_CALLBACK(tag_event), NULL);