GnomeMDI session management (was Re: GNOME CVS: gnome-libs martin)
- From: Martin Baulig <martin home-of-linux org>
- To: Jaka Mocnik <jaka mocnik kiss uni-lj si>
- cc: gnome-hackers nuclecu unam mx, cvs-commits-list gnome org, gnome-cvs-commits dagon mandrake net, Gnome Mailing List <gnome-list gnome org>
- Subject: GnomeMDI session management (was Re: GNOME CVS: gnome-libs martin)
- Date: Tue, 29 Sep 1998 19:30:53 +0200 (CEST)
Perhaps I should explain this a little bit ...
First, in the `save_state' callback function you use something like this:
session_id = gnome_client_get_id (client);
/* Save the state using gnome-config stuff. */
gnome_config_push_prefix (gnome_client_get_config_prefix (client));
gnome_mdi_save_state (mdi, "Session");
gnome_config_pop_prefix();
gnome_config_sync();
This creates a new config section which looks about like this:
[Session]
mdi_session=1
mdi_children=80af948:80afaa8:80afc20
mdi_windows=80ac198:80d2c78:811f578
mdi_child_config_80af948=0/0
mdi_child_views_80af948=811f578
mdi_child_config_80afaa8=1/0
mdi_child_views_80afaa8=80ac198:80d2c78:80d2c78
mdi_child_config_80afc20=2/2
mdi_child_views_80afc20=80ac198
mdi_window_80ac198=294/136/984/788
mdi_window_80d2c78=0/368/719/647
mdi_window_811f578=0/41/890/435
The `mdi_children' key represents the list of GnomeMDIChild objects which is
read from `mdi->children'- well, pointers are meaningless in config files,
I'm just using them as index values ...
Every entry in the `mdi_children' list has two other keys associated:
`mdi_child_config_<index>' which is a config string representing the
GnomeMDIChild. This string is created by the object itself in its
`get_config_string' signal handler. When restarting, you need to provide
a function which parses this string and creates a new GnomeMDIChild out
of it.
The second one is the `mdi_child_views_<index>' keys which is the list of
views associated with this child, we use the pointer to the toplevel window
as index here. The `mdi_window_<index>' key gives the geometry (x/y/w/h) of
this toplevel window.
When restoring, we first walk the list of children `mdi_children' and create
all of the childs (without creating any views!).
Then, we walk the list of toplevel windows - for each of them we walk the
list of children again, if one of the childs has a view in the current
window, we add it ...
This should restore everything exactly as it was before session-saving.
Martin
On Tue, 29 Sep 1998, Gnome CVS User wrote:
> CVSROOT: /cvs/gnome
> Module name: gnome-libs
> Changes by: martin 98/09/29 16:31:55
>
> Modified files:
> libgnomeui : ChangeLog Makefile.am gnome-mdi-child.c
> gnome-mdi-child.h gnome-mdi.c gnome-mdi.h
> libgnomeui.h
> Added files:
> libgnomeui : gnome-mdi-session.c gnome-mdi-session.h
>
> Log message:
> 1998-09-29 Martin Baulig <martin@home-of-linux.org>
>
> * gnome-mdi-session.[ch]: New files.
> (GnomeMDIChildCreate): New typedef. This is a pointer to a function
> which parses the config string and creates a new GnomeMDIChild.
> (gnome_mdi_save_state): Call this function when saving state with
> the GnomeMDI object and the name of the config section to use.
> (gnome_mdi_restore_state): Call this function with the GnomeMDI
> object, the name of the config section and a (GnomeMDIChildCreate)
> function pointer.
>
> * gnome-mdi.c (gnome_mdi_add_toplevel_view): New function. Same as
> `gnome_mdi_add_view', but when using GNOME_MDI_NOTEBOOK we add the
> view to a newly created toplevel window.
> * gnome-mdi.h (gnome_mdi_add_toplevel_view): Added prototype.
>
> * gnome-mdi-child.c: Added new signal `get_config_string'. This
> should be used in subclasses to return a config string representing
> the object which can be used to recreate it when restarting from
> the session manager.
> * gnome-mdi-child.h (GnomeMDIChildClass): Added new signal handler
> function `get_config_string'.
>
> * libgnomeui.h: Include `gnome-mdi-session.h'.
> * Makefile.am (libgnomeui_la_SOURCES): Added `gnome-mdi-session.c'.
> (libgnomeuiinclude_HEADERS): Added `gnome-mdi-session.h'.
-----------------------------------------------------------------
Martin Baulig - Angewandte Mathematik - Universitaet Trier
martin@home-of-linux.org, http://www.home-of-linux.org/
------------------------------------------------------------------
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]