Re: Asking for a control solution



It depends on what your priorities are
and the size of the file. Here are some solutions.

Solution 1:
        do a g_timeout_add for a function
        to reload the file contents (see
        g_file_get_contents but there is
        a file leak in version 1.3.5 ... 
        dont know if its fixed yet ...).
        in this case; your UI will *block* untill
        your timeout function is complete.

Solution 2:
        Progressive loading. If it's a big file
        you may want to declare a timeout every
        5 seconds which in turn declares another
        timeout for every 100 milisecs or so and
        loads "num" bytes at a time.

Solution 3:
        Threads. You can have a side thread to
        load the file every so often and mutexes
        and (see g_cond_signal/g_cond_wait) signals
        to know when the file contents is ready
        (or use a double buffering method).


Cheers,
                        -Tristan


jantonio leonardo amena es wrote:

Hi !!
I'm spanish, so.. sorry for my english.

I want to develop a very particular application, with glade & GTK, in C
languaje for linux/unix. These are my first steps in GTK...

I want to load a file which it's changed every 5 seconds. So i need refresh
the main window frecuently, and i want my users can do other things
pressing keys or buttons.

But,  if i pass the control to the function gtk_main(), and GTK sleep
waiting for X events, how can i refresh the file?
Are "timeouts in GTK" a solution for this?

Thank you.

_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list gnome org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list



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