# HG changeset patch # User Mark Doliner # Date 1081218481 0 # Node ID f96795b786d29f384f728a0b4c3062fc15212eaf # Parent de3d7eb3fc86f416c9a2e9819370c579562ab1ad [gaim-migrate @ 9342] Alright, I had to get my tooltip construction deuglification on. I removed the \n between the core's tooltip and the prpl's tooltip. prpl's should PREpend a \n to each line they add to the tooltip instead of APpending. This way you don't have to worry about removing trailing newline... it makes a lot more sense to me. I also changed oscar and trepia to use g_strings instead of g_strdup_printf and g_strconcat. G strings are sexy. And I apologize to the translators for changing some strings (separated some html and some text). committer: Tailor Script diff -r de3d7eb3fc86 -r f96795b786d2 src/gtkblist.c --- a/src/gtkblist.c Tue Apr 06 01:19:51 2004 +0000 +++ b/src/gtkblist.c Tue Apr 06 02:28:01 2004 +0000 @@ -2442,7 +2442,7 @@ loggedin ? _("\nLogged In:") : "", loggedin ? loggedin : "", idletime ? _("\nIdle:") : "", idletime ? idletime : "", b->evil ? _("\nWarned:") : "", b->evil ? warning : "", - statustext ? "\n" : "", statustext ? statustext : "", + statustext ? "" : "", statustext ? statustext : "", !g_ascii_strcasecmp(b->name, "robflynn") ? _("\nDescription: Spooky") : !g_ascii_strcasecmp(b->name, "seanegn") ? _("\nStatus: Awesome") : !g_ascii_strcasecmp(b->name, "chipx86") ? _("\nStatus: Rockin'") : ""); diff -r de3d7eb3fc86 -r f96795b786d2 src/protocols/jabber/jabber.c --- a/src/protocols/jabber/jabber.c Tue Apr 06 01:19:51 2004 +0000 +++ b/src/protocols/jabber/jabber.c Tue Apr 06 02:28:01 2004 +0000 @@ -895,7 +895,6 @@ JabberBuddy *jb = jabber_buddy_find(b->account->gc->proto_data, b->name, FALSE); GString *ret = g_string_new(""); - char *r = NULL; if(jb) { JabberBuddyResource *jbr = jabber_buddy_find_resource(jb, NULL); @@ -915,7 +914,7 @@ else sub = _("None"); } - g_string_append_printf(ret, "%s: %s\n", _("Subscription"), sub); + g_string_append_printf(ret, "\n%s: %s", _("Subscription"), sub); if(jbr) { char *text = NULL; @@ -926,7 +925,7 @@ g_free(stripped); } - g_string_append_printf(ret, "%s: %s%s%s\n", + g_string_append_printf(ret, "\n%s: %s%s%s", _("Status"), jabber_get_state_string(jbr->state), text ? ": " : "", @@ -934,20 +933,12 @@ if(text) g_free(text); } else if(!GAIM_BUDDY_IS_ONLINE(b) && jb->error_msg) { - g_string_append_printf(ret, "%s: %s\n", + g_string_append_printf(ret, "\n%s: %s", _("Error"), jb->error_msg); } } - if(ret->len > 0) { - g_string_truncate(ret, ret->len-1); - r = ret->str; - g_string_free(ret, FALSE); - } else { - g_string_free(ret, TRUE); - } - - return r; + return g_string_free(ret, FALSE); } static GList *jabber_away_states(GaimConnection *gc) diff -r de3d7eb3fc86 -r f96795b786d2 src/protocols/msn/msn.c --- a/src/protocols/msn/msn.c Tue Apr 06 01:19:51 2004 +0000 +++ b/src/protocols/msn/msn.c Tue Apr 06 02:28:01 2004 +0000 @@ -332,7 +332,7 @@ char *text = NULL; if (GAIM_BUDDY_IS_ONLINE(b)) { - text = g_strdup_printf(_("Status: %s"), + text = g_strdup_printf("\n%s: %s", _("Status"), msn_away_get_text(MSN_AWAY_TYPE(b->uc))); } diff -r de3d7eb3fc86 -r f96795b786d2 src/protocols/oscar/oscar.c --- a/src/protocols/oscar/oscar.c Tue Apr 06 01:19:51 2004 +0000 +++ b/src/protocols/oscar/oscar.c Tue Apr 06 02:28:01 2004 +0000 @@ -3156,21 +3156,6 @@ return 1; } -#if 0 -static char *images(int flags) { - static char buf[1024]; - g_snprintf(buf, sizeof(buf), "%s%s%s%s%s%s%s", - (flags & AIM_FLAG_ACTIVEBUDDY) ? "" : "", - (flags & AIM_FLAG_UNCONFIRMED) ? "" : "", - (flags & AIM_FLAG_AOL) ? "" : "", - (flags & AIM_FLAG_ICQ) ? "" : "", - (flags & AIM_FLAG_ADMINISTRATOR) ? "" : "", - (flags & AIM_FLAG_FREE) ? "" : "", - (flags & AIM_FLAG_WIRELESS) ? "" : ""); - return buf; -} -#endif - static char *caps_string(guint caps) { static char buf[512], *tmp; @@ -5695,15 +5680,13 @@ GaimGroup *g = gaim_find_buddys_group(b); struct buddyinfo *bi = g_hash_table_lookup(od->buddyinfo, gaim_normalize(b->account, b->name)); aim_userinfo_t *userinfo = aim_locate_finduserinfo(od->sess, b->name); - gchar *tmp = NULL, *ret = g_strdup(""); + GString *ret = g_string_new(""); if (GAIM_BUDDY_IS_ONLINE(b)) { if (isdigit(b->name[0])) { char *status; status = gaim_icq_status((b->uc & 0xffff0000) >> 16); - tmp = ret; - ret = g_strconcat(tmp, _("Status: "), status, "\n", NULL); - g_free(tmp); + g_string_append_printf(ret, "\n%s: %s", _("Status"), status); g_free(status); } @@ -5713,35 +5696,26 @@ (bi->ipaddr & 0x00ff0000) >> 16, (bi->ipaddr & 0x0000ff00) >> 8, (bi->ipaddr & 0x000000ff)); - tmp = ret; - ret = g_strconcat(tmp, _("IP Address: "), tstr, "\n", NULL); - g_free(tmp); + g_string_append_printf(ret, "\n%s: %s", _("IP Address"), tstr); g_free(tstr); } if ((userinfo != NULL) && (userinfo->capabilities)) { char *caps = caps_string(userinfo->capabilities); - tmp = ret; - ret = g_strconcat(tmp, _("Capabilities: "), caps, "\n", NULL); - g_free(tmp); + g_string_append_printf(ret, "\n%s: %s", _("Capabilities"), caps); } if (g && g->name) { - char *comment = NULL; - comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, b->name); + char *comment = aim_ssi_getcomment(od->sess->ssi.local, g->name, b->name); if (comment != NULL) { - tmp = ret; - ret = g_strconcat(tmp, _("Buddy Comment: "), comment, "\n", NULL); - free(tmp); + g_string_append_printf(ret, "\n%s: %s", _("Buddy Comment"), comment); free(comment); } } if ((bi != NULL) && (bi->availmsg != NULL) && !(b->uc & UC_UNAVAILABLE)) { gchar *escaped = g_markup_escape_text(bi->availmsg, strlen(bi->availmsg)); - tmp = ret; - ret = g_strconcat(tmp, _("Available: "), escaped, "\n", NULL); - g_free(tmp); + g_string_append_printf(ret, "\n%s: %s", _("Available"), escaped); g_free(escaped); } @@ -5760,28 +5734,18 @@ g_free(tmp2); tmp3 = gaim_str_sub_away_formatters(tmp1, gaim_account_get_username(gaim_connection_get_account(gc))); g_free(tmp1); - tmp = ret; - ret = g_strconcat(tmp, _("Away Message: "), tmp3, "\n", NULL); - g_free(tmp); + g_string_append_printf(ret, "\n%s: %s", _("Away Message"), tmp3); } } } else { char *gname = aim_ssi_itemlist_findparentname(od->sess->ssi.local, b->name); - if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) { - tmp = ret; - ret = g_strconcat(tmp, _("Status: Not Authorized"), "\n", NULL); - g_free(tmp); - } else { - tmp = ret; - ret = g_strconcat(tmp, _("Status: Offline"), "\n", NULL); - g_free(tmp); - } - } - - /* remove the trailing newline character */ - if (ret && (strlen(ret) > 0)) - ret[strlen(ret)-1] = '\0'; - return ret; + if (aim_ssi_waitingforauth(od->sess->ssi.local, gname, b->name)) + g_string_append_printf(ret, "\n%s: %s", _("Status"), _("Not Authorized")); + else + g_string_append_printf(ret, "\n%s: %s", _("Status"), _("Offline")); + } + + return g_string_free(ret, FALSE);; } static char *oscar_status_text(GaimBuddy *b) { @@ -6861,11 +6825,13 @@ pam->gc = gc; m = g_list_append(m, pam); -/* pam = g_new0(struct proto_actions_menu, 1); +#if 0 + pam = g_new0(struct proto_actions_menu, 1); pam->label = _("Search for Buddy by Information"); pam->callback = show_find_info; pam->gc = gc; - m = g_list_append(m, pam); */ + m = g_list_append(m, pam); +#endif return m; } diff -r de3d7eb3fc86 -r f96795b786d2 src/protocols/rendezvous/rendezvous.c --- a/src/protocols/rendezvous/rendezvous.c Tue Apr 06 01:19:51 2004 +0000 +++ b/src/protocols/rendezvous/rendezvous.c Tue Apr 06 02:28:01 2004 +0000 @@ -306,13 +306,13 @@ ret = g_string_new(""); if (rb->aim != NULL) - g_string_append_printf(ret, _("AIM Screen name: %s\n"), rb->aim); + g_string_append_printf(ret, "\n%s: %s", _("AIM Screen name"), rb->aim); if (rb->msg != NULL) { if (rb->status == UC_UNAVAILABLE) - g_string_append_printf(ret, _("Away: %s\n"), rb->msg); + g_string_append_printf(ret, "\n%s: %s", _("Away"), rb->msg); else - g_string_append_printf(ret, _("Available: %s\n"), rb->msg); + g_string_append_printf(ret, "\n%s: %s", _("Available"), rb->msg); } /* XXX - Fix blist.c so we can prepend the \n's rather than appending them */ diff -r de3d7eb3fc86 -r f96795b786d2 src/protocols/trepia/trepia.c --- a/src/protocols/trepia/trepia.c Tue Apr 06 01:19:51 2004 +0000 +++ b/src/protocols/trepia/trepia.c Tue Apr 06 02:28:01 2004 +0000 @@ -389,95 +389,44 @@ const char *value; const char *first_name, *last_name; int int_value; - char *text = NULL; - char *tmp, *tmp2; - - text = g_strdup(""); + GString *ret = g_string_new(""); first_name = trepia_profile_get_first_name(profile); last_name = trepia_profile_get_last_name(profile); - if (first_name != NULL || last_name != NULL) { - tmp = g_strdup_printf("%s: %s%s%s\n",_("Name"), + if (first_name != NULL || last_name != NULL) + g_string_append_printf(ret, "\n%s: %s%s%s", _("Name"), (first_name == NULL ? "" : first_name), (first_name == NULL ? "" : " "), (last_name == NULL ? "" : last_name)); - tmp2 = g_strconcat(text, tmp, NULL); - g_free(tmp); - g_free(text); - text = tmp2; - } + if ((int_value = trepia_profile_get_age(profile)) != 0) + g_string_append_printf(ret, "\n%s: %d", _("Age"), int_value); - if ((int_value = trepia_profile_get_age(profile)) != 0) { - tmp = g_strdup_printf("%s: %d\n", _("Age"),int_value); - - tmp2 = g_strconcat(text, tmp, NULL); - g_free(tmp); - g_free(text); - text = tmp2; - } - - tmp = g_strdup_printf("%s: %s\n",_("Gender"), + g_string_append_printf(ret, "\n%s: %s", _("Gender"), (trepia_profile_get_sex(profile) == 'F' ? _("Female") : _("Male"))); - tmp2 = g_strconcat(text, tmp, NULL); - g_free(tmp); - g_free(text); - text = tmp2; - - if ((value = trepia_profile_get_city(profile)) != NULL) { - tmp = g_strdup_printf("%s: %s\n", _("City"), value); + if ((value = trepia_profile_get_city(profile)) != NULL) + g_string_append_printf(ret, "\n%s: %s", _("City"), value); - tmp2 = g_strconcat(text, tmp, NULL); - g_free(tmp); - g_free(text); - text = tmp2; - } - - if ((value = trepia_profile_get_state(profile)) != NULL) { - tmp = g_strdup_printf("%s: %s\n", _("State"), value); + if ((value = trepia_profile_get_state(profile)) != NULL) + g_string_append_printf(ret, "\n%s: %s", _("State"), value); - tmp2 = g_strconcat(text, tmp, NULL); - g_free(tmp); - g_free(text); - text = tmp2; - } - - if ((value = trepia_profile_get_country(profile)) != NULL) { - tmp = g_strdup_printf("%s: %s\n", _("Country"), value); + if ((value = trepia_profile_get_country(profile)) != NULL) + g_string_append_printf(ret, "\n%s: %s", _("Country"), value); - tmp2 = g_strconcat(text, tmp, NULL); - g_free(tmp); - g_free(text); - text = tmp2; - } - - if ((value = trepia_profile_get_homepage(profile)) != NULL) { - tmp = g_strdup_printf("%s: %s\n", _("Homepage"), value); - - tmp2 = g_strconcat(text, tmp, NULL); - g_free(tmp); - g_free(text); - text = tmp2; - } + if ((value = trepia_profile_get_homepage(profile)) != NULL) + g_string_append_printf(ret, "\n%s: %s", _("Homepage"), value); if ((value = trepia_profile_get_profile(profile)) != NULL) { char *escaped_val = g_markup_escape_text(value, -1); - tmp = g_strdup_printf("%s: %s\n", _("Profile"), escaped_val); + g_string_append_printf(ret, "\n%s: %s", _("Profile"), escaped_val); g_free(escaped_val); - - tmp2 = g_strconcat(text, tmp, NULL); - g_free(tmp); - g_free(text); - text = tmp2; } - text[strlen(text) - 1] = '\0'; - - return text; + return g_string_free(ret, FALSE); } static GList * diff -r de3d7eb3fc86 -r f96795b786d2 src/protocols/yahoo/yahoo.c --- a/src/protocols/yahoo/yahoo.c Tue Apr 06 01:19:51 2004 +0000 +++ b/src/protocols/yahoo/yahoo.c Tue Apr 06 02:28:01 2004 +0000 @@ -2383,7 +2383,7 @@ f = g_hash_table_lookup(yd->friends, b->name); if (!f) - status = g_strdup(_("Not on server list")); + status = g_strdup_printf("\n%s", _("Not on server list")); else switch (f->status) { case YAHOO_STATUS_IDLE: @@ -2403,7 +2403,7 @@ } escaped = g_markup_escape_text(status, strlen(status)); - ret = g_strdup_printf(_("Status: %s"), escaped); + ret = g_strdup_printf(_("\n%s: %s"), _("Status"), escaped); g_free(status); g_free(escaped);