1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
|
/*
* Copyright © 2005 Gustavo Gama
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2, or (at your option)
* any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*
* $Id$
*/
#include "config.h"
#include "ephy-activation.h"
#include "ephy-shell.h"
#include "ephy-session.h"
#include "ephy-prefs.h"
#include "eel-gconf-extensions.h"
#include "ephy-debug.h"
static gboolean
session_queue_command (EphySessionCommand command,
char *arg,
char **args,
guint startup_id,
GError **error)
{
EphyShell *shell;
EphySession *session;
shell = ephy_shell_get_default ();
if (shell == NULL)
{
g_set_error (error,
g_quark_from_static_string ("ephy-activation-error"),
0,
"Shutting down." /* FIXME i18n & better string */);
return FALSE;
}
session = EPHY_SESSION (ephy_shell_get_session (ephy_shell_get_default()));
g_assert (session != NULL);
ephy_session_queue_command (session, command, arg, args,
(guint32) startup_id, FALSE);
return TRUE;
}
gboolean
ephy_activation_load_uri_list (EphyDbus *ephy_dbus,
char **uris,
char *options,
guint startup_id,
GError **error)
{
char *new_options;
new_options = g_strconcat (options, "external,", NULL);
return session_queue_command (EPHY_SESSION_CMD_OPEN_URIS,
new_options, uris, startup_id, error);
g_free (new_options);
}
gboolean
ephy_activation_load_session (EphyDbus *ephy_dbus,
char *session_name,
guint startup_id,
GError **error)
{
return session_queue_command (EPHY_SESSION_CMD_LOAD_SESSION,
session_name, NULL, startup_id, error);
}
gboolean
ephy_activation_open_bookmarks_editor (EphyDbus *ephy_dbus,
guint startup_id,
GError **error)
{
if (eel_gconf_get_boolean (CONF_LOCKDOWN_DISABLE_BOOKMARK_EDITING))
{
g_set_error (error,
g_quark_from_static_string ("ephy-activation-error"),
0,
"Bookmarks editing is locked down.");
return FALSE;
}
return session_queue_command (EPHY_SESSION_CMD_OPEN_BOOKMARKS_EDITOR,
NULL, NULL, startup_id, error);
}
|