RE: Use 'GetOpenFileName' in GTK for Win32



I tried GetOpenFileName function in another thread, and use g_main_loop_run() to refresh and block the main window, just as what Inkscape did.
The brief code is:

    _main_loop = g_main_loop_new(g_main_context_default(), FALSE);

    if (GThread *td = g_thread_create(file_selector_thread, NULL, TRUE, NULL)) {
        g_main_loop_run(_main_loop);
    }


The thread function 'file_selector_thread' would invoke GetOpenFileName function to open a windows style file selection window, and when file selected, 'file_selector_thread' thread would call 'g_main_loop_quit(_main_loop)' before quit, so 'g_main_loop_run(_main_loop)' function would return.
The problem is: using this method, I cannot block the main window and making the file selection window modally. The reason is g_main_loop_run(_main_loop) function seems to accept and handle signals from main window as well. So the main window can still operate.

Any suggestions?


Bruce Cheng
--


> -----Original Message-----
> From: gtk-list-bounces gnome org [mailto:gtk-list-bounces gnome org] On
> Behalf Of Bruce
> Sent: Sunday, July 11, 2010 3:57 AM
> To: 'Jernej Simončič'; gtk-list gnome org
> Subject: RE: Use 'GetOpenFileName' in GTK for Win32
> 
> I see the source code of Inkscape, and also searched achieved mail for
> GTK mail list.
> It seems that I have to create another thread to open the Win32 file
> dialog.
> 
> I will try it.
> 
> 
> Bruce Cheng
> --
> 
> 
> > -----Original Message-----
> > From: gtk-list-bounces gnome org [mailto:gtk-list-bounces gnome org]
> On
> > Behalf Of Jernej Simon?i?
> > Sent: Sunday, July 11, 2010 3:29 AM
> > To: gtk-list gnome org
> > Subject: Re: Use 'GetOpenFileName' in GTK for Win32
> >
> > On Sun, 11 Jul 2010 03:17:54 +0800, Bruce wrote:
> >
> > > 	Is there anyone successfully used 'GetOpenFileName' function on
> > GTK?
> >
> > Inkscape seems to use it fine, maybe you could check how they do it?
> >
> > --
> > < Jernej Simončič ><><><><>< http://eternallybored.org/ >
> >
> > _______________________________________________
> > gtk-list mailing list
> > gtk-list gnome org
> > http://mail.gnome.org/mailman/listinfo/gtk-list
> 
> _______________________________________________
> gtk-list mailing list
> gtk-list gnome org
> http://mail.gnome.org/mailman/listinfo/gtk-list



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