Hello.

I think you need to save your window's size from within the
"delete-event" callback. Docs:
http://library.gnome.org/devel/gtk/stable/GtkWidget.html#GtkWidget-delete-event

2009/1/20 Dr. Michael J. Chudobiak <m...@avtechpulse.com>:
> Hi all,
>
> Suppose I have an app, and I would like to save the window size when when
> quitting.
>
> This is easy to do if the user selects File->Quit, but what if they click
> window-close? By the time you get the destroy signal, the true width/height
> values are gone. (You seem to get the default values.)
>
> Is there a "resize" signal I can listen to?
>
> Here's what I have, in vala:
>
>
> window.destroy += quitSave;
>
> //quit menu item
> Action quit = (Action)builder.get_object("menubar_quit");
> quit.activate += (quit) => {quitSave (window);};
>
> ...
> private void quitSave(Window window)
> {
> var gc = GConf.Client.get_default ();
> int width = 0;
> int height = 0;
> window.get_size (out width, out height);
>
> if (width > 0)
>       gc.set_int ("/apps/moserial/ui/window_width", width);
> if (height > 0)
>       gc.set_int ("/apps/moserial/ui/window_height", height);
>
> Gtk.main_quit ();
> }
>
>
> Suggestions?
>
> - Mike
>
> _______________________________________________
> gtk-app-devel-list mailing list
> gtk-app-devel-list@gnome.org
> http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list
>



-- 
Tadej Borovšak
tadeb...@gmail.com
tadej.borov...@gmail.com
_______________________________________________
gtk-app-devel-list mailing list
gtk-app-devel-list@gnome.org
http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list

Reply via email to