Fri, 23 Dec 2011 09:14:56 +0000
propagate from branch 'im.pidgin.pidgin' (head 681ca041d42bb5093590d0ac5495f1309e1472f2)
to branch 'im.pidgin.cpw.qulogic.gtk3-required' (head 1fd0091b97e8e587035d4dd46ba14a6803c412e9)
| 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 | |
|
32427
62ca9d966c38
Port the markerline to cairo and the new draw signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
45 | imhtml_expose_cb(GtkWidget *widget, cairo_t *cr, 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); | |
|
32427
62ca9d966c38
Port the markerline to cairo and the new draw signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
54 | GdkColor red = {0, 0xffff, 0, 0}; |
| 15231 | 55 | |
| 15884 | 56 | if ((type == PURPLE_CONV_TYPE_CHAT && !purple_prefs_get_bool(PREF_CHATS)) || |
| 57 | (type == PURPLE_CONV_TYPE_IM && !purple_prefs_get_bool(PREF_IMS))) | |
| 15231 | 58 | return FALSE; |
| 59 | ||
| 60 | gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(widget), &visible_rect); | |
| 61 | ||
| 62 | offset = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(widget), "markerline")); | |
| 63 | if (offset) | |
| 64 | { | |
| 65 | gtk_text_buffer_get_iter_at_offset(gtk_text_view_get_buffer(GTK_TEXT_VIEW(widget)), | |
| 66 | &iter, offset); | |
| 67 | ||
| 68 | gtk_text_view_get_iter_location(GTK_TEXT_VIEW(widget), &iter, &buf); | |
| 69 | last_y = buf.y + buf.height; | |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30564
diff
changeset
|
70 | pad = (gtk_text_view_get_pixels_below_lines(GTK_TEXT_VIEW(widget)) + |
| 15231 | 71 | gtk_text_view_get_pixels_above_lines(GTK_TEXT_VIEW(widget))) / 2; |
| 72 | last_y += pad; | |
| 73 | } | |
| 74 | else | |
| 75 | last_y = 0; | |
| 76 | ||
| 77 | gtk_text_view_buffer_to_window_coords(GTK_TEXT_VIEW(widget), GTK_TEXT_WINDOW_TEXT, | |
| 78 | 0, last_y, 0, &y); | |
| 79 | ||
|
32427
62ca9d966c38
Port the markerline to cairo and the new draw signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
80 | gdk_cairo_set_source_color(cr, &red); |
|
62ca9d966c38
Port the markerline to cairo and the new draw signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
81 | cairo_move_to(cr, 0.0, y + 0.5); |
|
62ca9d966c38
Port the markerline to cairo and the new draw signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
82 | cairo_rel_line_to(cr, visible_rect.width, 0.0); |
|
62ca9d966c38
Port the markerline to cairo and the new draw signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
83 | cairo_set_line_width(cr, 1.0); |
|
62ca9d966c38
Port the markerline to cairo and the new draw signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
84 | cairo_stroke(cr); |
| 15231 | 85 | |
| 86 | return FALSE; | |
| 87 | } | |
| 88 | ||
| 89 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
90 | update_marker_for_gtkconv(PidginConversation *gtkconv) |
| 15231 | 91 | { |
| 92 | GtkTextIter iter; | |
| 93 | GtkTextBuffer *buffer; | |
| 94 | g_return_if_fail(gtkconv != NULL); | |
| 95 | ||
| 96 | buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(gtkconv->imhtml)); | |
| 97 | ||
| 98 | if (!gtk_text_buffer_get_char_count(buffer)) | |
| 99 | return; | |
| 100 | ||
| 101 | gtk_text_buffer_get_end_iter(buffer, &iter); | |
| 102 | ||
| 103 | g_object_set_data(G_OBJECT(gtkconv->imhtml), "markerline", | |
| 104 | GINT_TO_POINTER(gtk_text_iter_get_offset(&iter))); | |
| 105 | gtk_widget_queue_draw(gtkconv->imhtml); | |
| 106 | } | |
| 107 | ||
| 108 | static gboolean | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
109 | focus_removed(GtkWidget *widget, GdkEventVisibility *event, PidginWindow *win) |
| 15231 | 110 | { |
| 15884 | 111 | PurpleConversation *conv; |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
112 | PidginConversation *gtkconv; |
| 15231 | 113 | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
114 | conv = pidgin_conv_window_get_active_conversation(win); |
| 15231 | 115 | g_return_val_if_fail(conv != NULL, FALSE); |
| 116 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
117 | gtkconv = PIDGIN_CONVERSATION(conv); |
| 15231 | 118 | update_marker_for_gtkconv(gtkconv); |
| 119 | ||
| 120 | return FALSE; | |
| 121 | } | |
| 122 | ||
| 123 | #if 0 | |
| 124 | static gboolean | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
125 | window_resized(GtkWidget *w, GdkEventConfigure *event, PidginWindow *win) |
| 15231 | 126 | { |
| 127 | GList *list; | |
| 128 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
129 | list = pidgin_conv_window_get_gtkconvs(win); |
|
31294
73607ab89c6f
Remove trailing whitespace
Richard Laager <rlaager@pidgin.im>
parents:
30564
diff
changeset
|
130 | |
| 15231 | 131 | for (; list; list = list->next) |
| 132 | update_marker_for_gtkconv(list->data); | |
| 133 | ||
| 134 | return FALSE; | |
| 135 | } | |
| 136 | ||
| 137 | static gboolean | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
138 | imhtml_resize_cb(GtkWidget *w, GtkAllocation *allocation, PidginConversation *gtkconv) |
| 15231 | 139 | { |
| 140 | gtk_widget_queue_draw(w); | |
| 141 | return FALSE; | |
| 142 | } | |
| 143 | #endif | |
| 144 | ||
| 145 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
146 | page_switched(GtkWidget *widget, GtkWidget *page, gint num, PidginWindow *win) |
| 15231 | 147 | { |
| 148 | focus_removed(NULL, NULL, win); | |
| 149 | } | |
| 150 | ||
| 151 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
152 | detach_from_gtkconv(PidginConversation *gtkconv, gpointer null) |
| 15231 | 153 | { |
| 154 | g_signal_handlers_disconnect_by_func(G_OBJECT(gtkconv->imhtml), imhtml_expose_cb, gtkconv); | |
| 155 | } | |
| 156 | ||
| 157 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
158 | detach_from_pidgin_window(PidginWindow *win, gpointer null) |
| 15231 | 159 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
160 | g_list_foreach(pidgin_conv_window_get_gtkconvs(win), (GFunc)detach_from_gtkconv, NULL); |
| 15231 | 161 | g_signal_handlers_disconnect_by_func(G_OBJECT(win->notebook), page_switched, win); |
| 162 | g_signal_handlers_disconnect_by_func(G_OBJECT(win->window), focus_removed, win); | |
| 163 | ||
| 164 | gtk_widget_queue_draw(win->window); | |
| 165 | } | |
| 166 | ||
| 167 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
168 | attach_to_gtkconv(PidginConversation *gtkconv, gpointer null) |
| 15231 | 169 | { |
| 170 | detach_from_gtkconv(gtkconv, NULL); | |
|
32427
62ca9d966c38
Port the markerline to cairo and the new draw signal.
Elliott Sales de Andrade <qulogic@pidgin.im>
parents:
32414
diff
changeset
|
171 | g_signal_connect(G_OBJECT(gtkconv->imhtml), "draw", |
| 15231 | 172 | G_CALLBACK(imhtml_expose_cb), gtkconv); |
| 173 | } | |
| 174 | ||
| 175 | static void | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
176 | attach_to_pidgin_window(PidginWindow *win, gpointer null) |
| 15231 | 177 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
178 | g_list_foreach(pidgin_conv_window_get_gtkconvs(win), (GFunc)attach_to_gtkconv, NULL); |
| 15231 | 179 | |
| 180 | g_signal_connect(G_OBJECT(win->window), "focus_out_event", | |
| 181 | G_CALLBACK(focus_removed), win); | |
| 182 | ||
| 183 | g_signal_connect(G_OBJECT(win->notebook), "switch_page", | |
| 184 | G_CALLBACK(page_switched), win); | |
| 185 | ||
| 186 | gtk_widget_queue_draw(win->window); | |
| 187 | } | |
| 188 | ||
| 189 | 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
|
190 | detach_from_all_windows(void) |
| 15231 | 191 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
192 | g_list_foreach(pidgin_conv_windows_get_list(), (GFunc)detach_from_pidgin_window, NULL); |
| 15231 | 193 | } |
| 194 | ||
| 195 | 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
|
196 | attach_to_all_windows(void) |
| 15231 | 197 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
198 | g_list_foreach(pidgin_conv_windows_get_list(), (GFunc)attach_to_pidgin_window, NULL); |
| 15231 | 199 | } |
| 200 | ||
| 201 | 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
|
202 | conv_created(PidginConversation *gtkconv, gpointer null) |
| 15231 | 203 | { |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
204 | PidginWindow *win; |
| 15231 | 205 | |
|
24604
6d8cec169c3f
Use a more appropriate signal for the markerline plugin. Fixes #7518.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22809
diff
changeset
|
206 | 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
|
207 | if (!win) |
| 15231 | 208 | return; |
| 209 | ||
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
210 | detach_from_pidgin_window(win, NULL); |
|
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
211 | attach_to_pidgin_window(win, NULL); |
| 15231 | 212 | } |
| 213 | ||
|
22809
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
214 | 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
|
215 | 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
|
216 | { |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
217 | 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
|
218 | 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
|
219 | 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
|
220 | |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
221 | 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
|
222 | return; |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
223 | |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
224 | 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
|
225 | 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
|
226 | 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
|
227 | } |
|
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 | 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
|
230 | 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
|
231 | { |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
232 | 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
|
233 | 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
|
234 | (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
|
235 | 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
|
236 | 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
|
237 | *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
|
238 | } |
|
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
239 | |
| 15231 | 240 | static gboolean |
| 15884 | 241 | plugin_load(PurplePlugin *plugin) |
| 15231 | 242 | { |
| 243 | attach_to_all_windows(); | |
| 244 | ||
|
24604
6d8cec169c3f
Use a more appropriate signal for the markerline plugin. Fixes #7518.
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22809
diff
changeset
|
245 | purple_signal_connect(pidgin_conversations_get_handle(), "conversation-displayed", |
| 15884 | 246 | plugin, PURPLE_CALLBACK(conv_created), NULL); |
| 15231 | 247 | |
|
22809
c2b010c50376
Add a 'Jump to markerline' option in the conversation window menu to
Sadrul Habib Chowdhury <sadrul@pidgin.im>
parents:
22104
diff
changeset
|
248 | 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
|
249 | plugin, PURPLE_CALLBACK(conv_menu_cb), NULL); |
| 15231 | 250 | return TRUE; |
| 251 | } | |
| 252 | ||
| 253 | static gboolean | |
| 15884 | 254 | plugin_unload(PurplePlugin *plugin) |
| 15231 | 255 | { |
| 256 | detach_from_all_windows(); | |
| 257 | ||
| 258 | return TRUE; | |
| 259 | } | |
| 260 | ||
| 15884 | 261 | static PurplePluginPrefFrame * |
| 262 | get_plugin_pref_frame(PurplePlugin *plugin) | |
| 15231 | 263 | { |
| 15884 | 264 | PurplePluginPrefFrame *frame; |
| 265 | PurplePluginPref *pref; | |
| 15231 | 266 | |
| 15884 | 267 | frame = purple_plugin_pref_frame_new(); |
| 15231 | 268 | |
| 15884 | 269 | pref = purple_plugin_pref_new_with_label(_("Draw Markerline in ")); |
| 270 | purple_plugin_pref_frame_add(frame, pref); | |
| 15231 | 271 | |
| 15884 | 272 | pref = purple_plugin_pref_new_with_name_and_label(PREF_IMS, |
| 15231 | 273 | _("_IM windows")); |
| 15884 | 274 | purple_plugin_pref_frame_add(frame, pref); |
| 15231 | 275 | |
| 15884 | 276 | pref = purple_plugin_pref_new_with_name_and_label(PREF_CHATS, |
| 15231 | 277 | _("C_hat windows")); |
| 15884 | 278 | purple_plugin_pref_frame_add(frame, pref); |
| 15231 | 279 | |
| 280 | return frame; | |
| 281 | } | |
| 282 | ||
| 15884 | 283 | static PurplePluginUiInfo prefs_info = { |
| 15231 | 284 | get_plugin_pref_frame, |
| 285 | 0, | |
| 286 | 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
|
287 | |
|
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
|
288 | /* 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
|
289 | 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
|
290 | 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
|
291 | 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
|
292 | NULL |
| 15231 | 293 | }; |
| 294 | ||
| 15884 | 295 | static PurplePluginInfo info = { |
| 296 | PURPLE_PLUGIN_MAGIC, /* Magic */ | |
| 297 | PURPLE_MAJOR_VERSION, /* Purple Major Version */ | |
| 298 | PURPLE_MINOR_VERSION, /* Purple Minor Version */ | |
| 299 | PURPLE_PLUGIN_STANDARD, /* plugin type */ | |
|
15562
8c8249fe5e3c
gaim_gtk to pidgin. I hope
Sean Egan <seanegan@pidgin.im>
parents:
15435
diff
changeset
|
300 | PIDGIN_PLUGIN_TYPE, /* ui requirement */ |
| 15231 | 301 | 0, /* flags */ |
| 302 | NULL, /* dependencies */ | |
| 15884 | 303 | PURPLE_PRIORITY_DEFAULT, /* priority */ |
| 15231 | 304 | |
| 305 | PLUGIN_ID, /* plugin id */ | |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
306 | PLUGIN_NAME, /* name */ |
|
20288
5ca925a094e2
applied changes from 03b709ec2a153e7e82719df0ba4635108bb1d3c6
John Bailey <rekkanoryo@rekkanoryo.org>
parents:
19859
diff
changeset
|
307 | DISPLAY_VERSION, /* version */ |
|
15418
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
308 | PLUGIN_SUMMARY, /* summary */ |
|
bf287f742a5a
[gaim-migrate @ 18149]
Luke Schierer <lschiere@pidgin.im>
parents:
15231
diff
changeset
|
309 | PLUGIN_DESCRIPTION, /* description */ |
| 15231 | 310 | PLUGIN_AUTHOR, /* author */ |
| 15884 | 311 | PURPLE_WEBSITE, /* website */ |
| 15231 | 312 | |
| 313 | plugin_load, /* load */ | |
| 314 | plugin_unload, /* unload */ | |
| 315 | NULL, /* destroy */ | |
| 316 | ||
| 317 | NULL, /* ui_info */ | |
| 318 | NULL, /* extra_info */ | |
| 319 | &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
|
320 | 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
|
321 | |
|
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
|
322 | /* 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
|
323 | 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
|
324 | 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
|
325 | 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
|
326 | NULL |
| 15231 | 327 | }; |
| 328 | ||
| 329 | static void | |
| 15884 | 330 | init_plugin(PurplePlugin *plugin) |
| 15231 | 331 | { |
| 15884 | 332 | purple_prefs_add_none(PREF_PREFIX); |
| 333 | purple_prefs_add_bool(PREF_IMS, FALSE); | |
| 334 | purple_prefs_add_bool(PREF_CHATS, TRUE); | |
| 15231 | 335 | } |
| 336 | ||
| 15884 | 337 | PURPLE_INIT_PLUGIN(PLUGIN_STATIC_NAME, init_plugin, info) |