On 7/20/06, John Coppens <[EMAIL PROTECTED]> wrote:
>
> On Thu, 20 Jul 2006 11:55:47 +0200
> rupert <[EMAIL PROTECTED]> wrote:
>
> > Currently i update a buffer with gtk_text_buffer_insert_at_cursor(data,
> > line, -1);    in a timeout, the problem here is that the new text gets
> > copied at the and of the old text, i also tried gtk_text_buffer_insert,
> > but that gives me no text or a segfault.
>
> Rupert,
>
> I see you do not use textiters - a very valuable tool. For example, if
> you want to insert text at the beginning, start with
> gtk_text_buffer_get_start_iter. This gives you a reliable point of
> insertion, and permits you to gtk_text_buffer_insert, not relying on the
> cursor, which the user could have changed by clicking.
>
> Now, this doesn't garantee you that the added text will be visible
> (generally, the cursor remains visible). But you can scroll by software
> by manipulating the textview with  gtk_text_view_scroll_to_iter.


mmh, it seems to do the same thing, the new text gets added after the old...

out_smb_status(gpointer data){

    system("smbstatus -S > /tmp/smb_status");

    FILE *fp = fopen("/tmp/smb_status", "r");
    gchar line[512];
    GtkTextIter start1;



    if (fp)
    {
        while (fgets(line, sizeof(line), fp))
        {
        gtk_text_buffer_get_start_iter(data, &start1);
        gtk_text_buffer_insert(data, &start1, line, -1);

        }
        fclose(fp);
    }
    return data;

}


This help?
> John
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to