5
#include "shell-global-private.h"
6
#include "shell-enum-types.h"
7
#include "shell-perf-log.h"
8
#include "shell-window-tracker.h"
9
#include "shell-marshal.h"
15
#include <clutter/glx/clutter-glx.h>
16
#include <clutter/x11/clutter-x11.h>
22
10
#include <string.h>
23
11
#include <unistd.h>
12
#ifdef HAVE_SYS_RESOURCE_H
13
#include <sys/resource.h>
16
#include <X11/extensions/Xfixes.h>
18
#include <clutter/glx/clutter-glx.h>
19
#include <clutter/x11/clutter-x11.h>
24
20
#include <dbus/dbus-glib.h>
25
22
#include <gio/gio.h>
27
#include <X11/extensions/Xfixes.h>
28
23
#include <gjs/gjs-module.h>
30
#include <libxml/xmlmemory.h>
31
24
#include <libxml/parser.h>
32
25
#include <libxml/tree.h>
33
#ifdef HAVE_SYS_RESOURCE_H
34
#include <sys/resource.h>
26
#include <libxml/xmlmemory.h>
27
#include <meta/display.h>
28
#include <meta/util.h>
30
#include "shell-enum-types.h"
31
#include "shell-global-private.h"
36
32
#include "shell-jsapi-compat-private.h"
38
#define SHELL_DBUS_SERVICE "org.gnome.Shell"
39
#define MAGNIFIER_DBUS_SERVICE "org.gnome.Magnifier"
33
#include "shell-marshal.h"
34
#include "shell-perf-log.h"
35
#include "shell-window-tracker.h"
41
39
static void grab_notify (GtkWidget *widget, gboolean is_grab, gpointer user_data);
245
244
ca_context_create (&global->sound_context);
246
245
ca_context_change_props (global->sound_context, CA_PROP_APPLICATION_NAME, PACKAGE_NAME, CA_PROP_APPLICATION_ID, "org.gnome.Shell", NULL);
247
246
ca_context_open (global->sound_context);
250
search_path = g_strsplit (shell_js, ":", -1);
251
global->js_context = g_object_new (GJS_TYPE_CONTEXT,
252
"search-path", search_path,
255
g_strfreev (search_path);
1231
1238
gjs_context_maybe_gc (global->js_context);
1235
shell_global_grab_dbus_service (ShellGlobal *global)
1237
GError *error = NULL;
1238
DBusGConnection *session;
1240
guint32 request_name_result;
1242
session = dbus_g_bus_get (DBUS_BUS_SESSION, NULL);
1244
bus = dbus_g_proxy_new_for_name (session,
1247
DBUS_INTERFACE_DBUS);
1249
if (!dbus_g_proxy_call (bus, "RequestName", &error,
1250
G_TYPE_STRING, SHELL_DBUS_SERVICE,
1253
G_TYPE_UINT, &request_name_result,
1256
g_print ("failed to acquire org.gnome.Shell: %s\n", error->message);
1257
/* If we somehow got started again, it's not an error to be running
1258
* already. So just exit 0.
1263
/* Also grab org.gnome.Panel to replace any existing panel process,
1264
* unless a special environment variable is passed. The environment
1265
* variable is used by the gnome-shell (no --replace) launcher in
1267
if (!g_getenv ("GNOME_SHELL_NO_REPLACE"))
1269
if (!dbus_g_proxy_call (bus, "RequestName", &error, G_TYPE_STRING,
1270
"org.gnome.Panel", G_TYPE_UINT,
1271
DBUS_NAME_FLAG_REPLACE_EXISTING | DBUS_NAME_FLAG_DO_NOT_QUEUE,
1272
G_TYPE_INVALID, G_TYPE_UINT,
1273
&request_name_result, G_TYPE_INVALID))
1275
g_print ("failed to acquire org.gnome.Panel: %s\n", error->message);
1280
/* ...and the org.gnome.Magnifier service.
1282
if (!dbus_g_proxy_call (bus, "RequestName", &error,
1283
G_TYPE_STRING, MAGNIFIER_DBUS_SERVICE,
1286
G_TYPE_UINT, &request_name_result,
1289
g_print ("failed to acquire %s: %s\n", MAGNIFIER_DBUS_SERVICE, error->message);
1290
/* Failing to acquire the magnifer service is not fatal. Log the error,
1291
* but keep going. */
1293
g_object_unref (bus);
1297
1242
grab_notify (GtkWidget *widget, gboolean was_grabbed, gpointer user_data)
2049
1994
shell_global_get_tp_contacts_cb,
2050
1995
callback, NULL, NULL);
1999
* shell_global_launch_calendar_server:
2000
* @global: The #ShellGlobal.
2002
* Launch the gnome-shell-calendar-server helper.
2005
shell_global_launch_calendar_server (ShellGlobal *global)
2007
const gchar *bin_dir;
2008
gchar *calendar_server_exe;
2011
gint child_standard_input;
2013
/* launch calendar-server */
2014
bin_dir = g_getenv ("GNOME_SHELL_BINDIR");
2015
if (bin_dir != NULL)
2016
calendar_server_exe = g_strdup_printf ("%s/gnome-shell-calendar-server", bin_dir);
2018
calendar_server_exe = g_strdup_printf (GNOME_SHELL_LIBEXECDIR "/gnome-shell-calendar-server");
2020
argv[0] = calendar_server_exe;
2023
if (!g_spawn_async_with_pipes (NULL, /* working_directory */
2026
0, /* GSpawnFlags */
2027
NULL, /* child_setup */
2028
NULL, /* user_data */
2029
NULL, /* GPid *child_pid */
2030
&child_standard_input,
2031
NULL, /* gint *stdout */
2032
NULL, /* gint *stderr */
2035
g_warning ("Error launching `%s': %s (%s %d)",
2036
calendar_server_exe,
2038
g_quark_to_string (error->domain),
2040
g_error_free (error);
2042
/* Note that gnome-shell-calendar-server exits whenever its stdin
2043
* file descriptor is HUP'ed. This means that whenever the the shell
2044
* process exits or is being replaced, the calendar server is also
2045
* exits...and if the shell is being replaced, a new copy of the
2046
* calendar server is launched...
2049
g_free (calendar_server_exe);