saving window size?



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




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