|
|
27be76 |
From 3b383ffcb65dcd318cdb9c1bf3e039007e628ec3 Mon Sep 17 00:00:00 2001
|
|
|
7faf05 |
From: Rui Matos <tiagomatos@gmail.com>
|
|
|
7faf05 |
Date: Wed, 11 Oct 2017 18:08:52 +0200
|
|
|
7faf05 |
Subject: [PATCH 1/3] Revert "Revert "plugins: Work-around startup deadlock""
|
|
|
7faf05 |
|
|
|
7faf05 |
This reverts commit e0f230ce6124fac47bc0810d30ff78ec327152ca.
|
|
|
7faf05 |
---
|
|
|
7faf05 |
plugins/common/daemon-skeleton-gtk.h | 4 ++++
|
|
|
7faf05 |
plugins/common/daemon-skeleton.h | 4 ++++
|
|
|
27be76 |
2 files changed, 8 insertions(+)
|
|
|
7faf05 |
|
|
|
7faf05 |
diff --git a/plugins/common/daemon-skeleton-gtk.h b/plugins/common/daemon-skeleton-gtk.h
|
|
|
27be76 |
index 2194b3d6..500ff3de 100644
|
|
|
7faf05 |
--- a/plugins/common/daemon-skeleton-gtk.h
|
|
|
7faf05 |
+++ b/plugins/common/daemon-skeleton-gtk.h
|
|
|
27be76 |
@@ -172,60 +172,64 @@ set_empty_gtk_theme (gboolean set)
|
|
|
27be76 |
/* Override GTK_THEME to reduce overhead of CSS engine. By using
|
|
|
27be76 |
* GTK_THEME environment variable, GtkSettings is not allowed to
|
|
|
27be76 |
* initially parse the Adwaita theme.
|
|
|
27be76 |
*
|
|
|
27be76 |
* https://bugzilla.gnome.org/show_bug.cgi?id=780555 */
|
|
|
27be76 |
old_gtk_theme = g_strdup (g_getenv ("GTK_THEME"));
|
|
|
27be76 |
g_setenv ("GTK_THEME", "Disabled", TRUE);
|
|
|
27be76 |
} else {
|
|
|
27be76 |
/* GtkSettings has loaded, so we can drop GTK_THEME used to initialize
|
|
|
27be76 |
* our internal theme. Only the main thread accesses the GTK_THEME
|
|
|
27be76 |
* environment variable, so this is safe to release. */
|
|
|
27be76 |
if (old_gtk_theme != NULL)
|
|
|
27be76 |
g_setenv ("GTK_THEME", old_gtk_theme, TRUE);
|
|
|
27be76 |
else
|
|
|
27be76 |
g_unsetenv ("GTK_THEME");
|
|
|
27be76 |
}
|
|
|
27be76 |
}
|
|
|
27be76 |
|
|
|
27be76 |
int
|
|
|
27be76 |
main (int argc, char **argv)
|
|
|
27be76 |
{
|
|
|
27be76 |
GError *error;
|
|
|
27be76 |
|
|
|
27be76 |
bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
|
|
|
27be76 |
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
|
27be76 |
textdomain (GETTEXT_PACKAGE);
|
|
|
27be76 |
setlocale (LC_ALL, "");
|
|
|
7faf05 |
|
|
|
7faf05 |
set_empty_gtk_theme (TRUE);
|
|
|
7faf05 |
|
|
|
7faf05 |
+ /* Work around https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
|
|
|
7faf05 |
+ g_type_ensure (G_TYPE_DBUS_CONNECTION);
|
|
|
7faf05 |
+ g_type_ensure (G_TYPE_DBUS_PROXY);
|
|
|
7faf05 |
+
|
|
|
7faf05 |
gdk_set_allowed_backends ("x11");
|
|
|
7faf05 |
|
|
|
7faf05 |
error = NULL;
|
|
|
27be76 |
if (! gtk_init_with_args (&argc, &argv, PLUGIN_NAME, entries, NULL, &error)) {
|
|
|
27be76 |
if (error != NULL) {
|
|
|
27be76 |
fprintf (stderr, "%s\n", error->message);
|
|
|
27be76 |
g_error_free (error);
|
|
|
27be76 |
}
|
|
|
27be76 |
exit (1);
|
|
|
27be76 |
}
|
|
|
27be76 |
|
|
|
27be76 |
set_empty_gtk_theme (FALSE);
|
|
|
27be76 |
|
|
|
27be76 |
if (verbose) {
|
|
|
27be76 |
g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
|
|
|
27be76 |
/* Work around GLib not flushing the output for us by explicitly
|
|
|
27be76 |
* setting buffering to a sane behaviour. This is important
|
|
|
27be76 |
* during testing when the output is not going to a TTY and
|
|
|
27be76 |
* we are reading messages from g_debug on stdout.
|
|
|
27be76 |
*
|
|
|
27be76 |
* See also
|
|
|
27be76 |
* https://bugzilla.gnome.org/show_bug.cgi?id=792432
|
|
|
27be76 |
*/
|
|
|
27be76 |
setlinebuf (stdout);
|
|
|
27be76 |
}
|
|
|
27be76 |
|
|
|
27be76 |
if (timeout > 0) {
|
|
|
27be76 |
guint id;
|
|
|
27be76 |
id = g_timeout_add_seconds (timeout, (GSourceFunc) gtk_main_quit, NULL);
|
|
|
27be76 |
g_source_set_name_by_id (id, "[gnome-settings-daemon] gtk_main_quit");
|
|
|
7faf05 |
diff --git a/plugins/common/daemon-skeleton.h b/plugins/common/daemon-skeleton.h
|
|
|
27be76 |
index 367ac1ec..83493ca1 100644
|
|
|
7faf05 |
--- a/plugins/common/daemon-skeleton.h
|
|
|
7faf05 |
+++ b/plugins/common/daemon-skeleton.h
|
|
|
27be76 |
@@ -147,60 +147,64 @@ on_client_registered (GObject *source_object,
|
|
|
27be76 |
static void
|
|
|
27be76 |
register_with_gnome_session (GMainLoop *loop)
|
|
|
27be76 |
{
|
|
|
27be76 |
GDBusProxy *proxy;
|
|
|
27be76 |
const char *startup_id;
|
|
|
27be76 |
|
|
|
27be76 |
proxy = G_DBUS_PROXY (gnome_settings_bus_get_session_proxy ());
|
|
|
27be76 |
startup_id = g_getenv ("DESKTOP_AUTOSTART_ID");
|
|
|
27be76 |
g_dbus_proxy_call (proxy,
|
|
|
27be76 |
"RegisterClient",
|
|
|
27be76 |
g_variant_new ("(ss)", dummy_name ? dummy_name : PLUGIN_NAME, startup_id ? startup_id : ""),
|
|
|
27be76 |
G_DBUS_CALL_FLAGS_NONE,
|
|
|
27be76 |
-1,
|
|
|
27be76 |
NULL,
|
|
|
27be76 |
(GAsyncReadyCallback) on_client_registered,
|
|
|
27be76 |
loop);
|
|
|
27be76 |
}
|
|
|
27be76 |
|
|
|
27be76 |
int
|
|
|
27be76 |
main (int argc, char **argv)
|
|
|
27be76 |
{
|
|
|
27be76 |
GError *error = NULL;
|
|
|
27be76 |
GOptionContext *context;
|
|
|
27be76 |
GMainLoop *loop;
|
|
|
27be76 |
|
|
|
27be76 |
bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR);
|
|
|
27be76 |
bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
|
|
|
7faf05 |
textdomain (GETTEXT_PACKAGE);
|
|
|
7faf05 |
setlocale (LC_ALL, "");
|
|
|
7faf05 |
|
|
|
7faf05 |
+ /* Work around https://bugzilla.gnome.org/show_bug.cgi?id=674885 */
|
|
|
7faf05 |
+ g_type_ensure (G_TYPE_DBUS_CONNECTION);
|
|
|
7faf05 |
+ g_type_ensure (G_TYPE_DBUS_PROXY);
|
|
|
7faf05 |
+
|
|
|
7faf05 |
context = g_option_context_new (NULL);
|
|
|
7faf05 |
g_option_context_add_main_entries (context, entries, GETTEXT_PACKAGE);
|
|
|
7faf05 |
if (!g_option_context_parse (context, &argc, &argv, &error)) {
|
|
|
27be76 |
fprintf (stderr, "%s\n", error->message);
|
|
|
27be76 |
g_error_free (error);
|
|
|
27be76 |
exit (1);
|
|
|
27be76 |
}
|
|
|
27be76 |
g_option_context_free (context);
|
|
|
27be76 |
|
|
|
27be76 |
loop = g_main_loop_new (NULL, FALSE);
|
|
|
27be76 |
|
|
|
27be76 |
if (verbose) {
|
|
|
27be76 |
g_setenv ("G_MESSAGES_DEBUG", "all", TRUE);
|
|
|
27be76 |
/* Work around GLib not flushing the output for us by explicitly
|
|
|
27be76 |
* setting buffering to a sane behaviour. This is important
|
|
|
27be76 |
* during testing when the output is not going to a TTY and
|
|
|
27be76 |
* we are reading messages from g_debug on stdout.
|
|
|
27be76 |
*
|
|
|
27be76 |
* See also
|
|
|
27be76 |
* https://bugzilla.gnome.org/show_bug.cgi?id=792432
|
|
|
27be76 |
*/
|
|
|
27be76 |
setlinebuf (stdout);
|
|
|
27be76 |
}
|
|
|
27be76 |
|
|
|
27be76 |
if (timeout > 0) {
|
|
|
27be76 |
guint id;
|
|
|
27be76 |
id = g_timeout_add_seconds (timeout, (GSourceFunc) g_main_loop_quit, loop);
|
|
|
27be76 |
g_source_set_name_by_id (id, "[gnome-settings-daemon] g_main_loop_quit");
|
|
|
27be76 |
}
|
|
|
27be76 |
|
|
|
7faf05 |
--
|
|
|
27be76 |
2.17.0
|
|
|
7faf05 |
|