Mercurial > pidgin.yaz
annotate 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 |
rev | line source |
---|---|
7432 | 1 /** |
2 * @file gtklog.c GTK+ Log viewer | |
3 * @ingroup gtkui | |
4 * | |
5 * gaim | |
6 * | |
8046 | 7 * Gaim is the legal property of its developers, whose names are too numerous |
8 * to list here. Please refer to the COPYRIGHT file distributed with this | |
9 * source distribution. | |
7537
083427fd8ba8
[gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents:
7535
diff
changeset
|
10 * |
7432 | 11 * This program is free software; you can redistribute it and/or modify |
12 * it under the terms of the GNU General Public License as published by | |
13 * the Free Software Foundation; either version 2 of the License, or | |
14 * (at your option) any later version. | |
15 * | |
16 * This program is distributed in the hope that it will be useful, | |
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
19 * GNU General Public License for more details. | |
20 * | |
21 * You should have received a copy of the GNU General Public License | |
22 * along with this program; if not, write to the Free Software | |
23 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | |
24 */ | |
9791 | 25 #include "internal.h" |
26 #include "gtkgaim.h" | |
7432 | 27 |
28 #include "account.h" | |
29 #include "util.h" | |
30 #include "gtkblist.h" | |
31 #include "gtkimhtml.h" | |
32 #include "gtklog.h" | |
33 #include "gtkutils.h" | |
34 #include "log.h" | |
10636 | 35 #include "util.h" |
7432 | 36 |
37 static GHashTable *log_viewers = NULL; | |
7535 | 38 static void populate_log_tree(GaimGtkLogViewer *lv); |
8573 | 39 static GaimGtkLogViewer *syslog_viewer = NULL; |
7432 | 40 |
41 struct log_viewer_hash_t { | |
42 char *screenname; | |
43 GaimAccount *account; | |
44 }; | |
45 | |
7440 | 46 static guint log_viewer_hash(gconstpointer data) |
7432 | 47 { |
7440 | 48 const struct log_viewer_hash_t *viewer = data; |
7432 | 49 return g_str_hash(viewer->screenname) + g_str_hash(gaim_account_get_username(viewer->account)); |
7440 | 50 |
7432 | 51 } |
52 | |
7440 | 53 static gint log_viewer_equal(gconstpointer y, gconstpointer z) |
7432 | 54 { |
7440 | 55 const struct log_viewer_hash_t *a, *b; |
7432 | 56 int ret; |
7440 | 57 char *normal; |
58 | |
59 a = y; | |
60 b = z; | |
61 | |
62 normal = g_strdup(gaim_normalize(a->account, a->screenname)); | |
63 ret = (a->account == b->account) && | |
64 !strcmp(normal, gaim_normalize(b->account, b->screenname)); | |
7432 | 65 g_free(normal); |
66 return ret; | |
67 } | |
68 | |
7535 | 69 static void search_cb(GtkWidget *button, GaimGtkLogViewer *lv) |
70 { | |
71 const char *search_term = gtk_entry_get_text(GTK_ENTRY(lv->entry)); | |
72 GList *logs; | |
73 GdkCursor *cursor = gdk_cursor_new(GDK_WATCH); | |
10175 | 74 |
7535 | 75 if (lv->search) |
76 g_free(lv->search); | |
10175 | 77 |
7535 | 78 gtk_tree_store_clear(lv->treestore); |
79 if (strlen(search_term) == 0) {/* reset the tree */ | |
80 populate_log_tree(lv); | |
81 lv->search = NULL; | |
7537
083427fd8ba8
[gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents:
7535
diff
changeset
|
82 gtk_imhtml_search_clear(GTK_IMHTML(lv->imhtml)); |
7535 | 83 return; |
84 } | |
10175 | 85 |
7535 | 86 lv->search = g_strdup(search_term); |
10175 | 87 |
7535 | 88 gdk_window_set_cursor(lv->window->window, cursor); |
89 while (gtk_events_pending()) | |
90 gtk_main_iteration(); | |
91 gdk_cursor_unref(cursor); | |
10175 | 92 |
7535 | 93 for (logs = lv->logs; logs != NULL; logs = logs->next) { |
94 char *read = gaim_log_read((GaimLog*)logs->data, NULL); | |
95 if (gaim_strcasestr(read, search_term)) { | |
96 GtkTreeIter iter; | |
97 GaimLog *log = logs->data; | |
98 char title[64]; | |
7676 | 99 char *title_utf8; /* temporary variable for utf8 conversion */ |
10636 | 100 gaim_strftime(title, sizeof(title), "%c", localtime(&log->time)); |
7676 | 101 title_utf8 = gaim_utf8_try_convert(title); |
102 strncpy(title, title_utf8, sizeof(title)); | |
103 g_free(title_utf8); | |
7535 | 104 gtk_tree_store_append (lv->treestore, &iter, NULL); |
105 gtk_tree_store_set(lv->treestore, &iter, | |
106 0, title, | |
10175 | 107 1, log, -1); |
7535 | 108 } |
10574 | 109 g_free(read); |
7535 | 110 } |
10175 | 111 |
112 | |
7535 | 113 cursor = gdk_cursor_new(GDK_LEFT_PTR); |
114 gdk_window_set_cursor(lv->window->window, cursor); | |
115 gdk_cursor_unref(cursor); | |
116 } | |
117 | |
7454 | 118 static gboolean destroy_cb(GtkWidget *w, gint resp, struct log_viewer_hash_t *ht) { |
8573 | 119 GaimGtkLogViewer *lv = syslog_viewer; |
7454 | 120 |
8573 | 121 if(ht != NULL){ |
122 lv = g_hash_table_lookup(log_viewers, ht); | |
123 g_hash_table_remove(log_viewers, ht); | |
124 g_free(ht->screenname); | |
125 g_free(ht); | |
126 } else | |
127 syslog_viewer = NULL; | |
128 | |
7535 | 129 while (lv->logs) { |
7533 | 130 GaimLog *log = lv->logs->data; |
7535 | 131 GList *logs2; |
7685 | 132 gaim_log_free(log); |
7535 | 133 logs2 = lv->logs->next; |
134 g_list_free_1(lv->logs); | |
135 lv->logs = logs2; | |
7533 | 136 } |
7535 | 137 if (lv->search) |
138 g_free(lv->search); | |
8573 | 139 g_free(lv); |
7454 | 140 gtk_widget_destroy(w); |
141 | |
142 return TRUE; | |
143 } | |
8573 | 144 #if 0 |
145 static gboolean destroy_syslog_cb(GtkWidget *w, gint resp, void *cb) | |
146 { | |
147 while (syslog_viewer->logs) { | |
148 GaimLog *log = syslog_viewer->logs->data; | |
149 GList *logs2; | |
150 gaim_log_free(log); | |
151 logs2 = syslog_viewer->logs->next; | |
152 g_list_free_1(syslog_viewer->logs); | |
153 syslog_viewer->logs = logs2; | |
154 } | |
155 if (syslog_viewer->search) | |
156 g_free(syslog_viewer->search); | |
157 g_free(syslog_viewer); | |
158 syslog_viewer = NULL; | |
159 gtk_widget_destroy(w); | |
7454 | 160 |
8573 | 161 return TRUE; |
162 } | |
163 #endif | |
7454 | 164 static void log_select_cb(GtkTreeSelection *sel, GaimGtkLogViewer *viewer) { |
7432 | 165 GtkTreeIter iter; |
166 GValue val = { 0, }; | |
167 GtkTreeModel *model = GTK_TREE_MODEL(viewer->treestore); | |
168 GaimLog *log = NULL; | |
169 GaimLogReadFlags flags; | |
170 char *read = NULL; | |
171 char time[64]; | |
172 | |
173 char *title; | |
7676 | 174 char *title_utf8; /* temporary variable for utf8 conversion */ |
7432 | 175 |
176 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
177 return; | |
178 gtk_tree_model_get_value (model, &iter, 1, &val); | |
179 log = g_value_get_pointer(&val); | |
180 g_value_unset(&val); | |
181 | |
182 if (!log) | |
183 return; | |
184 | |
185 read = gaim_log_read(log, &flags); | |
186 viewer->flags = flags; | |
10636 | 187 gaim_strftime(time, sizeof(time), "%c", localtime(&log->time)); |
7432 | 188 title = g_strdup_printf("%s - %s", log->name, time); |
7676 | 189 title_utf8 = gaim_utf8_try_convert(title); |
190 g_free(title); | |
191 title = title_utf8; | |
7432 | 192 gtk_window_set_title(GTK_WINDOW(viewer->window), title); |
193 gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml)); | |
10574 | 194 gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read, |
10175 | 195 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL | |
7432 | 196 ((flags & GAIM_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0)); |
7535 | 197 |
198 if (viewer->search) | |
10574 | 199 { |
200 gtk_imhtml_search_clear(GTK_IMHTML(viewer->imhtml)); | |
7537
083427fd8ba8
[gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents:
7535
diff
changeset
|
201 gtk_imhtml_search_find(GTK_IMHTML(viewer->imhtml), viewer->search); |
10574 | 202 } |
10175 | 203 |
7432 | 204 g_free(read); |
205 g_free(title); | |
206 } | |
207 | |
208 /* I want to make this smarter, but haven't come up with a cool algorithm to do so, yet. | |
209 * I want the tree to be divided into groups like "Today," "Yesterday," "Last week," | |
210 * "August," "2002," etc. based on how many conversation took place in each subdivision. | |
211 * | |
212 * For now, I'll just make it a flat list. | |
213 */ | |
214 static void populate_log_tree(GaimGtkLogViewer *lv) | |
215 /* Logs are made from trees in real life. | |
216 This is a tree made from logs */ | |
217 { | |
9435 | 218 char month[30]; |
7440 | 219 char title[64]; |
9435 | 220 char prev_top_month[30]; |
221 char *utf8_tmp; /* temporary variable for utf8 conversion */ | |
222 GtkTreeIter toplevel, child; | |
7432 | 223 GList *logs = lv->logs; |
224 while (logs) { | |
225 GaimLog *log = logs->data; | |
10175 | 226 |
10636 | 227 gaim_strftime(month, sizeof(month), "%B %Y", localtime(&log->time)); |
228 gaim_strftime(title, sizeof(title), "%c", localtime(&log->time)); | |
10175 | 229 |
9435 | 230 /* do utf8 conversions */ |
231 utf8_tmp = gaim_utf8_try_convert(month); | |
232 strncpy(month, utf8_tmp, sizeof(month)); | |
10574 | 233 g_free(utf8_tmp); |
9435 | 234 utf8_tmp = gaim_utf8_try_convert(title); |
235 strncpy(title, utf8_tmp, sizeof(title)); | |
236 g_free(utf8_tmp); | |
10175 | 237 |
9435 | 238 if (strncmp(month, prev_top_month, sizeof(month)) != 0) { |
239 /* top level */ | |
240 gtk_tree_store_append(lv->treestore, &toplevel, NULL); | |
241 gtk_tree_store_set(lv->treestore, &toplevel, 0, month, 1, NULL, -1); | |
10175 | 242 |
9435 | 243 /* sub */ |
244 gtk_tree_store_append(lv->treestore, &child, &toplevel); | |
245 gtk_tree_store_set(lv->treestore, &child, 0, title, 1, log, -1); | |
10175 | 246 |
9435 | 247 strncpy(prev_top_month, month, sizeof(prev_top_month)); |
248 } else { | |
249 gtk_tree_store_append(lv->treestore, &child, &toplevel); | |
250 gtk_tree_store_set(lv->treestore, &child, 0, title, 1, log, -1); | |
251 } | |
10175 | 252 |
7432 | 253 logs = logs->next; |
254 } | |
255 } | |
256 | |
9917 | 257 void gaim_gtk_log_show(GaimLogType type, const char *screenname, GaimAccount *account) { |
7432 | 258 /* if (log_viewers && g_hash_table */ |
259 GtkWidget *hbox, *vbox; | |
260 GdkPixbuf *pixbuf, *scale; | |
261 GtkCellRenderer *rend; | |
262 GtkTreeViewColumn *col; | |
263 GaimGtkLogViewer *lv = NULL; | |
264 GtkTreeSelection *sel; | |
10181 | 265 GtkWidget *icon, *label, *pane, *sw, *button, *frame; |
7432 | 266 GList *logs; |
9624 | 267 char *text ,*ttext; |
7436 | 268 struct log_viewer_hash_t *ht = g_new0(struct log_viewer_hash_t, 1); |
269 | |
7432 | 270 ht->screenname = g_strdup(screenname); |
271 ht->account = account; | |
272 | |
273 if (!log_viewers) { | |
274 log_viewers = g_hash_table_new(log_viewer_hash, log_viewer_equal); | |
275 } else if ((lv = g_hash_table_lookup(log_viewers, ht))) { | |
276 gtk_window_present(GTK_WINDOW(lv->window)); | |
10181 | 277 g_free(ht); |
7432 | 278 return; |
279 } | |
280 | |
281 lv = g_new0(GaimGtkLogViewer, 1); | |
9917 | 282 lv->logs = logs = gaim_log_get_logs(type, screenname, account); |
7432 | 283 g_hash_table_insert(log_viewers, ht, lv); |
284 | |
285 /* Window ***********/ | |
10175 | 286 lv->window = gtk_dialog_new_with_buttons(screenname, NULL, 0, |
7432 | 287 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); |
288 gtk_container_set_border_width (GTK_CONTAINER(lv->window), 6); | |
289 gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); | |
290 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0); | |
10175 | 291 g_signal_connect(G_OBJECT(lv->window), "response", |
7454 | 292 G_CALLBACK(destroy_cb), ht); |
293 | |
7432 | 294 hbox = gtk_hbox_new(FALSE, 6); |
295 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); | |
296 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), hbox, FALSE, FALSE, 0); | |
297 | |
298 /* Icon *************/ | |
299 pixbuf = create_prpl_icon(account); | |
300 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); | |
301 icon = gtk_image_new_from_pixbuf(scale); | |
302 gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); | |
303 g_object_unref(G_OBJECT(pixbuf)); | |
304 g_object_unref(G_OBJECT(scale)); | |
305 | |
306 /* Label ************/ | |
307 label = gtk_label_new(NULL); | |
9624 | 308 |
309 ttext = g_strdup_printf(_("Conversations with %s"), screenname); | |
310 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>",ttext); | |
311 g_free(ttext); | |
312 | |
7432 | 313 gtk_label_set_markup(GTK_LABEL(label), text); |
314 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
315 g_free(text); | |
316 | |
317 /* Pane *************/ | |
318 pane = gtk_hpaned_new(); | |
319 gtk_container_set_border_width(GTK_CONTAINER(pane), 6); | |
320 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), pane, TRUE, TRUE, 0); | |
10175 | 321 |
7432 | 322 /* List *************/ |
323 sw = gtk_scrolled_window_new (NULL, NULL); | |
324 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); | |
325 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
326 gtk_paned_add1(GTK_PANED(pane), sw); | |
327 lv->treestore = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); | |
328 lv->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (lv->treestore)); | |
329 rend = gtk_cell_renderer_text_new(); | |
330 col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); | |
331 gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col); | |
332 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE); | |
333 gtk_container_add (GTK_CONTAINER (sw), lv->treeview); | |
334 populate_log_tree(lv); | |
335 | |
336 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview)); | |
337 g_signal_connect (G_OBJECT (sel), "changed", | |
7454 | 338 G_CALLBACK (log_select_cb), |
7432 | 339 lv); |
10181 | 340 gaim_set_accessible_label(lv->treeview, label); |
8577 | 341 |
10181 | 342 /* A fancy little box ************/ |
7432 | 343 vbox = gtk_vbox_new(FALSE, 6); |
344 gtk_paned_add2(GTK_PANED(pane), vbox); | |
10181 | 345 |
346 /* Viewer ************/ | |
347 frame = gaim_gtk_create_imhtml(FALSE, &lv->imhtml, NULL); | |
9005 | 348 gtk_widget_set_name(lv->imhtml, "gaim_gtklog_imhtml"); |
7432 | 349 gtk_widget_set_size_request(lv->imhtml, 320, 200); |
10181 | 350 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
351 gtk_widget_show(frame); | |
10175 | 352 |
7432 | 353 /* Search box **********/ |
354 hbox = gtk_hbox_new(FALSE, 6); | |
355 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
356 lv->entry = gtk_entry_new(); | |
357 gtk_box_pack_start(GTK_BOX(hbox), lv->entry, TRUE, TRUE, 0); | |
358 button = gtk_button_new_from_stock(GTK_STOCK_FIND); | |
359 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
10181 | 360 g_signal_connect(GTK_ENTRY(lv->entry), "activate", G_CALLBACK(search_cb), lv); |
361 g_signal_connect(GTK_BUTTON(button), "activate", G_CALLBACK(search_cb), lv); | |
362 g_signal_connect(GTK_BUTTON(button), "clicked", G_CALLBACK(search_cb), lv); | |
7432 | 363 |
364 gtk_widget_show_all(lv->window); | |
365 } | |
8573 | 366 |
367 void gaim_gtk_syslog_show() | |
368 { | |
369 GtkWidget *hbox, *vbox; | |
370 GtkCellRenderer *rend; | |
371 GtkTreeViewColumn *col; | |
372 GtkTreeSelection *sel; | |
10181 | 373 GtkWidget *label, *pane, *sw, *button, *frame; |
8573 | 374 char *text; |
375 GList *accounts = NULL; | |
376 | |
10181 | 377 if (syslog_viewer != NULL) { |
8573 | 378 gtk_window_present(GTK_WINDOW(syslog_viewer->window)); |
379 return; | |
380 } | |
381 | |
382 syslog_viewer = g_new0(GaimGtkLogViewer, 1); | |
383 | |
384 for(accounts = gaim_accounts_get_all(); accounts != NULL; | |
385 accounts = accounts->next) { | |
386 GList *logs; | |
387 GaimAccount *account = (GaimAccount *)accounts->data; | |
388 if(!gaim_find_prpl(gaim_account_get_protocol_id(account))) | |
389 continue; | |
390 | |
391 logs = gaim_log_get_system_logs(account); | |
392 syslog_viewer->logs = g_list_concat(syslog_viewer->logs, logs); | |
393 } | |
394 syslog_viewer->logs = g_list_sort(syslog_viewer->logs, gaim_log_compare); | |
395 | |
396 /* Window ***********/ | |
10175 | 397 syslog_viewer->window = gtk_dialog_new_with_buttons(_("System Log"), NULL, 0, |
8573 | 398 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); |
399 gtk_container_set_border_width (GTK_CONTAINER(syslog_viewer->window), 6); | |
400 gtk_dialog_set_has_separator(GTK_DIALOG(syslog_viewer->window), FALSE); | |
401 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(syslog_viewer->window)->vbox), 0); | |
10175 | 402 g_signal_connect(G_OBJECT(syslog_viewer->window), "response", |
8573 | 403 G_CALLBACK(destroy_cb), NULL); |
404 | |
405 hbox = gtk_hbox_new(FALSE, 6); | |
406 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); | |
407 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(syslog_viewer->window)->vbox), hbox, | |
408 FALSE, FALSE, 0); | |
409 | |
410 /* Label ************/ | |
411 label = gtk_label_new(NULL); | |
412 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>", | |
413 _("System Log")); | |
414 gtk_label_set_markup(GTK_LABEL(label), text); | |
415 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
416 g_free(text); | |
417 | |
418 /* Pane *************/ | |
419 pane = gtk_hpaned_new(); | |
420 gtk_container_set_border_width(GTK_CONTAINER(pane), 6); | |
421 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(syslog_viewer->window)->vbox), pane, | |
422 TRUE, TRUE, 0); | |
10175 | 423 |
8573 | 424 /* List *************/ |
425 sw = gtk_scrolled_window_new (NULL, NULL); | |
426 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); | |
427 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
428 gtk_paned_add1(GTK_PANED(pane), sw); | |
429 syslog_viewer->treestore = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); | |
430 syslog_viewer->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (syslog_viewer->treestore)); | |
431 rend = gtk_cell_renderer_text_new(); | |
432 col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); | |
433 gtk_tree_view_append_column (GTK_TREE_VIEW(syslog_viewer->treeview), col); | |
434 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (syslog_viewer->treeview), FALSE); | |
435 gtk_container_add (GTK_CONTAINER (sw), syslog_viewer->treeview); | |
436 | |
437 gtk_widget_set_size_request(syslog_viewer->treeview, 170, 200); | |
438 populate_log_tree(syslog_viewer); | |
439 | |
440 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (syslog_viewer->treeview)); | |
441 g_signal_connect (G_OBJECT (sel), "changed", | |
442 G_CALLBACK (log_select_cb), | |
443 syslog_viewer); | |
9005 | 444 |
10181 | 445 /* A fancy little box ************/ |
8573 | 446 vbox = gtk_vbox_new(FALSE, 6); |
447 gtk_paned_add2(GTK_PANED(pane), vbox); | |
10181 | 448 |
449 /* Viewer ************/ | |
450 frame = gaim_gtk_create_imhtml(FALSE, &syslog_viewer->imhtml, NULL); | |
9005 | 451 gtk_widget_set_name(syslog_viewer->imhtml, "gaim_gtklog_imhtml"); |
8573 | 452 gtk_widget_set_size_request(syslog_viewer->imhtml, 400, 200); |
10181 | 453 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
454 gtk_widget_show(frame); | |
9005 | 455 |
8573 | 456 /* Search box **********/ |
457 hbox = gtk_hbox_new(FALSE, 6); | |
458 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
459 syslog_viewer->entry = gtk_entry_new(); | |
460 gtk_box_pack_start(GTK_BOX(hbox), syslog_viewer->entry, TRUE, TRUE, 0); | |
461 button = gtk_button_new_from_stock(GTK_STOCK_FIND); | |
462 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | |
10181 | 463 g_signal_connect(GTK_ENTRY(syslog_viewer->entry), "activate", |
464 G_CALLBACK(search_cb), syslog_viewer); | |
465 g_signal_connect(GTK_BUTTON(button), "activate", | |
466 G_CALLBACK(search_cb), syslog_viewer); | |
467 g_signal_connect(GTK_BUTTON(button), "clicked", | |
468 G_CALLBACK(search_cb), syslog_viewer); | |
8573 | 469 |
10175 | 470 gtk_widget_show_all(syslog_viewer->window); |
8573 | 471 } |