comparison libpurple/protocols/oscar/visibility.c @ 30808:ab7e28b1b478

Gettextized the code and rephrased some of the messages slightly.
author ivan.komarov@soc.pidgin.im
date Thu, 01 Jul 2010 17:15:37 +0000
parents 48fe4720d795
children c5790044f32f
comparison
equal deleted inserted replaced
30807:48fe4720d795 30808:ab7e28b1b478
17 * License along with this library; if not, write to the Free Software 17 * License along with this library; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA 18 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02111-1301 USA
19 */ 19 */
20 20
21 #include "visibility.h" 21 #include "visibility.h"
22
23 /* 4 separate strings are needed in order to ease translators' job */
24 #define APPEAR_ONLINE N_("Appear Online")
25 #define DONT_APPEAR_ONLINE N_("Don't Appear Online")
26 #define APPEAR_OFFLINE N_("Appear Offline")
27 #define DONT_APPEAR_OFFLINE N_("Don't Appear Offline")
22 28
23 static guint16 29 static guint16
24 get_buddy_list_type(OscarData *od, const char *bname) 30 get_buddy_list_type(OscarData *od, const char *bname)
25 { 31 {
26 PurpleAccount *account = purple_connection_get_account(od->gc); 32 PurpleAccount *account = purple_connection_get_account(od->gc);
52 create_visibility_menu_item(OscarData *od, const char *bname) 58 create_visibility_menu_item(OscarData *od, const char *bname)
53 { 59 {
54 PurpleAccount *account = purple_connection_get_account(od->gc); 60 PurpleAccount *account = purple_connection_get_account(od->gc);
55 gboolean invisible = purple_account_is_status_active(account, OSCAR_STATUS_ID_INVISIBLE); 61 gboolean invisible = purple_account_is_status_active(account, OSCAR_STATUS_ID_INVISIBLE);
56 gboolean on_list = is_buddy_on_list(od, bname); 62 gboolean on_list = is_buddy_on_list(od, bname);
57 gchar *label; 63 const gchar *label;
58 PurpleMenuAction *result;
59 64
60 label = g_strdup_printf("%s %s", on_list ? "Don't Appear" : "Appear", invisible ? "Online" : "Offline"); 65 if (invisible) {
61 result = purple_menu_action_new(label, PURPLE_CALLBACK(visibility_cb), NULL, NULL); 66 label = on_list ? _(DONT_APPEAR_ONLINE) : _(APPEAR_ONLINE);
62 g_free(label); 67 } else {
63 return result; 68 label = on_list ? _(DONT_APPEAR_OFFLINE) : _(APPEAR_OFFLINE);
69 }
70 return purple_menu_action_new(label, PURPLE_CALLBACK(visibility_cb), NULL, NULL);
64 } 71 }
65 72
66 static void 73 static void
67 show_private_list(PurplePluginAction *action, guint16 list_type, const gchar *list_description, const gchar *menu_action_name) 74 show_private_list(PurplePluginAction *action, guint16 list_type, const gchar *list_description, const gchar *menu_action_name)
68 { 75 {
86 } 93 }
87 94
88 g_slist_free(buddies); 95 g_slist_free(buddies);
89 96
90 filtered_buddies = g_slist_reverse(filtered_buddies); 97 filtered_buddies = g_slist_reverse(filtered_buddies);
91 text = oscar_format_buddies(filtered_buddies, "you have no buddies on this list"); 98 text = oscar_format_buddies(filtered_buddies, _("you have no buddies on this list"));
92 g_slist_free(filtered_buddies); 99 g_slist_free(filtered_buddies);
93 100
94 secondary = g_strdup_printf("You can add a buddy to this list " 101 secondary = g_strdup_printf(_("You can add a buddy to this list "
95 "by right-clicking on them and " 102 "by right-clicking on them and "
96 "selecting \"%s\"", menu_action_name); 103 "selecting \"%s\""), menu_action_name);
97 purple_notify_formatted(gc, NULL, list_description, secondary, text, NULL, NULL); 104 purple_notify_formatted(gc, NULL, list_description, secondary, text, NULL, NULL);
98 g_free(secondary); 105 g_free(secondary);
99 g_free(text); 106 g_free(text);
100 } 107 }
101 108
102 void 109 void
103 oscar_show_visible_list(PurplePluginAction *action) 110 oscar_show_visible_list(PurplePluginAction *action)
104 { 111 {
105 show_private_list(action, AIM_SSI_TYPE_PERMIT, "These buddies will always see " 112 show_private_list(action, AIM_SSI_TYPE_PERMIT, _("These buddies will see "
106 "your status, even when you switch " 113 "your status when you switch "
107 "to \"Invisible\"", "Appear Online"); 114 "to \"Invisible\""),
115 _(APPEAR_ONLINE));
108 } 116 }
109 117
110 void 118 void
111 oscar_show_invisible_list(PurplePluginAction *action) 119 oscar_show_invisible_list(PurplePluginAction *action)
112 { 120 {
113 show_private_list(action, AIM_SSI_TYPE_DENY, "These buddies will always see you as offline", "Appear Offline"); 121 show_private_list(action, AIM_SSI_TYPE_DENY, _("These buddies will always see you as offline"), _(APPEAR_OFFLINE));
114 } 122 }