Initial import of ephy (rev# 7126) from svn
[ephy-soc.git] / src / ephy-activation.c
blob4e3904d3d2e37d8dfb81360d9b9bac2eaf5068d5
1 /*
2 * Copyright © 2005 Gustavo Gama
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2, or (at your option)
7 * any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
18 * $Id: ephy-activation.c 6952 2007-03-11 19:42:02Z chpe $
21 #include "config.h"
23 #include "ephy-activation.h"
25 #include "ephy-shell.h"
26 #include "ephy-session.h"
27 #include "ephy-prefs.h"
28 #include "eel-gconf-extensions.h"
29 #include "ephy-debug.h"
31 static gboolean
32 session_queue_command (EphySessionCommand command,
33 char *arg,
34 char **args,
35 guint startup_id,
36 GError **error)
38 EphyShell *shell;
39 EphySession *session;
41 shell = ephy_shell_get_default ();
42 if (shell == NULL)
44 g_set_error (error,
45 g_quark_from_static_string ("ephy-activation-error"),
46 0,
47 "Shutting down." /* FIXME i18n & better string */);
48 return FALSE;
51 session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default()));
52 g_assert (session != NULL);
54 ephy_session_queue_command (session, command, arg, args,
55 (guint32) startup_id, FALSE);
57 return TRUE;
60 gboolean
61 ephy_activation_load_uri_list (EphyDbus *ephy_dbus,
62 char **uris,
63 char *options,
64 guint startup_id,
65 GError **error)
67 return session_queue_command (EPHY_SESSION_CMD_OPEN_URIS,
68 options, uris, startup_id, error);
71 gboolean
72 ephy_activation_load_session (EphyDbus *ephy_dbus,
73 char *session_name,
74 guint startup_id,
75 GError **error)
77 return session_queue_command (EPHY_SESSION_CMD_LOAD_SESSION,
78 session_name, NULL, startup_id, error);
81 gboolean
82 ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus,
83 guint startup_id,
84 GError **error)
86 if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING))
88 g_set_error (error,
89 g_quark_from_static_string ("ephy-activation-error"),
91 "Bookmarks editing is locked down.");
93 return FALSE;
96 return session_queue_command (EPHY_SESSION_CMD_OPEN_BOOKMARKS_EDITOR,
97 NULL, NULL, startup_id, error);