Re: Saving window position



-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

John Franklin wrote:
| Can someone please tell me how to save and restore the window position and
size of a GTK app? Searching on
| the web has pointed me in the direction of GnomeClient which I don't really
understand. It seems very complicated
| for what I'm trying to do. Is there any sample code available?

I used gtk_window_get_position() to retrieve the coordinates, and to set, I used
gtk_window_set_default_size() & gtk_window_move()

save:
        gtk_window_get_position(GTK_WINDOW(conversation->window),
                                &notebook_window_x, &notebook_window_y );
        /* get current sizes */
        notebook_window_width  = conversation->window->allocation.width;
        notebook_window_height = conversation->window->allocation.height;

(relavant variables: notebook_window_x, notebook_window_y,
notebook_window_width, notebook_window_height)

Restore:

        gtk_window_set_default_size (GTK_WINDOW(gy_notebook->window),
                notebook_window_width, notebook_window_height);
        gtk_window_move(GTK_WINDOW(gy_notebook->window),
                notebook_window_x, notebook_window_y);

If you want explicit code references:

http://gyachi.cvs.sourceforge.net/*checkout*/gyachi/gyachi/client/pmnotebook.c?revision=1.17

:)

HTH,

- -Greg

| John
| _______________________________________________
| gtk-app-devel-list mailing list
| gtk-app-devel-list gnome org
| http://mail.gnome.org/mailman/listinfo/gtk-app-devel-list


- --
+---------------------------------------------------------------------+

Please also check the log file at "/dev/null" for additional information.
~                (from /var/log/Xorg.setup.log)

| Greg Hosler                                   ghosler redhat com    |
+---------------------------------------------------------------------+
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)
Comment: Using GnuPG with Fedora - http://enigmail.mozdev.org

iD8DBQFH1mIK404fl/0CV/QRAhs7AKC65URazhzaF1/NTqxk1QdwPnj+xACgmUiS
xl4VlSdFTLDL9sZIHuWCAk4=
=HGh+
-----END PGP SIGNATURE-----



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