Mercurial > pidgin
comparison pidgin/plugins/markerline.c @ 32672:3828a61c44da
A boring and large patch so I can merge heads.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Fri, 23 Dec 2011 08:21:58 +0000 |
parents | fa4662e64fc3 |
children |
comparison
equal
deleted
inserted
replaced
32671:0e69949b3e61 | 32672:3828a61c44da |
---|---|
40 #define PREF_PREFIX "/plugins/gtk/" PLUGIN_ID | 40 #define PREF_PREFIX "/plugins/gtk/" PLUGIN_ID |
41 #define PREF_IMS PREF_PREFIX "/ims" | 41 #define PREF_IMS PREF_PREFIX "/ims" |
42 #define PREF_CHATS PREF_PREFIX "/chats" | 42 #define PREF_CHATS PREF_PREFIX "/chats" |
43 | 43 |
44 static int | 44 static int |
45 imhtml_expose_cb(GtkWidget *widget, cairo_t *cr, PidginConversation *gtkconv) | 45 imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *gtkconv) |
46 { | 46 { |
47 int y, last_y, offset; | 47 int y, last_y, offset; |
48 GdkRectangle visible_rect; | 48 GdkRectangle visible_rect; |
49 GtkTextIter iter; | 49 GtkTextIter iter; |
50 GdkRectangle buf; | 50 GdkRectangle buf; |
51 int pad; | 51 int pad; |
52 PurpleConversation *conv = gtkconv->active_conv; | 52 PurpleConversation *conv = gtkconv->active_conv; |
53 PurpleConversationType type = purple_conversation_get_type(conv); | 53 PurpleConversationType type = purple_conversation_get_type(conv); |
54 GdkColor red = {0, 0xffff, 0, 0}; | |
55 | 54 |
56 if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || | 55 if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || |
57 (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) | 56 (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) |
58 return FALSE; | 57 return FALSE; |
59 | 58 |
75 last_y = 0; | 74 last_y = 0; |
76 | 75 |
77 gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, | 76 gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, |
78 0, last_y, 0, &y); | 77 0, last_y, 0, &y); |
79 | 78 |
80 gdk_cairo_set_source_color(cr, &red); | 79 if (y >= event->area.y) |
81 cairo_move_to(cr, 0.0, y + 0.5); | 80 { |
82 cairo_rel_line_to(cr, visible_rect.width, 0.0); | 81 GdkColor red = {0, 0xffff, 0, 0}; |
83 cairo_set_line_width(cr, 1.0); | 82 cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window)); |
84 cairo_stroke(cr); | 83 |
85 | 84 gdk_cairo_set_source_color(cr, &red); |
85 cairo_move_to(cr, 0.0, y + 0.5); | |
86 cairo_rel_line_to(cr, visible_rect.width, 0.0); | |
87 cairo_set_line_width(cr, 1.0); | |
88 cairo_stroke(cr); | |
89 cairo_destroy(cr); | |
90 } | |
86 return FALSE; | 91 return FALSE; |
87 } | 92 } |
88 | 93 |
89 static void | 94 static void |
90 update_marker_for_gtkconv(PidginConversation *gtkconv) | 95 update_marker_for_gtkconv(PidginConversation *gtkconv) |
166 | 171 |
167 static void | 172 static void |
168 attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) | 173 attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) |
169 { | 174 { |
170 detach_from_gtkconv(gtkconv, NULL); | 175 detach_from_gtkconv(gtkconv, NULL); |
171 g_signal_connect(G_OBJECT(gtkconv->imhtml), "draw", | 176 g_signal_connect(G_OBJECT(gtkconv->imhtml), "expose_event", |
172 G_CALLBACK(imhtml_expose_cb), gtkconv); | 177 G_CALLBACK(imhtml_expose_cb), gtkconv); |
173 } | 178 } |
174 | 179 |
175 static void | 180 static void |
176 attach_to_pidgin_window(PidginWindow *win, gpointer null) | 181 attach_to_pidgin_window(PidginWindow *win, gpointer null) |