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