changeset 32661:fa4662e64fc3

Port the markerline to cairo and the new draw signal.
author Elliott Sales de Andrade <qulogic@pidgin.im>
date Tue, 15 Mar 2011 04:15:58 +0000
parents 1c1317a2d471
children 1b4988e242fc
files pidgin/plugins/markerline.c
diffstat 1 files changed, 8 insertions(+), 15 deletions(-) [+]
line wrap: on
line diff
--- a/pidgin/plugins/markerline.c	Mon Mar 14 06:45:05 2011 +0000
+++ b/pidgin/plugins/markerline.c	Tue Mar 15 04:15:58 2011 +0000
@@ -42,7 +42,7 @@
 #define PREF_CHATS      PREF_PREFIX "/chats"
 
 static int
-imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *gtkconv)
+imhtml_expose_cb(GtkWidget *widget, cairo_t *cr, PidginConversation *gtkconv)
 {
 	int y, last_y, offset;
 	GdkRectangle visible_rect;
@@ -51,6 +51,7 @@
 	int pad;
 	PurpleConversation *conv = gtkconv->active_conv;
 	PurpleConversationType type = purple_conversation_get_type(conv);
+	GdkColor red = {0, 0xffff, 0, 0};
 
 	if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) ||
 			(type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS)))
@@ -76,20 +77,12 @@
 	gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT,
 										0, last_y, 0, &y);
 
-  /* TODO: port this to using Cairo 
-	if (y >= event->area.y)
-	{
-		GdkColor red = {0, 0xffff, 0, 0};
-		cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window));
+	gdk_cairo_set_source_color(cr, &red);
+	cairo_move_to(cr, 0.0, y + 0.5);
+	cairo_rel_line_to(cr, visible_rect.width, 0.0);
+	cairo_set_line_width(cr, 1.0);
+	cairo_stroke(cr);
 
-		gdk_cairo_set_source_color(cr, &red);
-		cairo_move_to(cr, 0.0, y + 0.5);
-		cairo_rel_line_to(cr, visible_rect.width, 0.0);
-		cairo_set_line_width(cr, 1.0);
-		cairo_stroke(cr);
-		cairo_destroy(cr);
-	}
-  */
 	return FALSE;
 }
 
@@ -175,7 +168,7 @@
 attach_to_gtkconv(PidginConversation *gtkconv, gpointer null)
 {
 	detach_from_gtkconv(gtkconv, NULL);
-	g_signal_connect(G_OBJECT(gtkconv->imhtml), "expose_event",
+	g_signal_connect(G_OBJECT(gtkconv->imhtml), "draw",
 					 G_CALLBACK(imhtml_expose_cb), gtkconv);
 }