comparison src/gtklog.c @ 10636:0f5c5e6fb27f

[gaim-migrate @ 12118] The strftime warnings fiunally got to me, so I made gaim_strftime to work around it. Turns out KingAnt had already discovered this solution for oscar.c but left it #iffed out. committer: Tailor Script <tailor@pidgin.im>
author Sean Egan <seanegan@gmail.com>
date Thu, 24 Feb 2005 01:11:17 +0000
parents 77ef3f2f0df8
children 6480697e907b
comparison
equal deleted inserted replaced
10635:6895c4212362 10636:0f5c5e6fb27f
30 #include "gtkblist.h" 30 #include "gtkblist.h"
31 #include "gtkimhtml.h" 31 #include "gtkimhtml.h"
32 #include "gtklog.h" 32 #include "gtklog.h"
33 #include "gtkutils.h" 33 #include "gtkutils.h"
34 #include "log.h" 34 #include "log.h"
35 #include "util.h"
35 36
36 static GHashTable *log_viewers = NULL; 37 static GHashTable *log_viewers = NULL;
37 static void populate_log_tree(GaimGtkLogViewer *lv); 38 static void populate_log_tree(GaimGtkLogViewer *lv);
38 static GaimGtkLogViewer *syslog_viewer = NULL; 39 static GaimGtkLogViewer *syslog_viewer = NULL;
39 40
94 if (gaim_strcasestr(read, search_term)) { 95 if (gaim_strcasestr(read, search_term)) {
95 GtkTreeIter iter; 96 GtkTreeIter iter;
96 GaimLog *log = logs->data; 97 GaimLog *log = logs->data;
97 char title[64]; 98 char title[64];
98 char *title_utf8; /* temporary variable for utf8 conversion */ 99 char *title_utf8; /* temporary variable for utf8 conversion */
99 strftime(title, sizeof(title), "%c", localtime(&log->time)); 100 gaim_strftime(title, sizeof(title), "%c", localtime(&log->time));
100 title_utf8 = gaim_utf8_try_convert(title); 101 title_utf8 = gaim_utf8_try_convert(title);
101 strncpy(title, title_utf8, sizeof(title)); 102 strncpy(title, title_utf8, sizeof(title));
102 g_free(title_utf8); 103 g_free(title_utf8);
103 gtk_tree_store_append (lv->treestore, &iter, NULL); 104 gtk_tree_store_append (lv->treestore, &iter, NULL);
104 gtk_tree_store_set(lv->treestore, &iter, 105 gtk_tree_store_set(lv->treestore, &iter,
181 if (!log) 182 if (!log)
182 return; 183 return;
183 184
184 read = gaim_log_read(log, &flags); 185 read = gaim_log_read(log, &flags);
185 viewer->flags = flags; 186 viewer->flags = flags;
186 strftime(time, sizeof(time), "%c", localtime(&log->time)); 187 gaim_strftime(time, sizeof(time), "%c", localtime(&log->time));
187 title = g_strdup_printf("%s - %s", log->name, time); 188 title = g_strdup_printf("%s - %s", log->name, time);
188 title_utf8 = gaim_utf8_try_convert(title); 189 title_utf8 = gaim_utf8_try_convert(title);
189 g_free(title); 190 g_free(title);
190 title = title_utf8; 191 title = title_utf8;
191 gtk_window_set_title(GTK_WINDOW(viewer->window), title); 192 gtk_window_set_title(GTK_WINDOW(viewer->window), title);
221 GtkTreeIter toplevel, child; 222 GtkTreeIter toplevel, child;
222 GList *logs = lv->logs; 223 GList *logs = lv->logs;
223 while (logs) { 224 while (logs) {
224 GaimLog *log = logs->data; 225 GaimLog *log = logs->data;
225 226
226 strftime(month, sizeof(month), "%B %Y", localtime(&log->time)); 227 gaim_strftime(month, sizeof(month), "%B %Y", localtime(&log->time));
227 strftime(title, sizeof(title), "%c", localtime(&log->time)); 228 gaim_strftime(title, sizeof(title), "%c", localtime(&log->time));
228 229
229 /* do utf8 conversions */ 230 /* do utf8 conversions */
230 utf8_tmp = gaim_utf8_try_convert(month); 231 utf8_tmp = gaim_utf8_try_convert(month);
231 strncpy(month, utf8_tmp, sizeof(month)); 232 strncpy(month, utf8_tmp, sizeof(month));
232 g_free(utf8_tmp); 233 g_free(utf8_tmp);