comparison pidgin/gtkpounce.c @ 26268:3d997c09b94e

A patch from Jorge Villaseor which makes all pounces share a single window. The window is based on the one used by the mail notifications. I made some extra changes on top of the patch to clean things up a little bit, mainly to improve strings. Blame me if something breaks! Thanks to bjlockie for helping with testing. Closes #190
author Kevin Stange <kevin@simguy.net>
date Mon, 16 Mar 2009 17:07:41 +0000
parents d95d1fb58014
children b937f137cd05 48ea900ee72a
comparison
equal deleted inserted replaced
26267:da9e022befd9 26268:3d997c09b94e
28 #include "pidgin.h" 28 #include "pidgin.h"
29 29
30 #include "account.h" 30 #include "account.h"
31 #include "conversation.h" 31 #include "conversation.h"
32 #include "debug.h" 32 #include "debug.h"
33 #include "notify.h"
34 #include "prpl.h" 33 #include "prpl.h"
35 #include "request.h" 34 #include "request.h"
36 #include "server.h" 35 #include "server.h"
37 #include "sound.h" 36 #include "sound.h"
38 #include "util.h" 37 #include "util.h"
39 38
40 #include "gtkblist.h" 39 #include "gtkblist.h"
41 #include "gtkdialogs.h" 40 #include "gtkdialogs.h"
42 #include "gtkimhtml.h" 41 #include "gtkimhtml.h"
43 #include "gtkpounce.h" 42 #include "gtkpounce.h"
43 #include "gtknotify.h"
44 #include "pidginstock.h" 44 #include "pidginstock.h"
45 #include "gtkutils.h" 45 #include "gtkutils.h"
46 46
47 /** 47 /**
48 * These are used for the GtkTreeView when you're scrolling through 48 * These are used for the GtkTreeView when you're scrolling through
1273 G_CALLBACK(pounce_selected_cb), dialog); 1273 G_CALLBACK(pounce_selected_cb), dialog);
1274 1274
1275 /* Handle double-clicking */ 1275 /* Handle double-clicking */
1276 g_signal_connect(G_OBJECT(treeview), "button_press_event", 1276 g_signal_connect(G_OBJECT(treeview), "button_press_event",
1277 G_CALLBACK(pounce_double_click_cb), dialog); 1277 G_CALLBACK(pounce_double_click_cb), dialog);
1278
1279 gtk_container_add(GTK_CONTAINER(sw), treeview); 1278 gtk_container_add(GTK_CONTAINER(sw), treeview);
1280 gtk_widget_show(treeview); 1279 gtk_widget_show(treeview);
1281 1280
1282 /* Pouncee Column */ 1281 /* Pouncee Column */
1283 column = gtk_tree_view_column_new(); 1282 column = gtk_tree_view_column_new();
1456 * Here we place the protocol name in the pounce dialog to lessen 1455 * Here we place the protocol name in the pounce dialog to lessen
1457 * confusion about what protocol a pounce is for. 1456 * confusion about what protocol a pounce is for.
1458 */ 1457 */
1459 tmp = g_strdup_printf( 1458 tmp = g_strdup_printf(
1460 (events & PURPLE_POUNCE_TYPING) ? 1459 (events & PURPLE_POUNCE_TYPING) ?
1461 _("%s has started typing to you (%s)") : 1460 _("Started typing") :
1462 (events & PURPLE_POUNCE_TYPED) ? 1461 (events & PURPLE_POUNCE_TYPED) ?
1463 _("%s has paused while typing to you (%s)") : 1462 _("Paused while typing") :
1464 (events & PURPLE_POUNCE_SIGNON) ? 1463 (events & PURPLE_POUNCE_SIGNON) ?
1465 _("%s has signed on (%s)") : 1464 _("Signed on") :
1466 (events & PURPLE_POUNCE_IDLE_RETURN) ? 1465 (events & PURPLE_POUNCE_IDLE_RETURN) ?
1467 _("%s has returned from being idle (%s)") : 1466 _("Returned from being idle") :
1468 (events & PURPLE_POUNCE_AWAY_RETURN) ? 1467 (events & PURPLE_POUNCE_AWAY_RETURN) ?
1469 _("%s has returned from being away (%s)") : 1468 _("Returned from being away") :
1470 (events & PURPLE_POUNCE_TYPING_STOPPED) ? 1469 (events & PURPLE_POUNCE_TYPING_STOPPED) ?
1471 _("%s has stopped typing to you (%s)") : 1470 _("Stopped typing") :
1472 (events & PURPLE_POUNCE_SIGNOFF) ? 1471 (events & PURPLE_POUNCE_SIGNOFF) ?
1473 _("%s has signed off (%s)") : 1472 _("Signed off") :
1474 (events & PURPLE_POUNCE_IDLE) ? 1473 (events & PURPLE_POUNCE_IDLE) ?
1475 _("%s has become idle (%s)") : 1474 _("Became idle") :
1476 (events & PURPLE_POUNCE_AWAY) ? 1475 (events & PURPLE_POUNCE_AWAY) ?
1477 _("%s has gone away. (%s)") : 1476 _("Went away") :
1478 (events & PURPLE_POUNCE_MESSAGE_RECEIVED) ? 1477 (events & PURPLE_POUNCE_MESSAGE_RECEIVED) ?
1479 _("%s has sent you a message. (%s)") : 1478 _("Sent a message") :
1480 _("Unknown pounce event. Please report this!"), 1479 _("Unknown.... Please report this!")
1481 alias, purple_account_get_protocol_name(account)); 1480 );
1482 1481
1483 /* 1482 /*
1484 * Ok here is where I change the second argument, title, from 1483 * Ok here is where I change the second argument, title, from
1485 * NULL to the account alias if we have it or the account 1484 * NULL to the account alias if we have it or the account
1486 * name if that's all we have 1485 * name if that's all we have
1487 */ 1486 */
1488 if ((name_shown = purple_account_get_alias(account)) == NULL) 1487 if ((name_shown = purple_account_get_alias(account)) == NULL)
1489 name_shown = purple_account_get_username(account); 1488 name_shown = purple_account_get_username(account);
1490 1489
1491 if (reason == NULL) 1490 pidgin_notify_pounce_add(account, pounce, alias, tmp, reason,
1492 { 1491 purple_date_format_full(NULL));
1493 purple_notify_info(NULL, name_shown, tmp, purple_date_format_full(NULL)); 1492
1494 }
1495 else
1496 {
1497 char *tmp2 = g_strdup_printf("%s\n\n%s", reason, purple_date_format_full(NULL));
1498 purple_notify_info(NULL, name_shown, tmp, tmp2);
1499 g_free(tmp2);
1500 }
1501 g_free(tmp); 1493 g_free(tmp);
1502 } 1494 }
1503 1495
1504 if (purple_pounce_action_is_enabled(pounce, "send-message")) 1496 if (purple_pounce_action_is_enabled(pounce, "send-message"))
1505 { 1497 {