Mercurial > pidgin.yaz
comparison src/gtklog.c @ 7676:5c5acdf8b982
[gaim-migrate @ 8320]
Ambrose C. Li made the log viewer right for you international folk.
Thanks, Ambrose!
committer: Tailor Script <tailor@pidgin.im>
author | Sean Egan <seanegan@gmail.com> |
---|---|
date | Mon, 01 Dec 2003 00:09:48 +0000 |
parents | 083427fd8ba8 |
children | 9e122b8f564f |
comparison
equal
deleted
inserted
replaced
7675:66d9440db6ec | 7676:5c5acdf8b982 |
---|---|
90 char *read = gaim_log_read((GaimLog*)logs->data, NULL); | 90 char *read = gaim_log_read((GaimLog*)logs->data, NULL); |
91 if (gaim_strcasestr(read, search_term)) { | 91 if (gaim_strcasestr(read, search_term)) { |
92 GtkTreeIter iter; | 92 GtkTreeIter iter; |
93 GaimLog *log = logs->data; | 93 GaimLog *log = logs->data; |
94 char title[64]; | 94 char title[64]; |
95 char *title_utf8; /* temporary variable for utf8 conversion */ | |
95 strftime(title, sizeof(title), "%c", localtime(&log->time)); | 96 strftime(title, sizeof(title), "%c", localtime(&log->time)); |
97 title_utf8 = gaim_utf8_try_convert(title); | |
98 strncpy(title, title_utf8, sizeof(title)); | |
99 g_free(title_utf8); | |
96 gtk_tree_store_append (lv->treestore, &iter, NULL); | 100 gtk_tree_store_append (lv->treestore, &iter, NULL); |
97 gtk_tree_store_set(lv->treestore, &iter, | 101 gtk_tree_store_set(lv->treestore, &iter, |
98 0, title, | 102 0, title, |
99 1, log, -1); | 103 1, log, -1); |
100 } | 104 } |
137 GaimLogReadFlags flags; | 141 GaimLogReadFlags flags; |
138 char *read = NULL; | 142 char *read = NULL; |
139 char time[64]; | 143 char time[64]; |
140 | 144 |
141 char *title; | 145 char *title; |
146 char *title_utf8; /* temporary variable for utf8 conversion */ | |
142 | 147 |
143 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | 148 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) |
144 return; | 149 return; |
145 gtk_tree_model_get_value (model, &iter, 1, &val); | 150 gtk_tree_model_get_value (model, &iter, 1, &val); |
146 log = g_value_get_pointer(&val); | 151 log = g_value_get_pointer(&val); |
151 | 156 |
152 read = gaim_log_read(log, &flags); | 157 read = gaim_log_read(log, &flags); |
153 viewer->flags = flags; | 158 viewer->flags = flags; |
154 strftime(time, sizeof(time), "%c", localtime(&log->time)); | 159 strftime(time, sizeof(time), "%c", localtime(&log->time)); |
155 title = g_strdup_printf("%s - %s", log->name, time); | 160 title = g_strdup_printf("%s - %s", log->name, time); |
161 title_utf8 = gaim_utf8_try_convert(title); | |
162 g_free(title); | |
163 title = title_utf8; | |
156 gtk_window_set_title(GTK_WINDOW(viewer->window), title); | 164 gtk_window_set_title(GTK_WINDOW(viewer->window), title); |
157 gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml)); | 165 gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml)); |
158 gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read, | 166 gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read, |
159 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL | | 167 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL | |
160 ((flags & GAIM_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0)); | 168 ((flags & GAIM_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0)); |
175 static void populate_log_tree(GaimGtkLogViewer *lv) | 183 static void populate_log_tree(GaimGtkLogViewer *lv) |
176 /* Logs are made from trees in real life. | 184 /* Logs are made from trees in real life. |
177 This is a tree made from logs */ | 185 This is a tree made from logs */ |
178 { | 186 { |
179 char title[64]; | 187 char title[64]; |
188 char *title_utf8; /* temporary variable for utf8 conversion */ | |
180 GtkTreeIter iter; | 189 GtkTreeIter iter; |
181 GList *logs = lv->logs; | 190 GList *logs = lv->logs; |
182 while (logs) { | 191 while (logs) { |
183 GaimLog *log = logs->data; | 192 GaimLog *log = logs->data; |
184 strftime(title, sizeof(title), "%c", localtime(&log->time)); | 193 strftime(title, sizeof(title), "%c", localtime(&log->time)); |
194 title_utf8 = gaim_utf8_try_convert(title); | |
195 strncpy(title, title_utf8, sizeof(title)); | |
196 g_free(title_utf8); | |
185 gtk_tree_store_append (lv->treestore, &iter, NULL); | 197 gtk_tree_store_append (lv->treestore, &iter, NULL); |
186 gtk_tree_store_set(lv->treestore, &iter, | 198 gtk_tree_store_set(lv->treestore, &iter, |
187 0, title, | 199 0, title, |
188 1, log, -1); | 200 1, log, -1); |
189 logs = logs->next; | 201 logs = logs->next; |