comparison src/protocols/novell/novell.c @ 9820:fa8111c03283

[gaim-migrate @ 10691] Nicer looking info display from Mike Stoddard of Novell committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Sun, 22 Aug 2004 17:13:05 +0000
parents 62eb9fe24692
children c28d5b45624e
comparison
equal deleted inserted replaced
9819:34b468bdc1c5 9820:fa8111c03283
1429 } 1429 }
1430 g_slist_free(rem_list); 1430 g_slist_free(rem_list);
1431 } 1431 }
1432 } 1432 }
1433 1433
1434 /* Map known property tags to user-friendly strings */
1435 static const char *
1436 _map_property_tag(const char *tag)
1437 {
1438 if (tag == NULL) return NULL;
1439
1440 if (strcmp(tag, "telephoneNumber") == 0)
1441 return _("Telephone Number");
1442 else if (strcmp(tag, "L") == 0)
1443 return _("Location");
1444 else if (strcmp(tag, "OU") == 0)
1445 return _("Department");
1446 else if (strcmp(tag, "personalTitle") == 0)
1447 return _("Personal Title");
1448 else if (strcmp(tag, "Title") == 0)
1449 return _("Title");
1450 else if (strcmp(tag, "mailstop") == 0)
1451 return _("Mailstop");
1452 else if (strcmp(tag, "Internet EMail Address") == 0)
1453 return _("Email Address");
1454 else
1455 return tag;
1456 }
1457
1434 /* Display a dialog box showing the properties for the given user record */ 1458 /* Display a dialog box showing the properties for the given user record */
1435 static void 1459 static void
1436 _show_info(GaimConnection * gc, NMUserRecord * user_record) 1460 _show_info(GaimConnection * gc, NMUserRecord * user_record)
1437 { 1461 {
1438 GString *info_text; 1462 GString *info_text;
1440 NMProperty *property; 1464 NMProperty *property;
1441 const char *tag, *value; 1465 const char *tag, *value;
1442 1466
1443 info_text = g_string_new(""); 1467 info_text = g_string_new("");
1444 1468
1445 tag = _("Userid"); 1469 tag = _("User ID");
1446 value = nm_user_record_get_userid(user_record); 1470 value = nm_user_record_get_userid(user_record);
1447 if (value) { 1471 if (value) {
1448 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", tag, value); 1472 g_string_append_printf(info_text, "<b>%s:</b> %s<br>", tag, value);
1449 } 1473 }
1450 1474
1451 /* tag = _("DN"); 1475 /* tag = _("DN");
1452 value = nm_user_record_get_dn(user_record); 1476 value = nm_user_record_get_dn(user_record);
1453 if (value) { 1477 if (value) {
1454 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", 1478 g_string_append_printf(info_text, "<b>%s:</b> %s<br>",
1455 tag, value); 1479 tag, value);
1456 } 1480 }
1457 */ 1481 */
1458 1482
1459 tag = _("Full name"); 1483 tag = _("Full name");
1460 value = nm_user_record_get_full_name(user_record); 1484 value = nm_user_record_get_full_name(user_record);
1461 if (value) { 1485 if (value) {
1462 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", tag, value); 1486 g_string_append_printf(info_text, "<b>%s:</b> %s<br>", tag, value);
1463 } 1487 }
1464 1488
1465 count = nm_user_record_get_property_count(user_record); 1489 count = nm_user_record_get_property_count(user_record);
1466 for (i = 0; i < count; i++) { 1490 for (i = 0; i < count; i++) {
1467 property = nm_user_record_get_property(user_record, i); 1491 property = nm_user_record_get_property(user_record, i);
1468 if (property) { 1492 if (property) {
1469 tag = nm_property_get_tag(property); 1493 tag = _map_property_tag(nm_property_get_tag(property));
1470 value = nm_property_get_value(property); 1494 value = nm_property_get_value(property);
1471 if (tag && value) { 1495 if (tag && value) {
1472 g_string_append_printf(info_text, "<b>%s:</b> %s<br/>\n", 1496 g_string_append_printf(info_text, "<b>%s:</b> %s<br>",
1473 tag, value); 1497 tag, value);
1474 } 1498 }
1475 nm_release_property(property); 1499 nm_release_property(property);
1476 } 1500 }
1477 } 1501 }