GtkTextView - when the buffer rendering is finished?



Hi all,

is there any way to check if the whole GtkTextBuffer had been rendered to the GtkTextView?

I want to display the procentage of the data displayed on the screen (and update it during scrolling), but to be able to calculate it, the whole buffer has to be rendered first, what, as far as I know, takes place in the idle state. How to find out if it has finished?

I calculate the procengate by dividing of the last visible in the GtkTextView line number by number of lines in the buffer. This is the simplified code:

get the last visible line number:
    gtk_text_view_get_visible_rect(GTK_TEXT_VIEW(tv), &rect);
    gtk_text_view_get_iter_at_location(GTK_TEXT_VIEW(tv), &iter,0, rect.y +rect.height);
    y1 = gtk_text_iter_get_line(&iter);

get total number of lines:
    gtk_text_buffer_get_end_iter(tb, &iter);
    y2 = gtk_text_iter_get_line(&iter);

calculate procentage:
    procentage = y1*100/y2;

Before the text has been rendered, whole buffer fits in the GtkTextView window. Calculation will be valid only after the text processing / rendering is finished.

I have not find any signal emitted when rendering finished.
Is there any other way to do it?


Regards,
LUK



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]