Mercurial > pidgin.yaz
comparison 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 |
comparison
equal
deleted
inserted
replaced
9006:bffe8d1adb8b | 9007:0a08f671b591 |
---|---|
942 } | 942 } |
943 | 943 |
944 /* Boring GTK stuff */ | 944 /* Boring GTK stuff */ |
945 static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) | 945 static void gtk_imhtml_class_init (GtkIMHtmlClass *klass) |
946 { | 946 { |
947 GtkWidgetClass *widget_class = (GtkWidgetClass *) klass; | |
947 GtkObjectClass *object_class; | 948 GtkObjectClass *object_class; |
948 GObjectClass *gobject_class; | 949 GObjectClass *gobject_class; |
949 object_class = (GtkObjectClass*) klass; | 950 object_class = (GtkObjectClass*) klass; |
950 gobject_class = (GObjectClass*) klass; | 951 gobject_class = (GObjectClass*) klass; |
951 parent_class = gtk_type_class(GTK_TYPE_TEXT_VIEW); | 952 parent_class = gtk_type_class(GTK_TYPE_TEXT_VIEW); |
991 NULL, | 992 NULL, |
992 0, | 993 0, |
993 g_cclosure_marshal_VOID__VOID, | 994 g_cclosure_marshal_VOID__VOID, |
994 G_TYPE_NONE, 0); | 995 G_TYPE_NONE, 0); |
995 gobject_class->finalize = gtk_imhtml_finalize; | 996 gobject_class->finalize = gtk_imhtml_finalize; |
997 | |
998 gtk_widget_class_install_style_property(widget_class, g_param_spec_boxed("hyperlink-color", | |
999 _("Hyperlink color"), | |
1000 _("Color to draw hyperlinks."), | |
1001 GDK_TYPE_COLOR, G_PARAM_READABLE)); | |
996 } | 1002 } |
997 | 1003 |
998 static void gtk_imhtml_init (GtkIMHtml *imhtml) | 1004 static void gtk_imhtml_init (GtkIMHtml *imhtml) |
999 { | 1005 { |
1000 GtkTextIter iter; | 1006 GtkTextIter iter; |
3436 { | 3442 { |
3437 GtkTextIter start, end; | 3443 GtkTextIter start, end; |
3438 GtkTextTag *linktag; | 3444 GtkTextTag *linktag; |
3439 static guint linkno = 0; | 3445 static guint linkno = 0; |
3440 gchar str[48]; | 3446 gchar str[48]; |
3447 GdkColor *color = NULL; | |
3441 | 3448 |
3442 imhtml->edit.link = NULL; | 3449 imhtml->edit.link = NULL; |
3443 | 3450 |
3444 | 3451 |
3445 | 3452 |
3446 if (url) { | 3453 if (url) { |
3447 g_snprintf(str, sizeof(str), "LINK %d", linkno++); | 3454 g_snprintf(str, sizeof(str), "LINK %d", linkno++); |
3448 str[47] = '\0'; | 3455 str[47] = '\0'; |
3449 | 3456 |
3450 imhtml->edit.link = linktag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL); | 3457 gtk_widget_style_get(GTK_WIDGET(imhtml), "hyperlink-color", &color, NULL); |
3458 if (color) | |
3459 imhtml->edit.link = linktag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "foreground-gdk", color, "underline", PANGO_UNDERLINE_SINGLE, NULL); | |
3460 else | |
3461 imhtml->edit.link = linktag = gtk_text_buffer_create_tag(imhtml->text_buffer, str, "foreground", "blue", "underline", PANGO_UNDERLINE_SINGLE, NULL); | |
3451 g_object_set_data_full(G_OBJECT(linktag), "link_url", g_strdup(url), g_free); | 3462 g_object_set_data_full(G_OBJECT(linktag), "link_url", g_strdup(url), g_free); |
3452 g_signal_connect(G_OBJECT(linktag), "event", G_CALLBACK(tag_event), NULL); | 3463 g_signal_connect(G_OBJECT(linktag), "event", G_CALLBACK(tag_event), NULL); |
3453 | 3464 |
3454 if (imhtml->editable && gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end)) { | 3465 if (imhtml->editable && gtk_text_buffer_get_selection_bounds(imhtml->text_buffer, &start, &end)) { |
3455 remove_font_link(imhtml, &start, &end, FALSE); | 3466 remove_font_link(imhtml, &start, &end, FALSE); |