pidgin/plugins/notify.c

changeset 35610
24b06c5e7760
parent 35526
ed1be305c985
child 36081
6764e037a308
child 37123
9c245220151d
equal deleted inserted replaced
35609:6bcd0955c8a4 35610:24b06c5e7760
105 static GdkAtom _PurpleUnseenCount = GDK_NONE; 105 static GdkAtom _PurpleUnseenCount = GDK_NONE;
106 #endif 106 #endif
107 107
108 /* notification set/unset */ 108 /* notification set/unset */
109 static int notify(PurpleConversation *conv, gboolean increment); 109 static int notify(PurpleConversation *conv, gboolean increment);
110 static void notify_win(PidginWindow *purplewin, PurpleConversation *conv); 110 static void notify_win(PidginConvWindow *purplewin, PurpleConversation *conv);
111 static void unnotify(PurpleConversation *conv, gboolean reset); 111 static void unnotify(PurpleConversation *conv, gboolean reset);
112 static int unnotify_cb(GtkWidget *widget, gpointer data, 112 static int unnotify_cb(GtkWidget *widget, gpointer data,
113 PurpleConversation *conv); 113 PurpleConversation *conv);
114 114
115 /* gtk widget callbacks for prefs panel */ 115 /* gtk widget callbacks for prefs panel */
120 gpointer data); 120 gpointer data);
121 static void apply_method(void); 121 static void apply_method(void);
122 static void apply_notify(void); 122 static void apply_notify(void);
123 123
124 /* string function */ 124 /* string function */
125 static void handle_string(PidginWindow *purplewin); 125 static void handle_string(PidginConvWindow *purplewin);
126 126
127 /* count_title function */ 127 /* count_title function */
128 static void handle_count_title(PidginWindow *purplewin); 128 static void handle_count_title(PidginConvWindow *purplewin);
129 129
130 /* count_xprop function */ 130 /* count_xprop function */
131 static void handle_count_xprop(PidginWindow *purplewin); 131 static void handle_count_xprop(PidginConvWindow *purplewin);
132 132
133 /* urgent function */ 133 /* urgent function */
134 static void handle_urgent(PidginWindow *purplewin, gboolean set); 134 static void handle_urgent(PidginConvWindow *purplewin, gboolean set);
135 135
136 /* raise function */ 136 /* raise function */
137 static void handle_raise(PidginWindow *purplewin); 137 static void handle_raise(PidginConvWindow *purplewin);
138 138
139 /* present function */ 139 /* present function */
140 static void handle_present(PurpleConversation *conv); 140 static void handle_present(PurpleConversation *conv);
141 141
142 /****************************************/ 142 /****************************************/
143 /* Begin doing stuff below this line... */ 143 /* Begin doing stuff below this line... */
144 /****************************************/ 144 /****************************************/
145 static guint 145 static guint
146 count_messages(PidginWindow *purplewin) 146 count_messages(PidginConvWindow *purplewin)
147 { 147 {
148 guint count = 0; 148 guint count = 0;
149 GList *convs = NULL, *l; 149 GList *convs = NULL, *l;
150 150
151 for (convs = purplewin->gtkconvs; convs != NULL; convs = convs->next) { 151 for (convs = purplewin->gtkconvs; convs != NULL; convs = convs->next) {
161 static int 161 static int
162 notify(PurpleConversation *conv, gboolean increment) 162 notify(PurpleConversation *conv, gboolean increment)
163 { 163 {
164 gint count; 164 gint count;
165 gboolean has_focus; 165 gboolean has_focus;
166 PidginWindow *purplewin = NULL; 166 PidginConvWindow *purplewin = NULL;
167 167
168 if (conv == NULL || PIDGIN_CONVERSATION(conv) == NULL) 168 if (conv == NULL || PIDGIN_CONVERSATION(conv) == NULL)
169 return 0; 169 return 0;
170 170
171 /* We want to remove the notifications, but not reset the counter */ 171 /* We want to remove the notifications, but not reset the counter */
196 196
197 return 0; 197 return 0;
198 } 198 }
199 199
200 static void 200 static void
201 notify_win(PidginWindow *purplewin, PurpleConversation *conv) 201 notify_win(PidginConvWindow *purplewin, PurpleConversation *conv)
202 { 202 {
203 if (count_messages(purplewin) <= 0) 203 if (count_messages(purplewin) <= 0)
204 return; 204 return;
205 205
206 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) 206 if (purple_prefs_get_bool("/plugins/gtk/X11/notify/method_count"))
219 219
220 static void 220 static void
221 unnotify(PurpleConversation *conv, gboolean reset) 221 unnotify(PurpleConversation *conv, gboolean reset)
222 { 222 {
223 PurpleConversation *active_conv = NULL; 223 PurpleConversation *active_conv = NULL;
224 PidginWindow *purplewin = NULL; 224 PidginConvWindow *purplewin = NULL;
225 225
226 g_return_if_fail(conv != NULL); 226 g_return_if_fail(conv != NULL);
227 if (PIDGIN_CONVERSATION(conv) == NULL) 227 if (PIDGIN_CONVERSATION(conv) == NULL)
228 return; 228 return;
229 229
385 385
386 static void 386 static void
387 conv_switched(PurpleConversation *conv) 387 conv_switched(PurpleConversation *conv)
388 { 388 {
389 #if 0 389 #if 0
390 PidginWindow *purplewin = purple_conversation_get_window(new_conv); 390 PidginConvWindow *purplewin = purple_conversation_get_window(new_conv);
391 #endif 391 #endif
392 392
393 /* 393 /*
394 * If the conversation was switched, then make sure we re-notify 394 * If the conversation was switched, then make sure we re-notify
395 * because Purple will have overwritten our custom window title. 395 * because Purple will have overwritten our custom window title.
411 } 411 }
412 412
413 static void 413 static void
414 deleting_conv(PurpleConversation *conv) 414 deleting_conv(PurpleConversation *conv)
415 { 415 {
416 PidginWindow *purplewin = NULL; 416 PidginConvWindow *purplewin = NULL;
417 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv); 417 PidginConversation *gtkconv = PIDGIN_CONVERSATION(conv);
418 418
419 if (gtkconv == NULL) 419 if (gtkconv == NULL)
420 return; 420 return;
421 421
436 } 436 }
437 437
438 #if 0 438 #if 0
439 static void 439 static void
440 conversation_dragging(PurpleConversation *active_conv, 440 conversation_dragging(PurpleConversation *active_conv,
441 PidginWindow *old_purplewin, 441 PidginConvWindow *old_purplewin,
442 PidginWindow *new_purplewin) 442 PidginConvWindow *new_purplewin)
443 { 443 {
444 if (old_purplewin != new_purplewin) { 444 if (old_purplewin != new_purplewin) {
445 if (old_purplewin == NULL) { 445 if (old_purplewin == NULL) {
446 /* 446 /*
447 purple_conversation_autoset_title(active_conv); 447 purple_conversation_autoset_title(active_conv);
483 } 483 }
484 } 484 }
485 #endif 485 #endif
486 486
487 static void 487 static void
488 handle_string(PidginWindow *purplewin) 488 handle_string(PidginConvWindow *purplewin)
489 { 489 {
490 GtkWindow *window = NULL; 490 GtkWindow *window = NULL;
491 gchar newtitle[256]; 491 gchar newtitle[256];
492 492
493 g_return_if_fail(purplewin != NULL); 493 g_return_if_fail(purplewin != NULL);
500 gtk_window_get_title(window)); 500 gtk_window_get_title(window));
501 gtk_window_set_title(window, newtitle); 501 gtk_window_set_title(window, newtitle);
502 } 502 }
503 503
504 static void 504 static void
505 handle_count_title(PidginWindow *purplewin) 505 handle_count_title(PidginConvWindow *purplewin)
506 { 506 {
507 GtkWindow *window; 507 GtkWindow *window;
508 char newtitle[256]; 508 char newtitle[256];
509 509
510 g_return_if_fail(purplewin != NULL); 510 g_return_if_fail(purplewin != NULL);
516 count_messages(purplewin), gtk_window_get_title(window)); 516 count_messages(purplewin), gtk_window_get_title(window));
517 gtk_window_set_title(window, newtitle); 517 gtk_window_set_title(window, newtitle);
518 } 518 }
519 519
520 static void 520 static void
521 handle_count_xprop(PidginWindow *purplewin) 521 handle_count_xprop(PidginConvWindow *purplewin)
522 { 522 {
523 #ifdef HAVE_X11 523 #ifdef HAVE_X11
524 guint count; 524 guint count;
525 GtkWidget *window; 525 GtkWidget *window;
526 GdkWindow *gdkwin; 526 GdkWindow *gdkwin;
543 GDK_PROP_MODE_REPLACE, (guchar *) &count, 1); 543 GDK_PROP_MODE_REPLACE, (guchar *) &count, 1);
544 #endif 544 #endif
545 } 545 }
546 546
547 static void 547 static void
548 handle_urgent(PidginWindow *purplewin, gboolean set) 548 handle_urgent(PidginConvWindow *purplewin, gboolean set)
549 { 549 {
550 g_return_if_fail(purplewin != NULL); 550 g_return_if_fail(purplewin != NULL);
551 g_return_if_fail(purplewin->window != NULL); 551 g_return_if_fail(purplewin->window != NULL);
552 552
553 pidgin_set_urgent(GTK_WINDOW(purplewin->window), set); 553 pidgin_set_urgent(GTK_WINDOW(purplewin->window), set);
554 } 554 }
555 555
556 static void 556 static void
557 handle_raise(PidginWindow *purplewin) 557 handle_raise(PidginConvWindow *purplewin)
558 { 558 {
559 pidgin_conv_window_raise(purplewin); 559 pidgin_conv_window_raise(purplewin);
560 } 560 }
561 561
562 static void 562 static void

mercurial