Mercurial > pidgin.yaz
annotate src/gtklog.c @ 9465:8a4797a608ae
[gaim-migrate @ 10290]
1) Fixes the parsing for Win32 clipboard format so that we more accurately
grab the right text
2) Revises our Win32 clipboard format conversion to act more like IE,
since this is as close as we will get to "the right way"
3) Makes clipboard pasting not paste HTML comments (this one effects
linux too, and fixes a problem i've seen pasting from oo.o)
committer: Tailor Script <tailor@pidgin.im>
author | Tim Ringenbach <marv@pidgin.im> |
---|---|
date | Wed, 07 Jul 2004 01:35:27 +0000 |
parents | 5635f71aa5db |
children | abacf29577b2 |
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 */ | |
25 | |
26 #include "gtkinternal.h" | |
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); | |
73 | |
74 if (lv->search) | |
75 g_free(lv->search); | |
76 | |
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 } | |
84 | |
85 lv->search = g_strdup(search_term); | |
86 | |
87 gdk_window_set_cursor(lv->window->window, cursor); | |
88 while (gtk_events_pending()) | |
89 gtk_main_iteration(); | |
90 gdk_cursor_unref(cursor); | |
91 | |
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, | |
106 1, log, -1); | |
107 } | |
108 } | |
109 | |
110 | |
111 cursor = gdk_cursor_new(GDK_LEFT_PTR); | |
112 gdk_window_set_cursor(lv->window->window, cursor); | |
113 gdk_cursor_unref(cursor); | |
114 } | |
115 | |
7454 | 116 static gboolean destroy_cb(GtkWidget *w, gint resp, struct log_viewer_hash_t *ht) { |
8573 | 117 GaimGtkLogViewer *lv = syslog_viewer; |
7454 | 118 |
8573 | 119 if(ht != NULL){ |
120 lv = g_hash_table_lookup(log_viewers, ht); | |
121 g_hash_table_remove(log_viewers, ht); | |
122 g_free(ht->screenname); | |
123 g_free(ht); | |
124 } else | |
125 syslog_viewer = NULL; | |
126 | |
7535 | 127 while (lv->logs) { |
7533 | 128 GaimLog *log = lv->logs->data; |
7535 | 129 GList *logs2; |
7685 | 130 gaim_log_free(log); |
7535 | 131 logs2 = lv->logs->next; |
132 g_list_free_1(lv->logs); | |
133 lv->logs = logs2; | |
7533 | 134 } |
7535 | 135 if (lv->search) |
136 g_free(lv->search); | |
8573 | 137 g_free(lv); |
7454 | 138 gtk_widget_destroy(w); |
139 | |
140 return TRUE; | |
141 } | |
8573 | 142 #if 0 |
143 static gboolean destroy_syslog_cb(GtkWidget *w, gint resp, void *cb) | |
144 { | |
145 while (syslog_viewer->logs) { | |
146 GaimLog *log = syslog_viewer->logs->data; | |
147 GList *logs2; | |
148 gaim_log_free(log); | |
149 logs2 = syslog_viewer->logs->next; | |
150 g_list_free_1(syslog_viewer->logs); | |
151 syslog_viewer->logs = logs2; | |
152 } | |
153 if (syslog_viewer->search) | |
154 g_free(syslog_viewer->search); | |
155 g_free(syslog_viewer); | |
156 syslog_viewer = NULL; | |
157 gtk_widget_destroy(w); | |
7454 | 158 |
8573 | 159 return TRUE; |
160 } | |
161 #endif | |
7454 | 162 static void log_select_cb(GtkTreeSelection *sel, GaimGtkLogViewer *viewer) { |
7432 | 163 GtkTreeIter iter; |
164 GValue val = { 0, }; | |
165 GtkTreeModel *model = GTK_TREE_MODEL(viewer->treestore); | |
166 GaimLog *log = NULL; | |
167 GaimLogReadFlags flags; | |
168 char *read = NULL; | |
169 char time[64]; | |
170 | |
171 char *title; | |
7676 | 172 char *title_utf8; /* temporary variable for utf8 conversion */ |
7432 | 173 |
174 if (! gtk_tree_selection_get_selected (sel, &model, &iter)) | |
175 return; | |
176 gtk_tree_model_get_value (model, &iter, 1, &val); | |
177 log = g_value_get_pointer(&val); | |
178 g_value_unset(&val); | |
179 | |
180 if (!log) | |
181 return; | |
182 | |
183 read = gaim_log_read(log, &flags); | |
184 viewer->flags = flags; | |
185 strftime(time, sizeof(time), "%c", localtime(&log->time)); | |
186 title = g_strdup_printf("%s - %s", log->name, time); | |
7676 | 187 title_utf8 = gaim_utf8_try_convert(title); |
188 g_free(title); | |
189 title = title_utf8; | |
7432 | 190 gtk_window_set_title(GTK_WINDOW(viewer->window), title); |
191 gtk_imhtml_clear(GTK_IMHTML(viewer->imhtml)); | |
192 gtk_imhtml_append_text(GTK_IMHTML(viewer->imhtml), read, | |
193 GTK_IMHTML_NO_COMMENTS | GTK_IMHTML_NO_TITLE | GTK_IMHTML_NO_SCROLL | | |
194 ((flags & GAIM_LOG_READ_NO_NEWLINE) ? GTK_IMHTML_NO_NEWLINE : 0)); | |
7535 | 195 |
196 if (viewer->search) | |
7537
083427fd8ba8
[gaim-migrate @ 8150]
Christian Hammond <chipx86@chipx86.com>
parents:
7535
diff
changeset
|
197 gtk_imhtml_search_find(GTK_IMHTML(viewer->imhtml), viewer->search); |
7535 | 198 |
7432 | 199 g_free(read); |
200 g_free(title); | |
201 } | |
202 | |
203 /* I want to make this smarter, but haven't come up with a cool algorithm to do so, yet. | |
204 * I want the tree to be divided into groups like "Today," "Yesterday," "Last week," | |
205 * "August," "2002," etc. based on how many conversation took place in each subdivision. | |
206 * | |
207 * For now, I'll just make it a flat list. | |
208 */ | |
209 static void populate_log_tree(GaimGtkLogViewer *lv) | |
210 /* Logs are made from trees in real life. | |
211 This is a tree made from logs */ | |
212 { | |
9435 | 213 char month[30]; |
7440 | 214 char title[64]; |
9435 | 215 char prev_top_month[30]; |
216 char *utf8_tmp; /* temporary variable for utf8 conversion */ | |
217 GtkTreeIter toplevel, child; | |
7432 | 218 GList *logs = lv->logs; |
219 while (logs) { | |
220 GaimLog *log = logs->data; | |
9435 | 221 |
222 strftime(month, sizeof(month), "%B %Y", localtime(&log->time)); | |
7432 | 223 strftime(title, sizeof(title), "%c", localtime(&log->time)); |
9435 | 224 |
225 /* do utf8 conversions */ | |
226 utf8_tmp = gaim_utf8_try_convert(month); | |
227 strncpy(month, utf8_tmp, sizeof(month)); | |
228 utf8_tmp = gaim_utf8_try_convert(title); | |
229 strncpy(title, utf8_tmp, sizeof(title)); | |
230 g_free(utf8_tmp); | |
231 | |
232 if (strncmp(month, prev_top_month, sizeof(month)) != 0) { | |
233 /* top level */ | |
234 gtk_tree_store_append(lv->treestore, &toplevel, NULL); | |
235 gtk_tree_store_set(lv->treestore, &toplevel, 0, month, 1, NULL, -1); | |
236 | |
237 /* sub */ | |
238 gtk_tree_store_append(lv->treestore, &child, &toplevel); | |
239 gtk_tree_store_set(lv->treestore, &child, 0, title, 1, log, -1); | |
240 | |
241 strncpy(prev_top_month, month, sizeof(prev_top_month)); | |
242 } else { | |
243 gtk_tree_store_append(lv->treestore, &child, &toplevel); | |
244 gtk_tree_store_set(lv->treestore, &child, 0, title, 1, log, -1); | |
245 } | |
246 | |
7432 | 247 logs = logs->next; |
248 } | |
249 } | |
250 | |
251 void gaim_gtk_log_show(const char *screenname, GaimAccount *account) { | |
252 /* if (log_viewers && g_hash_table */ | |
253 GtkWidget *hbox, *vbox; | |
254 GdkPixbuf *pixbuf, *scale; | |
255 GtkCellRenderer *rend; | |
256 GtkTreeViewColumn *col; | |
257 GaimGtkLogViewer *lv = NULL; | |
258 GtkTreeSelection *sel; | |
259 GtkWidget *icon, *label, *pane, *sw, *button; | |
260 GList *logs; | |
261 char *text; | |
7436 | 262 struct log_viewer_hash_t *ht = g_new0(struct log_viewer_hash_t, 1); |
263 | |
7432 | 264 ht->screenname = g_strdup(screenname); |
265 ht->account = account; | |
266 | |
267 if (!log_viewers) { | |
268 log_viewers = g_hash_table_new(log_viewer_hash, log_viewer_equal); | |
269 } else if ((lv = g_hash_table_lookup(log_viewers, ht))) { | |
270 gtk_window_present(GTK_WINDOW(lv->window)); | |
271 return; | |
272 } | |
273 | |
274 lv = g_new0(GaimGtkLogViewer, 1); | |
8898 | 275 lv->logs = logs = gaim_log_get_logs(GAIM_LOG_IM, screenname, account); |
7432 | 276 g_hash_table_insert(log_viewers, ht, lv); |
277 | |
278 /* Window ***********/ | |
279 lv->window = gtk_dialog_new_with_buttons(screenname, NULL, 0, | |
280 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); | |
281 gtk_container_set_border_width (GTK_CONTAINER(lv->window), 6); | |
282 gtk_dialog_set_has_separator(GTK_DIALOG(lv->window), FALSE); | |
283 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(lv->window)->vbox), 0); | |
7454 | 284 g_signal_connect(G_OBJECT(lv->window), "response", |
285 G_CALLBACK(destroy_cb), ht); | |
286 | |
7432 | 287 hbox = gtk_hbox_new(FALSE, 6); |
288 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); | |
289 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), hbox, FALSE, FALSE, 0); | |
290 | |
291 /* Icon *************/ | |
292 pixbuf = create_prpl_icon(account); | |
293 scale = gdk_pixbuf_scale_simple(pixbuf, 16, 16, GDK_INTERP_BILINEAR); | |
294 icon = gtk_image_new_from_pixbuf(scale); | |
295 gtk_box_pack_start(GTK_BOX(hbox), icon, FALSE, FALSE, 0); | |
296 g_object_unref(G_OBJECT(pixbuf)); | |
297 g_object_unref(G_OBJECT(scale)); | |
298 | |
299 /* Label ************/ | |
300 label = gtk_label_new(NULL); | |
301 text = g_strdup_printf("<span size='larger' weight='bold'>%s %s</span>", | |
302 _("Conversations with"), screenname); | |
303 gtk_label_set_markup(GTK_LABEL(label), text); | |
304 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
305 g_free(text); | |
306 | |
307 /* Pane *************/ | |
308 pane = gtk_hpaned_new(); | |
309 gtk_container_set_border_width(GTK_CONTAINER(pane), 6); | |
310 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(lv->window)->vbox), pane, TRUE, TRUE, 0); | |
311 | |
312 /* List *************/ | |
313 sw = gtk_scrolled_window_new (NULL, NULL); | |
314 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); | |
315 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
316 gtk_paned_add1(GTK_PANED(pane), sw); | |
317 lv->treestore = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); | |
318 lv->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (lv->treestore)); | |
319 rend = gtk_cell_renderer_text_new(); | |
320 col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); | |
321 gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col); | |
322 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE); | |
323 gtk_container_add (GTK_CONTAINER (sw), lv->treeview); | |
324 populate_log_tree(lv); | |
325 | |
326 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview)); | |
327 g_signal_connect (G_OBJECT (sel), "changed", | |
7454 | 328 G_CALLBACK (log_select_cb), |
7432 | 329 lv); |
8577 | 330 |
7432 | 331 /* Viewer ************/ |
332 vbox = gtk_vbox_new(FALSE, 6); | |
333 gtk_paned_add2(GTK_PANED(pane), vbox); | |
334 sw = gtk_scrolled_window_new(NULL, NULL); | |
335 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
336 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
337 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
338 lv->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 339 gtk_widget_set_name(lv->imhtml, "gaim_gtklog_imhtml"); |
7432 | 340 gtk_container_add(GTK_CONTAINER(sw), lv->imhtml); |
341 gaim_setup_imhtml(lv->imhtml); | |
342 gtk_widget_set_size_request(lv->imhtml, 320, 200); | |
343 | |
344 /* Search box **********/ | |
345 hbox = gtk_hbox_new(FALSE, 6); | |
346 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
347 lv->entry = gtk_entry_new(); | |
348 gtk_box_pack_start(GTK_BOX(hbox), lv->entry, TRUE, TRUE, 0); | |
9010 | 349 g_signal_connect(GTK_ENTRY(lv->entry), "activate", |
350 G_CALLBACK (search_cb), lv); | |
7432 | 351 button = gtk_button_new_from_stock(GTK_STOCK_FIND); |
9010 | 352 g_signal_connect (GTK_BUTTON (button), "activate", |
353 G_CALLBACK (search_cb), lv); | |
9192 | 354 g_signal_connect (GTK_BUTTON (button), "clicked", |
355 G_CALLBACK (search_cb), lv); | |
7432 | 356 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
8137 | 357 gaim_set_accessible_label (lv->treeview, label); |
7432 | 358 |
359 gtk_widget_show_all(lv->window); | |
360 } | |
8573 | 361 |
362 void gaim_gtk_syslog_show() | |
363 { | |
364 GtkWidget *hbox, *vbox; | |
365 GtkCellRenderer *rend; | |
366 GtkTreeViewColumn *col; | |
367 GtkTreeSelection *sel; | |
368 GtkWidget *label, *pane, *sw, *button; | |
369 char *text; | |
370 GList *accounts = NULL; | |
371 | |
372 if(syslog_viewer){ | |
373 gtk_window_present(GTK_WINDOW(syslog_viewer->window)); | |
374 return; | |
375 } | |
376 | |
377 syslog_viewer = g_new0(GaimGtkLogViewer, 1); | |
378 | |
379 for(accounts = gaim_accounts_get_all(); accounts != NULL; | |
380 accounts = accounts->next) { | |
381 GList *logs; | |
382 GaimAccount *account = (GaimAccount *)accounts->data; | |
383 if(!gaim_find_prpl(gaim_account_get_protocol_id(account))) | |
384 continue; | |
385 | |
386 logs = gaim_log_get_system_logs(account); | |
387 syslog_viewer->logs = g_list_concat(syslog_viewer->logs, logs); | |
388 } | |
389 syslog_viewer->logs = g_list_sort(syslog_viewer->logs, gaim_log_compare); | |
390 | |
391 /* Window ***********/ | |
392 syslog_viewer->window = gtk_dialog_new_with_buttons(_("System Log"), NULL, 0, | |
393 GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); | |
394 gtk_container_set_border_width (GTK_CONTAINER(syslog_viewer->window), 6); | |
395 gtk_dialog_set_has_separator(GTK_DIALOG(syslog_viewer->window), FALSE); | |
396 gtk_box_set_spacing(GTK_BOX(GTK_DIALOG(syslog_viewer->window)->vbox), 0); | |
397 g_signal_connect(G_OBJECT(syslog_viewer->window), "response", | |
398 G_CALLBACK(destroy_cb), NULL); | |
399 | |
400 hbox = gtk_hbox_new(FALSE, 6); | |
401 gtk_container_set_border_width(GTK_CONTAINER(hbox), 6); | |
402 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(syslog_viewer->window)->vbox), hbox, | |
403 FALSE, FALSE, 0); | |
404 | |
405 /* Label ************/ | |
406 label = gtk_label_new(NULL); | |
407 text = g_strdup_printf("<span size='larger' weight='bold'>%s</span>", | |
408 _("System Log")); | |
409 gtk_label_set_markup(GTK_LABEL(label), text); | |
410 gtk_box_pack_start(GTK_BOX(hbox), label, FALSE, FALSE, 0); | |
411 g_free(text); | |
412 | |
413 /* Pane *************/ | |
414 pane = gtk_hpaned_new(); | |
415 gtk_container_set_border_width(GTK_CONTAINER(pane), 6); | |
416 gtk_box_pack_start(GTK_BOX(GTK_DIALOG(syslog_viewer->window)->vbox), pane, | |
417 TRUE, TRUE, 0); | |
418 | |
419 /* List *************/ | |
420 sw = gtk_scrolled_window_new (NULL, NULL); | |
421 gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (sw), GTK_SHADOW_IN); | |
422 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
423 gtk_paned_add1(GTK_PANED(pane), sw); | |
424 syslog_viewer->treestore = gtk_tree_store_new (2, G_TYPE_STRING, G_TYPE_POINTER); | |
425 syslog_viewer->treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (syslog_viewer->treestore)); | |
426 rend = gtk_cell_renderer_text_new(); | |
427 col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); | |
428 gtk_tree_view_append_column (GTK_TREE_VIEW(syslog_viewer->treeview), col); | |
429 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (syslog_viewer->treeview), FALSE); | |
430 gtk_container_add (GTK_CONTAINER (sw), syslog_viewer->treeview); | |
431 | |
432 gtk_widget_set_size_request(syslog_viewer->treeview, 170, 200); | |
433 populate_log_tree(syslog_viewer); | |
434 | |
435 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (syslog_viewer->treeview)); | |
436 g_signal_connect (G_OBJECT (sel), "changed", | |
437 G_CALLBACK (log_select_cb), | |
438 syslog_viewer); | |
9005 | 439 |
8573 | 440 /* Viewer ************/ |
441 vbox = gtk_vbox_new(FALSE, 6); | |
442 gtk_paned_add2(GTK_PANED(pane), vbox); | |
443 sw = gtk_scrolled_window_new(NULL, NULL); | |
444 gtk_box_pack_start(GTK_BOX(vbox), sw, TRUE, TRUE, 0); | |
445 gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(sw), GTK_SHADOW_IN); | |
446 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(sw), GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); | |
447 syslog_viewer->imhtml = gtk_imhtml_new(NULL, NULL); | |
9005 | 448 gtk_widget_set_name(syslog_viewer->imhtml, "gaim_gtklog_imhtml"); |
8573 | 449 gtk_container_add(GTK_CONTAINER(sw), syslog_viewer->imhtml); |
450 gaim_setup_imhtml(syslog_viewer->imhtml); | |
451 gtk_widget_set_size_request(syslog_viewer->imhtml, 400, 200); | |
9005 | 452 |
8573 | 453 /* Search box **********/ |
454 hbox = gtk_hbox_new(FALSE, 6); | |
455 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | |
456 syslog_viewer->entry = gtk_entry_new(); | |
457 gtk_box_pack_start(GTK_BOX(hbox), syslog_viewer->entry, TRUE, TRUE, 0); | |
9010 | 458 g_signal_connect (GTK_ENTRY (syslog_viewer->entry), "activate", |
459 G_CALLBACK (search_cb), | |
460 syslog_viewer); | |
8573 | 461 button = gtk_button_new_from_stock(GTK_STOCK_FIND); |
9010 | 462 g_signal_connect (GTK_BUTTON (button), "activate", |
8573 | 463 G_CALLBACK (search_cb), |
464 syslog_viewer); | |
9192 | 465 g_signal_connect (GTK_BUTTON (button), "clicked", |
466 G_CALLBACK (search_cb), | |
467 syslog_viewer); | |
8573 | 468 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
469 | |
470 gtk_widget_show_all(syslog_viewer->window); | |
471 } | |
472 |