Re: Example for Gtk::Application
- From: Yannick Guesnet <Yannick Guesnet univ-rouen fr>
- To: Murray Cumming <murrayc murrayc com>
- Cc: gtkmm-list gnome org
- Subject: Re: Example for Gtk::Application
- Date: Wed, 22 Dec 2010 22:09:31 +0100
Le 22/12/2010 15:44, Murray Cumming a écrit :
On Sat, 2010-12-18 at 01:38 -0800, Yannick Guesnet wrote:
I try to adapt the example of GtkApplication found in the doc :
BloatPad.cpp
BloatPad.h
BloatWindow.cpp
BloatWindow.h
main.cpp
Could you please prepare a git patch against gtkmm-documentation, and
put that in bugzilla, please. For instance, this could go in
examples/book/giomm/application/ .
This is done.
And please names the classes Example* rather than Bloat*. And BloatPad
can be just ExampleApplication.
Please use the same formatting as in the other examples. For instance, 2
spaces for indentation. And use const& for RefPtr arguments, please.
I have tried to follow your recommendations.
This example is not very usefull this at this time since there's no
way to connect to the "open" signal (which is used in the Gtk+
example).
I'll apply your patch when bugzilla.gnome.org is working again.
Hopefully soon.
Thanks (I'm really happy that my efforts could help the project).
But I have a question : I have added a "delete this" when we hide the
window since otherwise the application does not finished when we close
all windows. In the Gtk+ example, this is not needed since the default
behavious of GtkWindow is to freed the object when the window receive
the delete signal. My question : I found that this "delete this" is
not very beautiful. What is the right way to delete the window when it
receives the delete signal ?
Hmm, so it's created here:
void BloatPad::new_window(Glib::RefPtr<Gio::File> file)
{
Gtk::Window * window = new BloatWindow(file);
add_window(*window);
}
and deleted here:
void BloatWindow::on_hide()
{
delete this;
}
Can't you just delete it in the BloatPad destructor?
I don't think so : the BloatPad is destructed only when all of its
windows are released.
Or, if you must,
can't you handle signal_hide() for the BloatWindow?
This is what I've done.
I'll look at this issue again when it's in gtkmm-documentation. Maybe we
can find some easy general solution.
PS Murray Cummings : finally I have decided to post the example to the
mailing list, I hope that it is the right thing to do.
Thanks.
Thanks.
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]