aboutsummaryrefslogtreecommitdiffstats
path: root/src
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
parent3adf5dd98cd8798dd1e2a1817a4f403976fdf41f (diff)
downloadgsoc2013-epiphany-125e01e3e09aa94595de4fd5efd8b669eb0ee9cb.tar.gz
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')
-rw-r--r--src/ephy-session.c80
-rw-r--r--src/ephy-shell.c67
2 files changed, 67 insertions, 80 deletions
diff --git a/src/ephy-session.c b/src/ephy-session.c
index 2a78ccb83..18900e87e 100644
--- a/src/ephy-session.c
+++ b/src/ephy-session.c
@@ -44,7 +44,6 @@
#include <gtk/gtkhbox.h>
#include <gtk/gtkvbox.h>
#include <libgnomevfs/gnome-vfs-ops.h>
-#include <libgnomeui/gnome-client.h>
#include <libxml/tree.h>
#include <libxml/xmlwriter.h>
@@ -58,7 +57,6 @@ struct EphySessionPrivate
#define BOOKMARKS_EDITOR_ID "BookmarksEditor"
#define HISTORY_WINDOW_ID "HistoryWindow"
#define SESSION_CRASHED "type:session_crashed"
-#define SESSION_GNOME "type:session_gnome"
static void ephy_session_class_init (EphySessionClass *klass);
static void ephy_session_iface_init (EphyExtensionClass *iface);
@@ -121,16 +119,6 @@ get_session_filename (const char *filename)
"session_crashed.xml",
NULL);
}
- else if (strcmp (filename, SESSION_GNOME) == 0)
- {
- char *tmp;
-
- tmp = g_build_filename (ephy_dot_dir (),
- "session_gnome-XXXXXX",
- NULL);
- save_to = ephy_file_tmp_filename (tmp, "xml");
- g_free (tmp);
- }
else
{
save_to = g_strdup (filename);
@@ -223,70 +211,6 @@ impl_detach_window (EphyExtension *extension,
*/
}
-static gboolean
-save_yourself_cb (GnomeClient *client,
- gint phase,
- GnomeSaveStyle save_style,
- gboolean shutdown,
- GnomeInteractStyle interact_style,
- gboolean fast,
- EphySession *session)
-{
- char *argv[] = { "epiphany", "--load-session", NULL };
- char *discard_argv[] = { "rm", "-r", NULL };
-
- argv[2] = get_session_filename (SESSION_GNOME);
- gnome_client_set_restart_command
- (client, 3, argv);
-
- discard_argv[2] = argv[2];
- gnome_client_set_discard_command (client, 3,
- discard_argv);
-
- ephy_session_save (session, argv[2]);
-
- g_free (argv[2]);
-
- return TRUE;
-}
-
-static void
-die_cb (GnomeClient* client,
- EphySession *session)
-{
- ephy_session_close (session);
-}
-
-static void
-gnome_session_attach (EphySession *session)
-{
- GnomeClient *client;
-
- client = gnome_master_client ();
-
- g_signal_connect (G_OBJECT (client),
- "save_yourself",
- G_CALLBACK (save_yourself_cb),
- session);
- g_signal_connect (G_OBJECT (client),
- "die",
- G_CALLBACK (die_cb),
- session);
-}
-
-static void
-gnome_session_detach (EphySession *session)
-{
- GnomeClient *client;
-
- client = gnome_master_client ();
-
- g_signal_handlers_disconnect_by_func
- (G_OBJECT (client), G_CALLBACK (save_yourself_cb), session);
- g_signal_handlers_disconnect_by_func
- (G_OBJECT (client), G_CALLBACK (die_cb), session);
-}
-
static void
ensure_session_directory (void)
{
@@ -314,8 +238,6 @@ ephy_session_init (EphySession *session)
session->priv->windows = NULL;
ensure_session_directory ();
-
- gnome_session_attach (session);
}
static void
@@ -335,8 +257,6 @@ ephy_session_finalize (GObject *object)
LOG ("EphySession finalising")
- gnome_session_detach (session);
-
g_list_free (session->priv->windows);
G_OBJECT_CLASS (parent_class)->finalize (object);
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);