comparison libgaim/util.c @ 15143:b81e4e44b509

[gaim-migrate @ 17929] User Info and Tooltips now use the GaimNotifyUserInfo object and methods defined in notify.h. GaimNotifyUserInfo objects encapsulate a list of GaimNotifyUserInfoEntry objects, each of which may have a label, a value, and be specified to be a section header. This moves the burden of UI generation of user information from the various prpls to the UI. The UI can choose how to display the information rather than being fenced into a particular HTML formatting. Consistency across the prpls' information presentation is now enforced, as well. gaim_notify_user_info_get_text_with_newline() generates text in the: <b>label</b>: value <b>label</b>: value format as was passed by convention from prpls in the past. committer: Tailor Script <tailor@pidgin.im>
author Evan Schoenberg <evan.s@dreskin.net>
date Sun, 10 Dec 2006 02:53:09 +0000
parents 9a69964d8c18
children
comparison
equal deleted inserted replaced
15142:4b319b19aa24 15143:b81e4e44b509
1059 1059
1060 return found; 1060 return found;
1061 } 1061 }
1062 1062
1063 gboolean 1063 gboolean
1064 gaim_markup_extract_info_field(const char *str, int len, GString *dest, 1064 gaim_markup_extract_info_field(const char *str, int len, GaimNotifyUserInfo *user_info,
1065 const char *start_token, int skip, 1065 const char *start_token, int skip,
1066 const char *end_token, char check_value, 1066 const char *end_token, char check_value,
1067 const char *no_value_token, 1067 const char *no_value_token,
1068 const char *display_name, gboolean is_link, 1068 const char *display_name, gboolean is_link,
1069 const char *link_prefix, 1069 const char *link_prefix,
1070 GaimInfoFieldFormatCallback format_cb) 1070 GaimInfoFieldFormatCallback format_cb)
1071 { 1071 {
1072 const char *p, *q; 1072 const char *p, *q;
1073 1073
1074 g_return_val_if_fail(str != NULL, FALSE); 1074 g_return_val_if_fail(str != NULL, FALSE);
1075 g_return_val_if_fail(dest != NULL, FALSE); 1075 g_return_val_if_fail(user_info != NULL, FALSE);
1076 g_return_val_if_fail(start_token != NULL, FALSE); 1076 g_return_val_if_fail(start_token != NULL, FALSE);
1077 g_return_val_if_fail(end_token != NULL, FALSE); 1077 g_return_val_if_fail(end_token != NULL, FALSE);
1078 g_return_val_if_fail(display_name != NULL, FALSE); 1078 g_return_val_if_fail(display_name != NULL, FALSE);
1079 1079
1080 p = strstr(str, start_token); 1080 p = strstr(str, start_token);
1108 1108
1109 if (q != NULL && (!no_value_token || 1109 if (q != NULL && (!no_value_token ||
1110 (no_value_token && strncmp(p, no_value_token, 1110 (no_value_token && strncmp(p, no_value_token,
1111 strlen(no_value_token))))) 1111 strlen(no_value_token)))))
1112 { 1112 {
1113 g_string_append_printf(dest, _("<b>%s:</b> "), display_name); 1113 GString *dest = g_string_new("");
1114 1114
1115 if (is_link) 1115 if (is_link)
1116 { 1116 {
1117 g_string_append(dest, "<br><a href=\""); 1117 g_string_append(dest, "<a href=\"");
1118 1118
1119 if (link_prefix) 1119 if (link_prefix)
1120 g_string_append(dest, link_prefix); 1120 g_string_append(dest, link_prefix);
1121 1121
1122 if (format_cb != NULL) 1122 if (format_cb != NULL)
1145 } 1145 }
1146 else 1146 else
1147 g_string_append_len(dest, p, q - p); 1147 g_string_append_len(dest, p, q - p);
1148 } 1148 }
1149 1149
1150 g_string_append(dest, "<br>\n"); 1150 gaim_notify_user_info_add_pair(user_info, display_name, dest->str);
1151 g_string_free(dest, TRUE);
1151 1152
1152 return TRUE; 1153 return TRUE;
1153 } 1154 }
1154 1155
1155 return FALSE; 1156 return FALSE;