Mercurial > pidgin.yaz
changeset 6308:a21cf07cd8e1
[gaim-migrate @ 6807]
Added some ngettext things. IMO, ngettext makes things really ugly.
http://sourceforge.net/tracker/?group_id=235&atid=100235&func=detail&aid=775089
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Sat, 26 Jul 2003 17:48:50 +0000 |
parents | 55588b222901 |
children | bf63ddea431f |
files | plugins/chkmail.c src/blist.c src/protocols/msn/notification.c src/protocols/oscar/oscar.c src/server.c |
diffstat | 5 files changed, 87 insertions(+), 77 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/chkmail.c Sat Jul 26 16:11:30 2003 +0000 +++ b/plugins/chkmail.c Sat Jul 26 17:48:50 2003 +0000 @@ -34,66 +34,67 @@ int num_msgs() { - struct in_addr *sin; - char recv[1024]; - char command[256]; - int fd; - int num = 0; - int step = 0; - int len; + struct in_addr *sin; + char recv[1024]; + char command[256]; + int fd; + int num = 0; + int step = 0; + int len; - sin = (struct in_addr *)get_address(mailhost); - fd = connect_address(sin->s_addr, mailport); + sin = (struct in_addr *)get_address(mailhost); + fd = connect_address(sin->s_addr, mailport); while ((len = read(fd, recv, 1023))>0) { recv[len] = 0; - if (!strncmp(recv, "-ERR", strlen("-ERR"))) { step = 4; break; - } else if (!strncmp(recv, "+OK", strlen("+OK"))) { - if (step == 3) { - if (sscanf(recv, "+OK %d %d\n", &num, &step) != 2) - break; - g_snprintf(command, sizeof(command), "QUIT\n"); - write(fd, command, strlen(command)); + if (!strncmp(recv, "-ERR", strlen("-ERR"))) { + step = 4; + break; + } else if (!strncmp(recv, "+OK", strlen("+OK"))) { + if (step == 3) { + if (sscanf(recv, "+OK %d %d\n", &num, &step) != 2) + break; + g_snprintf(command, sizeof(command), "QUIT\n"); + write(fd, command, strlen(command)); close(fd); -printf("DEBUG: Num is %d\n", num); - return num; - } + return num; + } - if (step == 0) { - g_snprintf(command, sizeof(command), "USER %s\n", username); - write(fd, command, strlen(command)); - step = 1; - } else if (step == 1) { - g_snprintf(command, sizeof(command), "PASS %s\n", password); - write(fd, command, strlen(command)); - step = 2; - } else if (step == 2) { - g_snprintf(command, sizeof(command), "STAT\n"); - write(fd, command, strlen(command)); - step = 3; - } - } - } - close(fd); + if (step == 0) { + g_snprintf(command, sizeof(command), "USER %s\n", username); + write(fd, command, strlen(command)); + step = 1; + } else if (step == 1) { + g_snprintf(command, sizeof(command), "PASS %s\n", password); + write(fd, command, strlen(command)); + step = 2; + } else if (step == 2) { + g_snprintf(command, sizeof(command), "STAT\n"); + write(fd, command, strlen(command)); + step = 3; + } + } + } + close(fd); + return 0; } void destroy_mail_list() { - GList *list; - GtkWidget *w; - - list = GTK_TREE(buddies)->children; + GList *list; + GtkWidget *w; - while (list) { - w = (GtkWidget *)list->data; - if (!strcmp(GTK_LABEL(GTK_BIN(w)->child)->label, _("Mail Server"))) { - gtk_tree_remove_items(GTK_TREE(buddies), list); + list = GTK_TREE(buddies)->children; + while (list) { + w = (GtkWidget *)list->data; + if (!strcmp(GTK_LABEL(GTK_BIN(w)->child)->label, _("Mail Server"))) { + gtk_tree_remove_items(GTK_TREE(buddies), list); list = GTK_TREE(buddies)->children; - if (!list) - break; - } - list = list->next; - } + if (!list) + break; + } + list = list->next; + } } @@ -152,28 +153,21 @@ pthread_t mail_thread; pthread_attr_t attr; - printf("Looping in: State = %d\n", state); if (state == 0) { state = 1; - printf("Before\n"); pthread_attr_init(&attr); pthread_create(&mail_thread, &attr, (void *)&update_mail, NULL); - printf("After\n"); } - printf("Bouncing out, state = %d\n", state); } void update_mail () { int newnum; - printf("um\n"); g_source_remove(mytimer); - printf("nm1\n"); newnum = num_msgs(); - printf("nm2\n"); - if ( (newnum >= lastnum) && (newnum > 0)) { + if ((newnum >= lastnum) && (newnum > 0)) { newnum = newnum - lastnum; } else { newnum = 0; @@ -185,9 +179,7 @@ lastnum = newnum; mytimer = g_timeout_add(30000, check_mail, NULL); - printf("sml1\n"); setup_mail_list(); - printf("sml2\n"); state = 0; }
--- a/src/blist.c Sat Jul 26 16:11:30 2003 +0000 +++ b/src/blist.c Sat Jul 26 17:48:50 2003 +0000 @@ -748,11 +748,15 @@ child = child->next; } - buf = g_strdup_printf(_("%d buddies from group %s were not " - "removed because their accounts were not logged in. These " - "buddies and the group were not removed.\n"), - count, group->name); - + buf = g_strdup_printf(ngettext("%d buddy from group %s was not removed " + "because its account was not logged in." + " This buddy and the group were not " + "removed.\n", + "%d buddies from group %s were not " + "removed because their accounts were " + " not logged in. These buddies and " + "the group were not removed.\n", count), + count, group->name); gaim_notify_error(NULL, NULL, _("Group not removed"), buf); g_free(buf); return;
--- a/src/protocols/msn/notification.c Sat Jul 26 16:11:30 2003 +0000 +++ b/src/protocols/msn/notification.c Sat Jul 26 17:48:50 2003 +0000 @@ -1339,18 +1339,25 @@ if ((type_s = g_hash_table_lookup(table, "Type")) != NULL) { int type = atoi(type_s); char buf[MSN_BUF_LEN]; + int minutes; switch (type) { case 1: - g_snprintf(buf, sizeof(buf), - _("The MSN server will shut down for maintenance " - "in %d minute(s). You will automatically be " - "signed out at that time. Please finish any " - "conversations in progress.\n\n" - "After the maintenance has been completed, you " - "will be able to successfully sign in."), - atoi(g_hash_table_lookup(table, "Arg1"))); - + minutes = atoi(g_hash_table_lookup(table, "Arg1")); + g_snprintf(buf, sizeof(buf), ngettext( + "The MSN server will shut down for maintenance " + "in %d minute. You will automatically be " + "signed out at that time. Please finish any " + "conversations in progress.\n\nAfter the " + "maintenance has been completed, you will be " + "able to successfully sign in.", + "The MSN server will shut down for maintenance " + "in %d minutes. You will automatically be " + "signed out at that time. Please finish any " + "conversations in progress.\n\nAfter the " + "maintenance has been completed, you will be " + "able to successfully sign in.", minutes), + minutes); default: break; }
--- a/src/protocols/oscar/oscar.c Sat Jul 26 16:11:30 2003 +0000 +++ b/src/protocols/oscar/oscar.c Sat Jul 26 17:48:50 2003 +0000 @@ -4461,8 +4461,11 @@ if (msglen > od->rights.maxsiglen) { gchar *errstr; - errstr = g_strdup_printf(_("The maximum profile length of %d bytes has been exceeded. " - "Gaim has truncated it for you."), od->rights.maxsiglen); + errstr = g_strdup_printf(ngettext("The maximum profile length of %d byte " + "has been exceeded. Gaim has truncated it for you.", + "The maximum profile length of %d bytes " + "has been exceeded. Gaim has truncated it for you.", + od->rights.maxsiglen), od->rights.maxsiglen); gaim_notify_warning(gc, NULL, _("Profile too long."), errstr); g_free(errstr); } @@ -4523,8 +4526,11 @@ if (msglen > od->rights.maxawaymsglen) { gchar *errstr; - errstr = g_strdup_printf(_("The maximum away message length of %d bytes has been exceeded. " - "Gaim has truncated it and set you away."), od->rights.maxawaymsglen); + errstr = g_strdup_printf(ngettext("The maximum away message length of %d byte " + "has been exceeded. Gaim has truncated it for you.", + "The maximum away message length of %d bytes " + "has been exceeded. Gaim has truncated it for you.", + od->rights.maxawaymsglen), od->rights.maxawaymsglen); gaim_notify_warning(gc, NULL, _("Away message too long."), errstr); g_free(errstr); }
--- a/src/server.c Sat Jul 26 16:11:30 2003 +0000 +++ b/src/server.c Sat Jul 26 17:48:50 2003 +0000 @@ -871,7 +871,8 @@ int qtotal; qtotal = find_queue_total_by_name(qm->name); - g_snprintf(number, 32, _("(%d messages)"), qtotal); + g_snprintf(number, 32, ngettext("(%d message)", + "(%d messages)", qtotal), qtotal); g_snprintf(path, 10, "%d", row); gtk_tree_model_get_iter_from_string( GTK_TREE_MODEL(awayqueuestore), &iter, path);