changeset 2975:626729653436

[gaim-migrate @ 2988] I think I'm alone now ... committer: Tailor Script <tailor@pidgin.im>
author Rob Flynn <gaim@robflynn.com>
date Fri, 22 Feb 2002 23:47:55 +0000
parents 11f563b4153a
children 40014144f948
files src/dialogs.c src/gaim.h src/multi.c src/protocols/jabber/jabber.c
diffstat 4 files changed, 92 insertions(+), 81 deletions(-) [+]
line wrap: on
line diff
--- a/src/dialogs.c	Thu Feb 21 12:59:25 2002 +0000
+++ b/src/dialogs.c	Fri Feb 22 23:47:55 2002 +0000
@@ -4355,7 +4355,7 @@
 	GSList *found;
 	MultiEntryData *data;
 
-	if((found = g_slist_find_custom(*list, label, multi_entry_data_label_compare)) == NULL) {
+	if((found = g_slist_find_custom(*list, (void *)label, multi_entry_data_label_compare)) == NULL) {
 		if(add_it) {
 			data = (MultiEntryData *) g_slist_last(*list =
 				g_slist_append(*list, g_malloc(sizeof(MultiEntryData))))->data;
@@ -4408,7 +4408,7 @@
 	GSList *found;
 	MultiTextData *data;
 
-	if((found = g_slist_find_custom(*list, label, multi_text_data_label_compare)) == NULL) {
+	if((found = g_slist_find_custom(*list, (void *)label, multi_text_data_label_compare)) == NULL) {
 		if(add_it) {
 			data = (MultiTextData *) g_slist_last(*list =
 				g_slist_append(*list, g_malloc(sizeof(MultiTextData))))->data;
@@ -4443,6 +4443,7 @@
 	multi_text_items_free_all(&(b->multi_text_items));
 	g_free(b->instructions->text);
 	g_free(b->instructions);
+	g_free(b->entries_title);
 	g_free(b);
 }
 
@@ -4485,45 +4486,52 @@
 	GtkWidget *label;
 	GSList *multi_entry;
 	MultiEntryData *med;
-	int rows = 0;
-	int rowNum;
+	int rows, row_num, col_num, col_offset;
+	int cols = 1;
 
 	/* Figure-out number of rows needed for table */
-	rows = g_slist_length(multi_entry_items);
+	if((rows = g_slist_length(multi_entry_items)) > 9) {
+		rows /= 2;
+		++cols;
+	}
 
 	if(*entries_table != NULL) {
 		gtk_widget_destroy(GTK_WIDGET (*entries_table));
 	}
-	*entries_table = gtk_table_new(rows, 3, FALSE);
-	gtk_table_set_col_spacings(GTK_TABLE(*entries_table), 5);
-	gtk_table_set_row_spacings(GTK_TABLE(*entries_table), 5);
-	gtk_container_set_border_width(GTK_CONTAINER(*entries_table), 5);
+	*entries_table = gtk_table_new(rows, 3 * cols, FALSE);
 	gtk_container_add(GTK_CONTAINER (entries_frame), *entries_table);
 
-	for(rowNum = 0, multi_entry = multi_entry_items;
-		multi_entry != NULL; ++rowNum, multi_entry = multi_entry->next) {
-
-		med = (MultiEntryData *) multi_entry->data;
-
-		label = gtk_label_new(med->label);
-		gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 1.0, (gfloat) 0.5);
-		gtk_table_attach_defaults(GTK_TABLE (*entries_table), label, 0, 1, rowNum, rowNum +1);
-		gtk_widget_show(label);
-
-		label = gtk_label_new(": ");
-		gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 0.0, (gfloat) 0.5);
-		gtk_table_attach_defaults(GTK_TABLE (*entries_table), label, 1, 2, rowNum, rowNum +1);
-		gtk_widget_show(label);
-
-		med->widget = gtk_entry_new_with_max_length(50);
-		if(med->text != NULL) {
-			gtk_entry_set_text(GTK_ENTRY (med->widget), med->text);
+	for(col_num = 0, multi_entry = multi_entry_items; col_num < cols && multi_entry != NULL;
+			++col_num) {
+		col_offset = col_num * 3;
+		for(row_num = 0; row_num < rows && multi_entry != NULL;
+				++row_num, multi_entry = multi_entry->next) {
+
+			med = (MultiEntryData *) multi_entry->data;
+
+			label = gtk_label_new(med->label);
+			gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 1.0, (gfloat) 0.5);
+			gtk_table_attach_defaults(GTK_TABLE (*entries_table), label,
+				    col_offset, 1 + col_offset, row_num, row_num +1);
+			gtk_widget_show(label);
+
+			label = gtk_label_new(": ");
+			gtk_misc_set_alignment(GTK_MISC(label), (gfloat) 0.0, (gfloat) 0.5);
+			gtk_table_attach_defaults(GTK_TABLE (*entries_table), label,
+				1 + col_offset, 2 + col_offset, row_num, row_num +1);
+			gtk_widget_show(label);
+
+			med->widget = gtk_entry_new_with_max_length(50);
+			if(med->text != NULL) {
+				gtk_entry_set_text(GTK_ENTRY (med->widget), med->text);
+			}
+			gtk_entry_set_visibility(GTK_ENTRY (med->widget), med->visible);
+			gtk_entry_set_editable(GTK_ENTRY (med->widget), med->editable);
+			gtk_table_attach(GTK_TABLE (*entries_table), med->widget,
+				2 + col_offset, 3 + col_offset, row_num, row_num +1,
+				GTK_FILL|GTK_EXPAND, GTK_FILL|GTK_EXPAND, 5, 0);
+			gtk_widget_show(med->widget);
 		}
-		gtk_entry_set_visibility(GTK_ENTRY (med->widget), med->visible);
-		gtk_entry_set_editable(GTK_ENTRY (med->widget), med->editable);
-		gtk_table_attach_defaults(GTK_TABLE (*entries_table),
-			med->widget, 2, 3, rowNum, rowNum +1);
-		gtk_widget_show(med->widget);
 	}
 
 	gtk_widget_show(*entries_table);
@@ -4628,7 +4636,7 @@
 	gtk_box_pack_start(GTK_BOX (vbox), b->instructions->label, TRUE, TRUE, 5);
 	re_show_multi_entry_instr(b->instructions);
 
-	b->entries_frame = gtk_frame_new(NULL);
+	b->entries_frame = gtk_frame_new(b->entries_title);
 	gtk_box_pack_start(GTK_BOX (vbox), b->entries_frame, TRUE, TRUE, 5);
 	gtk_widget_show(b->entries_frame);
 	b->entries_table = NULL;
--- a/src/gaim.h	Thu Feb 21 12:59:25 2002 +0000
+++ b/src/gaim.h	Fri Feb 22 23:47:55 2002 +0000
@@ -467,6 +467,7 @@
 
 	GtkWidget *entries_table;		/* table widget containing m-e lables & entries */
 	GtkWidget *entries_frame;		/* frame widget containing the table widget */
+	gchar *entries_title;			/* title of multi-entries list */
 	GSList *multi_entry_items;		/* entry dialogs parameters */
 
 	GtkWidget *texts_ibox;			/* inner vbox containing multi-text frames */
--- a/src/multi.c	Thu Feb 21 12:59:25 2002 +0000
+++ b/src/multi.c	Fri Feb 22 23:47:55 2002 +0000
@@ -666,7 +666,7 @@
 	}
 
 	if(p->register_user != NULL) {
-		u->register_user = gtk_check_button_new_with_label("Register with server");
+		u->register_user = gtk_check_button_new_with_label(_("Register with server"));
 		gtk_toggle_button_set_state(GTK_TOGGLE_BUTTON(u->register_user), FALSE);
 		gtk_box_pack_start(GTK_BOX(vbox), u->register_user, FALSE, FALSE, 0);
 		gtk_widget_show(u->register_user);
--- a/src/protocols/jabber/jabber.c	Thu Feb 21 12:59:25 2002 +0000
+++ b/src/protocols/jabber/jabber.c	Fri Feb 22 23:47:55 2002 +0000
@@ -690,13 +690,13 @@
 
 	if((show = xmlnode_get_tag_data(p->x, "show")) != NULL) {
 		if (!strcasecmp(show, "away")) {
-			vshow = "Away";
+			vshow = _("Away");
 		} else if (!strcasecmp(show, "chat")) {
-			vshow = "Online";
+			vshow = _("Online");
 		} else if (!strcasecmp(show, "xa")) {
-			vshow = "Extended Away";
+			vshow = _("Extended Away");
 		} else if (!strcasecmp(show, "dnd")) {
-			vshow = "Do Not Disturb";
+			vshow = _("Do Not Disturb");
 		}
 	}
 
@@ -1085,7 +1085,7 @@
 	buddyname = g_strdup_printf("%s@%s", who->user, who->server);
 
 	if((g = xmlnode_get_tag(x, "group")) == NULL || (groupname = xmlnode_get_data(g)) == NULL) {
-		groupname = "Buddies";
+		groupname = _("Buddies");
 	}
 
 
@@ -1138,7 +1138,7 @@
 	if (jpacket_subtype(p) == JPACKET__RESULT) {
 		if (xmlnode_has_children(p->x)) {
 			xmlnode query = xmlnode_get_tag(p->x, "query");
-			set_login_progress(GJ_GC(gjc), 4, "Authenticating");
+			set_login_progress(GJ_GC(gjc), 4, _("Authenticating"));
 			if (!xmlnode_get_tag(query, "digest")) {
 				g_free(gjc->sid);
 				gjc->sid = NULL;
@@ -1175,7 +1175,7 @@
 				g_snprintf(msg, sizeof(msg), "%s", errmsg);
 			hide_login_progress(GJ_GC(gjc), msg);
 		} else {
-			hide_login_progress(GJ_GC(gjc), "Unknown login error");
+			hide_login_progress(GJ_GC(gjc), _("Unknown login error"));
 		}
 
 		jd->die = TRUE;
@@ -1405,14 +1405,14 @@
 {
 	switch (state) {
 	case JCONN_STATE_OFF:
-		hide_login_progress(GJ_GC(gjc), "Unable to connect");
+		hide_login_progress(GJ_GC(gjc), _("Unable to connect"));
 		signoff(GJ_GC(gjc));
 		break;
 	case JCONN_STATE_CONNECTED:
-		set_login_progress(GJ_GC(gjc), 2, "Connected");
+		set_login_progress(GJ_GC(gjc), 2, _("Connected"));
 		break;
 	case JCONN_STATE_ON:
-		set_login_progress(GJ_GC(gjc), 3, "Requesting Authentication Method");
+		set_login_progress(GJ_GC(gjc), 3, _("Requesting Authentication Method"));
 		gjab_reqauth(gjc);
 		break;
 	default:
@@ -1430,12 +1430,12 @@
 	jd->hash = g_hash_table_new(g_str_hash, g_str_equal);
 	jd->chats = NULL;	/* we have no chats yet */
 
-	set_login_progress(gc, 1, "Connecting");
+	set_login_progress(gc, 1, _("Connecting"));
 
 	if (!(jd->gjc = gjab_new(loginname, user->password, gc))) {
 		g_free(loginname);
 		debug_printf("jabber: unable to connect (jab_new failed)\n");
-		hide_login_progress(gc, "Unable to connect");
+		hide_login_progress(gc, _("Unable to connect"));
 		signoff(gc);
 		return;
 	}
@@ -1968,7 +1968,7 @@
 	*ap++ = g_strdup_printf("<B>Jabber ID:</B> %s<BR>\n", realwho);
 
 	if((status = g_hash_table_lookup(jd->hash, realwho)) == NULL) {
-		status = "Online";
+		status = _("Online");
 	}
 	*ap++ = g_strdup_printf("<B>Status:</B> %s<BR>\n", status);
 
@@ -2205,25 +2205,25 @@
 	char *ptag;			/* parent tag "path" text */
 	char *url;			/* vCard display format if URL */
 } vcard_template_data[] = {
-	{"Full Name",          NULL, TRUE, TRUE, "FN",        NULL,  NULL},
-	{"Family Name",        NULL, TRUE, TRUE, "FAMILY",    "N",   NULL},
-	{"Given Name",         NULL, TRUE, TRUE, "GIVEN",     "N",   NULL},
-	{"Nickname",           NULL, TRUE, TRUE, "NICKNAME",  NULL,  NULL},
-	{"URL",                NULL, TRUE, TRUE, "URL",       NULL,  "<A HREF=\"%s\">%s</A>"},
-	{"Street Address",     NULL, TRUE, TRUE, "STREET",    "ADR", NULL},
-	{"Extended Address",   NULL, TRUE, TRUE, "EXTADD",    "ADR", NULL},
-	{"Locality",           NULL, TRUE, TRUE, "LOCALITY",  "ADR", NULL},
-	{"Region",             NULL, TRUE, TRUE, "REGION",    "ADR", NULL},
-	{"Postal Code",        NULL, TRUE, TRUE, "PCODE",     "ADR", NULL},
-	{"Country",            NULL, TRUE, TRUE, "COUNTRY",   "ADR", NULL},
-	{"Telephone",          NULL, TRUE, TRUE, "TELEPHONE", NULL,  NULL},
-	{"Email",              NULL, TRUE, TRUE, "EMAIL",     NULL,  "<A HREF=\"mailto:%s\">%s</A>"},
-	{"Organization Name",  NULL, TRUE, TRUE, "ORGNAME",   "ORG", NULL},
-	{"Organization Unit",  NULL, TRUE, TRUE, "ORGUNIT",   "ORG", NULL},
-	{"Title",              NULL, TRUE, TRUE, "TITLE",     NULL,  NULL},
-	{"Role",               NULL, TRUE, TRUE, "ROLE",      NULL,  NULL},
-	{"Birthday",           NULL, TRUE, TRUE, "BDAY",      NULL,  NULL},
-	{"Description",        NULL, TRUE, TRUE, "DESC",      NULL,  NULL},
+	{N_("Full Name"),          NULL, TRUE, TRUE, "FN",        NULL,  NULL},
+	{N_("Family Name"),        NULL, TRUE, TRUE, "FAMILY",    "N",   NULL},
+	{N_("Given Name"),         NULL, TRUE, TRUE, "GIVEN",     "N",   NULL},
+	{N_("Nickname"),           NULL, TRUE, TRUE, "NICKNAME",  NULL,  NULL},
+	{N_("URL"),                NULL, TRUE, TRUE, "URL",       NULL,  "<A HREF=\"%s\">%s</A>"},
+	{N_("Street Address"),     NULL, TRUE, TRUE, "STREET",    "ADR", NULL},
+	{N_("Extended Address"),   NULL, TRUE, TRUE, "EXTADD",    "ADR", NULL},
+	{N_("Locality"),           NULL, TRUE, TRUE, "LOCALITY",  "ADR", NULL},
+	{N_("Region"),             NULL, TRUE, TRUE, "REGION",    "ADR", NULL},
+	{N_("Postal Code"),        NULL, TRUE, TRUE, "PCODE",     "ADR", NULL},
+	{N_("Country"),            NULL, TRUE, TRUE, "COUNTRY",   "ADR", NULL},
+	{N_("Telephone"),          NULL, TRUE, TRUE, "TELEPHONE", NULL,  NULL},
+	{N_("Email"),              NULL, TRUE, TRUE, "EMAIL",     NULL,  "<A HREF=\"mailto:%s\">%s</A>"},
+	{N_("Organization Name"),  NULL, TRUE, TRUE, "ORGNAME",   "ORG", NULL},
+	{N_("Organization Unit"),  NULL, TRUE, TRUE, "ORGUNIT",   "ORG", NULL},
+	{N_("Title"),              NULL, TRUE, TRUE, "TITLE",     NULL,  NULL},
+	{N_("Role"),               NULL, TRUE, TRUE, "ROLE",      NULL,  NULL},
+	{N_("Birthday"),           NULL, TRUE, TRUE, "BDAY",      NULL,  NULL},
+	{N_("Description"),        NULL, TRUE, TRUE, "DESC",      NULL,  NULL},
 	{"", NULL, TRUE, TRUE, "N",     NULL, NULL},
 	{"", NULL, TRUE, TRUE, "ADR",   NULL, NULL},
 	{"", NULL, TRUE, TRUE, "ORG",   NULL, NULL},
@@ -2248,7 +2248,8 @@
  * V-Card user instructions
  */
 static char *multi_entry_instructions =
-	"Enter the stuff you feel comfortable with.  Leave the rest blank.";
+	N_("All items below are optional. Enter only the information with which you feel comfortable");
+static char *entries_title = N_("User Identity");
 
 /*
  * Used by routines to parse an XML-encoded string into an xmlnode tree
@@ -2306,7 +2307,7 @@
 	}
 
 	if((status = g_hash_table_lookup(jd->hash, buddy)) == NULL) {
-		status = "Online";
+		status = _("Online");
 	}
 	*ap++ = g_strdup_printf("<B>Status:</B> %s<BR>\n", status);
 
@@ -2664,10 +2665,11 @@
 		g_free(user_info);
 	}
 
-	b->title = "Gaim - vCard Wizzard";
+	b->title = _("Gaim - Edit Jabber vCard");
 	b->wmclass_name = "set_info";
 	b->wmclass_class = "Gaim";
 	b->instructions->text = g_strdup(multi_entry_instructions);
+	b->entries_title = g_strdup(entries_title);
 
 	b->custom = (void *) jabber_format_info;
 
@@ -2737,7 +2739,7 @@
 		} else {
 			debug_printf("registration successful!\n");
 
-			hide_login_progress_notice(GJ_GC(gjc), "Server Registration successful!");
+			hide_login_progress_notice(GJ_GC(gjc), _("Server Registration successful!"));
 			/*
 			 * TBD: is this the correct way to do away with a
 			 * gaim_connection and all its associated memory
@@ -2764,7 +2766,7 @@
 				g_snprintf(msg, sizeof(msg), "%s", errmsg);
 			hide_login_progress(GJ_GC(gjc), msg);
 		} else {
-			hide_login_progress(GJ_GC(gjc), "Unknown registration error");
+			hide_login_progress(GJ_GC(gjc), _("Unknown registration error"));
 		}
 
 		jd->die = TRUE;
@@ -2840,19 +2842,19 @@
 {
 	switch (state) {
 	case JCONN_STATE_OFF:
-		hide_login_progress(GJ_GC(gjc), "Unable to connect");
+		hide_login_progress(GJ_GC(gjc), _("Unable to connect"));
 		signoff(GJ_GC(gjc));
 		break;
 	case JCONN_STATE_CONNECTED:
 		/*
 		 * TBD?
-		set_login_progress(GJ_GC(gjc), 2, "Connected");
+		set_login_progress(GJ_GC(gjc), 2, _("Connected"));
 		 */
 		break;
 	case JCONN_STATE_ON:
 		/*
 		 * TBD?
-		set_login_progress(GJ_GC(gjc), 3, "Requesting Authentication Method");
+		set_login_progress(GJ_GC(gjc), 3, _("Requesting Authentication Method"));
 		 */
 		gjab_reqreg(gjc);
 		/*
@@ -2884,7 +2886,7 @@
 	if ((jd->gjc = gjab_new(loginname, au->password, gc)) == NULL) {
 		g_free(loginname);
 		debug_printf("jabber: unable to connect (jab_new failed)\n");
-		hide_login_progress(gc, "Unable to connect");
+		hide_login_progress(gc, _("Unable to connect"));
 		signoff(gc);
 	} else {
 		gjab_state_handler(jd->gjc, jabber_handle_registration_state);
@@ -2902,12 +2904,12 @@
 
 static void jabber_do_action(struct gaim_connection *gc, char *act)
 {
-	if (!strcmp(act, "Set User Info")) {
+	if (!strcmp(act, _("Set User Info"))) {
 		jabber_setup_set_info(gc);
 	/*
-	} else if (!strcmp(act, "Set Dir Info")) {
+	} else if (!strcmp(act, _("Set Dir Info"))) {
 		show_set_dir(gc);
-	} else if (!strcmp(act, "Change Password")) {
+	} else if (!strcmp(act, _("Change Password"))) {
 		show_change_passwd(gc);
 	 */
 	}
@@ -2917,10 +2919,10 @@
 {
 	GList *m = NULL;
 
-	m = g_list_append(m, "Set User Info");
+	m = g_list_append(m, _("Set User Info"));
 	/*
-	m = g_list_append(m, "Set Dir Info");
-	m = g_list_append(m, "Change Password");
+	m = g_list_append(m, _("Set Dir Info"));
+	m = g_list_append(m, _("Change Password"));
 	 */
 
 	return m;