diff src/gtklog.c @ 13104:e1e5462b7d81

[gaim-migrate @ 15466] Rework lots of date parsing. I either introduced a whole lot of bugs, or I've made sure all dates are localized properly now. Only time will tell which it is... ;) committer: Tailor Script <tailor@pidgin.im>
author Richard Laager <rlaager@wiktel.com>
date Thu, 02 Feb 2006 19:50:51 +0000
parents 0aa231ebbfd5
children fcde3faa1f57
line wrap: on
line diff
--- a/src/gtklog.c	Thu Feb 02 19:39:12 2006 +0000
+++ b/src/gtklog.c	Thu Feb 02 19:50:51 2006 +0000
@@ -114,17 +114,10 @@
 		if (read && *read && gaim_strcasestr(read, search_term)) {
 			GtkTreeIter iter;
 			GaimLog *log = logs->data;
-			char title[64];
-			char *title_utf8; /* temporary variable for utf8 conversion */
-
-			gaim_strftime(title, sizeof(title), "%c", localtime(&log->time));
-			title_utf8 = gaim_utf8_try_convert(title);
-			strncpy(title, title_utf8, sizeof(title));
-			g_free(title_utf8);
 
 			gtk_tree_store_append (lv->treestore, &iter, NULL);
 			gtk_tree_store_set(lv->treestore, &iter,
-					   0, title,
+					   0, gaim_date_format_full(log->time),
 					   1, log, -1);
 		}
 		g_free(read);
@@ -181,7 +174,6 @@
 	GdkCursor *cursor;
 	GaimLogReadFlags flags;
 	char *read = NULL;
-	char time[64];
 
 	if (!gtk_tree_selection_get_selected(sel, &model, &iter))
 		return;
@@ -206,20 +198,12 @@
 
 	if (log->type != GAIM_LOG_SYSTEM) {
 		char *title;
-		char *title_utf8; /* temporary variable for utf8 conversion */
-
-		gaim_strftime(time, sizeof(time), "%c", localtime(&log->time));
-
 		if (log->type == GAIM_LOG_CHAT)
-			title = g_strdup_printf(_("Conversation in %s on %s"), log->name, time);
+			title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation in %s on %s</span>"),
+									log->name, gaim_date_format_full(log->time));
 		else
-			title = g_strdup_printf(_("Conversation with %s on %s"), log->name, time);
-
-		title_utf8 = gaim_utf8_try_convert(title);
-		g_free(title);
-
-		title = g_strdup_printf("<span size='larger' weight='bold'>%s</span>", title_utf8);
-		g_free(title_utf8);
+			title = g_strdup_printf(_("<span size='larger' weight='bold'>Conversation with %s on %s</span>"),
+									log->name, gaim_date_format_full(log->time));
 
 		gtk_label_set_markup(GTK_LABEL(viewer->label), title);
 		g_free(title);
@@ -259,28 +243,18 @@
      /* Logs are made from trees in real life.
         This is a tree made from logs */
 {
-	char month[30];
-	char title[64];
+	const char *month;
 	char prev_top_month[30] = "";
-	char *utf8_tmp; /* temporary variable for utf8 conversion */
 	GtkTreeIter toplevel, child;
 	GList *logs = lv->logs;
 
 	while (logs != NULL) {
 		GaimLog *log = logs->data;
 
-		gaim_strftime(month, sizeof(month), "%B %Y", localtime(&log->time));
-		gaim_strftime(title, sizeof(title), "%c", localtime(&log->time));
+		month = gaim_utf8_strftime(_("%B %Y"), localtime(&log->time));
 
-		/* do utf8 conversions */
-		utf8_tmp = gaim_utf8_try_convert(month);
-		strncpy(month, utf8_tmp, sizeof(month));
-		g_free(utf8_tmp);
-		utf8_tmp = gaim_utf8_try_convert(title);
-		strncpy(title, utf8_tmp, sizeof(title));
-		g_free(utf8_tmp);
-
-		if (strncmp(month, prev_top_month, sizeof(month)) != 0) {
+		if (strcmp(month, prev_top_month) != 0)
+		{
 			/* top level */
 			gtk_tree_store_append(lv->treestore, &toplevel, NULL);
 			gtk_tree_store_set(lv->treestore, &toplevel, 0, month, 1, NULL, -1);
@@ -290,7 +264,10 @@
 
 		/* sub */
 		gtk_tree_store_append(lv->treestore, &child, &toplevel);
-		gtk_tree_store_set(lv->treestore, &child, 0, title, 1, log, -1);
+		gtk_tree_store_set(lv->treestore, &child,
+						   0, gaim_date_format_full(log->time),
+						   1, log,
+						   -1);
 
 		logs = logs->next;
 	}