comparison plugins/notify.c @ 10971:57e3e958ff49

[gaim-migrate @ 12796] This commit includes the changes I made to oldstatus to make urgent notification/taskbar flashing more sensible (auto- tab switching), the changes to notify.c so that tab switching doesn't reset the counters, and the changes and translations for gaim.desktop committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Mon, 06 Jun 2005 01:40:46 +0000
parents 9c4dca2deb99
children caaacfede4ae
comparison
equal deleted inserted replaced
10970:a126bdfd7688 10971:57e3e958ff49
177 177
178 g_object_get(G_OBJECT(GAIM_GTK_WINDOW(gaimwin)->window), 178 g_object_get(G_OBJECT(GAIM_GTK_WINDOW(gaimwin)->window),
179 "has-toplevel-focus", &has_focus, NULL); 179 "has-toplevel-focus", &has_focus, NULL);
180 180
181 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") || 181 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/type_focused") ||
182 (has_focus && gaim_conv_window_get_active_conversation(gaimwin) != conv) || 182 !has_focus ||
183 !has_focus) { 183 gaim_conv_window_get_active_conversation(gaimwin) != conv) {
184 if (increment) { 184 if (increment) {
185 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count")); 185 count = GPOINTER_TO_INT(gaim_conversation_get_data(conv, "notify-message-count"));
186 count++; 186 count++;
187 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count)); 187 gaim_conversation_set_data(conv, "notify-message-count", GINT_TO_POINTER(count));
188 } 188 }
194 } 194 }
195 195
196 static void 196 static void
197 notify_win(GaimConvWindow *gaimwin) 197 notify_win(GaimConvWindow *gaimwin)
198 { 198 {
199 if (count_messages(gaimwin) <= 0)
200 return;
201
199 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count")) 202 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_count"))
200 handle_count(gaimwin); 203 handle_count(gaimwin);
201 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string")) 204 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_string"))
202 handle_string(gaimwin); 205 handle_string(gaimwin);
203 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent")) 206 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/method_urgent"))
380 /* always attach the signals, notify() will take care of conversation type 383 /* always attach the signals, notify() will take care of conversation type
381 * checking */ 384 * checking */
382 attach_signals(conv); 385 attach_signals(conv);
383 } 386 }
384 387
388 static void
389 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv)
390 {
385 #if 0 391 #if 0
386 static void
387 conv_switched(GaimConversation *old_conv, GaimConversation *new_conv)
388 {
389 GaimConvWindow *gaimwin = gaim_conversation_get_window(new_conv); 392 GaimConvWindow *gaimwin = gaim_conversation_get_window(new_conv);
390 393 #endif
394
395 /*
396 * If the conversation was switched, then make sure we re-notify
397 * because Gaim will have overwritten our custom window title.
398 */
399 notify(new_conv, FALSE);
400
401 #if 0
391 printf("conv_switched - %p - %p\n", old_conv, new_conv); 402 printf("conv_switched - %p - %p\n", old_conv, new_conv);
392 printf("count - %d\n", count_messages(gaimwin)); 403 printf("count - %d\n", count_messages(gaimwin));
393 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch")) 404 if (gaim_prefs_get_bool("/plugins/gtk/X11/notify/notify_switch"))
394 unnotify(new_conv, FALSE); 405 unnotify(new_conv, FALSE);
395 else { 406 else {
396 /* if we don't have notification on the window then we don't want to 407 /* if we don't have notification on the window then we don't want to
397 * re-notify it */ 408 * re-notify it */
398 if (count_messages(gaimwin)) 409 if (count_messages(gaimwin))
399 notify_win(gaimwin); 410 notify_win(gaimwin);
400 } 411 }
401 }
402 #endif 412 #endif
413 }
403 414
404 static void 415 static void
405 deleting_conv(GaimConversation *conv) 416 deleting_conv(GaimConversation *conv)
406 { 417 {
407 GaimConvWindow *gaimwin = NULL; 418 GaimConvWindow *gaimwin = NULL;
777 GAIM_CALLBACK(conv_created), NULL); 788 GAIM_CALLBACK(conv_created), NULL);
778 gaim_signal_connect(conv_handle, "chat-joined", plugin, 789 gaim_signal_connect(conv_handle, "chat-joined", plugin,
779 GAIM_CALLBACK(conv_created), NULL); 790 GAIM_CALLBACK(conv_created), NULL);
780 gaim_signal_connect(conv_handle, "deleting-conversation", plugin, 791 gaim_signal_connect(conv_handle, "deleting-conversation", plugin,
781 GAIM_CALLBACK(deleting_conv), NULL); 792 GAIM_CALLBACK(deleting_conv), NULL);
782 #if 0
783 gaim_signal_connect(conv_handle, "conversation-switched", plugin, 793 gaim_signal_connect(conv_handle, "conversation-switched", plugin,
784 GAIM_CALLBACK(conv_switched), NULL); 794 GAIM_CALLBACK(conv_switched), NULL);
795 #if 0
785 gaim_signal_connect(gtk_conv_handle, "conversation-drag-ended", plugin, 796 gaim_signal_connect(gtk_conv_handle, "conversation-drag-ended", plugin,
786 GAIM_CALLBACK(conversation_drag_ended), NULL); 797 GAIM_CALLBACK(conversation_drag_ended), NULL);
787 #endif 798 #endif
788 799
789 while (convs) { 800 while (convs) {