2 * Copyright (C) 2008 - 2016 The Geeqie Team
4 * Authors: Vladimir Nadvornik, Laurent Monin
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
21 #include "logwindow.h"
28 #include <gdk-pixbuf/gdk-pixbuf.h>
30 #include <glib-object.h>
39 #include "main-defines.h"
48 GtkWidget *scrolledwin;
50 GtkTextTag *color_tags[LOG_COUNT];
52 GtkWidget *regexp_box;
56 GtkWidget *timer_data;
57 GtkWidget *debug_level;
58 gint debug_value; /**< Not used */
59 GtkWidget *search_entry_box;
60 gboolean highlight_all;
63 enum LogWindowSearchDirection {
64 LOGWINDOW_SEARCH_BACKWARDS,
65 LOGWINDOW_SEARCH_FORWARDS
68 static LogWindow *logwindow = nullptr;
70 static void hide_cb(GtkWidget *, LogWindow *)
75 * @brief Handle escape and F1 keys
81 * If escape key pressed, hide log window. \n
82 * If no text selected, select the entire line. \n
83 * If F1 pressed, execute command line program: \n
84 * <options->log_window.action> <selected text>
87 static gboolean key_pressed(GtkWidget *, GdkEventKey *event, LogWindow *logwin)
91 GtkTextBuffer *buffer;
93 GtkTextIter chr_marker;
94 GtkTextIter chr_start;
95 GtkTextIter cursor_iter;
97 GtkTextIter line_start;
98 GtkTextMark *cursor_mark;
100 if (event && event->keyval == GDK_KEY_Escape)
101 gtk_widget_hide(logwin->window);
103 if (event && event->keyval == GDK_KEY_F1)
105 if (strlen(options->log_window.action) > 0)
107 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
109 if (!gtk_text_buffer_get_has_selection(buffer))
111 cursor_mark = gtk_text_buffer_get_insert(buffer);
112 gtk_text_buffer_get_iter_at_mark(buffer, &cursor_iter, cursor_mark);
114 line_start = cursor_iter;
115 gtk_text_iter_set_line_offset(&line_start, 0);
116 line_end = cursor_iter;
117 gtk_text_iter_forward_to_line_end(&line_end);
118 chr_marker = line_end;
119 gtk_text_buffer_select_range(buffer, &line_start, &line_end);
122 if (gtk_text_buffer_get_selection_bounds(gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text)), &chr_start, &chr_end))
124 sel_text = gtk_text_buffer_get_text( gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text)), &chr_start, &chr_end, FALSE);
126 cmd_line = g_strconcat(options->log_window.action, " \"", sel_text, "\"", NULL);
140 static void log_window_pause_cb(GtkWidget *, gpointer)
142 options->log_window.paused = !options->log_window.paused;
145 static void log_window_line_wrap_cb(GtkWidget *, gpointer data)
147 auto logwin = static_cast<LogWindow *>(data);
149 options->log_window.line_wrap = !options->log_window.line_wrap;
151 if (options->log_window.line_wrap)
153 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(logwin->text), GTK_WRAP_WORD);
157 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(logwin->text), GTK_WRAP_NONE);
161 static void log_window_timer_data_cb(GtkWidget *, gpointer)
163 options->log_window.timer_data = !options->log_window.timer_data;
166 static void log_window_regexp_cb(GtkWidget *text_entry, gpointer)
170 new_regexp = g_strdup(gq_gtk_entry_get_text(GTK_ENTRY(text_entry)));
171 set_regexp(new_regexp);
175 static void remove_green_bg(LogWindow *logwin)
177 GtkTextIter start_find;
178 GtkTextIter start_match;
179 GtkTextIter end_match;
180 GtkTextBuffer *buffer;
186 text = gq_gtk_entry_get_text(GTK_ENTRY(logwin->search_entry_box));
187 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
188 gtk_text_buffer_get_start_iter(buffer, &start_find);
190 while (gtk_text_iter_forward_search(&start_find, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr))
192 list = gtk_text_iter_get_tags(&start_match);
195 g_object_get(list->data, "name", &tag_name, NULL);
196 if (g_strcmp0(tag_name, "green_bg") == 0)
198 gtk_text_buffer_remove_tag_by_name(buffer, "green_bg", &start_match, &end_match);
204 offset = gtk_text_iter_get_offset(&end_match);
205 gtk_text_buffer_get_iter_at_offset(buffer, &start_find, offset);
209 static void search_activate_event(GtkEntry *, LogWindow *logwin)
211 GtkTextIter start_find;
212 GtkTextIter start_match;
213 GtkTextIter end_match;
214 GtkTextBuffer *buffer;
215 GtkTextMark *cursor_mark;
216 GtkTextIter cursor_iter;
220 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
221 text = gq_gtk_entry_get_text(GTK_ENTRY(logwin->search_entry_box));
223 if (logwin->highlight_all)
225 gtk_text_buffer_get_start_iter(buffer, &start_find);
227 while (gtk_text_iter_forward_search(&start_find, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr))
229 gtk_text_buffer_apply_tag_by_name(buffer, "gray_bg", &start_match, &end_match);
230 offset = gtk_text_iter_get_offset(&end_match);
231 gtk_text_buffer_get_iter_at_offset(buffer, &start_find, offset);
236 cursor_mark = gtk_text_buffer_get_insert(buffer);
237 gtk_text_buffer_get_iter_at_mark(buffer, &cursor_iter, cursor_mark);
239 if (gtk_text_iter_forward_search(&cursor_iter, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr))
241 gtk_text_buffer_apply_tag_by_name(buffer, "gray_bg", &start_match, &end_match);
246 static gboolean search_keypress_event(GtkWidget *, GdkEventKey *, LogWindow *logwin, LogWindowSearchDirection direction)
248 GtkTextIter start_find;
249 GtkTextIter start_match;
250 GtkTextIter end_match;
251 GtkTextIter start_sel;
254 GtkTextBuffer *buffer;
255 GtkTextMark *cursor_mark;
256 GtkTextIter cursor_iter;
258 gboolean match_found = FALSE;
261 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
262 gtk_text_buffer_get_start_iter(buffer, &start_find);
264 text = gq_gtk_entry_get_text(GTK_ENTRY(logwin->search_entry_box));
265 if (strlen(text) == 0)
267 selected = gtk_text_buffer_get_selection_bounds(buffer, &start_sel, &end_sel);
270 text = gtk_text_buffer_get_text(buffer, &start_sel, &end_sel, FALSE);
271 gq_gtk_entry_set_text(GTK_ENTRY(logwin->search_entry_box), text);
275 if (logwin->highlight_all)
277 while (gtk_text_iter_forward_search(&start_find, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr))
279 gtk_text_buffer_apply_tag_by_name(buffer, "gray_bg", &start_match, &end_match);
280 offset = gtk_text_iter_get_offset(&end_match);
281 gtk_text_buffer_get_iter_at_offset(buffer, &start_find, offset);
285 cursor_mark = gtk_text_buffer_get_insert(buffer);
286 gtk_text_buffer_get_iter_at_mark(buffer, &cursor_iter, cursor_mark);
288 if (direction == LOGWINDOW_SEARCH_BACKWARDS)
290 match_found = gtk_text_iter_backward_search( &cursor_iter, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr);
294 match_found = gtk_text_iter_forward_search( &cursor_iter, text, GTK_TEXT_SEARCH_VISIBLE_ONLY, &start_match, &end_match, nullptr);
299 remove_green_bg(logwin);
301 gtk_text_buffer_apply_tag_by_name(buffer, "green_bg", &start_match, &end_match);
303 if (direction == LOGWINDOW_SEARCH_BACKWARDS)
305 gtk_text_buffer_place_cursor(buffer, &start_match);
309 gtk_text_buffer_place_cursor(buffer, &end_match);
312 cursor_mark = gtk_text_buffer_get_insert(buffer);
313 gtk_text_view_scroll_to_mark(GTK_TEXT_VIEW(logwin->text), cursor_mark, 0.2, FALSE, 0.0, 0.0);
319 static gboolean backwards_keypress_event_cb(GtkWidget *widget, GdkEventKey *event, LogWindow *logwin)
321 search_keypress_event(widget, event, logwin, LOGWINDOW_SEARCH_BACKWARDS);
326 static gboolean forwards_keypress_event_cb(GtkWidget *widget, GdkEventKey *event, LogWindow *logwin)
328 search_keypress_event(widget, event, logwin, LOGWINDOW_SEARCH_FORWARDS);
333 static gboolean all_keypress_event_cb(GtkToggleButton *widget, LogWindow *logwin)
335 logwin->highlight_all = gtk_toggle_button_get_active(widget);
340 static gboolean debug_changed_cb(GtkSpinButton *widget, LogWindow *)
342 set_debug_level((gtk_spin_button_get_value(widget)));
347 static void search_entry_icon_cb(GtkEntry *, GtkEntryIconPosition pos, GdkEvent *, gpointer userdata)
349 auto logwin = static_cast<LogWindow *>(userdata);
350 GtkTextIter start_find;
351 GtkTextIter end_find;
352 GtkTextBuffer *buffer;
354 if (pos == GTK_ENTRY_ICON_SECONDARY)
356 gq_gtk_entry_set_text(GTK_ENTRY(logwin->search_entry_box), "");
358 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
359 gtk_text_buffer_get_start_iter(buffer, &start_find);
360 gtk_text_buffer_get_end_iter(buffer, &end_find);
361 gtk_text_buffer_remove_tag_by_name(buffer, "gray_bg", &start_find, &end_find);
362 gtk_text_buffer_remove_tag_by_name(buffer, "green_bg", &start_find, &end_find);
366 static void filter_entry_icon_cb(GtkEntry *entry, GtkEntryIconPosition, GdkEvent *, gpointer)
368 const gchar *blank = "";
369 gq_gtk_entry_set_text(entry, blank);
373 static LogWindow *log_window_create(LayoutWindow *lw)
377 GtkWidget *scrolledwin;
379 GtkTextBuffer *buffer;
384 GtkWidget *label = nullptr;
385 GtkWidget *search_box;
386 GtkWidget *backwards_button;
387 GtkWidget *forwards_button;
388 GtkWidget *all_button;
391 GtkWidget *image = nullptr;
393 logwin = g_new0(LogWindow, 1);
395 window = window_new("log", nullptr, nullptr, _("Log"));
397 win_vbox = gtk_box_new(GTK_ORIENTATION_VERTICAL, PREF_PAD_SPACE);
398 gq_gtk_container_add(GTK_WIDGET(window), win_vbox);
399 gtk_widget_show(win_vbox);
401 gtk_window_resize(GTK_WINDOW(window), lw->options.log_window.width, lw->options.log_window.height);
402 gq_gtk_window_move(GTK_WINDOW(window), lw->options.log_window.x, lw->options.log_window.y);
404 g_signal_connect(G_OBJECT(window), "delete_event",
405 G_CALLBACK(gtk_widget_hide_on_delete), NULL);
406 g_signal_connect(G_OBJECT(window), "key_press_event",
407 G_CALLBACK(key_pressed), logwin);
408 g_signal_connect(G_OBJECT(window), "hide",
409 G_CALLBACK(hide_cb), logwin);
410 gtk_widget_realize(window);
412 scrolledwin = gq_gtk_scrolled_window_new(nullptr, nullptr);
413 gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolledwin),
414 GTK_POLICY_NEVER, GTK_POLICY_ALWAYS);
415 gq_gtk_scrolled_window_set_shadow_type(GTK_SCROLLED_WINDOW(scrolledwin),
418 gq_gtk_box_pack_start(GTK_BOX(win_vbox), scrolledwin, TRUE, TRUE, 0);
419 gtk_widget_show(scrolledwin);
421 text = gtk_text_view_new();
422 gtk_text_view_set_editable(GTK_TEXT_VIEW(text), FALSE);
423 if (options->log_window.line_wrap)
425 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_WORD);
429 gtk_text_view_set_wrap_mode(GTK_TEXT_VIEW(text), GTK_WRAP_NONE);
431 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(text));
432 gtk_text_buffer_get_start_iter(buffer, &iter);
433 gtk_text_buffer_create_mark(buffer, "end", &iter, FALSE);
434 gq_gtk_container_add(GTK_WIDGET(scrolledwin), text);
435 gtk_widget_show(text);
438 gtk_text_buffer_create_tag(buffer, "gray_bg", "background", "gray", NULL);
439 gtk_text_buffer_create_tag(buffer, "green_bg", "background", "#00FF00", NULL);
441 hbox = pref_box_new(win_vbox, FALSE, GTK_ORIENTATION_HORIZONTAL, PREF_PAD_SPACE);
443 gtk_widget_show(hbox);
444 logwin->debug_level = pref_spin_new_int(hbox, _("Debug level:"), nullptr, 0, 4, 1, get_debug_level(), &logwin->debug_value);
445 g_signal_connect(logwin->debug_level, "value-changed", G_CALLBACK(debug_changed_cb), logwin);
447 logwin->pause = gtk_toggle_button_new();
448 label = gtk_label_new("Pause");
449 gtk_widget_set_tooltip_text(GTK_WIDGET(logwin->pause), _("Pause scrolling"));
450 gq_gtk_container_add(GTK_WIDGET(logwin->pause), label) ;
451 gq_gtk_box_pack_start(GTK_BOX(hbox),logwin->pause, FALSE, FALSE, 0) ;
452 g_signal_connect(logwin->pause, "toggled", G_CALLBACK(log_window_pause_cb), logwin);
453 gtk_widget_show_all(logwin->pause);
455 logwin->wrap = gtk_toggle_button_new();
456 label = gtk_label_new("Wrap");
457 gtk_widget_set_tooltip_text(GTK_WIDGET(logwin->wrap), _("Enable line wrap"));
458 gq_gtk_container_add(GTK_WIDGET(logwin->wrap), label) ;
459 gq_gtk_box_pack_start(GTK_BOX(hbox),logwin->wrap, FALSE, FALSE, 0) ;
460 g_signal_connect(logwin->wrap, "toggled", G_CALLBACK(log_window_line_wrap_cb), logwin);
461 gtk_widget_show_all(logwin->wrap);
463 logwin->timer_data = gtk_toggle_button_new();
464 label = gtk_label_new(_("Timer"));
465 gtk_widget_set_tooltip_text(GTK_WIDGET(logwin->timer_data), _("Enable timer data"));
466 gq_gtk_container_add(GTK_WIDGET(logwin->timer_data), label) ;
467 gq_gtk_box_pack_start(GTK_BOX(hbox),logwin->timer_data, FALSE, FALSE, 0) ;
468 if (options->log_window.timer_data)
470 gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(logwin->timer_data), TRUE);
472 g_signal_connect(logwin->timer_data, "toggled", G_CALLBACK(log_window_timer_data_cb), logwin);
473 gtk_widget_show_all(logwin->timer_data);
475 search_box = gtk_box_new(GTK_ORIENTATION_HORIZONTAL, 0);
476 gq_gtk_container_add(GTK_WIDGET(hbox), search_box);
477 gtk_widget_show(search_box);
479 logwin->search_entry_box = gtk_entry_new();
480 gq_gtk_box_pack_start(GTK_BOX(search_box), logwin->search_entry_box, FALSE, FALSE, 0);
481 gtk_widget_show(logwin->search_entry_box);
482 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(logwin->search_entry_box), GTK_ENTRY_ICON_PRIMARY, GQ_ICON_FIND);
483 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(logwin->search_entry_box), GTK_ENTRY_ICON_SECONDARY, GQ_ICON_CLEAR);
484 gtk_widget_show(search_box);
485 gtk_widget_set_tooltip_text(logwin->search_entry_box, _("Search for text in log window"));
486 g_signal_connect(logwin->search_entry_box, "icon-press", G_CALLBACK(search_entry_icon_cb), logwin);
487 g_signal_connect(logwin->search_entry_box, "activate", G_CALLBACK(search_activate_event), logwin);
489 theme = gtk_icon_theme_get_default();
490 pixbuf = gtk_icon_theme_load_icon(theme, GQ_ICON_PAN_UP, 20, GTK_ICON_LOOKUP_GENERIC_FALLBACK, nullptr);
491 image = gtk_image_new_from_pixbuf(pixbuf);
492 backwards_button = gtk_button_new();
493 gtk_button_set_image(GTK_BUTTON(backwards_button), GTK_WIDGET(image));
494 gtk_widget_set_tooltip_text(backwards_button, _("Search backwards"));
495 gq_gtk_box_pack_start(GTK_BOX(search_box), backwards_button, FALSE, FALSE, 0);
496 gtk_widget_show(backwards_button);
497 g_signal_connect(backwards_button, "button_release_event", G_CALLBACK(backwards_keypress_event_cb), logwin);
498 g_object_unref(pixbuf);
500 pixbuf = gtk_icon_theme_load_icon(theme, GQ_ICON_PAN_DOWN, 20, GTK_ICON_LOOKUP_GENERIC_FALLBACK, nullptr);
501 image = gtk_image_new_from_pixbuf(pixbuf);
502 forwards_button = gtk_button_new();
503 gtk_button_set_image(GTK_BUTTON(forwards_button), GTK_WIDGET(image));
504 gtk_widget_set_tooltip_text(forwards_button, _("Search forwards"));
505 gq_gtk_box_pack_start(GTK_BOX(search_box), forwards_button, FALSE, FALSE, 0);
506 gtk_widget_show(forwards_button);
507 g_signal_connect(forwards_button, "button_release_event", G_CALLBACK(forwards_keypress_event_cb), logwin);
508 g_object_unref(pixbuf);
510 pixbuf = gtk_icon_theme_load_icon(theme, "edit-select-all-symbolic", 20, GTK_ICON_LOOKUP_GENERIC_FALLBACK, nullptr);
511 image = gtk_image_new_from_pixbuf(pixbuf);
512 all_button = gtk_toggle_button_new();
513 gtk_button_set_image(GTK_BUTTON(all_button), GTK_WIDGET(image));
514 gtk_widget_set_tooltip_text(GTK_WIDGET(all_button), _("Highlight all"));
515 gq_gtk_box_pack_start(GTK_BOX(search_box), all_button, FALSE, FALSE, 0) ;
516 g_signal_connect(all_button, "toggled", G_CALLBACK(all_keypress_event_cb), logwin);
517 gtk_widget_show_all(all_button);
518 g_object_unref(pixbuf);
520 pref_label_new(hbox, _("Filter regexp"));
522 textbox = gtk_entry_new();
523 gq_gtk_box_pack_start(GTK_BOX(hbox), textbox, FALSE, FALSE, 0);
524 gtk_entry_set_icon_from_icon_name(GTK_ENTRY(textbox), GTK_ENTRY_ICON_SECONDARY, GQ_ICON_CLEAR);
525 gtk_widget_show(textbox);
526 g_signal_connect(G_OBJECT(textbox), "activate",
527 G_CALLBACK(log_window_regexp_cb), logwin);
528 g_signal_connect(textbox, "icon-press", G_CALLBACK(filter_entry_icon_cb), logwin);
531 logwin->window = window;
532 logwin->scrolledwin = scrolledwin;
535 logwin->regexp_box = textbox;
536 lw->log_window = logwin->window;
540 static void log_window_init(LogWindow *logwin)
542 GtkTextBuffer *buffer;
544 g_assert(logwin != nullptr);
546 buffer = gtk_text_view_get_buffer(GTK_TEXT_VIEW(logwin->text));
548 logwin->color_tags[LOG_NORMAL] = gtk_text_buffer_create_tag (buffer,
549 "black_foreground", "foreground", "black",
550 "family", "MonoSpace", NULL);
551 logwin->color_tags[LOG_MSG] = gtk_text_buffer_create_tag (buffer,
552 "blue_foreground", "foreground", "blue",
553 "family", "MonoSpace", NULL);
554 logwin->color_tags[LOG_WARN] = gtk_text_buffer_create_tag (buffer,
555 "orange_foreground", "foreground", "orange",
556 "family", "MonoSpace", NULL);
557 logwin->color_tags[LOG_ERROR] = gtk_text_buffer_create_tag (buffer,
558 "red_foreground", "foreground", "red",
559 "family", "MonoSpace", NULL);
562 static void log_window_show(LogWindow *logwin)
564 GtkTextView *text = GTK_TEXT_VIEW(logwin->text);
565 GtkTextBuffer *buffer;
569 buffer = gtk_text_view_get_buffer(text);
570 mark = gtk_text_buffer_get_mark(buffer, "end");
571 gtk_text_view_scroll_mark_onscreen(text, mark);
573 gtk_window_present(GTK_WINDOW(logwin->window));
575 log_window_append("", LOG_NORMAL); // to flush memorized lines
577 regexp = g_strdup(get_regexp());
578 if (regexp != nullptr)
580 gq_gtk_entry_set_text(GTK_ENTRY(logwin->regexp_box), regexp);
585 void log_window_new(LayoutWindow *lw)
587 if (logwindow == nullptr)
591 logwin = log_window_create(lw);
592 log_window_init(logwin);
596 log_window_show(logwindow);
601 LogMsg(const gchar *text, LogType type)
609 static void log_window_insert_text(GtkTextBuffer *buffer, GtkTextIter *iter,
610 const gchar *text, GtkTextTag *tag)
614 if (!text || !*text) return;
616 str_utf8 = utf8_validate_or_convert(text);
617 gtk_text_buffer_insert_with_tags(buffer, iter, str_utf8, -1, tag, NULL);
621 void log_window_append(const gchar *str, LogType type)
624 GtkTextBuffer *buffer;
626 static std::deque<LogMsg> memory;
628 if (logwindow == nullptr)
632 memory.emplace_front(str, type);
634 if (memory.size() >= static_cast<guint>(options->log_window_lines))
636 const auto count = std::max(options->log_window_lines - 1, 0);
638 memory.resize(count);
644 text = GTK_TEXT_VIEW(logwindow->text);
645 buffer = gtk_text_view_get_buffer(text);
647 if (options->log_window_lines > 0 && logwindow->lines >= options->log_window_lines)
652 gtk_text_buffer_get_start_iter(buffer, &start);
654 gtk_text_iter_forward_lines(&end, logwindow->lines - options->log_window_lines);
655 gtk_text_buffer_delete(buffer, &start, &end);
658 gtk_text_buffer_get_end_iter(buffer, &iter);
660 std::for_each(memory.crbegin(), memory.crend(), [buffer, &iter](const LogMsg &oldest_msg)
662 log_window_insert_text(buffer, &iter, oldest_msg.text.c_str(), logwindow->color_tags[oldest_msg.type]);
666 log_window_insert_text(buffer, &iter, str, logwindow->color_tags[type]);
668 if (!options->log_window.paused)
670 if (gtk_widget_get_visible(GTK_WIDGET(text)))
674 mark = gtk_text_buffer_get_mark(buffer, "end");
675 gtk_text_view_scroll_mark_onscreen(text, mark);
679 logwindow->lines = gtk_text_buffer_get_line_count(buffer);
681 /* vim: set shiftwidth=8 softtabstop=0 cindent cinoptions={1s: */