Fri, 23 Dec 2011 08:21:58 +0000
A boring and large patch so I can merge heads.
| 15231 | 1 | /* |
| 2 | * Markerline - Draw a line to indicate new messages in a conversation. | |
| 3 | * Copyright (C) 2006 | |
| 4 | * | |
| 5 | * This program is free software; you can redistribute it and/or | |
| 6 | * modify it under the terms of the GNU General Public License as | |
| 7 | * published by the Free Software Foundation; either version 2 of the | |
| 8 | * License, or (at your option) any later version. | |
| 9 | * | |
| 10 | * This program is distributed in the hope that it will be useful, but | |
| 11 | * WITHOUT ANY WARRANTY; without even the implied warranty of | |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | |
| 13 | * General Public License for more details. | |
| 14 | * | |
| 15 | * You should have received a copy of the GNU General Public License | |
| 16 | * along with this program; if not, write to the Free Software | |
|
19859
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16749
diff
changeset
|
17 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA |
|
71d37b57eff2
The FSF changed its address a while ago; our files were out of date.
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
16749
diff
changeset
|
18 | * 02111-1301, USA. |
| 15231 | 19 | */ |
| 20 | #include "internal.h" | |
| 21 | ||
| 22 | #define PLUGIN_ID "gtk-plugin_pack-markerline" | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
23 | #define PLUGIN_NAME N_("Markerline") |
|
25633
feee0c7e503f
Fix some more mis-identified plugins, like 3b3526a0...
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
24604
diff
changeset
|
24 | #define PLUGIN_STATIC_NAME Markerline |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
25 | #define PLUGIN_SUMMARY N_("Draw a line to indicate new messages in a conversation.") |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
26 | #define PLUGIN_DESCRIPTION N_("Draw a line to indicate new messages in a conversation.") |
| 15231 | 27 | #define PLUGIN_AUTHOR "Sadrul H Chowdhury <sadrul@users.sourceforge.net>" |
| 28 | ||
| 29 | /* System headers */ | |
| 30 | #include <gdk/gdk.h> | |
| 31 | #include <glib.h> | |
| 32 | #include <gtk/gtk.h> | |
| 33 | ||
| 15884 | 34 | /* Purple headers */ |
| 15231 | 35 | #include <gtkconv.h> |
| 36 | #include <gtkimhtml.h> | |
| 37 | #include <gtkplugin.h> | |
| 38 | #include <version.h> | |
| 39 | ||
| 40 | #define PREF_PREFIX "/plugins/gtk/" PLUGIN_ID | |
| 41 | #define PREF_IMS PREF_PREFIX "/ims" | |
| 42 | #define PREF_CHATS PREF_PREFIX "/chats" | |
| 43 | ||
| 44 | static int | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
45 | imhtml_expose_cb(GtkWidget *widget, GdkEventExpose *event, PidginConversation *gtkconv) |
| 15231 | 46 | { |
| 47 | int y, last_y, offset; | |
| 48 | GdkRectangle visible_rect; | |
| 49 | GtkTextIter iter; | |
| 50 | GdkRectangle buf; | |
| 51 | int pad; | |
| 15884 | 52 | PurpleConversation *conv = gtkconv->active_conv; |
| 53 | PurpleConversationType type = purple_conversation_get_type(conv); | |
| 15231 | 54 | |
| 15884 | 55 | if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || |
| 56 | (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) | |
| 15231 | 57 | return FALSE; |
| 58 | ||
| 59 | gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); | |
| 60 | ||
| 61 | offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "markerline")); | |
| 62 | if (offset) | |
| 63 | { | |
| 64 | gtk_text_buffer_get_iter_at_offset(gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)), | |
| 65 | &iter, offset); | |
| 66 | ||
| 67 | gtk_text_view_get_iter_location(GTK_TEXT_VIEW(widget), &iter, &buf); | |
| 68 | last_y = buf.y + buf.height; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30564
diff
changeset
|
69 | pad = (gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(widget)) + |
| 15231 | 70 | gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(widget))) / 2; |
| 71 | last_y += pad; | |
| 72 | } | |
| 73 | else | |
| 74 | last_y = 0; | |
| 75 | ||
| 76 | gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, | |
| 77 | 0, last_y, 0, &y); | |
| 78 | ||
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
79 | if (y >= event->area.y) |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
80 | { |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
81 | GdkColor red = {0, 0xffff, 0, 0}; |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
82 | cairo_t *cr = gdk_cairo_create(GDK_DRAWABLE(event->window)); |
| 15231 | 83 | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
84 | gdk_cairo_set_source_color(cr, &red); |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
85 | cairo_move_to(cr, 0.0, y + 0.5); |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
86 | cairo_rel_line_to(cr, visible_rect.width, 0.0); |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
87 | cairo_set_line_width(cr, 1.0); |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
88 | cairo_stroke(cr); |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
89 | cairo_destroy(cr); |
|
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
90 | } |
| 15231 | 91 | return FALSE; |
| 92 | } | |
| 93 | ||
| 94 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
95 | update_marker_for_gtkconv(PidginConversation *gtkconv) |
| 15231 | 96 | { |
| 97 | GtkTextIter iter; | |
| 98 | GtkTextBuffer *buffer; | |
| 99 | g_return_if_fail(gtkconv != NULL); | |
| 100 | ||
| 101 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); | |
| 102 | ||
| 103 | if (!gtk_text_buffer_get_char_count(buffer)) | |
| 104 | return; | |
| 105 | ||
| 106 | gtk_text_buffer_get_end_iter(buffer, &iter); | |
| 107 | ||
| 108 | g_object_set_data(G_OBJECT(gtkconv->imhtml), "markerline", | |
| 109 | GINT_TO_POINTER(gtk_text_iter_get_offset(&iter))); | |
| 110 | gtk_widget_queue_draw(gtkconv->imhtml); | |
| 111 | } | |
| 112 | ||
| 113 | static gboolean | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
114 | focus_removed(GtkWidget *widget, GdkEventVisibility *event, PidginWindow *win) |
| 15231 | 115 | { |
| 15884 | 116 | PurpleConversation *conv; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
117 | PidginConversation *gtkconv; |
| 15231 | 118 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
119 | conv = pidgin_conv_window_get_active_conversation(win); |
| 15231 | 120 | g_return_val_if_fail(conv != NULL, FALSE); |
| 121 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
122 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 15231 | 123 | update_marker_for_gtkconv(gtkconv); |
| 124 | ||
| 125 | return FALSE; | |
| 126 | } | |
| 127 | ||
| 128 | #if 0 | |
| 129 | static gboolean | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
130 | window_resized(GtkWidget *w, GdkEventConfigure *event, PidginWindow *win) |
| 15231 | 131 | { |
| 132 | GList *list; | |
| 133 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
134 | list = pidgin_conv_window_get_gtkconvs(win); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30564
diff
changeset
|
135 | |
| 15231 | 136 | for (; list; list = list->next) |
| 137 | update_marker_for_gtkconv(list->data); | |
| 138 | ||
| 139 | return FALSE; | |
| 140 | } | |
| 141 | ||
| 142 | static gboolean | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
143 | imhtml_resize_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv) |
| 15231 | 144 | { |
| 145 | gtk_widget_queue_draw(w); | |
| 146 | return FALSE; | |
| 147 | } | |
| 148 | #endif | |
| 149 | ||
| 150 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
151 | page_switched(GtkWidget *widget, GtkWidget *page, gint num, PidginWindow *win) |
| 15231 | 152 | { |
| 153 | focus_removed(NULL, NULL, win); | |
| 154 | } | |
| 155 | ||
| 156 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
157 | detach_from_gtkconv(PidginConversation *gtkconv, gpointer null) |
| 15231 | 158 | { |
| 159 | g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->imhtml), imhtml_expose_cb, gtkconv); | |
| 160 | } | |
| 161 | ||
| 162 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
163 | detach_from_pidgin_window(PidginWindow *win, gpointer null) |
| 15231 | 164 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
165 | g_list_foreach(pidgin_conv_window_get_gtkconvs(win), (GFunc)detach_from_gtkconv, NULL); |
| 15231 | 166 | g_signal_handlers_disconnect_by_func(G_OBJECT(win->notebook), page_switched, win); |
| 167 | g_signal_handlers_disconnect_by_func(G_OBJECT(win->window), focus_removed, win); | |
| 168 | ||
| 169 | gtk_widget_queue_draw(win->window); | |
| 170 | } | |
| 171 | ||
| 172 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
173 | attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) |
| 15231 | 174 | { |
| 175 | detach_from_gtkconv(gtkconv, NULL); | |
|
32438
dc8991868906
A boring and large patch so I can merge heads.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32427
diff
changeset
|
176 | g_signal_connect(G_OBJECT(gtkconv->imhtml), "expose_event", |
| 15231 | 177 | G_CALLBACK(imhtml_expose_cb), gtkconv); |
| 178 | } | |
| 179 | ||
| 180 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
181 | attach_to_pidgin_window(PidginWindow *win, gpointer null) |
| 15231 | 182 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
183 | g_list_foreach(pidgin_conv_window_get_gtkconvs(win), (GFunc)attach_to_gtkconv, NULL); |
| 15231 | 184 | |
| 185 | g_signal_connect(G_OBJECT(win->window), "focus_out_event", | |
| 186 | G_CALLBACK(focus_removed), win); | |
| 187 | ||
| 188 | g_signal_connect(G_OBJECT(win->notebook), "switch_page", | |
| 189 | G_CALLBACK(page_switched), win); | |
| 190 | ||
| 191 | gtk_widget_queue_draw(win->window); | |
| 192 | } | |
| 193 | ||
| 194 | static void | |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
20288
diff
changeset
|
195 | detach_from_all_windows(void) |
| 15231 | 196 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
197 | g_list_foreach(pidgin_conv_windows_get_list(), (GFunc)detach_from_pidgin_window, NULL); |
| 15231 | 198 | } |
| 199 | ||
| 200 | static void | |
|
22104
56970903b8e9
Probe for -Wstrict-prototypes to get some more warnings. I then cleaned up
Richard Laager <rlaager@pidgin.im>
parents:
20288
diff
changeset
|
201 | attach_to_all_windows(void) |
| 15231 | 202 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
203 | g_list_foreach(pidgin_conv_windows_get_list(), (GFunc)attach_to_pidgin_window, NULL); |
| 15231 | 204 | } |
| 205 | ||
| 206 | static void | |
|
24604
6d8cec169c3f
Use a more appropriate signal for the markerline plugin. Fixes #7518.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22809
diff
changeset
|
207 | conv_created(PidginConversation *gtkconv, gpointer null) |
| 15231 | 208 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
209 | PidginWindow *win; |
| 15231 | 210 | |
|
24604
6d8cec169c3f
Use a more appropriate signal for the markerline plugin. Fixes #7518.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22809
diff
changeset
|
211 | win = pidgin_conv_get_window(gtkconv); |
|
6d8cec169c3f
Use a more appropriate signal for the markerline plugin. Fixes #7518.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22809
diff
changeset
|
212 | if (!win) |
| 15231 | 213 | return; |
| 214 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
215 | detach_from_pidgin_window(win, NULL); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
216 | attach_to_pidgin_window(win, NULL); |
| 15231 | 217 | } |
| 218 | ||
|
22809
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
219 | static void |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
220 | jump_to_markerline(PurpleConversation *conv, gpointer null) |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
221 | { |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
222 | PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
223 | int offset; |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
224 | GtkTextIter iter; |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
225 | |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
226 | if (!gtkconv) |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
227 | return; |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
228 | |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
229 | offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkconv->imhtml), "markerline")); |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
230 | gtk_text_buffer_get_iter_at_offset(GTK_IMHTML(gtkconv->imhtml)->text_buffer, &iter, offset); |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
231 | gtk_text_view_scroll_to_iter(GTK_TEXT_VIEW(gtkconv->imhtml), &iter, 0, TRUE, 0, 0); |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
232 | } |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
233 | |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
234 | static void |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
235 | conv_menu_cb(PurpleConversation *conv, GList **list) |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
236 | { |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
237 | PurpleConversationType type = purple_conversation_get_type(conv); |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
238 | gboolean enabled = ((type == PURPLE_CONV_TYPE_IM && purple_prefs_get_bool(PREF_IMS)) || |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
239 | (type == PURPLE_CONV_TYPE_CHAT && purple_prefs_get_bool(PREF_CHATS))); |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
240 | PurpleMenuAction *action = purple_menu_action_new(_("Jump to markerline"), |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
241 | enabled ? PURPLE_CALLBACK(jump_to_markerline) : NULL, NULL, NULL); |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
242 | *list = g_list_append(*list, action); |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
243 | } |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
244 | |
| 15231 | 245 | static gboolean |
| 15884 | 246 | plugin_load(PurplePlugin *plugin) |
| 15231 | 247 | { |
| 248 | attach_to_all_windows(); | |
| 249 | ||
|
24604
6d8cec169c3f
Use a more appropriate signal for the markerline plugin. Fixes #7518.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22809
diff
changeset
|
250 | purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed", |
| 15884 | 251 | plugin, PURPLE_CALLBACK(conv_created), NULL); |
| 15231 | 252 | |
|
22809
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
253 | purple_signal_connect(purple_conversations_get_handle(), "conversation-extended-menu", |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
254 | plugin, PURPLE_CALLBACK(conv_menu_cb), NULL); |
| 15231 | 255 | return TRUE; |
| 256 | } | |
| 257 | ||
| 258 | static gboolean | |
| 15884 | 259 | plugin_unload(PurplePlugin *plugin) |
| 15231 | 260 | { |
| 261 | detach_from_all_windows(); | |
| 262 | ||
| 263 | return TRUE; | |
| 264 | } | |
| 265 | ||
| 15884 | 266 | static PurplePluginPrefFrame * |
| 267 | get_plugin_pref_frame(PurplePlugin *plugin) | |
| 15231 | 268 | { |
| 15884 | 269 | PurplePluginPrefFrame *frame; |
| 270 | PurplePluginPref *pref; | |
| 15231 | 271 | |
| 15884 | 272 | frame = purple_plugin_pref_frame_new(); |
| 15231 | 273 | |
| 15884 | 274 | pref = purple_plugin_pref_new_with_label(_("Draw Markerline in ")); |
| 275 | purple_plugin_pref_frame_add(frame, pref); | |
| 15231 | 276 | |
| 15884 | 277 | pref = purple_plugin_pref_new_with_name_and_label(PREF_IMS, |
| 15231 | 278 | _("_IM windows")); |
| 15884 | 279 | purple_plugin_pref_frame_add(frame, pref); |
| 15231 | 280 | |
| 15884 | 281 | pref = purple_plugin_pref_new_with_name_and_label(PREF_CHATS, |
| 15231 | 282 | _("C_hat windows")); |
| 15884 | 283 | purple_plugin_pref_frame_add(frame, pref); |
| 15231 | 284 | |
| 285 | return frame; | |
| 286 | } | |
| 287 | ||
| 15884 | 288 | static PurplePluginUiInfo prefs_info = { |
| 15231 | 289 | get_plugin_pref_frame, |
| 290 | 0, | |
| 291 | NULL, | |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
292 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
293 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
294 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
295 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
296 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
297 | NULL |
| 15231 | 298 | }; |
| 299 | ||
| 15884 | 300 | static PurplePluginInfo info = { |
| 301 | PURPLE_PLUGIN_MAGIC, /* Magic */ | |
| 302 | PURPLE_MAJOR_VERSION, /* Purple Major Version */ | |
| 303 | PURPLE_MINOR_VERSION, /* Purple Minor Version */ | |
| 304 | PURPLE_PLUGIN_STANDARD, /* plugin type */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
305 | PIDGIN_PLUGIN_TYPE, /* ui requirement */ |
| 15231 | 306 | 0, /* flags */ |
| 307 | NULL, /* dependencies */ | |
| 15884 | 308 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
| 15231 | 309 | |
| 310 | PLUGIN_ID, /* plugin id */ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
311 | PLUGIN_NAME, /* name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
312 | DISPLAY_VERSION, /* version */ |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
313 | PLUGIN_SUMMARY, /* summary */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
314 | PLUGIN_DESCRIPTION, /* description */ |
| 15231 | 315 | PLUGIN_AUTHOR, /* author */ |
| 15884 | 316 | PURPLE_WEBSITE, /* website */ |
| 15231 | 317 | |
| 318 | plugin_load, /* load */ | |
| 319 | plugin_unload, /* unload */ | |
| 320 | NULL, /* destroy */ | |
| 321 | ||
| 322 | NULL, /* ui_info */ | |
| 323 | NULL, /* extra_info */ | |
| 324 | &prefs_info, /* prefs_info */ | |
|
16749
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
325 | NULL, /* actions */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
326 | |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
327 | /* padding */ |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
328 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
329 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
330 | NULL, |
|
14a3fdc0aed7
Default plugins are done, for the release i'm not that concerned about plugins that do _NOT_ compile by default
Gary Kramlich <grim@reaperworld.com>
parents:
15884
diff
changeset
|
331 | NULL |
| 15231 | 332 | }; |
| 333 | ||
| 334 | static void | |
| 15884 | 335 | init_plugin(PurplePlugin *plugin) |
| 15231 | 336 | { |
| 15884 | 337 | purple_prefs_add_none(PREF_PREFIX); |
| 338 | purple_prefs_add_bool(PREF_IMS, FALSE); | |
| 339 | purple_prefs_add_bool(PREF_CHATS, TRUE); | |
| 15231 | 340 | } |
| 341 | ||
| 15884 | 342 | PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |