[Glade-users] glade and/or gtkmm, insert a FileChooserDialog inside a Notebook tab
- From: gergely at polonkai.eu (Gergely Polonkai)
- Subject: [Glade-users] glade and/or gtkmm, insert a FileChooserDialog inside a Notebook tab
- Date: Fri, 30 Jan 2015 12:07:57 +0100
Hello,
if you use a FileChooserWidget, you will most likely want to create your
own open/save button, and connect to its clicked signal. When the button is
clicked, you should run gtk_file_chooser_get_files() (I assume it's
::get_files() in the gtkmm API) to get the list of selected files in the
file chooser widget. Another option is to connect to the file chooser's
file-activated signal, but that may cause other problems.
Hope that helps!
Best,
Gergely
On 30 Jan 2015 06:33, "Nicolas J?ger" <jagernicolas at legtux.org> wrote:
Hi,
I appreciate all help you guys provided so far, but I shall try to
summarize. I'm using gtkmm, it's a C++ API not C nor python. It's
a wrapper of the C API.
with gtkmm when you want to "run" a dialog you use this
method :
int Gtk::Dialog::run()
https://developer.gnome.org/gtkmm/stable/classGtk_1_1Dialog.html#adc98a1e747613c9b6cb66c238f6f8da6
this method loops until the dialog emits the
`Gtk::Dialog::signal_response()` signal, and return an `int`. This
`int` depend of the button you clicked, for example, if I set the
response value of the cancel button to 1, then, when I clicked on
cancel, `run()` return 1.
So when I call the FileChooserDialog, this loop locks the next
operations in my program until the end of `run()`. If I use a
`FileChooserWidget`, it seems, that there is no way to get the same
behaviour.
`run()` seems to be the wrapper of `gtk_dialog_run()` then what Tristan
wrote,
you cannot have gtk_dialog_run() without a dialog, that's sort
of the whole point, the dialog is then automatically modal and
exclusive, so you only get the response once it's done - an attribute
of it being a dialog is of course, that it is a separate window.
that's what I feared...
If you want a filechooser widget in a notebook tab, then you will have
to provide some control as to when you want to try to save the file,
I do this, the tab is hide until the user ask to save. Then, the
tab is shown and the notebook get the signal to switch on this tab. I
plan (this part is not done yet) (or planned) to not allow to switch on
another tab (maybe hidding the tabs bar) until the user click on Ok or
Cancel.
Of course I can still make some waiting function, or maybe it's
possible to get what I would like with plug'n'socket, even it's in
the same process.
I really recommend that you consider allowing a popup modal dialog
for saving things, doing this in a notebook tab is rather unintuitive
(i.e., it's safer when a window takes control, and the user is not
allowed to do anything until they decide what file to save as, or
decide to cancel and not save at all).
Cheers,
-Tristan
for now I will stay with a FileChooserDialog, I'll see in the future if
it will lead to any problem (on small screen). Any suggestion is still
welcome.
regards,
/nicoo
_______________________________________________
Glade-users maillist - Glade-users at lists.ximian.com
http://lists.ximian.com/mailman/listinfo/glade-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.ximian.com/pipermail/glade-users/attachments/20150130/f6a122b4/attachment.html>
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]