diff options
author | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-02-13 16:18:20 -0500 |
---|---|---|
committer | Jasper St. Pierre <jstpierre@mecheye.net> | 2014-02-13 17:01:23 -0500 |
commit | dcec22b0ad9f1c50d10d4bbbfa69bbfad6232357 (patch) | |
tree | 31b4e9b056f128a2922757f3bf63b1706495748f | |
parent | d94f5a79acf308e2d1adb25790e8379f8a839ba3 (diff) | |
download | gdm-dcec22b0ad9f1c50d10d4bbbfa69bbfad6232357.tar.gz |
common: Remove settings client / server
This is used in *one* place in the simple slave. Just port it
over to use gdm_settings_direct instead of keeping an entire
DBus API around for just one call...
-rw-r--r-- | .gitignore | 4 | ||||
-rw-r--r-- | common/Makefile.am | 44 | ||||
-rw-r--r-- | common/gdm-settings-client.c | 513 | ||||
-rw-r--r-- | common/gdm-settings-client.h | 63 | ||||
-rw-r--r-- | common/gdm-settings.c | 113 | ||||
-rw-r--r-- | common/gdm-settings.xml | 18 | ||||
-rw-r--r-- | common/test-settings-client.c | 89 | ||||
-rw-r--r-- | common/test-settings-server.c | 102 | ||||
-rw-r--r-- | daemon/gdm-simple-slave.c | 4 | ||||
-rw-r--r-- | daemon/simple-slave-main.c | 6 | ||||
-rw-r--r-- | gui/simple-chooser/chooser-main.c | 2 | ||||
-rw-r--r-- | gui/simple-chooser/gdm-host-chooser.c | 2 | ||||
-rw-r--r-- | po/POTFILES.in | 3 |
13 files changed, 1 insertions, 962 deletions
@@ -42,8 +42,6 @@ gdm-session-glue.h gdm-session-glue.c gdm-session-worker-glue.h gdm-session-worker-glue.c -gdm-settings-glue.h -gdm-settings-glue.c gdm-simple-greeter.desktop.in gdm-simple-greeter.schemas gdm-simple-slave-glue.h @@ -96,8 +94,6 @@ INSTALL aclocal.m4 autom4te.cache/ common/test-log -common/test-settings-client -common/test-settings-server compile config.guess config.h.in diff --git a/common/Makefile.am b/common/Makefile.am index b8687da5..ece167b6 100644 --- a/common/Makefile.am +++ b/common/Makefile.am @@ -27,20 +27,9 @@ noinst_LTLIBRARIES = \ libgdmcommon.la \ $(NULL) -BUILT_SOURCES = \ - gdm-settings-glue.h \ - $(NULL) - gdmdir = $(datadir)/gdm gdm_DATA = gdb-cmd -gdm-settings-glue.c gdm-settings-glue.h : gdm-settings.xml Makefile.am - $(AM_V_GEN)gdbus-codegen \ - --c-namespace=GdmDBus \ - --interface-prefix=org.gnome.DisplayManager \ - --generate-c-code=gdm-settings-glue \ - $(srcdir)/gdm-settings.xml - if MKDTEMP_MISSING MKDTEMP_FILES = mkdtemp.c mkdtemp.h else @@ -65,18 +54,11 @@ libgdmcommon_la_SOURCES = \ gdm-settings-utils.c \ gdm-settings-direct.c \ gdm-settings-direct.h \ - gdm-settings-client.h \ - gdm-settings-client.c \ gdm-log.h \ gdm-log.c \ $(MKDTEMP_FILES) \ $(NULL) -nodist_libgdmcommon_la_SOURCES = \ - gdm-settings-glue.h \ - gdm-settings-glue.c \ - $(NULL) - libgdmcommon_la_CPPFLAGS = \ $(AM_CPPFLAGS) \ $(DISABLE_DEPRECATED_CFLAGS) \ @@ -96,8 +78,6 @@ libgdmcommon_la_LDFLAGS = \ $(NULL) noinst_PROGRAMS = \ - test-settings-server \ - test-settings-client \ test-log \ $(NULL) @@ -110,31 +90,7 @@ test_log_LDADD = \ $(COMMON_LIBS) \ $(NULL) -test_settings_server_SOURCES = \ - test-settings-server.c \ - $(NULL) - -test_settings_server_LDADD = \ - libgdmcommon.la \ - $(COMMON_LIBS) \ - $(NULL) - -test_settings_client_SOURCES = \ - test-settings-client.c \ - $(NULL) - -test_settings_client_LDADD = \ - libgdmcommon.la \ - $(COMMON_LIBS) \ - $(NULL) - -CLEANFILES = \ - gdm-settings-glue.c \ - $(BUILT_SOURCES) \ - $(NULL) - EXTRA_DIST = \ - gdm-settings.xml \ mkdtemp.c \ mkdtemp.h \ $(gdm_DATA) \ diff --git a/common/gdm-settings-client.c b/common/gdm-settings-client.c deleted file mode 100644 index 93a278eb..00000000 --- a/common/gdm-settings-client.c +++ /dev/null @@ -1,513 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> - * - * 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 of the License, 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. - * - */ - -#include "config.h" - -#include <stdlib.h> -#include <stdio.h> -#include <fcntl.h> -#include <unistd.h> -#include <string.h> -#include <signal.h> -#include <sys/stat.h> -#include <sys/types.h> - -#include <glib.h> -#include <glib/gi18n.h> -#include <glib/gstdio.h> -#include <glib-object.h> -#include <gio/gio.h> - -#include "gdm-settings-client.h" -#include "gdm-settings-utils.h" -#include "gdm-settings-glue.h" - -#define SETTINGS_DBUS_NAME "org.gnome.DisplayManager" -#define SETTINGS_DBUS_PATH "/org/gnome/DisplayManager/Settings" -#define SETTINGS_DBUS_INTERFACE "org.gnome.DisplayManager.Settings" - -static GHashTable *notifiers = NULL; -static GHashTable *schemas = NULL; -static GdmDBusSettings *settings_proxy = NULL; -static guint32 id_serial = 0; - -typedef struct { - guint id; - char *root; - GdmSettingsClientNotifyFunc func; - gpointer user_data; - GFreeFunc destroy_notify; -} GdmSettingsClientNotify; - -static void -gdm_settings_client_notify_free (GdmSettingsClientNotify *notify) -{ - g_free (notify->root); - - if (notify->destroy_notify != NULL) { - notify->destroy_notify (notify->user_data); - } - - g_free (notify); -} - -static GdmSettingsEntry * -get_entry_for_key (const char *key) -{ - GdmSettingsEntry *entry; - - entry = g_hash_table_lookup (schemas, key); - - if (entry == NULL) { - g_warning ("GdmSettingsClient: unable to find schema for key: %s", key); - } - - return entry; -} - -static gboolean -set_value (const char *key, - const char *value) -{ - GError *error; - gboolean res; - - /* FIXME: check cache */ - - error = NULL; - - res = gdm_dbus_settings_call_set_value_sync (settings_proxy, - key, - value, - NULL, - &error); - if (! res) { - g_debug ("Failed to set value for %s: %s", key, error->message); - g_error_free (error); - } - - return res; -} - -static gboolean -get_value (const char *key, - char **value) -{ - GError *error; - gboolean res; - - /* FIXME: check cache */ - - error = NULL; - - res = gdm_dbus_settings_call_get_value_sync (settings_proxy, - key, - value, - NULL, - &error); - if (! res) { - g_debug ("Failed to get value for %s: %s", key, error->message); - g_error_free (error); - } - - return res; -} - -static void -assert_signature (GdmSettingsEntry *entry, - const char *signature) -{ - const char *sig; - - sig = gdm_settings_entry_get_signature (entry); - - g_assert (sig != NULL); - g_assert (signature != NULL); - g_assert (strcmp (signature, sig) == 0); -} - -static guint32 -get_next_serial (void) -{ - guint32 serial; - - serial = id_serial++; - - if ((gint32)id_serial < 0) { - id_serial = 1; - } - - return serial; -} - -guint -gdm_settings_client_notify_add (const char *root, - GdmSettingsClientNotifyFunc func, - gpointer user_data, - GFreeFunc destroy_notify) -{ - guint32 id; - GdmSettingsClientNotify *notify; - - id = get_next_serial (); - - notify = g_new0 (GdmSettingsClientNotify, 1); - notify->id = id; - notify->root = g_strdup (root); - notify->func = func; - notify->user_data = user_data; - notify->destroy_notify = destroy_notify; - - g_hash_table_insert (notifiers, GINT_TO_POINTER (id), notify); - - return id; -} - -void -gdm_settings_client_notify_remove (guint id) -{ - g_hash_table_remove (notifiers, GINT_TO_POINTER (id)); -} - -gboolean -gdm_settings_client_get_string (const char *key, - char **value) -{ - GdmSettingsEntry *entry; - gboolean ret; - gboolean res; - char *str; - - g_return_val_if_fail (key != NULL, FALSE); - - entry = get_entry_for_key (key); - g_assert (entry != NULL); - - assert_signature (entry, "s"); - - ret = FALSE; - - res = get_value (key, &str); - - if (! res) { - /* use the default */ - str = g_strdup (gdm_settings_entry_get_default_value (entry)); - } - - if (value != NULL) { - *value = g_strdup (str); - } - - ret = TRUE; - - g_free (str); - - return ret; -} - -gboolean -gdm_settings_client_get_locale_string (const char *key, - const char *locale, - char **value) -{ - char *candidate_key; - char *translated_value; - char **languages; - gboolean free_languages = FALSE; - int i; - gboolean ret; - - g_return_val_if_fail (key != NULL, FALSE); - - candidate_key = NULL; - translated_value = NULL; - - if (locale != NULL) { - languages = g_new (char *, 2); - languages[0] = (char *)locale; - languages[1] = NULL; - - free_languages = TRUE; - } else { - languages = (char **) g_get_language_names (); - free_languages = FALSE; - } - - for (i = 0; languages[i]; i++) { - gboolean res; - - candidate_key = g_strdup_printf ("%s[%s]", key, languages[i]); - - res = get_value (candidate_key, &translated_value); - g_free (candidate_key); - - if (res) { - break; - } - - g_free (translated_value); - translated_value = NULL; - } - - /* Fallback to untranslated key - */ - if (translated_value == NULL) { - get_value (key, &translated_value); - } - - if (free_languages) { - g_strfreev (languages); - } - - if (translated_value != NULL) { - ret = TRUE; - if (value != NULL) { - *value = g_strdup (translated_value); - } - } else { - ret = FALSE; - } - - g_free (translated_value); - - return ret; -} - -gboolean -gdm_settings_client_get_boolean (const char *key, - gboolean *value) -{ - GdmSettingsEntry *entry; - gboolean ret; - gboolean res; - char *str; - - g_return_val_if_fail (key != NULL, FALSE); - - entry = get_entry_for_key (key); - g_assert (entry != NULL); - - assert_signature (entry, "b"); - - ret = FALSE; - - res = get_value (key, &str); - - if (! res) { - /* use the default */ - str = g_strdup (gdm_settings_entry_get_default_value (entry)); - } - - ret = gdm_settings_parse_value_as_boolean (str, value); - - g_free (str); - - return ret; -} - -gboolean -gdm_settings_client_get_int (const char *key, - int *value) -{ - GdmSettingsEntry *entry; - gboolean ret; - gboolean res; - char *str; - - g_return_val_if_fail (key != NULL, FALSE); - - entry = get_entry_for_key (key); - g_assert (entry != NULL); - - assert_signature (entry, "i"); - - ret = FALSE; - - res = get_value (key, &str); - - if (! res) { - /* use the default */ - str = g_strdup (gdm_settings_entry_get_default_value (entry)); - } - - ret = gdm_settings_parse_value_as_integer (str, value); - - g_free (str); - - return ret; -} - -gboolean -gdm_settings_client_set_int (const char *key, - int value) -{ - GdmSettingsEntry *entry; - gboolean res; - char *str; - - g_return_val_if_fail (key != NULL, FALSE); - - entry = get_entry_for_key (key); - g_assert (entry != NULL); - - assert_signature (entry, "i"); - - str = gdm_settings_parse_integer_as_value (value); - - res = set_value (key, str); - - g_free (str); - - return res; -} - -gboolean -gdm_settings_client_set_string (const char *key, - const char *value) -{ - GdmSettingsEntry *entry; - gboolean res; - - g_return_val_if_fail (key != NULL, FALSE); - - entry = get_entry_for_key (key); - g_assert (entry != NULL); - - assert_signature (entry, "s"); - - res = set_value (key, value); - - return res; -} - -gboolean -gdm_settings_client_set_boolean (const char *key, - gboolean value) -{ - GdmSettingsEntry *entry; - gboolean res; - char *str; - - g_return_val_if_fail (key != NULL, FALSE); - - entry = get_entry_for_key (key); - g_assert (entry != NULL); - - assert_signature (entry, "b"); - - str = gdm_settings_parse_boolean_as_value (value); - - res = set_value (key, str); - - g_free (str); - - return res; -} - -static void -hashify_list (GdmSettingsEntry *entry, - gpointer data) -{ - g_hash_table_insert (schemas, g_strdup (gdm_settings_entry_get_key (entry)), entry); -} - -static void -send_notification (gpointer key, - GdmSettingsClientNotify *notify, - GdmSettingsEntry *entry) -{ - /* get out if the key is not in the region of interest */ - if (! g_str_has_prefix (gdm_settings_entry_get_key (entry), notify->root)) { - return; - } - - notify->func (notify->id, entry, notify->user_data); -} - -static void -on_value_changed (GdmDBusSettings *proxy, - const char *key, - const char *old_value, - const char *new_value, - gpointer data) -{ - GdmSettingsEntry *entry; - - g_debug ("Value Changed key=%s old=%s new=%s", key, old_value, new_value); - - /* lookup entry */ - entry = get_entry_for_key (key); - - if (entry == NULL) { - return; - } - - gdm_settings_entry_set_value (entry, new_value); - - g_hash_table_foreach (notifiers, (GHFunc)send_notification, entry); -} - -gboolean -gdm_settings_client_init (const char *file, - const char *root) -{ - GError *error; - GSList *list; - - g_return_val_if_fail (file != NULL, FALSE); - g_return_val_if_fail (root != NULL, FALSE); - - g_assert (schemas == NULL); - - error = NULL; - - settings_proxy = GDM_DBUS_SETTINGS (gdm_dbus_settings_proxy_new_for_bus_sync (G_BUS_TYPE_SYSTEM, - G_DBUS_PROXY_FLAGS_DO_NOT_LOAD_PROPERTIES, - SETTINGS_DBUS_NAME, - SETTINGS_DBUS_PATH, - NULL, - &error)); - if (settings_proxy == NULL) { - g_warning ("Unable to connect to settings server: %s", error->message); - g_error_free (error); - return FALSE; - } - - list = NULL; - if (! gdm_settings_parse_schemas (file, root, &list)) { - g_warning ("Unable to parse schemas"); - g_clear_object (&settings_proxy); - return FALSE; - } - - notifiers = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, (GDestroyNotify)gdm_settings_client_notify_free); - - schemas = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, (GDestroyNotify)gdm_settings_entry_free); - g_slist_foreach (list, (GFunc)hashify_list, NULL); - - g_signal_connect (settings_proxy, "value-changed", G_CALLBACK (on_value_changed), NULL); - return TRUE; -} - -void -gdm_settings_client_shutdown (void) -{ - -} diff --git a/common/gdm-settings-client.h b/common/gdm-settings-client.h deleted file mode 100644 index bfa10ec9..00000000 --- a/common/gdm-settings-client.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> - * - * 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 of the License, 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. - * - */ - - -#ifndef __GDM_SETTINGS_CLIENT_H -#define __GDM_SETTINGS_CLIENT_H - -#include <glib-object.h> -#include "gdm-settings-utils.h" - -G_BEGIN_DECLS - -typedef void (*GdmSettingsClientNotifyFunc) (guint id, - GdmSettingsEntry *entry, - gpointer user_data); - -gboolean gdm_settings_client_init (const char *schemas_file, - const char *root); -void gdm_settings_client_shutdown (void); - -gboolean gdm_settings_client_get_int (const char *key, - int *value); -gboolean gdm_settings_client_get_boolean (const char *key, - gboolean *value); -gboolean gdm_settings_client_get_string (const char *key, - char **value); -gboolean gdm_settings_client_get_locale_string (const char *key, - const char *locale, - char **value); - -gboolean gdm_settings_client_set_int (const char *key, - int value); -gboolean gdm_settings_client_set_boolean (const char *key, - gboolean value); -gboolean gdm_settings_client_set_string (const char *key, - const char *value); - -guint gdm_settings_client_notify_add (const char *namespace_section, - GdmSettingsClientNotifyFunc func, - gpointer user_data, - GFreeFunc destroy_notify); -void gdm_settings_client_notify_remove (guint id); - -G_END_DECLS - -#endif /* __GDM_SETTINGS_CLIENT_H */ diff --git a/common/gdm-settings.c b/common/gdm-settings.c index 9e680568..1040fbba 100644 --- a/common/gdm-settings.c +++ b/common/gdm-settings.c @@ -36,20 +36,13 @@ #include <gio/gio.h> #include "gdm-settings.h" -#include "gdm-settings-glue.h" #include "gdm-settings-desktop-backend.h" -#define GDM_DBUS_PATH "/org/gnome/DisplayManager" -#define GDM_SETTINGS_DBUS_PATH GDM_DBUS_PATH "/Settings" -#define GDM_SETTINGS_DBUS_NAME "org.gnome.DisplayManager.Settings" - #define GDM_SETTINGS_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GDM_TYPE_SETTINGS, GdmSettingsPrivate)) struct GdmSettingsPrivate { - GDBusConnection *connection; - GdmDBusSettings *skeleton; GdmSettingsBackend *backend; }; @@ -79,10 +72,6 @@ gdm_settings_error_quark (void) return ret; } -/* -dbus-send --system --print-reply --dest=org.gnome.DisplayManager /org/gnome/DisplayManager/Settings org.gnome.DisplayManager.Settings.GetValue string:"xdmcp/Enable" -*/ - gboolean gdm_settings_get_value (GdmSettings *settings, const char *key, @@ -107,10 +96,6 @@ gdm_settings_get_value (GdmSettings *settings, return res; } -/* -dbus-send --system --print-reply --dest=org.gnome.DisplayManager /org/gnome/DisplayManager/Settings org.gnome.DisplayManager.Settings.SetValue string:"xdmcp/Enable" string:"false" -*/ - gboolean gdm_settings_set_value (GdmSettings *settings, const char *key, @@ -137,91 +122,6 @@ gdm_settings_set_value (GdmSettings *settings, return res; } -static gboolean -handle_get_value (GdmDBusSettings *settings, - GDBusMethodInvocation *invocation, - const char *key, - gpointer user_data) -{ - GdmSettings *self = GDM_SETTINGS (user_data); - GError *error = NULL; - char *value = NULL; - - gdm_settings_get_value (self, key, &value, &error); - if (error) { - g_dbus_method_invocation_return_gerror (invocation, error); - g_error_free (error); - return TRUE; - } - - gdm_dbus_settings_complete_get_value (settings, invocation, - value); - g_free (value); - - return TRUE; -} - -static gboolean -handle_set_value (GdmDBusSettings *settings, - GDBusMethodInvocation *invocation, - const char *key, - const char *value, - gpointer user_data) -{ - GdmSettings *self = GDM_SETTINGS (user_data); - GError *error = NULL; - - gdm_settings_set_value (self, key, value, &error); - if (error) { - g_dbus_method_invocation_return_gerror (invocation, error); - g_error_free (error); - return TRUE; - } - - gdm_dbus_settings_complete_set_value (settings, invocation); - - return TRUE; -} - -static gboolean -register_settings (GdmSettings *settings) -{ - GError *error = NULL; - - error = NULL; - settings->priv->connection = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - if (settings->priv->connection == NULL) { - if (error != NULL) { - g_critical ("error getting system bus: %s", error->message); - g_error_free (error); - } - exit (1); - } - - settings->priv->skeleton = GDM_DBUS_SETTINGS (gdm_dbus_settings_skeleton_new ()); - g_signal_connect_object (settings->priv->skeleton, - "handle-get-value", - G_CALLBACK (handle_get_value), - settings, - 0); - g_signal_connect_object (settings->priv->skeleton, - "handle-set-value", - G_CALLBACK (handle_set_value), - settings, - 0); - - g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (settings->priv->skeleton), - settings->priv->connection, - GDM_SETTINGS_DBUS_PATH, - NULL); - - return TRUE; -} - -/* -dbus-send --system --print-reply --dest=org.gnome.DisplayManager /org/gnome/DisplayManager/Settings org.freedesktop.DBus.Introspectable.Introspect -*/ - static void gdm_settings_class_init (GdmSettingsClass *klass) { @@ -257,9 +157,6 @@ backend_value_changed (GdmSettingsBackend *backend, /* proxy it to internal listeners */ g_signal_emit (settings, signals [VALUE_CHANGED], 0, key, old_value, new_value); - - /* and to dbus */ - gdm_dbus_settings_emit_value_changed (settings->priv->skeleton, key, old_value, new_value); } static void @@ -299,17 +196,7 @@ gdm_settings_new (void) if (settings_object != NULL) { g_object_ref (settings_object); } else { - gboolean res; - settings_object = g_object_new (GDM_TYPE_SETTINGS, NULL); - g_object_add_weak_pointer (settings_object, - (gpointer *) &settings_object); - res = register_settings (settings_object); - if (! res) { - g_warning ("Unable to register settings"); - g_object_unref (settings_object); - return NULL; - } } return GDM_SETTINGS (settings_object); diff --git a/common/gdm-settings.xml b/common/gdm-settings.xml deleted file mode 100644 index 69d9b335..00000000 --- a/common/gdm-settings.xml +++ /dev/null @@ -1,18 +0,0 @@ -<!DOCTYPE node PUBLIC "-//freedesktop//DTD D-BUS Object Introspection 1.0//EN" "http://www.freedesktop.org/standards/dbus/1.0/introspect.dtd"> -<node name="/org/gnome/DisplayManager/Settings"> - <interface name="org.gnome.DisplayManager.Settings"> - <method name="GetValue"> - <arg name="key" direction="in" type="s"/> - <arg name="value" direction="out" type="s"/> - </method> - <method name="SetValue"> - <arg name="key" direction="in" type="s"/> - <arg name="value" direction="in" type="s"/> - </method> - <signal name="ValueChanged"> - <arg name="key" type="s"/> - <arg name="old_value" type="s"/> - <arg name="new_value" type="s"/> - </signal> - </interface> -</node> diff --git a/common/test-settings-client.c b/common/test-settings-client.c deleted file mode 100644 index 4a483fe9..00000000 --- a/common/test-settings-client.c +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> - * - * 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 of the - * License, 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. - * - */ - -#include "config.h" - -#include <stdlib.h> -#include <stdio.h> -#include <sys/types.h> -#include <string.h> -#include <errno.h> - -#include <locale.h> - -#include <glib.h> -#include <glib-object.h> - -#include "gdm-settings-client.h" -#include "gdm-settings-keys.h" - -static void -notify_cb (guint id, - GdmSettingsEntry *entry, - gpointer user_data) -{ - g_debug ("Value changed: %s=%s", - gdm_settings_entry_get_key (entry), - gdm_settings_entry_get_value (entry)); -} - -static gboolean -test_settings_client (gpointer data) -{ - char *strval; - gboolean boolval; - gboolean res; - - strval = NULL; - res = gdm_settings_client_get_string (GDM_KEY_WILLING, &strval); - g_debug ("Got res=%d %s=%s", res, GDM_KEY_WILLING, strval); - g_free (strval); - - res = gdm_settings_client_get_boolean (GDM_KEY_XDMCP_ENABLE, &boolval); - g_debug ("Got res=%d %s=%s", res, GDM_KEY_XDMCP_ENABLE, boolval ? "true" : "false"); - - g_debug ("Adding notify for all keys"); - gdm_settings_client_notify_add ("/", notify_cb, NULL, NULL); - - g_debug ("Setting boolean key %s to %s", GDM_KEY_XDMCP_ENABLE, !boolval ? "true" : "false"); - gdm_settings_client_set_boolean (GDM_KEY_XDMCP_ENABLE, !boolval); - g_debug ("Setting boolean key %s to %s", GDM_KEY_XDMCP_ENABLE, boolval ? "true" : "false"); - gdm_settings_client_set_boolean (GDM_KEY_XDMCP_ENABLE, boolval); - - return FALSE; -} - -int -main (int argc, char **argv) -{ - GMainLoop *loop; - - if (! gdm_settings_client_init (DATADIR "/gdm/gdm.schemas", "/")) { - exit (1); - } - - g_idle_add (test_settings_client, NULL); - - loop = g_main_loop_new (NULL, FALSE); - g_main_loop_run (loop); - - return 0; -} diff --git a/common/test-settings-server.c b/common/test-settings-server.c deleted file mode 100644 index 358af5cc..00000000 --- a/common/test-settings-server.c +++ /dev/null @@ -1,102 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 8 -*- - * - * Copyright (C) 2007 William Jon McCann <mccann@jhu.edu> - * - * 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 of the - * License, 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. - * - */ - -#include "config.h" - -#include <stdlib.h> -#include <stdio.h> -#include <sys/types.h> -#include <string.h> -#include <errno.h> - -#include <locale.h> - -#include <glib.h> -#include <gio/gio.h> - -#include "gdm-settings.h" - -#define GDM_DBUS_NAME "org.gnome.DisplayManager" - -static GdmSettings *settings = NULL; - -static GDBusConnection * -get_system_bus (void) -{ - GError *error; - GDBusConnection *bus; - - error = NULL; - bus = g_bus_get_sync (G_BUS_TYPE_SYSTEM, NULL, &error); - if (bus == NULL) { - g_warning ("Couldn't connect to system bus: %s", - error->message); - g_error_free (error); - goto out; - } - - g_dbus_connection_set_exit_on_close (bus, FALSE); - - out: - return bus; -} - -static void -on_name_acquired (GDBusConnection *connection, - const char *name, - gpointer user_data) -{ - settings = gdm_settings_new (); - if (settings == NULL) { - g_warning ("Unable to initialize settings"); - exit (1); - } -} - -int -main (int argc, char **argv) -{ - GMainLoop *main_loop; - GDBusConnection *connection; - - connection = get_system_bus (); - if (connection == NULL) { - goto out; - } - - g_bus_own_name (G_BUS_TYPE_SYSTEM, - GDM_DBUS_NAME, - G_BUS_NAME_OWNER_FLAGS_NONE, - NULL, /* bus acquired */ - on_name_acquired, - NULL, /* name lost */ - NULL, NULL); - - main_loop = g_main_loop_new (NULL, FALSE); - g_main_loop_run (main_loop); - - g_main_loop_unref (main_loop); - - g_object_unref (settings); - - out: - return 0; -} diff --git a/daemon/gdm-simple-slave.c b/daemon/gdm-simple-slave.c index d83216be..a58368d8 100644 --- a/daemon/gdm-simple-slave.c +++ b/daemon/gdm-simple-slave.c @@ -44,7 +44,6 @@ #include "gdm-common.h" -#include "gdm-settings-client.h" #include "gdm-settings-keys.h" #include "gdm-simple-slave.h" @@ -1491,8 +1490,7 @@ gdm_simple_slave_run (GdmSimpleSlave *slave) slave->priv->server = gdm_server_new (display_name, seat_id, auth_file, display_is_initial); disable_tcp = TRUE; - if (gdm_settings_client_get_boolean (GDM_KEY_DISALLOW_TCP, - &disable_tcp)) { + if (gdm_settings_direct_get_boolean (GDM_KEY_DISALLOW_TCP, &disable_tcp)) { g_object_set (slave->priv->server, "disable-tcp", disable_tcp, NULL); diff --git a/daemon/simple-slave-main.c b/daemon/simple-slave-main.c index 5c6bfa20..a94a5ad0 100644 --- a/daemon/simple-slave-main.c +++ b/daemon/simple-slave-main.c @@ -43,7 +43,6 @@ #include "gdm-settings.h" #include "gdm-settings-direct.h" #include "gdm-settings-keys.h" -#include "gdm-settings-client.h" static GdmSettings *settings = NULL; static int gdm_return_code = 0; @@ -159,11 +158,6 @@ main (int argc, exit (1); } - if (! gdm_settings_client_init (DATADIR "/gdm/gdm.schemas", "/")) { - g_critical ("Unable to initialize settings client"); - exit (1); - } - main_loop = g_main_loop_new (NULL, FALSE); g_unix_signal_add (SIGTERM, on_shutdown_signal_cb, main_loop); diff --git a/gui/simple-chooser/chooser-main.c b/gui/simple-chooser/chooser-main.c index ca5b92c2..54aebf17 100644 --- a/gui/simple-chooser/chooser-main.c +++ b/gui/simple-chooser/chooser-main.c @@ -33,8 +33,6 @@ #include "gdm-common.h" #include "gdm-log.h" -#include "gdm-settings-client.h" -#include "gdm-settings-keys.h" #include "gdm-chooser-session.h" diff --git a/gui/simple-chooser/gdm-host-chooser.c b/gui/simple-chooser/gdm-host-chooser.c index fa15be33..47f37d47 100644 --- a/gui/simple-chooser/gdm-host-chooser.c +++ b/gui/simple-chooser/gdm-host-chooser.c @@ -33,8 +33,6 @@ #include "gdm-common.h" #include "gdm-log.h" -#include "gdm-settings-client.h" -#include "gdm-settings-keys.h" #include "gdm-chooser-host.h" #include "gdm-host-chooser-dialog.h" diff --git a/po/POTFILES.in b/po/POTFILES.in index eec3fa52..44ff2d6f 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -4,13 +4,10 @@ common/gdm-common.c common/gdm-log.c common/gdm-settings-backend.c common/gdm-settings.c -common/gdm-settings-client.c common/gdm-settings-desktop-backend.c common/gdm-settings-direct.c common/gdm-settings-utils.c common/test-log.c -common/test-settings-client.c -common/test-settings-server.c daemon/gdm-display-access-file.c daemon/gdm-display.c daemon/gdm-display-store.c |