Mercurial > pidgin
comparison plugins/notify.c @ 9298:b0b544e0f246
[gaim-migrate @ 10101]
da update i thought i commited earlier and
(22:16:23) deryni: LSchiere: http://deryni.perlmonk.org/notify.diff I've
looked at that code too much right now. So you can commit it (I've been
using it since I last changed it and it hasn't crashed on me yet.) Have
people bang on it, I'll be around through the end of the week to work on it
before string freeze (and after since I shouldn't need to change strings.)
committer: Tailor Script <tailor@pidgin.im>
author | Luke Schierer <lschiere@pidgin.im> |
---|---|
date | Wed, 16 Jun 2004 02:21:34 +0000 |
parents | 8f838ae3e710 |
children | fe931c791fc0 |
comparison
equal
deleted
inserted
replaced
9297:391a6533296a | 9298:b0b544e0f246 |
---|---|
49 * -Better pref change handling | 49 * -Better pref change handling |
50 * -Fixed a possible memleak and possible crash (rare) | 50 * -Fixed a possible memleak and possible crash (rare) |
51 * -Use gtk_window_get_title() rather than gtkwin->title | 51 * -Use gtk_window_get_title() rather than gtkwin->title |
52 * -Other random fixes and cleanups | 52 * -Other random fixes and cleanups |
53 * | 53 * |
54 * Etan again, 12 August 2003: | 54 * Etan again, 12 August 2003: |
55 * -Better use of the new xml prefs | 55 * -Better use of the new xml prefs |
56 * -Removed all bitmask stuff | 56 * -Removed all bitmask stuff |
57 * -Even better pref change handling | 57 * -Even better pref change handling |
58 * -Removed unnecessary functions | 58 * -Removed unnecessary functions |
59 * -Reworking of notification/unnotification stuff | 59 * -Reworking of notification/unnotification stuff |
60 * -Header file include cleanup | 60 * -Header file include cleanup |
61 * -General code cleanup | 61 * -General code cleanup |
62 * | |
63 * Etan yet again, 04 April 2004: | |
64 * -Re-added Urgent option | |
65 * -Re-added unnotify on focus option (still needs work, as it will only | |
66 * react to focus-in events when the entry or history widgets are focused) | |
62 */ | 67 */ |
63 | 68 |
64 #include "gtkinternal.h" | 69 #include "gtkinternal.h" |
65 | 70 |
66 #include "conversation.h" | |
67 #include "debug.h" | 71 #include "debug.h" |
68 #include "prefs.h" | 72 #include "prefs.h" |
69 #include "signals.h" | 73 #include "signals.h" |
70 | 74 |
71 #include "gtkconv.h" | |
72 #include "gtkplugin.h" | 75 #include "gtkplugin.h" |
73 #include "gtkutils.h" | 76 #include "gtkutils.h" |
74 | 77 |
75 #include <X11/Xatom.h> | 78 #include <X11/Xatom.h> |
76 #include <X11/Xlib.h> | 79 #include <X11/Xlib.h> |
80 | 83 |
81 static GaimPlugin *my_plugin = NULL; | 84 static GaimPlugin *my_plugin = NULL; |
82 | 85 |
83 /* notification set/unset */ | 86 /* notification set/unset */ |
84 static int notify(GaimConversation *conv, gboolean increment); | 87 static int notify(GaimConversation *conv, gboolean increment); |
85 static gboolean unnotify(GaimConversation *conv, gboolean reset); | 88 static void notify_win(GaimConvWindow *gaimwin); |
86 static int unnotify_cb(GtkWidget *widget, GaimConversation *conv); | 89 static void unnotify(GaimConversation *conv, gboolean reset); |
87 static void renotify(GaimConvWindow *gaimwin); | 90 static int unnotify_cb(GtkWidget *widget, gpointer data, GaimConversation *conv); |
88 | 91 |
89 /* gtk widget callbacks for prefs panel */ | 92 /* gtk widget callbacks for prefs panel */ |
90 static void type_toggle_cb(GtkWidget *widget, gpointer data); | 93 static void type_toggle_cb(GtkWidget *widget, gpointer data); |
91 static void method_toggle_cb(GtkWidget *widget, gpointer data); | 94 static void method_toggle_cb(GtkWidget *widget, gpointer data); |
92 static void notify_toggle_cb(GtkWidget *widget, gpointer data); | 95 static void notify_toggle_cb(GtkWidget *widget, gpointer data); |
93 static gboolean options_entry_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data); | 96 static gboolean options_entry_cb(GtkWidget *widget, GdkEventFocus *event, gpointer data); |
94 static void apply_method(); | 97 static void apply_method(); |
95 static void apply_notify(); | 98 static void apply_notify(); |
96 | 99 |
97 /* string function */ | 100 /* string function */ |
98 static void handle_string(GtkWidget *widget); | 101 static void handle_string(GaimConvWindow *window); |
99 | 102 |
100 /* count function */ | 103 /* count function */ |
101 static void handle_count(GtkWidget *widget); | 104 static void handle_count(GaimConvWindow *window); |
102 | 105 |
103 /* urgent function */ | 106 /* urgent function */ |
104 static void handle_urgent(GtkWidget *widget, gboolean add); | 107 static void handle_urgent(GaimConvWindow *window, gboolean add); |
105 | 108 |
106 /****************************************/ | 109 /****************************************/ |
107 /* Begin doing stuff below this line... */ | 110 /* Begin doing stuff below this line... */ |
108 /****************************************/ | 111 /****************************************/ |
112 static int | |
113 count_messages(GaimConvWindow *gaimwin) | |
114 { | |
115 gint count = 0; | |
116 GList *convs = NULL; | |
117 | |
118 for (convs = gaim_conv_window_get_conversations(gaimwin); | |
119 convs != NULL; convs = convs->next) { | |
120 GaimConversation *conv = convs->data; | |
121 count += GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); | |
122 } | |
123 | |
124 return count; | |
125 } | |
109 | 126 |
110 static int | 127 static int |
111 notify(GaimConversation *conv, gboolean increment) | 128 notify(GaimConversation *conv, gboolean increment) |
112 { | 129 { |
113 GaimConvWindow *gaimwin = NULL; | 130 GaimConvWindow *gaimwin = NULL; |
114 GaimGtkWindow *gtkwin = NULL; | |
115 /* | |
116 Window focus_return; | |
117 */ | |
118 gint count; | 131 gint count; |
119 gboolean has_focus; | 132 gboolean has_focus; |
120 | 133 |
121 if (conv == NULL) | 134 if (conv == NULL) |
122 return 0; | 135 return 0; |
123 | 136 |
124 /* We want to remove the notifications, but not reset the counter */ | 137 /* We want to remove the notifications, but not reset the counter */ |
125 unnotify(conv, FALSE); | 138 unnotify(conv, FALSE); |
126 | 139 |
127 gaimwin = gaim_conversation_get_window(conv); | 140 gaimwin = gaim_conversation_get_window(conv); |
128 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
129 | 141 |
130 /* If we aren't doing notifications for this type of conversation, return */ | 142 /* If we aren't doing notifications for this type of conversation, return */ |
131 if (((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && | 143 if (((gaim_conversation_get_type(conv) == GAIM_CONV_IM) && |
132 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) || | 144 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")) || |
133 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && | 145 ((gaim_conversation_get_type(conv) == GAIM_CONV_CHAT) && |
134 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) | 146 !gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat"))) |
135 return 0; | 147 return 0; |
136 | 148 |
137 g_object_get(G_OBJECT(gtkwin->window), "has-toplevel-focus", &has_focus, NULL); | 149 g_object_get(G_OBJECT(GAIM_GTK_WINDOW(gaimwin)->window), |
138 | 150 "has-toplevel-focus", &has_focus, NULL); |
139 /* TODO need to test these different levels of having focus | 151 |
140 * only still need to test the window has focus, but tab doesn't one */ | |
141 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || | 152 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || |
142 (has_focus && gaim_conv_window_get_active_conversation(gaimwin) != conv) || | 153 (has_focus && gaim_conv_window_get_active_conversation(gaimwin) != conv) || |
143 !has_focus) { | 154 !has_focus) { |
144 if (increment) { | 155 if (increment) { |
145 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count")); | |
146 count++; | |
147 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(count)); | |
148 | |
149 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); | 156 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); |
150 count++; | 157 count++; |
151 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); | 158 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); |
152 } | 159 } |
153 | 160 |
154 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) | 161 notify_win(gaimwin); |
155 handle_count(gtkwin->window); | |
156 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")) | |
157 handle_string(gtkwin->window); | |
158 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) | |
159 handle_urgent(gtkwin->window, TRUE); | |
160 } | 162 } |
161 | 163 |
162 return 0; | 164 return 0; |
163 } | 165 } |
164 | 166 |
165 static gboolean | 167 static void |
168 notify_win(GaimConvWindow *gaimwin) | |
169 { | |
170 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) | |
171 handle_count(gaimwin); | |
172 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")) | |
173 handle_string(gaimwin); | |
174 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) | |
175 handle_urgent(gaimwin, TRUE); | |
176 } | |
177 | |
178 static void | |
166 unnotify(GaimConversation *conv, gboolean reset) | 179 unnotify(GaimConversation *conv, gboolean reset) |
167 { | 180 { |
168 GaimConversation *active_conv = NULL; | 181 GaimConversation *active_conv = NULL; |
169 GaimGtkWindow *gtkwin = NULL; | |
170 GaimConvWindow *gaimwin = NULL; | 182 GaimConvWindow *gaimwin = NULL; |
171 gint count; | 183 |
172 | 184 g_return_if_fail(conv != NULL); |
173 if (conv == NULL) | |
174 return FALSE; | |
175 | 185 |
176 gaimwin = gaim_conversation_get_window(conv); | 186 gaimwin = gaim_conversation_get_window(conv); |
177 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
178 active_conv = gaim_conv_window_get_active_conversation(gaimwin); | 187 active_conv = gaim_conv_window_get_active_conversation(gaimwin); |
179 | |
180 /* This should mean that there is no notification on the window */ | |
181 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); | |
182 if (count == 0) | |
183 return FALSE; | |
184 | 188 |
185 /* reset the conversation window title */ | 189 /* reset the conversation window title */ |
186 gaim_conversation_autoset_title(active_conv); | 190 gaim_conversation_autoset_title(active_conv); |
187 | 191 |
188 if (reset) { | 192 if (reset) { |
189 int count2; | 193 /* Only need to actually remove the urgent hinting here, since removing it |
190 /* There is no point in removing the urgent wm_hint if we are just going | 194 * just to have it readded in re-notify is an unnecessary couple extra RTs |
191 * to add it back again in a second */ | 195 * to the server */ |
192 handle_urgent(gtkwin->window, FALSE); | 196 handle_urgent(gaimwin, FALSE); |
193 count2 = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count")); | |
194 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(count2-count)); | |
195 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); | 197 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); |
196 } | 198 } |
197 | 199 |
198 renotify(gaimwin); | 200 return; |
199 | |
200 return TRUE; | |
201 } | 201 } |
202 | 202 |
203 static int | 203 static int |
204 unnotify_cb(GtkWidget *widget, GaimConversation *conv) | 204 unnotify_cb(GtkWidget *widget, gpointer data, GaimConversation *conv) |
205 { | 205 { |
206 GaimConversation *c = g_object_get_data(G_OBJECT(widget), "notify-conversation"); | 206 if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0) |
207 | 207 unnotify(conv, TRUE); |
208 unnotify(c, TRUE); | |
209 | 208 |
210 return 0; | 209 return 0; |
211 } | 210 } |
212 | 211 |
213 static void | |
214 renotify(GaimConvWindow *gaimwin) | |
215 { | |
216 GList *convs = NULL; | |
217 | |
218 | |
219 for (convs = gaim_conv_window_get_conversations(gaimwin); | |
220 convs != NULL; convs = convs->next) { | |
221 GaimGtkWindow *gtkwin = NULL; | |
222 int count; | |
223 | |
224 gtkwin = GAIM_GTK_WINDOW(gaimwin); | |
225 count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message_count")); | |
226 if (count != 0) { | |
227 notify((GaimConversation *)convs->data, FALSE); | |
228 return; | |
229 } | |
230 } | |
231 } | |
232 | |
233 static gboolean | 212 static gboolean |
234 chat_recv_im(GaimAccount *account, char *who, char *text, int id, void *m) | 213 im_recv_im(GaimAccount *account, char *sender, char *message, |
235 { | 214 int *flags) |
236 GaimConversation *conv = gaim_find_chat(gaim_account_get_connection(account), | 215 { |
237 id); | 216 GaimConversation *conv = gaim_find_conversation_with_account(sender, account); |
238 | 217 |
239 notify(conv, TRUE); | 218 notify(conv, TRUE); |
240 | 219 |
241 return FALSE; | 220 return FALSE; |
242 } | 221 } |
243 | 222 |
244 static void | 223 static gboolean |
245 chat_sent_im(GaimAccount *account, char *text, int id, void *m) | 224 chat_recv_im(GaimAccount *account, char *sender, char *message, |
225 GaimConversation *conv) | |
226 { | |
227 notify(conv, TRUE); | |
228 | |
229 return FALSE; | |
230 } | |
231 | |
232 static void | |
233 im_sent_im(GaimAccount *account, char *receiver, const char *message) { | |
234 GaimConversation *conv = NULL; | |
235 | |
236 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { | |
237 conv = gaim_find_conversation_with_account(receiver, account); | |
238 unnotify(conv, TRUE); | |
239 } | |
240 } | |
241 | |
242 static void | |
243 chat_sent_im(GaimAccount *account, const char *message, int id) | |
246 { | 244 { |
247 GaimConversation *conv = NULL; | 245 GaimConversation *conv = NULL; |
248 | 246 |
249 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { | 247 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { |
250 conv = gaim_find_chat(gaim_account_get_connection(account), id); | 248 conv = gaim_find_chat(gaim_account_get_connection(account), id); |
251 unnotify(conv, TRUE); | 249 unnotify(conv, TRUE); |
252 } | 250 } |
253 } | 251 } |
254 | 252 |
255 static gboolean | |
256 im_recv_im(GaimAccount *account, char *who, char *what, int flags, void *m) | |
257 { | |
258 GaimConversation *conv = gaim_find_conversation_with_account(who, account); | |
259 | |
260 notify(conv, TRUE); | |
261 | |
262 return FALSE; | |
263 } | |
264 | |
265 static void | |
266 im_sent_im(GaimAccount *account, char *who, void *m) { | |
267 GaimConversation *conv = NULL; | |
268 | |
269 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")) { | |
270 conv = gaim_find_conversation_with_account(who, account); | |
271 unnotify(conv, TRUE); | |
272 } | |
273 } | |
274 | |
275 static int | 253 static int |
276 attach_signals(GaimConversation *conv) | 254 attach_signals(GaimConversation *conv) |
277 { | 255 { |
278 /* TODO I can't seem to get passing a GaimConversation to a callback to work | |
279 * correctly, so in the interest of not g_object_set_data'ing on multiple | |
280 * widgets, I'm going to just _set_data on ->entry and _connect_swapped the | |
281 * other signals, if I ever get passing the GaimConversation to work I'll | |
282 * stop this ugliness */ | |
283 GaimGtkConversation *gtkconv = NULL; | 256 GaimGtkConversation *gtkconv = NULL; |
284 GaimGtkWindow *gtkwin = NULL; | 257 GaimGtkWindow *gtkwin = NULL; |
285 GSList *window_ids = NULL, *imhtml_ids = NULL, *entry_ids = NULL; | 258 GSList *window_ids = NULL, *imhtml_ids = NULL, *entry_ids = NULL; |
286 guint id; | 259 guint id; |
287 | 260 |
288 gtkconv = GAIM_GTK_CONVERSATION(conv); | 261 gtkconv = GAIM_GTK_CONVERSATION(conv); |
289 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); | 262 gtkwin = GAIM_GTK_WINDOW(gaim_conversation_get_window(conv)); |
290 | 263 |
291 /* | |
292 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { | 264 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")) { |
293 id = g_signal_connect(G_OBJECT(gtkwin->window), "focus-in-event", G_CALLBACK(unnotify_cb), conv); | 265 GtkWidget *child = NULL; |
266 gint page_num; | |
267 | |
268 page_num = gaim_conversation_get_index(conv); | |
269 child = gtk_notebook_get_nth_page(GTK_NOTEBOOK(gtkwin->notebook), page_num); | |
270 | |
271 /* TODO should really find a way to make this work no matter where the | |
272 * focus is inside the conv window, without having to bind to | |
273 * focus-in-event on the g(d|t)kwindow */ | |
274 /* try setting the signal on the focus-in-event for | |
275 * gtkwin->notebook->container? */ | |
276 id = g_signal_connect(G_OBJECT(gtkconv->entry), "focus-in-event", | |
277 G_CALLBACK(unnotify_cb), conv); | |
294 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); | 278 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); |
295 } | 279 |
296 */ | 280 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "focus-in-event", |
281 G_CALLBACK(unnotify_cb), conv); | |
282 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); | |
283 } | |
297 | 284 |
298 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { | 285 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")) { |
299 /* TODO I think this might crash when convs dragged in/out of windows. | 286 /* TODO similarly should really find a way to allow for clicking in other |
300 * needs testing | 287 * places of the window */ |
301 id = g_signal_connect(G_OBJECT(gtkwin->window), "button-press-event", G_CALLBACK(unnotify_cb), conv); | 288 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event", |
302 window_ids = g_slist_append(window_ids, GUINT_TO_POINTER(id)); | 289 G_CALLBACK(unnotify_cb), conv); |
303 */ | |
304 | |
305 /* | |
306 id = g_signal_connect(G_OBJECT(gtkconv->imhtml), "button-press-event", G_CALLBACK(unnotify_cb), conv); | |
307 */ | |
308 id = g_signal_connect_swapped(G_OBJECT(gtkconv->imhtml), "button-press-event", G_CALLBACK(unnotify_cb), G_OBJECT(gtkconv->entry)); | |
309 imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); | 290 imhtml_ids = g_slist_append(imhtml_ids, GUINT_TO_POINTER(id)); |
310 | 291 |
311 id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", G_CALLBACK(unnotify_cb), conv); | 292 id = g_signal_connect(G_OBJECT(gtkconv->entry), "button-press-event", |
293 G_CALLBACK(unnotify_cb), conv); | |
312 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); | 294 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
313 } | 295 } |
314 | 296 |
315 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { | 297 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")) { |
316 id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", G_CALLBACK(unnotify_cb), conv); | 298 id = g_signal_connect(G_OBJECT(gtkconv->entry), "key-press-event", |
299 G_CALLBACK(unnotify_cb), conv); | |
317 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); | 300 entry_ids = g_slist_append(entry_ids, GUINT_TO_POINTER(id)); |
318 } | 301 } |
319 | |
320 g_object_set_data(G_OBJECT(gtkconv->entry), "notify-conversation", conv); | |
321 | 302 |
322 gaim_conversation_set_data(conv, "notify-window-signals", window_ids); | 303 gaim_conversation_set_data(conv, "notify-window-signals", window_ids); |
323 gaim_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids); | 304 gaim_conversation_set_data(conv, "notify-imhtml-signals", imhtml_ids); |
324 gaim_conversation_set_data(conv, "notify-entry-signals", entry_ids); | 305 gaim_conversation_set_data(conv, "notify-entry-signals", entry_ids); |
325 | 306 |
346 | 327 |
347 ids = gaim_conversation_get_data(conv, "notify-entry-signals"); | 328 ids = gaim_conversation_get_data(conv, "notify-entry-signals"); |
348 for (; ids != NULL; ids = ids->next) | 329 for (; ids != NULL; ids = ids->next) |
349 g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(ids->data)); | 330 g_signal_handler_disconnect(gtkconv->entry, GPOINTER_TO_INT(ids->data)); |
350 | 331 |
351 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message_count", GINT_TO_POINTER(0)); | 332 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); |
352 | 333 |
353 gaim_conversation_set_data(conv, "notify-window-signals", NULL); | 334 gaim_conversation_set_data(conv, "notify-window-signals", NULL); |
354 gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL); | 335 gaim_conversation_set_data(conv, "notify-imhtml-signals", NULL); |
355 gaim_conversation_set_data(conv, "notify-entry-signals", NULL); | 336 gaim_conversation_set_data(conv, "notify-entry-signals", NULL); |
356 } | 337 } |
366 if (gaimwin == NULL) | 347 if (gaimwin == NULL) |
367 return; | 348 return; |
368 | 349 |
369 gtkwin = GAIM_GTK_WINDOW(gaimwin); | 350 gtkwin = GAIM_GTK_WINDOW(gaimwin); |
370 | 351 |
371 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(0)); | 352 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(0)); |
372 | 353 |
373 /* always attach the signals, notify() will take care of conversation type | 354 /* always attach the signals, notify() will take care of conversation type |
374 * checking */ | 355 * checking */ |
375 attach_signals(conv); | 356 attach_signals(conv); |
376 } | 357 } |
377 | 358 |
378 static void | 359 static void |
379 chat_join(GaimConversation *conv) | 360 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv) |
361 { | |
362 GaimConvWindow *gaimwin = gaim_conversation_get_window(new_conv); | |
363 | |
364 printf("conv_switched - %p - %p\n", old_conv, new_conv); | |
365 printf("count - %d\n", count_messages(gaimwin)); | |
366 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) | |
367 unnotify(new_conv, FALSE); | |
368 else { | |
369 /* if we don't have notification on the window then we don't want to | |
370 * re-notify it */ | |
371 if (count_messages(gaimwin)) | |
372 notify_win(gaimwin); | |
373 } | |
374 } | |
375 | |
376 static void | |
377 deleting_conv(GaimConversation *conv) | |
380 { | 378 { |
381 GaimConvWindow *gaimwin = NULL; | 379 GaimConvWindow *gaimwin = NULL; |
382 GaimGtkWindow *gtkwin = NULL; | 380 |
381 detach_signals(conv); | |
382 | |
383 unnotify(conv, TRUE); | |
383 | 384 |
384 gaimwin = gaim_conversation_get_window(conv); | 385 gaimwin = gaim_conversation_get_window(conv); |
385 | 386 if (count_messages(gaimwin)) |
386 if (gaimwin == NULL) | 387 notify_win(gaimwin); |
387 return; | 388 } |
388 | 389 |
389 gtkwin = GAIM_GTK_WINDOW(gaimwin); | 390 static void |
390 | 391 conversation_drag_ended(GaimConversation *active_conv, |
391 g_object_set_data(G_OBJECT(gtkwin->window), "notify-message-count", GINT_TO_POINTER(0)); | 392 GaimConvWindow *old_gaimwin, |
392 | 393 GaimConvWindow *new_gaimwin) |
393 /* always attach the signals, notify() will take care of conversation type | 394 { |
394 * checking */ | 395 if (old_gaimwin != new_gaimwin) { |
395 attach_signals(conv); | 396 if (old_gaimwin == NULL) { |
396 } | 397 /* |
397 | 398 gaim_conversation_autoset_title(active_conv); |
398 #if 0 | 399 handle_urgent(new_gaimwin, FALSE); |
399 static void | 400 */ |
400 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv) | 401 |
401 { | 402 if (count_messages(new_gaimwin)) |
402 GaimConvWindow *gaimwin = NULL; | 403 notify_win(new_gaimwin); |
403 GaimGtkWindow *gtkwin = NULL; | 404 } else { |
404 /* | 405 printf("if else count = %d\n", count_messages(new_gaimwin)); |
405 gint count; | 406 printf("if else count = %d\n", count_messages(old_gaimwin)); |
406 */ | 407 /* |
407 gaim_debug(GAIM_DEBUG_INFO, "notify", "conv_switch\n"); | 408 GaimConversation *old_active_conv = NULL; |
408 | 409 old_active_conv = gaim_conv_window_get_active_conversation(new_gaimwin); |
409 if (!gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) { | 410 |
410 gaimwin = gaim_conversation_get_window(new_conv); | 411 gaim_conversation_autoset_title(old_active_conv); |
411 | 412 handle_urgent(old_gaimwin, FALSE); |
412 if (gaimwin == NULL); | 413 |
413 | 414 if (count_messages(old_gaimwin)) |
414 gtkwin = GAIM_GTK_WINDOW(gaimwin); | 415 notify_win(old_gaimwin); |
415 | 416 |
416 /* if we don't have notification on the window then we don't want to add | 417 gaim_conversation_autoset_title(active_conv); |
417 * it back */ | 418 handle_urgent(new_gaimwin, FALSE); |
418 if (GPOINTER_TO_INT(g_object_get_data(G_OBJECT(gtkwin->window), "notify-message-count")) != 0) | 419 |
419 notify(new_conv, FALSE); | 420 if (count_messages(new_gaimwin)) |
420 } else | 421 notify_win(new_gaimwin); |
421 unnotify(new_conv, TRUE); | 422 */ |
422 } | 423 } |
423 #endif | 424 } else { |
424 | 425 printf("else count = %d\n", count_messages(new_gaimwin)); |
425 static void | 426 printf("else count = %d\n", count_messages(old_gaimwin)); |
426 deleting_conv(GaimConversation *conv) | 427 /* |
427 { | 428 gaim_conversation_autoset_title(active_conv); |
428 detach_signals(conv); | 429 handle_urgent(old_gaimwin, FALSE); |
429 } | 430 |
430 | 431 if (count_messages(old_gaimwin)) |
431 static void | 432 notify_win(old_gaimwin); |
432 handle_string(GtkWidget *widget) | 433 */ |
433 { | 434 } |
434 GtkWindow *win = GTK_WINDOW(widget); | 435 } |
436 | |
437 static void | |
438 handle_string(GaimConvWindow *gaimwin) | |
439 { | |
440 GtkWindow *window = NULL; | |
435 gchar newtitle[256]; | 441 gchar newtitle[256]; |
436 | 442 |
443 g_return_if_fail(gaimwin != NULL); | |
444 | |
445 window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); | |
446 g_return_if_fail(window != NULL); | |
447 | |
437 g_snprintf(newtitle, sizeof(newtitle), "%s%s", | 448 g_snprintf(newtitle, sizeof(newtitle), "%s%s", |
438 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"), | 449 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string"), |
439 gtk_window_get_title(win)); | 450 gtk_window_get_title(window)); |
440 gtk_window_set_title(win, newtitle); | 451 gtk_window_set_title(window, newtitle); |
441 } | 452 } |
442 | 453 |
443 static void | 454 static void |
444 handle_count(GtkWidget *widget) | 455 handle_count(GaimConvWindow *gaimwin) |
445 { | 456 { |
446 GtkWindow *win = GTK_WINDOW(widget); | 457 GtkWindow *window; |
447 char newtitle[256]; | 458 char newtitle[256]; |
448 gint count = GPOINTER_TO_INT(g_object_get_data(G_OBJECT(win), "notify-message-count")); | 459 |
449 | 460 g_return_if_fail(gaimwin != NULL); |
450 g_snprintf(newtitle, sizeof(newtitle), "[%d]%s", count, | 461 |
451 gtk_window_get_title(win)); | 462 window = GTK_WINDOW(GAIM_GTK_WINDOW(gaimwin)->window); |
452 gtk_window_set_title(win, newtitle); | 463 g_return_if_fail(window != NULL); |
453 } | 464 |
454 | 465 g_snprintf(newtitle, sizeof(newtitle), "[%d] %s", count_messages(gaimwin), |
455 static void | 466 gtk_window_get_title(window)); |
456 handle_urgent(GtkWidget *widget, gboolean add) | 467 gtk_window_set_title(window, newtitle); |
468 } | |
469 | |
470 static void | |
471 handle_urgent(GaimConvWindow *gaimwin, gboolean add) | |
457 { | 472 { |
458 XWMHints *hints; | 473 XWMHints *hints; |
459 | 474 GaimGtkWindow *gtkwin = GAIM_GTK_WINDOW(gaimwin); |
460 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(widget->window), GDK_WINDOW_XWINDOW(widget->window)); | 475 |
476 g_return_if_fail(gtkwin != NULL); | |
477 g_return_if_fail(gtkwin->window != NULL); | |
478 g_return_if_fail(gtkwin->window->window != NULL); | |
479 | |
480 hints = XGetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), GDK_WINDOW_XWINDOW(gtkwin->window->window)); | |
461 if (add) | 481 if (add) |
462 hints->flags |= XUrgencyHint; | 482 hints->flags |= XUrgencyHint; |
463 else | 483 else |
464 hints->flags &= ~XUrgencyHint; | 484 hints->flags &= ~XUrgencyHint; |
465 XSetWMHints(GDK_WINDOW_XDISPLAY(widget->window), GDK_WINDOW_XWINDOW(widget->window), hints); | 485 XSetWMHints(GDK_WINDOW_XDISPLAY(gtkwin->window->window), |
486 GDK_WINDOW_XWINDOW(gtkwin->window->window), hints); | |
466 XFree(hints); | 487 XFree(hints); |
467 } | 488 } |
468 | 489 |
469 static void | 490 static void |
470 type_toggle_cb(GtkWidget *widget, gpointer data) | 491 type_toggle_cb(GtkWidget *widget, gpointer data) |
526 } | 547 } |
527 | 548 |
528 static void | 549 static void |
529 apply_method() { | 550 apply_method() { |
530 GList *convs = gaim_get_conversations(); | 551 GList *convs = gaim_get_conversations(); |
531 | 552 GaimConvWindow *gaimwin = NULL; |
532 while (convs) { | 553 |
554 for (convs = gaim_get_conversations(); convs != NULL; convs = convs->next) { | |
533 GaimConversation *conv = (GaimConversation *)convs->data; | 555 GaimConversation *conv = (GaimConversation *)convs->data; |
534 | 556 |
535 /* remove notifications */ | 557 /* remove notifications */ |
536 if (unnotify(conv, FALSE)) | 558 unnotify(conv, FALSE); |
559 | |
560 gaimwin = gaim_conversation_get_window(conv); | |
561 if (GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")) != 0) | |
537 /* reattach appropriate notifications */ | 562 /* reattach appropriate notifications */ |
538 notify(conv, FALSE); | 563 notify(conv, FALSE); |
539 | |
540 convs = convs->next; | |
541 } | 564 } |
542 } | 565 } |
543 | 566 |
544 static void | 567 static void |
545 apply_notify() | 568 apply_notify() |
574 gtk_container_add(GTK_CONTAINER(frame), vbox); | 597 gtk_container_add(GTK_CONTAINER(frame), vbox); |
575 | 598 |
576 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); | 599 toggle = gtk_check_button_new_with_mnemonic(_("_IM windows")); |
577 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 600 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
578 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 601 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
579 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); | 602 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_im")); |
580 g_signal_connect(G_OBJECT(toggle), "toggled", | 603 g_signal_connect(G_OBJECT(toggle), "toggled", |
581 G_CALLBACK(type_toggle_cb), "type_im"); | 604 G_CALLBACK(type_toggle_cb), "type_im"); |
582 | 605 |
583 toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); | 606 toggle = gtk_check_button_new_with_mnemonic(_("C_hat windows")); |
584 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 607 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
585 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 608 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
586 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); | 609 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_chat")); |
587 g_signal_connect(G_OBJECT(toggle), "toggled", | 610 g_signal_connect(G_OBJECT(toggle), "toggled", |
588 G_CALLBACK(type_toggle_cb), "type_chat"); | 611 G_CALLBACK(type_toggle_cb), "type_chat"); |
589 | 612 |
590 toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); | 613 toggle = gtk_check_button_new_with_mnemonic(_("_Focused windows")); |
591 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 614 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
592 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 615 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
593 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); | 616 gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused")); |
594 g_signal_connect(G_OBJECT(toggle), "toggled", | 617 g_signal_connect(G_OBJECT(toggle), "toggled", |
595 G_CALLBACK(type_toggle_cb), "type_focused"); | 618 G_CALLBACK(type_toggle_cb), "type_focused"); |
596 | 619 |
597 /*---------- "Notification Methods" ----------*/ | 620 /*---------- "Notification Methods" ----------*/ |
598 frame = gaim_gtk_make_frame(ret, _("Notification Methods")); | 621 frame = gaim_gtk_make_frame(ret, _("Notification Methods")); |
599 vbox = gtk_vbox_new(FALSE, 5); | 622 vbox = gtk_vbox_new(FALSE, 5); |
600 gtk_container_add(GTK_CONTAINER(frame), vbox); | 623 gtk_container_add(GTK_CONTAINER(frame), vbox); |
602 /* String method button */ | 625 /* String method button */ |
603 hbox = gtk_hbox_new(FALSE, 18); | 626 hbox = gtk_hbox_new(FALSE, 18); |
604 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 627 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
605 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); | 628 toggle = gtk_check_button_new_with_mnemonic(_("Prepend _string into window title:")); |
606 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 629 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
607 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); | 630 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
608 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); | 631 gtk_box_pack_start(GTK_BOX(hbox), toggle, FALSE, FALSE, 0); |
609 | 632 |
610 entry = gtk_entry_new(); | 633 entry = gtk_entry_new(); |
611 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); | 634 gtk_box_pack_start(GTK_BOX(hbox), entry, FALSE, FALSE, 0); |
612 gtk_entry_set_max_length(GTK_ENTRY(entry), 10); | 635 gtk_entry_set_max_length(GTK_ENTRY(entry), 10); |
613 gtk_widget_set_sensitive(GTK_WIDGET(entry), | 636 gtk_widget_set_sensitive(GTK_WIDGET(entry), |
614 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); | 637 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")); |
615 gtk_entry_set_text(GTK_ENTRY(entry), | 638 gtk_entry_set_text(GTK_ENTRY(entry), |
616 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string")); | 639 gaim_prefs_get_string("/plugins/gtk/X11/notify/title_string")); |
617 g_object_set_data(G_OBJECT(toggle), "title-entry", entry); | 640 g_object_set_data(G_OBJECT(toggle), "title-entry", entry); |
618 g_signal_connect(G_OBJECT(toggle), "toggled", | 641 g_signal_connect(G_OBJECT(toggle), "toggled", |
619 G_CALLBACK(method_toggle_cb), "method_string"); | 642 G_CALLBACK(method_toggle_cb), "method_string"); |
620 g_signal_connect(G_OBJECT(entry), "focus-out-event", | 643 g_signal_connect(G_OBJECT(entry), "focus-out-event", |
621 G_CALLBACK(options_entry_cb), "method_string"); | 644 G_CALLBACK(options_entry_cb), "method_string"); |
622 | 645 |
623 /* Count method button */ | 646 /* Count method button */ |
624 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); | 647 toggle = gtk_check_button_new_with_mnemonic(_("Insert c_ount of new messages into window title")); |
625 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 648 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
626 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); | 649 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")); |
627 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 650 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
628 g_signal_connect(G_OBJECT(toggle), "toggled", | 651 g_signal_connect(G_OBJECT(toggle), "toggled", |
629 G_CALLBACK(method_toggle_cb), "method_count"); | 652 G_CALLBACK(method_toggle_cb), "method_count"); |
630 | 653 |
631 #if 0 | |
632 /* Urgent method button */ | 654 /* Urgent method button */ |
633 toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint")); | 655 toggle = gtk_check_button_new_with_mnemonic(_("Set window manager \"_URGENT\" hint")); |
634 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 656 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
635 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 657 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
636 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); | 658 gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")); |
637 #endif | 659 g_signal_connect(G_OBJECT(toggle), "toggled", |
660 G_CALLBACK(method_toggle_cb), "method_urgent"); | |
638 | 661 |
639 /*---------- "Notification Removals" ----------*/ | 662 /*---------- "Notification Removals" ----------*/ |
640 frame = gaim_gtk_make_frame(ret, _("Notification Removal")); | 663 frame = gaim_gtk_make_frame(ret, _("Notification Removal")); |
641 vbox = gtk_vbox_new(FALSE, 5); | 664 vbox = gtk_vbox_new(FALSE, 5); |
642 gtk_container_add(GTK_CONTAINER(frame), vbox); | 665 gtk_container_add(GTK_CONTAINER(frame), vbox); |
643 | 666 |
644 #if 0 | |
645 /* Remove on focus button */ | 667 /* Remove on focus button */ |
646 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); | 668 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _gains focus")); |
647 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 669 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
648 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 670 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
649 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); | 671 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_focus")); |
650 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); | 672 g_signal_connect(G_OBJECT(toggle), "toggled", G_CALLBACK(notify_toggle_cb), "notify_focus"); |
651 #endif | |
652 | 673 |
653 /* Remove on click button */ | 674 /* Remove on click button */ |
654 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); | 675 toggle = gtk_check_button_new_with_mnemonic(_("Remove when conversation window _receives click")); |
655 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 676 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
656 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 677 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
657 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); | 678 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_click")); |
658 g_signal_connect(G_OBJECT(toggle), "toggled", | 679 g_signal_connect(G_OBJECT(toggle), "toggled", |
659 G_CALLBACK(notify_toggle_cb), "notify_click"); | 680 G_CALLBACK(notify_toggle_cb), "notify_click"); |
660 | 681 |
661 /* Remove on type button */ | 682 /* Remove on type button */ |
662 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); | 683 toggle = gtk_check_button_new_with_mnemonic(_("Remove when _typing in conversation window")); |
663 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 684 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
664 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 685 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
665 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); | 686 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_type")); |
666 g_signal_connect(G_OBJECT(toggle), "toggled", | 687 g_signal_connect(G_OBJECT(toggle), "toggled", |
667 G_CALLBACK(notify_toggle_cb), "notify_type"); | 688 G_CALLBACK(notify_toggle_cb), "notify_type"); |
668 | 689 |
669 /* Remove on message send button */ | 690 /* Remove on message send button */ |
670 toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); | 691 toggle = gtk_check_button_new_with_mnemonic(_("Remove when a _message gets sent")); |
671 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 692 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
672 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 693 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
673 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); | 694 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_send")); |
674 g_signal_connect(G_OBJECT(toggle), "toggled", | 695 g_signal_connect(G_OBJECT(toggle), "toggled", |
675 G_CALLBACK(notify_toggle_cb), "notify_send"); | 696 G_CALLBACK(notify_toggle_cb), "notify_send"); |
676 | 697 |
677 #if 0 | 698 #if 0 |
678 /* Remove on conversation switch button */ | 699 /* Remove on conversation switch button */ |
679 toggle = gtk_check_button_new_with_mnemonic(_("Remove on conversation ta_b switch")); | 700 toggle = gtk_check_button_new_with_mnemonic(_("Remove on switch to conversation ta_b")); |
680 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); | 701 gtk_box_pack_start(GTK_BOX(vbox), toggle, FALSE, FALSE, 0); |
681 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), | 702 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(toggle), |
682 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); | 703 gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")); |
683 g_signal_connect(G_OBJECT(toggle), "toggled", | 704 g_signal_connect(G_OBJECT(toggle), "toggled", |
684 G_CALLBACK(notify_toggle_cb), "notify_switch"); | 705 G_CALLBACK(notify_toggle_cb), "notify_switch"); |
685 #endif | 706 #endif |
686 | 707 |
687 gtk_widget_show_all(ret); | 708 gtk_widget_show_all(ret); |
688 return ret; | 709 return ret; |
689 } | 710 } |
691 static gboolean | 712 static gboolean |
692 plugin_load(GaimPlugin *plugin) | 713 plugin_load(GaimPlugin *plugin) |
693 { | 714 { |
694 GList *convs = gaim_get_conversations(); | 715 GList *convs = gaim_get_conversations(); |
695 void *conv_handle = gaim_conversations_get_handle(); | 716 void *conv_handle = gaim_conversations_get_handle(); |
717 /* | |
718 void *gtk_conv_handle = gaim_gtk_conversations_get_handle(); | |
719 */ | |
696 | 720 |
697 my_plugin = plugin; | 721 my_plugin = plugin; |
698 | 722 |
699 gaim_signal_connect(conv_handle, "received-im-msg", plugin, | 723 gaim_signal_connect(conv_handle, "received-im-msg", plugin, |
700 GAIM_CALLBACK(im_recv_im), NULL); | 724 GAIM_CALLBACK(im_recv_im), NULL); |
701 gaim_signal_connect(conv_handle, "received-chat-msg", plugin, | 725 gaim_signal_connect(conv_handle, "received-chat-msg", plugin, |
702 GAIM_CALLBACK(chat_recv_im), NULL); | 726 GAIM_CALLBACK(chat_recv_im), NULL); |
703 gaim_signal_connect(conv_handle, "sent-im-msg", plugin, | 727 gaim_signal_connect(conv_handle, "sent-im-msg", plugin, |
704 GAIM_CALLBACK(im_sent_im), NULL); | 728 GAIM_CALLBACK(im_sent_im), NULL); |
705 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin, | 729 gaim_signal_connect(conv_handle, "sent-chat-msg", plugin, |
706 GAIM_CALLBACK(chat_sent_im), NULL); | 730 GAIM_CALLBACK(chat_sent_im), NULL); |
707 gaim_signal_connect(conv_handle, "conversation-created", plugin, | 731 gaim_signal_connect(conv_handle, "conversation-created", plugin, |
708 GAIM_CALLBACK(conv_created), NULL); | 732 GAIM_CALLBACK(conv_created), NULL); |
709 gaim_signal_connect(conv_handle, "chat-joined", plugin, | 733 gaim_signal_connect(conv_handle, "chat-joined", plugin, |
710 GAIM_CALLBACK(chat_join), NULL); | 734 GAIM_CALLBACK(conv_created), NULL); |
711 gaim_signal_connect(conv_handle, "deleting-conversation", plugin, | 735 gaim_signal_connect(conv_handle, "deleting-conversation", plugin, |
712 GAIM_CALLBACK(deleting_conv), NULL); | 736 GAIM_CALLBACK(deleting_conv), NULL); |
713 #if 0 | 737 /* |
714 gaim_signal_connect(conv_handle, "conversation-switched", plugin, | 738 gaim_signal_connect(conv_handle, "conversation-switched", plugin, |
715 GAIM_CALLBACK(conv_switched), NULL); | 739 GAIM_CALLBACK(conv_switched), NULL); |
716 #endif | 740 gaim_signal_connect(gtk_conv_handle, "conversation-drag-ended", plugin, |
741 GAIM_CALLBACK(conversation_drag_ended), NULL); | |
742 */ | |
717 | 743 |
718 while (convs) { | 744 while (convs) { |
719 GaimConversation *conv = (GaimConversation *)convs->data; | 745 GaimConversation *conv = (GaimConversation *)convs->data; |
720 | 746 |
721 /* attach signals */ | 747 /* attach signals */ |
763 VERSION, /**< version */ | 789 VERSION, /**< version */ |
764 /** summary */ | 790 /** summary */ |
765 N_("Provides a variety of ways of notifying you of unread messages."), | 791 N_("Provides a variety of ways of notifying you of unread messages."), |
766 /** description */ | 792 /** description */ |
767 N_("Provides a variety of ways of notifying you of unread messages."), | 793 N_("Provides a variety of ways of notifying you of unread messages."), |
768 "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu", | 794 "Etan Reisner <deryni@eden.rutgers.edu>\n\t\t\tBrian Tarricone <bjt23@cornell.edu>", |
769 /**< author */ | 795 /**< author */ |
770 GAIM_WEBSITE, /**< homepage */ | 796 GAIM_WEBSITE, /**< homepage */ |
771 | 797 |
772 plugin_load, /**< load */ | 798 plugin_load, /**< load */ |
773 plugin_unload, /**< unload */ | 799 plugin_unload, /**< unload */ |