aboutsummaryrefslogtreecommitdiff
Submitted upstream: https://github.com/canonical/lightdm/pull/312

diff --git a/src/vnc-server.c b/src/vnc-server.c
index d3500764..00a2fc02 100644
--- a/src/vnc-server.c
+++ b/src/vnc-server.c
@@ -126,18 +126,10 @@ vnc_server_start (VNCServer *server)
 
     g_return_val_if_fail (server != NULL, FALSE);
 
-    g_autoptr(GError) ipv4_error = NULL;
-    priv->socket = open_tcp_socket (G_SOCKET_FAMILY_IPV4, priv->port, priv->listen_address, &ipv4_error);
-    if (ipv4_error)
-        g_warning ("Failed to create IPv4 VNC socket: %s", ipv4_error->message);
-
-    if (priv->socket)
-    {
-        GSource *source = g_socket_create_source (priv->socket, G_IO_IN, NULL);
-        g_source_set_callback (source, (GSourceFunc) read_cb, server, NULL);
-        g_source_attach (source, NULL);
-    }
-
+    // Bind to IPv6 first, as this implies binding to 0.0.0.0 in the
+    // Linux kernel default configuration, which would otherwise cause
+    // IPv6 clients to fail with "Error binding to address [::]:5900:
+    // Address already in use" (#266).
     g_autoptr(GError) ipv6_error = NULL;
     priv->socket6 = open_tcp_socket (G_SOCKET_FAMILY_IPV6, priv->port, priv->listen_address, &ipv6_error);
     if (ipv6_error)
@@ -150,6 +142,18 @@ vnc_server_start (VNCServer *server)
         g_source_attach (source, NULL);
     }
 
+    g_autoptr(GError) ipv4_error = NULL;
+    priv->socket = open_tcp_socket (G_SOCKET_FAMILY_IPV4, priv->port, priv->listen_address, &ipv4_error);
+    if (ipv4_error)
+        g_warning ("Failed to create IPv4 VNC socket: %s", ipv4_error->message);
+
+    if (priv->socket)
+    {
+        GSource *source = g_socket_create_source (priv->socket, G_IO_IN, NULL);
+        g_source_set_callback (source, (GSourceFunc) read_cb, server, NULL);
+        g_source_attach (source, NULL);
+    }
+
     if (!priv->socket && !priv->socket6)
         return FALSE;
 
n36' href='#n36'>36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52
Gnome-tweaks does not look at GSETTINGS_SCHEMA_PATH or XDG_DATA_DIRS, it
assumes that schemas are installed in one global directory
(GSETTINGS_SCHEMA_DIR/gsettingsschemadir).

Guix/GuixSD uses a different directory for every gir package and has
packages pick-up files using XDG_DATA_DIRS.

Upstream ticket: https://bugzilla.gnome.org/show_bug.cgi?id=764537
janneke@gnu.org

--- gnome-tweak-3.18.1.orig/gtweak/gsettings.py	2015-04-08 15:21:32.000000000 +0200
+++ gnome-tweak-tool-3.18.1/gtweak/gsettings.py	2016-04-03 11:26:38.658482704 +0200
@@ -16,7 +16,8 @@
 # along with gnome-tweak-tool.  If not, see <http://www.gnu.org/licenses/>.
 
 import logging
-import os.path
+import os
+import sys
 import xml.dom.minidom
 import gettext
 
@@ -31,6 +32,13 @@
 class GSettingsMissingError(Exception):
     pass
 
+def file_from_path(path, file_name):
+    for dir in path:
+        f = os.path.join(dir, file_name)
+        if os.path.exists(f):
+            return f
+    return None
+
 class _GSettingsSchema:
     def __init__(self, schema_name, schema_dir=None, schema_filename=None, **options):
         if not schema_dir:
@@ -38,9 +46,14 @@
         if not schema_filename:
             schema_filename = schema_name + ".gschema.xml"
 
+        schema_prefix = os.path.join('glib-2.0', 'schemas')
         schema_path = os.path.join(schema_dir, schema_filename)
         if not os.path.exists(schema_path):
-            logging.critical("Could not find schema %s" % schema_path)
+            schema_path = file_from_path(os.environ.get ('GSETTINGS_SCHEMA_PATH', '').split(os.path.pathsep), schema_filename)
+        if not (schema_path and os.path.exists(schema_path)):
+            schema_path = file_from_path(os.environ.get ('XDG_DATA_DIRS', '').split(os.path.pathsep), os.path.join(schema_prefix, schema_filename))
+        if not (schema_path and os.path.exists(schema_path)):
+            logging.critical("Could not find schema %s" % schema_filename)
             assert(False)
 
         self._schema_name = schema_name