Re: saving window size?



Look at GtkWidget::delete_event signal.

On Tue, 2009-01-20 at 09:26 -0500, Dr. Michael J. Chudobiak wrote:
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
-- 
Alexander Semenov <bohtvaroh gmail com>




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