Re: saving window size?



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 <mjc 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
tadeboro gmail com
tadej borovsak gmail com


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