aboutsummaryrefslogtreecommitdiffstats
path: root/src/ephy-shell.c
diff options
context:
space:
mode:
authorMarco Pesenti Gritti <marco@gnome.org>2003-11-17 06:48:59 +0800
committerMarco Pesenti Gritti <marco@src.gnome.org>2003-11-17 06:48:59 +0800
commit125e01e3e09aa94595de4fd5efd8b669eb0ee9cb (patch)
tree54e24d0b117ea0284d82cb442e73cd399d4f6f3a /src/ephy-shell.c
parent3adf5dd98cd8798dd1e2a1817a4f403976fdf41f (diff)
downloadgsoc2013-epiphany-125e01e3e09aa94595de4fd5efd8b669eb0ee9cb.tar
gsoc2013-epiphany-125e01e3e09aa94595de4fd5efd8b669eb0ee9cb.tar.gz
gsoc2013-epiphany-125e01e3e09aa94595de4fd5efd8b669eb0ee9cb.tar.bz2
gsoc2013-epiphany-125e01e3e09aa94595de4fd5efd8b669eb0ee9cb.tar.lz
gsoc2013-epiphany-125e01e3e09aa94595de4fd5efd8b669eb0ee9cb.tar.xz
gsoc2013-epiphany-125e01e3e09aa94595de4fd5efd8b669eb0ee9cb.tar.zst
gsoc2013-epiphany-125e01e3e09aa94595de4fd5efd8b669eb0ee9cb.zip
Move gnome session code in the shell.
2003-11-16 Marco Pesenti Gritti <marco@gnome.org> * src/ephy-session.c: (get_session_filename), (ephy_session_init), (ephy_session_finalize): * src/ephy-shell.c: (save_yourself_cb), (die_cb), (gnome_session_init), (ephy_shell_startup): Move gnome session code in the shell.
Diffstat (limited to 'src/ephy-shell.c')
-rw-r--r--src/ephy-shell.c67
1 files changed, 67 insertions, 0 deletions
diff --git a/src/ephy-shell.c b/src/ephy-shell.c
index 90f8ddbc4..4fd1a5aaf 100644
--- a/src/ephy-shell.c
+++ b/src/ephy-shell.c
@@ -48,6 +48,7 @@
#include <gtk/gtkmessagedialog.h>
#include <dirent.h>
#include <unistd.h>
+#include <libgnomeui/gnome-client.h>
#ifdef ENABLE_NAUTILUS_VIEW
#include <bonobo/bonobo-generic-factory.h>
@@ -272,6 +273,70 @@ server_timeout (EphyShell *gs)
return FALSE;
}
+static gboolean
+save_yourself_cb (GnomeClient *client,
+ gint phase,
+ GnomeSaveStyle save_style,
+ gboolean shutdown,
+ GnomeInteractStyle interact_style,
+ gboolean fast,
+ EphyShell *shell)
+{
+ char *argv[] = { "epiphany", "--load-session", NULL };
+ char *discard_argv[] = { "rm", "-r", NULL };
+ EphySession *session;
+ char *tmp, *save_to;
+
+ tmp = g_build_filename (ephy_dot_dir (),
+ "session_gnome-XXXXXX",
+ NULL);
+ save_to = ephy_file_tmp_filename (tmp, "xml");
+ g_free (tmp);
+
+ session = EPHY_SESSION (ephy_shell_get_session (shell));
+
+ argv[2] = save_to;
+ gnome_client_set_restart_command
+ (client, 3, argv);
+
+ discard_argv[2] = save_to;
+ gnome_client_set_discard_command (client, 3,
+ discard_argv);
+
+ ephy_session_save (session, save_to);
+
+ g_free (save_to);
+
+ return TRUE;
+}
+
+static void
+die_cb (GnomeClient* client,
+ EphyShell *shell)
+{
+ EphySession *session;
+
+ session = EPHY_SESSION (ephy_shell_get_session (shell));
+ ephy_session_close (session);
+}
+
+static void
+gnome_session_init (EphyShell *shell)
+{
+ GnomeClient *client;
+
+ client = gnome_master_client ();
+
+ g_signal_connect (G_OBJECT (client),
+ "save_yourself",
+ G_CALLBACK (save_yourself_cb),
+ shell);
+ g_signal_connect (G_OBJECT (client),
+ "die",
+ G_CALLBACK (die_cb),
+ shell);
+}
+
gboolean
ephy_shell_startup (EphyShell *gs,
EphyShellStartupFlags flags,
@@ -366,6 +431,8 @@ ephy_shell_startup (EphyShell *gs,
{
bonobo_object_release_unref (automation, &ev);
}
+
+ gnome_session_init (gs);
}
CORBA_exception_free (&ev);