Re: Nesting gtk_main ?

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

 



On Mon, 01 Feb 2010 11:27:12 +0100
Martin Vejnár <avakar@xxxxxxxxxxxx> wrote:
> On 1/31/2010 7:22 PM, Tadej Borovšak wrote:
> > 2010/1/31 Martin Vejnár<avakar@xxxxxxxxxxxx>:
> >> On 1/30/2010 10:30 PM, jcupitt@xxxxxxxxx wrote:
> >>> A single gtk_main will run multiple independent windows. You only
> >>> need to nest them if you want a modal dialog.
> >>
> >> What should you do if you want to run two dialog boxes at the same
> >> time?
> >
> > If you don't want them to interfere with the rest of the GUI, you
> > simply don't use gtk_dialog_run(). Instead, you show dialogs using
> > gtk_widget_show() and all windows will run without interference.
> > After all, gtk_dialog_run() is merely a convenience method that
> > makes it easy to use dialogs that need urgent user intervention. If
> > you don't need this kind of functionality from dialog, simply
> > showing it will also work.
> 
> So I should connect the appropriate signals, call gtk_widget_show and 
> perform actions (those which I would normally perform below 
> gtk_dialog_run) in the signal handlers, right?

More or less.  You will need to ensure that when the window is finished
with you have called gtk_object_destroy() or gtk_widget_destroy().  I
suggest you also read the documentation, which has an example:
http://library.gnome.org/devel/gtk/stable/GtkDialog.html#GtkDialog.description
 
> How do I make the dialog's parent ignore user input? Event if I call 
> gtk_window_set_transient_for(dialog, parent), the parent remains
> clickable.

If you want this, then why not call gtk_dialog_run() and have a
blocking dialog?  However, if you have a special reason why you want to
do it without a recursive call to gtk_main(), then use
gtk_window_set_modal() as well as gtk_window_set_transient(). As a
further sophistication you can set the parent insensitive with
gtk_widget_set_sensitive(), but if you do that you will need to set the
parent sensitive again when the dialog is finished with (say by
connecting a callback to the destroy and/or hide signal).

Chris


_______________________________________________
gtk-list mailing list
gtk-list@xxxxxxxxx
http://mail.gnome.org/mailman/listinfo/gtk-list


[Index of Archives]     [Touch Screen Library]     [GIMP Users]     [Gnome]     [KDE]     [Yosemite News]     [Steve's Art]

  Powered by Linux