Re: Session Management
- From: "Iain" <nodatadj webtribe net>
- To: "Tom Tromey" <tromey cygnus com>
- Cc: "gnome mailing list" <gnome-list gnome org>
- Subject: Re: Session Management
- Date: Tue, 7 Sep 1999 12:40:17 +0100
> Maybe you are somehow getting your application registered twice? I
> don't know without seeing the code.
This is the session management code, and the two callbacks.
amb->smclient = gnome_client_new ();
if (!GNOME_CLIENT_CONNECTED (amb->smclient))
{
amb->smon = FALSE;
sm_off (); /* Inform user that session management
is not running and ask if they want to
* Quit or continue */
}
else
{
getcwd ((gchar*) cwd, sizeof (cwd));
gnome_client_set_current_directory (amb->smclient, (gchar*) cwd);
gtk_object_ref (GTK_OBJECT (amb->smclient));
gtk_object_sink (GTK_OBJECT (amb->smclient));
gtk_signal_connect (GTK_OBJECT (amb->smclient), "save_yourself",
GTK_SIGNAL_FUNC (save_state), NULL);
gtk_signal_connect (GTK_OBJECT (amb->smclient), "die",
GTK_SIGNAL_FUNC (session_die), NULL);
}
----------------------------------------------------------
void session_die( gpointer data ){
gtk_main_quit();
}
----------------------------------------------------------
int save_state( GnomeClient *client, gint phase,
GnomeRestartStyle save_style, gint shutdown,
GnomeInteractStyle interact_style, gint fast,
gpointer data ){
gchar *argv[20];
int xpos, ypos, width, height, i=0, j;
g_message( "Session Management: Saving state.\n" );
argv[i++] = g_strdup (g_get_prgname ());
gdk_window_get_origin( amb->app->window, &xpos, &ypos );
gdk_window_get_size( amb->app->window, &width, &height );
argv[i++] = g_strdup ("--session-restart");
gnome_config_set_int ("/Ambiance/restart/x", xpos);
gnome_config_set_int ("/Ambiance/restart/y", ypos);
gnome_config_set_int ("/Ambiance/restart/width", width);
gnome_config_set_int ("/Ambiance/restart/height", height);
gnome_config_sync ();
gnome_config_drop_all ();
gnome_client_set_restart_command (client, i, argv);
/* gnome_client_set_clone_command (client, 0, NULL); */
return(TRUE);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]