Mercurial > pidgin
comparison src/gtklog.c @ 11402:3b95804caea4
[gaim-migrate @ 13637]
sf patch #1277682, from Peter McCurdy
Display most recent log by default in View Logs window
FANtastic!
committer: Tailor Script <tailor@pidgin.im>
author | Mark Doliner <mark@kingant.net> |
---|---|
date | Thu, 01 Sep 2005 02:32:14 +0000 |
parents | a511b77a368b |
children | 46265a317bd3 |
comparison
equal
deleted
inserted
replaced
11401:69b0378c79e0 | 11402:3b95804caea4 |
---|---|
330 GtkWidget *pane; | 330 GtkWidget *pane; |
331 GtkWidget *sw; | 331 GtkWidget *sw; |
332 GtkCellRenderer *rend; | 332 GtkCellRenderer *rend; |
333 GtkTreeViewColumn *col; | 333 GtkTreeViewColumn *col; |
334 GtkTreeSelection *sel; | 334 GtkTreeSelection *sel; |
335 GtkTreePath *path_to_first_log; | |
335 GtkWidget *vbox; | 336 GtkWidget *vbox; |
336 GtkWidget *frame; | 337 GtkWidget *frame; |
337 GtkWidget *hbox; | 338 GtkWidget *hbox; |
338 GtkWidget *button; | 339 GtkWidget *button; |
339 | 340 |
352 rend = gtk_cell_renderer_text_new(); | 353 rend = gtk_cell_renderer_text_new(); |
353 col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); | 354 col = gtk_tree_view_column_new_with_attributes ("time", rend, "markup", 0, NULL); |
354 gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col); | 355 gtk_tree_view_append_column (GTK_TREE_VIEW(lv->treeview), col); |
355 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE); | 356 gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (lv->treeview), FALSE); |
356 gtk_container_add (GTK_CONTAINER (sw), lv->treeview); | 357 gtk_container_add (GTK_CONTAINER (sw), lv->treeview); |
357 | 358 |
358 populate_log_tree(lv); | 359 populate_log_tree(lv); |
359 | 360 |
360 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview)); | 361 sel = gtk_tree_view_get_selection (GTK_TREE_VIEW (lv->treeview)); |
361 g_signal_connect (G_OBJECT (sel), "changed", | 362 g_signal_connect (G_OBJECT (sel), "changed", |
362 G_CALLBACK (log_select_cb), | 363 G_CALLBACK (log_select_cb), |
363 lv); | 364 lv); |
364 g_signal_connect (G_OBJECT(lv->treeview), "row-activated", | 365 g_signal_connect (G_OBJECT(lv->treeview), "row-activated", |
365 G_CALLBACK(log_row_activated_cb), | 366 G_CALLBACK(log_row_activated_cb), |
366 lv); | 367 lv); |
367 gaim_set_accessible_label(lv->treeview, lv->label); | 368 gaim_set_accessible_label(lv->treeview, lv->label); |
368 | 369 |
369 /* A fancy little box ************/ | 370 /* A fancy little box ************/ |
370 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); | 371 vbox = gtk_vbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
371 gtk_paned_add2(GTK_PANED(pane), vbox); | 372 gtk_paned_add2(GTK_PANED(pane), vbox); |
372 | 373 |
373 /* Viewer ************/ | 374 /* Viewer ************/ |
374 frame = gaim_gtk_create_imhtml(FALSE, &lv->imhtml, NULL); | 375 frame = gaim_gtk_create_imhtml(FALSE, &lv->imhtml, NULL); |
375 gtk_widget_set_name(lv->imhtml, "gaim_gtklog_imhtml"); | 376 gtk_widget_set_name(lv->imhtml, "gaim_gtklog_imhtml"); |
376 gtk_widget_set_size_request(lv->imhtml, 320, 200); | 377 gtk_widget_set_size_request(lv->imhtml, 320, 200); |
377 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); | 378 gtk_box_pack_start(GTK_BOX(vbox), frame, TRUE, TRUE, 0); |
378 gtk_widget_show(frame); | 379 gtk_widget_show(frame); |
379 | 380 |
380 /* Search box **********/ | 381 /* Search box **********/ |
381 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); | 382 hbox = gtk_hbox_new(FALSE, GAIM_HIG_BOX_SPACE); |
382 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); | 383 gtk_box_pack_start(GTK_BOX(vbox), hbox, FALSE, FALSE, 0); |
383 lv->entry = gtk_entry_new(); | 384 lv->entry = gtk_entry_new(); |
384 gtk_box_pack_start(GTK_BOX(hbox), lv->entry, TRUE, TRUE, 0); | 385 gtk_box_pack_start(GTK_BOX(hbox), lv->entry, TRUE, TRUE, 0); |
385 button = gtk_button_new_from_stock(GTK_STOCK_FIND); | 386 button = gtk_button_new_from_stock(GTK_STOCK_FIND); |
386 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); | 387 gtk_box_pack_start(GTK_BOX(hbox), button, FALSE, FALSE, 0); |
387 g_signal_connect(GTK_ENTRY(lv->entry), "activate", G_CALLBACK(search_cb), lv); | 388 g_signal_connect(GTK_ENTRY(lv->entry), "activate", G_CALLBACK(search_cb), lv); |
388 g_signal_connect(GTK_BUTTON(button), "activate", G_CALLBACK(search_cb), lv); | 389 g_signal_connect(GTK_BUTTON(button), "activate", G_CALLBACK(search_cb), lv); |
389 g_signal_connect(GTK_BUTTON(button), "clicked", G_CALLBACK(search_cb), lv); | 390 g_signal_connect(GTK_BUTTON(button), "clicked", G_CALLBACK(search_cb), lv); |
391 | |
392 /* Show most recent log **********/ | |
393 path_to_first_log = gtk_tree_path_new_from_string("0:0"); | |
394 if (path_to_first_log) | |
395 { | |
396 gtk_tree_view_expand_to_path(GTK_TREE_VIEW(lv->treeview), path_to_first_log); | |
397 gtk_tree_selection_select_path(sel, path_to_first_log); | |
398 gtk_tree_path_free(path_to_first_log); | |
399 } | |
400 | |
390 } else { | 401 } else { |
391 /* No logs were found. */ | 402 /* No logs were found. */ |
392 const char *log_preferences = NULL; | 403 const char *log_preferences = NULL; |
393 GtkWidget *label; | 404 GtkWidget *label; |
394 | 405 |
395 if (ht == NULL) { | 406 if (ht == NULL) { |
396 if (!gaim_prefs_get_bool("/core/logging/log_system")) | 407 if (!gaim_prefs_get_bool("/core/logging/log_system")) |
397 log_preferences = _("System events will only be logged if the <span style=\"italic\">Enable system log preference</span> is set."); | 408 log_preferences = _("System events will only be logged if the <span style=\"italic\">Enable system log preference</span> is set."); |
398 } else { | 409 } else { |