Re: glade and/or gtkmm, insert a FileChooserDialog inside a Notebook tab

Gergely Polonkai <[email protected]> Fri, 30 Jan 2015 12:07:57 +0100
Newsgroups gmane.comp.gnome.glade.user
Message-ID <CACczBUJ1vQA=HMciZcXk9i+yKNCTW8vgg2GsV=Jd6yuoTmJ6OQ@mail.gmail.com>
--===============1829984782==
Content-Type: multipart/alternative; boundary=001a11c342baf6f9ac050ddc9db7

--001a11c342baf6f9ac050ddc9db7
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

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=C3=A4ger" <[email protected]> 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#adc98a1e=
747613c9b6cb66c238f6f8da6
>
> 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  -  [email protected]
> http://lists.ximian.com/mailman/listinfo/glade-users
>

--001a11c342baf6f9ac050ddc9db7
Content-Type: text/html; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

<p dir=3D"ltr">Hello,</p>
<p dir=3D"ltr">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 assum=
e it&#39;s ::get_files() in the gtkmm API) to get the list of selected file=
s in the file chooser widget. Another option is to connect to the file choo=
ser&#39;s file-activated signal, but that may cause other problems.</p>
<p dir=3D"ltr">Hope that helps!</p>
<p dir=3D"ltr">Best,<br>
Gergely</p>
<div class=3D"gmail_quote">On 30 Jan 2015 06:33, &quot;Nicolas J=C3=A4ger&q=
uot; &lt;<a href=3D"mailto:[email protected]">[email protected]=
</a>&gt; wrote:<br type=3D"attribution"><blockquote class=3D"gmail_quote" s=
tyle=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<=
br>
<br>
I appreciate all help you guys provided so far, but I shall try to<br>
summarize. I&#39;m using gtkmm, it&#39;s a C++ API not C nor python. It&#39=
;s<br>
a wrapper of the C API.<br>
<br>
with gtkmm when you want to &quot;run&quot; a dialog you use this<br>
method :<br>
<br>
int Gtk::Dialog::run()<br>
<a href=3D"https://developer.gnome.org/gtkmm/stable/classGtk_1_1Dialog.html=
#adc98a1e747613c9b6cb66c238f6f8da6" target=3D"_blank">https://developer.gno=
me.org/gtkmm/stable/classGtk_1_1Dialog.html#adc98a1e747613c9b6cb66c238f6f8d=
a6</a><br>
<br>
this method loops until the dialog emits the<br>
`Gtk::Dialog::signal_response()` signal, and return an `int`. This<br>
`int` depend of the button you clicked, for example, if I set the<br>
response value of the cancel button to 1, then, when I clicked on<br>
cancel, `run()` return 1.<br>
<br>
So when I call the FileChooserDialog, this loop locks the next<br>
operations in my program until the end of `run()`. If I use a<br>
`FileChooserWidget`, it seems, that there is no way to get the same<br>
behaviour.<br>
<br>
`run()` seems to be the wrapper of `gtk_dialog_run()` then what Tristan<br>
wrote,<br>
<br>
&gt; you cannot have gtk_dialog_run() without a dialog, that&#39;s sort<br>
&gt; of the whole point, the dialog is then automatically modal and<br>
&gt; exclusive, so you only get the response once it&#39;s done - an attrib=
ute<br>
&gt; of it being a dialog is of course, that it is a separate window.<br>
<br>
that&#39;s what I feared...<br>
<br>
&gt;<br>
&gt; If you want a filechooser widget in a notebook tab, then you will have=
<br>
&gt; to provide some control as to when you want to try to save the file,<b=
r>
&gt;<br>
I do this, the tab is hide until the user ask to save. Then, the<br>
tab is shown and the notebook get the signal to switch on this tab. I<br>
plan (this part is not done yet) (or planned) to not allow to switch on<br>
another tab (maybe hidding the tabs bar) until the user click on Ok or<br>
Cancel.<br>
<br>
Of course I can still make some waiting function, or maybe it&#39;s<br>
possible to get what I would like with plug&#39;n&#39;socket, even it&#39;s=
 in<br>
the same process.<br>
<br>
&gt; I really recommend that you consider allowing a popup modal dialog<br>
&gt; for saving things, doing this in a notebook tab is rather unintuitive<=
br>
&gt; (i.e., it&#39;s safer when a window takes control, and the user is not=
<br>
&gt; allowed to do anything until they decide what file to save as, or<br>
&gt; decide to cancel and not save at all).<br>
&gt;<br>
&gt; Cheers,<br>
&gt;=C2=A0 =C2=A0 =C2=A0-Tristan<br>
<br>
for now I will stay with a FileChooserDialog, I&#39;ll see in the future if=
<br>
it will lead to any problem (on small screen). Any suggestion is still<br>
welcome.<br>
<br>
regards,<br>
/nicoo<br>
<br>
_______________________________________________<br>
Glade-users maillist=C2=A0 -=C2=A0 <a href=3D"mailto:[email protected]=
an.com">[email protected]</a><br>
<a href=3D"http://lists.ximian.com/mailman/listinfo/glade-users" target=3D"=
_blank">http://lists.ximian.com/mailman/listinfo/glade-users</a><br>
</blockquote></div>

--001a11c342baf6f9ac050ddc9db7--

--===============1829984782==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Glade-users maillist  -  [email protected]
http://lists.ximian.com/mailman/listinfo/glade-users

--===============1829984782==--