diff options
author | Bastien Nocera <hadess@hadess.net> | 2016-09-26 19:09:00 +0200 |
---|---|---|
committer | Bastien Nocera <hadess@hadess.net> | 2016-10-11 11:00:56 +0200 |
commit | 950251e7eb4264e4b8e6c31a972ff5232c4a0f9d (patch) | |
tree | a1cb2996810a1c54564a329caa8dff6c1536aa20 | |
parent | 6d01a434ca2faa88acb2aed1224d23cea329f1f8 (diff) | |
download | gnome-settings-daemon-950251e7eb4264e4b8e6c31a972ff5232c4a0f9d.tar.gz |
main: Remove gnome-settings-daemon binary
https://bugzilla.gnome.org/show_bug.cgi?id=772370
-rw-r--r-- | Makefile.am | 4 | ||||
-rwxr-xr-x | autogen.sh | 2 | ||||
-rw-r--r-- | configure.ac | 15 | ||||
-rw-r--r-- | data/Makefile.am | 11 | ||||
-rw-r--r-- | data/gnome-settings-daemon.desktop.in.in | 9 | ||||
-rw-r--r-- | gnome-settings-daemon/Makefile.am | 33 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-manager.c | 456 | ||||
-rw-r--r-- | gnome-settings-daemon/gnome-settings-manager.h | 68 | ||||
-rw-r--r-- | gnome-settings-daemon/main.c | 449 | ||||
-rw-r--r-- | man/Makefile.am | 19 | ||||
-rw-r--r-- | man/gnome-settings-daemon.xml | 140 | ||||
-rw-r--r-- | po/POTFILES.in | 2 | ||||
-rw-r--r-- | po/POTFILES.skip | 6 |
13 files changed, 3 insertions, 1211 deletions
diff --git a/Makefile.am b/Makefile.am index e7ae0305..3c54c26a 100644 --- a/Makefile.am +++ b/Makefile.am @@ -8,10 +8,6 @@ SUBDIRS = \ tests \ $(NULL) -if ENABLE_MAN -SUBDIRS += man -endif - # Honor aclocal flags ACLOCAL_AMFLAGS = ${ACLOCAL_FLAGS} @@ -11,7 +11,7 @@ PKG_NAME="gnome-settings-daemon" (test -f $srcdir/configure.ac \ && test -d $srcdir/gnome-settings-daemon \ - && test -f $srcdir/gnome-settings-daemon/gnome-settings-manager.h) || { + && test -f $srcdir/gnome-settings-daemon/gnome-settings-bus.c) || { echo -n "**Error**: Directory "\`$srcdir\'" does not look like the" echo " top-level gnome-settings-daemon directory" exit 1 diff --git a/configure.ac b/configure.ac index 965375e5..2a688494 100644 --- a/configure.ac +++ b/configure.ac @@ -4,7 +4,7 @@ AC_INIT([gnome-settings-daemon], [3.23.1], [http://bugzilla.gnome.org/enter_bug.cgi?product=gnome-settings-daemon]) -AC_CONFIG_SRCDIR([gnome-settings-daemon/gnome-settings-manager.c]) +AC_CONFIG_SRCDIR([gnome-settings-daemon/gnome-settings-bus.c]) AM_INIT_AUTOMAKE([1.9 tar-ustar dist-xz no-dist-gzip check-news]) AM_MAINTAINER_MODE([enable]) @@ -430,18 +430,6 @@ AC_SUBST([plugindir]) PLUGIN_CFLAGS="-DG_LOG_DOMAIN=\"\\\"\$(plugin_name)-plugin\\\"\" -DPLUGIN_NAME=\"\\\"\$(plugin_name)\\\"\" " AC_SUBST(PLUGIN_CFLAGS) -AC_ARG_ENABLE(man, - [AS_HELP_STRING([--enable-man], - [generate man pages [default=yes]])],, - enable_man=yes) -if test "$enable_man" != no; then - AC_PATH_PROG([XSLTPROC], [xsltproc]) - if test -z "$XSLTPROC"; then - AC_MSG_ERROR([xsltproc is required for --enable-man]) - fi -fi -AM_CONDITIONAL(ENABLE_MAN, test "$enable_man" != no) - dnl --------------------------------------------------------------------------- dnl - Finish dnl --------------------------------------------------------------------------- @@ -547,7 +535,6 @@ data/org.gnome.settings-daemon.plugins.sharing.gschema.xml.in data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in po/Makefile.in -man/Makefile tests/Makefile ]) diff --git a/data/Makefile.am b/data/Makefile.am index c9d27dcd..b2aee3d0 100644 --- a/data/Makefile.am +++ b/data/Makefile.am @@ -25,14 +25,6 @@ gsettings_SCHEMAS = \ convertdir = $(datadir)/GConf/gsettings convert_DATA = gnome-settings-daemon.convert -@INTLTOOL_DESKTOP_RULE@ -desktopdir = $(sysconfdir)/xdg/autostart -desktop_in_files = gnome-settings-daemon.desktop.in.in -desktop_DATA = $(desktop_in_files:.desktop.in.in=.desktop) - -gnome-settings-daemon.desktop.in: gnome-settings-daemon.desktop.in.in - $(AM_V_GEN) sed -e "s|\@libexecdir\@|$(libexecdir)|" $< > $@.tmp && mv $@.tmp $@ - pkgconfigdir = $(libdir)/pkgconfig pkgconfig_DATA = gnome-settings-daemon.pc @@ -41,7 +33,6 @@ pkgconfig_DATA = gnome-settings-daemon.pc EXTRA_DIST = \ $(convert_DATA) \ $(gsettings_SCHEMAS:.xml=.xml.in.in) \ - $(desktop_in_files) \ $(gsettings_ENUM_FILES) \ gnome-settings-daemon.pc.in \ $(api_DATA) \ @@ -49,8 +40,6 @@ EXTRA_DIST = \ DISTCLEANFILES = \ $(gsettings_SCHEMAS) \ - $(desktop_DATA) \ - gnome-settings-daemon.desktop.in \ $(NULL) MAINTAINERCLEANFILES = \ diff --git a/data/gnome-settings-daemon.desktop.in.in b/data/gnome-settings-daemon.desktop.in.in deleted file mode 100644 index c5a5518c..00000000 --- a/data/gnome-settings-daemon.desktop.in.in +++ /dev/null @@ -1,9 +0,0 @@ -[Desktop Entry] -Type=Application -_Name=GNOME Settings Daemon -Exec=@libexecdir@/gnome-settings-daemon -OnlyShowIn=GNOME; -NoDisplay=true -X-GNOME-Autostart-Phase=Initialization -X-GNOME-Autostart-Notify=true -X-GNOME-AutoRestart=true diff --git a/gnome-settings-daemon/Makefile.am b/gnome-settings-daemon/Makefile.am index b6beb0f6..d1125d22 100644 --- a/gnome-settings-daemon/Makefile.am +++ b/gnome-settings-daemon/Makefile.am @@ -88,11 +88,6 @@ libgsd_la_LDFLAGS = \ -no-undefined \ $(NULL) -gsddir = $(libexecdir) - -gsd_PROGRAMS = \ - gnome-settings-daemon - EXTRA_DIST = \ org.gnome.SessionManager.xml \ org.gnome.ScreenSaver.xml \ @@ -103,33 +98,7 @@ apidir = $(includedir)/gnome-settings-daemon-$(GSD_API_VERSION)/gnome-settings api_DATA = \ gnome-settings-plugin.h -gnome_settings_daemon_SOURCES = \ - main.c \ - gnome-settings-manager.c \ - gnome-settings-manager.h \ - gnome-settings-plugin.c \ - gnome-settings-plugin.h \ - gnome-settings-plugin-info.c \ - gnome-settings-plugin-info.h \ - gnome-settings-module.c \ - gnome-settings-module.h \ - $(NULL) - -gnome_settings_daemon_CPPFLAGS = \ - $(AM_CPPFLAGS) - -gnome_settings_daemon_CFLAGS = \ - $(AM_CFLAGS) - -gnome_settings_daemon_LDFLAGS = \ - $(AM_LDFLAGS) - -gnome_settings_daemon_LDADD = \ - libgsd.la \ - $(SETTINGS_DAEMON_LIBS) \ - $(LIBNOTIFY_LIBS) \ - $(GNOME_DESKTOP_LIBS) \ - $(NULL) +EXTRA_DIST += $(api_DATA) CLEANFILES = $(gsd_SCRIPTS) diff --git a/gnome-settings-daemon/gnome-settings-manager.c b/gnome-settings-daemon/gnome-settings-manager.c deleted file mode 100644 index 05f568b3..00000000 --- a/gnome-settings-daemon/gnome-settings-manager.c +++ /dev/null @@ -1,456 +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, see <http://www.gnu.org/licenses/>. - * - */ - -#include "config.h" - -#include <stdlib.h> -#include <stdio.h> -#include <unistd.h> -#include <string.h> - -#include <glib.h> -#include <glib/gi18n.h> -#include <glib-object.h> -#include <gio/gio.h> - -#define GNOME_DESKTOP_USE_UNSTABLE_API -#include <libgnome-desktop/gnome-pnp-ids.h> - -#include "gnome-settings-plugin.h" -#include "gnome-settings-plugin-info.h" -#include "gnome-settings-manager.h" -#include "gnome-settings-profile.h" - -#define DEFAULT_SETTINGS_PREFIX "org.gnome.settings-daemon" - -#define PLUGIN_EXT ".gnome-settings-plugin" - -#define GNOME_SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManagerPrivate)) - -static const gchar introspection_xml[] = -"<node name='/org/gnome/SettingsDaemon'>" -" <interface name='org.gnome.SettingsDaemon'>" -" <annotation name='org.freedesktop.DBus.GLib.CSymbol' value='gnome_settings_manager'/>" -" <signal name='PluginActivated'>" -" <arg name='name' type='s'/>" -" </signal>" -" <signal name='PluginDeactivated'>" -" <arg name='name' type='s'/>" -" </signal>" -" </interface>" -"</node>"; - -struct GnomeSettingsManagerPrivate -{ - guint owner_id; - GDBusNodeInfo *introspection_data; - GDBusConnection *connection; - guint dbus_register_object_id; - GCancellable *cancellable; - - GSettings *settings; - char **whitelist; - GnomePnpIds *pnp_ids; - GSList *plugins; -}; - -static void gnome_settings_manager_class_init (GnomeSettingsManagerClass *klass); -static void gnome_settings_manager_init (GnomeSettingsManager *settings_manager); - -G_DEFINE_TYPE (GnomeSettingsManager, gnome_settings_manager, G_TYPE_OBJECT) - -static gpointer manager_object = NULL; - -GQuark -gnome_settings_manager_error_quark (void) -{ - static GQuark ret = 0; - if (ret == 0) { - ret = g_quark_from_static_string ("gnome_settings_manager_error"); - } - - return ret; -} - -static void -activate_plugin (GnomeSettingsPluginInfo *info, gpointer user_data) -{ - gboolean res; - res = gnome_settings_plugin_info_activate (info); - if (res) { - g_debug ("Plugin %s: active", gnome_settings_plugin_info_get_location (info)); - } else { - g_debug ("Plugin %s: activation failed", gnome_settings_plugin_info_get_location (info)); - } -} - -static gint -compare_location (GnomeSettingsPluginInfo *a, - GnomeSettingsPluginInfo *b) -{ - const char *loc_a; - const char *loc_b; - - loc_a = gnome_settings_plugin_info_get_location (a); - loc_b = gnome_settings_plugin_info_get_location (b); - - if (loc_a == NULL || loc_b == NULL) { - return -1; - } - - return strcmp (loc_a, loc_b); -} - -static int -compare_priority (GnomeSettingsPluginInfo *a, - GnomeSettingsPluginInfo *b) -{ - int prio_a; - int prio_b; - - prio_a = gnome_settings_plugin_info_get_priority (a); - prio_b = gnome_settings_plugin_info_get_priority (b); - - return prio_a - prio_b; -} - -static void -emit_signal (GnomeSettingsManager *manager, - const char *signal, - const char *name) -{ - GError *error = NULL; - - /* FIXME: maybe we should queue those up until the D-Bus - * connection is available... */ - if (manager->priv->connection == NULL) - return; - - if (g_dbus_connection_emit_signal (manager->priv->connection, - NULL, - GSD_DBUS_PATH, - GSD_DBUS_NAME, - "PluginActivated", - g_variant_new ("(s)", name), - &error) == FALSE) { - g_debug ("Error emitting signal: %s", error->message); - g_error_free (error); - } - -} - -static void -on_plugin_activated (GnomeSettingsPluginInfo *info, - GnomeSettingsManager *manager) -{ - const char *name; - - name = gnome_settings_plugin_info_get_location (info); - g_debug ("GnomeSettingsManager: emitting plugin-activated %s", name); - emit_signal (manager, "PluginActivated", name); -} - -static void -on_plugin_deactivated (GnomeSettingsPluginInfo *info, - GnomeSettingsManager *manager) -{ - const char *name; - - name = gnome_settings_plugin_info_get_location (info); - g_debug ("GnomeSettingsManager: emitting plugin-deactivated %s", name); - emit_signal (manager, "PluginDeactivated", name); -} - -static gboolean -is_whitelisted (char **whitelist, - const char *plugin_name) -{ - if (whitelist == NULL || - whitelist[0] == NULL || - g_strcmp0 (whitelist[0], "all") == 0) - return TRUE; - - return g_strv_contains ((const gchar * const *)whitelist, plugin_name); -} - -static void -_load_file (GnomeSettingsManager *manager, - const char *filename) -{ - GnomeSettingsPluginInfo *info; - char *key_name; - GSList *l; - - g_debug ("Loading plugin: %s", filename); - gnome_settings_profile_start ("%s", filename); - - info = gnome_settings_plugin_info_new_from_file (filename); - if (info == NULL) { - goto out; - } - - l = g_slist_find_custom (manager->priv->plugins, - info, - (GCompareFunc) compare_location); - if (l != NULL) { - goto out; - } - - if (!is_whitelisted (manager->priv->whitelist, - gnome_settings_plugin_info_get_location (info))) { - g_debug ("Plugin %s ignored as it's not whitelisted", - gnome_settings_plugin_info_get_location (info)); - goto out; - } - - key_name = g_strdup_printf ("%s.plugins.%s", - DEFAULT_SETTINGS_PREFIX, - gnome_settings_plugin_info_get_location (info)); - - /* Ignore unknown schemas or else we'll assert */ - manager->priv->plugins = g_slist_prepend (manager->priv->plugins, - g_object_ref (info)); - - g_signal_connect (info, "activated", - G_CALLBACK (on_plugin_activated), manager); - g_signal_connect (info, "deactivated", - G_CALLBACK (on_plugin_deactivated), manager); - - /* Priority is set in the call above */ - g_free (key_name); - - out: - if (info != NULL) { - g_object_unref (info); - } - - gnome_settings_profile_end ("%s", filename); -} - -static void -_load_dir (GnomeSettingsManager *manager, - const char *path) -{ - GError *error; - GDir *d; - const char *name; - - g_debug ("Loading settings plugins from dir: %s", path); - gnome_settings_profile_start (NULL); - - error = NULL; - d = g_dir_open (path, 0, &error); - if (d == NULL) { - g_warning ("%s", error->message); - g_error_free (error); - return; - } - - while ((name = g_dir_read_name (d))) { - char *filename; - - if (!g_str_has_suffix (name, PLUGIN_EXT)) { - continue; - } - - filename = g_build_filename (path, name, NULL); - if (g_file_test (filename, G_FILE_TEST_IS_REGULAR)) { - _load_file (manager, filename); - } - g_free (filename); - } - - g_dir_close (d); - - gnome_settings_profile_end (NULL); -} - -static void -_load_all (GnomeSettingsManager *manager) -{ - gnome_settings_profile_start (NULL); - - /* load system plugins */ - _load_dir (manager, GNOME_SETTINGS_PLUGINDIR G_DIR_SEPARATOR_S); - - manager->priv->plugins = g_slist_sort (manager->priv->plugins, (GCompareFunc) compare_priority); - g_slist_foreach (manager->priv->plugins, (GFunc) activate_plugin, NULL); - gnome_settings_profile_end (NULL); -} - -static void -_unload_plugin (GnomeSettingsPluginInfo *info, gpointer user_data) -{ - gnome_settings_plugin_info_deactivate (info); - g_object_unref (info); -} - -static void -_unload_all (GnomeSettingsManager *manager) -{ - g_slist_foreach (manager->priv->plugins, (GFunc) _unload_plugin, NULL); - g_slist_free (manager->priv->plugins); - manager->priv->plugins = NULL; -} - -static void -on_bus_gotten (GObject *source_object, - GAsyncResult *res, - GnomeSettingsManager *manager) -{ - GDBusConnection *connection; - GError *error = NULL; - - connection = g_bus_get_finish (res, &error); - if (connection == NULL) { - if (!g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) - g_warning ("Could not get session bus: %s", error->message); - g_error_free (error); - return; - } - manager->priv->connection = connection; - - manager->priv->dbus_register_object_id = g_dbus_connection_register_object (connection, - GSD_DBUS_PATH, - manager->priv->introspection_data->interfaces[0], - NULL, - NULL, - NULL, - NULL); - g_assert (manager->priv->dbus_register_object_id > 0); -} - -static void -register_manager (GnomeSettingsManager *manager) -{ - manager->priv->introspection_data = g_dbus_node_info_new_for_xml (introspection_xml, NULL); - g_assert (manager->priv->introspection_data != NULL); - - manager->priv->cancellable = g_cancellable_new (); - - g_bus_get (G_BUS_TYPE_SESSION, - manager->priv->cancellable, - (GAsyncReadyCallback) on_bus_gotten, - manager); -} - -gboolean -gnome_settings_manager_start (GnomeSettingsManager *manager, - GError **error) -{ - gboolean ret; - - g_debug ("Starting settings manager"); - - ret = FALSE; - - gnome_settings_profile_start (NULL); - - if (!g_module_supported ()) { - g_warning ("gnome-settings-daemon is not able to initialize the plugins."); - g_set_error (error, - GNOME_SETTINGS_MANAGER_ERROR, - GNOME_SETTINGS_MANAGER_ERROR_GENERAL, - "Plugins not supported"); - - goto out; - } - - g_debug ("loading PNPIDs"); - manager->priv->pnp_ids = gnome_pnp_ids_new (); - - gnome_settings_profile_start ("initializing plugins"); - manager->priv->settings = g_settings_new (DEFAULT_SETTINGS_PREFIX ".plugins"); - manager->priv->whitelist = g_settings_get_strv (manager->priv->settings, "whitelisted-plugins"); - - _load_all (manager); - gnome_settings_profile_end ("initializing plugins"); - - ret = TRUE; - out: - gnome_settings_profile_end (NULL); - - return ret; -} - -static void -gnome_settings_manager_dispose (GObject *object) -{ - GnomeSettingsManager *manager; - - manager = GNOME_SETTINGS_MANAGER (object); - - g_debug ("Stopping settings manager"); - - _unload_all (manager); - - if (manager->priv->cancellable) { - g_cancellable_cancel (manager->priv->cancellable); - g_clear_object (&manager->priv->cancellable); - } - if (manager->priv->owner_id > 0) { - g_bus_unown_name (manager->priv->owner_id); - manager->priv->owner_id = 0; - } - if (manager->priv->dbus_register_object_id > 0) { - g_dbus_connection_unregister_object (manager->priv->connection, - manager->priv->dbus_register_object_id); - manager->priv->dbus_register_object_id = 0; - } - - g_clear_pointer (&manager->priv->whitelist, g_strfreev); - g_clear_object (&manager->priv->settings); - g_clear_object (&manager->priv->pnp_ids); - g_clear_object (&manager->priv->connection); - - G_OBJECT_CLASS (gnome_settings_manager_parent_class)->dispose (object); -} - -static void -gnome_settings_manager_class_init (GnomeSettingsManagerClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - object_class->dispose = gnome_settings_manager_dispose; - - g_type_class_add_private (klass, sizeof (GnomeSettingsManagerPrivate)); -} - -static void -gnome_settings_manager_init (GnomeSettingsManager *manager) -{ - - manager->priv = GNOME_SETTINGS_MANAGER_GET_PRIVATE (manager); -} - -GnomeSettingsManager * -gnome_settings_manager_new (void) -{ - if (manager_object != NULL) { - g_object_ref (manager_object); - } else { - manager_object = g_object_new (GNOME_TYPE_SETTINGS_MANAGER, - NULL); - g_object_add_weak_pointer (manager_object, - (gpointer *) &manager_object); - register_manager (manager_object); - } - - return GNOME_SETTINGS_MANAGER (manager_object); -} diff --git a/gnome-settings-daemon/gnome-settings-manager.h b/gnome-settings-daemon/gnome-settings-manager.h deleted file mode 100644 index d2f80225..00000000 --- a/gnome-settings-daemon/gnome-settings-manager.h +++ /dev/null @@ -1,68 +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, see <http://www.gnu.org/licenses/>. - * - */ - -#ifndef __GNOME_SETTINGS_MANAGER_H -#define __GNOME_SETTINGS_MANAGER_H - -#include <glib-object.h> - -G_BEGIN_DECLS - -#define GNOME_TYPE_SETTINGS_MANAGER (gnome_settings_manager_get_type ()) -#define GNOME_SETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManager)) -#define GNOME_SETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManagerClass)) -#define GNOME_IS_SETTINGS_MANAGER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), GNOME_TYPE_SETTINGS_MANAGER)) -#define GNOME_IS_SETTINGS_MANAGER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), GNOME_TYPE_SETTINGS_MANAGER)) -#define GNOME_SETTINGS_MANAGER_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManagerClass)) - -typedef struct GnomeSettingsManagerPrivate GnomeSettingsManagerPrivate; - -typedef struct -{ - GObject parent; - GnomeSettingsManagerPrivate *priv; -} GnomeSettingsManager; - -typedef struct -{ - GObjectClass parent_class; - - void (* plugin_activated) (GnomeSettingsManager *manager, - const char *name); - void (* plugin_deactivated) (GnomeSettingsManager *manager, - const char *name); -} GnomeSettingsManagerClass; - -typedef enum -{ - GNOME_SETTINGS_MANAGER_ERROR_GENERAL -} GnomeSettingsManagerError; - -#define GNOME_SETTINGS_MANAGER_ERROR gnome_settings_manager_error_quark () - -GQuark gnome_settings_manager_error_quark (void); -GType gnome_settings_manager_get_type (void); - -GnomeSettingsManager * gnome_settings_manager_new (void); -gboolean gnome_settings_manager_start (GnomeSettingsManager *manager, - GError **error); - -G_END_DECLS - -#endif /* __GNOME_SETTINGS_MANAGER_H */ diff --git a/gnome-settings-daemon/main.c b/gnome-settings-daemon/main.c deleted file mode 100644 index 48d4bad4..00000000 --- a/gnome-settings-daemon/main.c +++ /dev/null @@ -1,449 +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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - */ - -#include "config.h" - -#include <stdlib.h> -#include <unistd.h> -#include <libintl.h> -#include <errno.h> -#include <locale.h> -#include <signal.h> -#include <fcntl.h> -#include <sys/wait.h> - -#include <glib/gi18n.h> -#include <glib/gstdio.h> -#include <glib-unix.h> -#include <gtk/gtk.h> -#include <libnotify/notify.h> - -#include "gnome-settings-manager.h" -#include "gnome-settings-plugin.h" -#include "gnome-settings-profile.h" -#include "gnome-settings-bus.h" - -#define GNOME_SESSION_DBUS_NAME "org.gnome.SessionManager" -#define GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE "org.gnome.SessionManager.ClientPrivate" - -static gboolean replace = FALSE; -static gboolean debug = FALSE; -static gboolean do_timed_exit = FALSE; -static gboolean ignore_name_lost = FALSE; -static guint name_id = 0; -static GnomeSettingsManager *manager = NULL; - -static GOptionEntry entries[] = { - {"debug", 0, 0, G_OPTION_ARG_NONE, &debug, N_("Enable debugging code"), NULL }, - { "replace", 'r', 0, G_OPTION_ARG_NONE, &replace, N_("Replace existing daemon"), NULL }, - { "timed-exit", 0, 0, G_OPTION_ARG_NONE, &do_timed_exit, N_("Exit after a time (for debugging)"), NULL }, - {NULL} -}; - -static gboolean -timed_exit_cb (void) -{ - g_debug ("Doing timed exit"); - gtk_main_quit (); - return FALSE; -} - -static void -respond_to_end_session (GDBusProxy *proxy) -{ - /* we must answer with "EndSessionResponse" */ - g_dbus_proxy_call (proxy, "EndSessionResponse", - g_variant_new ("(bs)", - TRUE, ""), - G_DBUS_CALL_FLAGS_NONE, - -1, NULL, NULL, NULL); -} - -static void -do_stop (void) -{ - /* We don't want to quit yet because if we do, gnome-shell - * and still mapped windows lose their theme and icons. But - * we have to unown our DBus name otherwise gnome-session - * will hang waiting for us. - * - * This only works due to a bug in gnome-session where it - * handles any client name being unowned as if the client has - * disconnected. Will need to be revisited when that bug is - * fixed in gnome-session. */ - ignore_name_lost = TRUE; - g_bus_unown_name (name_id); - name_id = 0; -} - -static void -client_proxy_signal_cb (GDBusProxy *proxy, - gchar *sender_name, - gchar *signal_name, - GVariant *parameters, - gpointer user_data) -{ - if (g_strcmp0 (signal_name, "QueryEndSession") == 0) { - g_debug ("Got QueryEndSession signal"); - respond_to_end_session (proxy); - } else if (g_strcmp0 (signal_name, "EndSession") == 0) { - g_debug ("Got EndSession signal"); - respond_to_end_session (proxy); - } else if (g_strcmp0 (signal_name, "Stop") == 0) { - g_debug ("Got Stop signal"); - do_stop (); - } -} - -static void -got_client_proxy (GObject *object, - GAsyncResult *res, - gpointer user_data) -{ - GDBusProxy *client_proxy; - GError *error = NULL; - - client_proxy = g_dbus_proxy_new_for_bus_finish (res, &error); - - if (error != NULL) { - g_debug ("Unable to get the session client proxy: %s", error->message); - g_error_free (error); - return; - } - - g_signal_connect (client_proxy, "g-signal", - G_CALLBACK (client_proxy_signal_cb), manager); -} - -static void -start_settings_manager (void) -{ - gboolean res; - GError *error; - - gnome_settings_profile_start ("gnome_settings_manager_new"); - manager = gnome_settings_manager_new (); - gnome_settings_profile_end ("gnome_settings_manager_new"); - if (manager == NULL) { - g_warning ("Unable to register object"); - gtk_main_quit (); - } - - error = NULL; - res = gnome_settings_manager_start (manager, &error); - if (! res) { - g_warning ("Unable to start: %s", error->message); - g_error_free (error); - gtk_main_quit (); - } -} - -static void -on_client_registered (GObject *source_object, - GAsyncResult *res, - gpointer user_data) -{ - GVariant *variant; - GError *error = NULL; - gchar *object_path = NULL; - - variant = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); - if (error != NULL) { - g_warning ("Unable to register client: %s", error->message); - g_error_free (error); - } else { - g_variant_get (variant, "(o)", &object_path); - - g_debug ("Registered client at path %s", object_path); - - g_dbus_proxy_new_for_bus (G_BUS_TYPE_SESSION, 0, NULL, - GNOME_SESSION_DBUS_NAME, - object_path, - GNOME_SESSION_CLIENT_PRIVATE_DBUS_INTERFACE, - NULL, - got_client_proxy, - manager); - - g_free (object_path); - g_variant_unref (variant); - } -} - -static void -session_env_done (GObject *source_object, - GAsyncResult *res, - gpointer user_data) -{ - GVariant *result; - GError *error = NULL; - - result = g_dbus_proxy_call_finish (G_DBUS_PROXY (source_object), res, &error); - if (result == NULL) { - g_debug ("Failed to set the environment: %s", error->message); - g_error_free (error); - return; - } - - g_variant_unref (result); -} - -static void -set_session_env (GDBusProxy *proxy, - const gchar *name, - const gchar *value) -{ - g_dbus_proxy_call (proxy, - "Setenv", - g_variant_new ("(ss)", name, value), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) session_env_done, - NULL); -} - -static void -set_locale (GDBusProxy *proxy) -{ - GSettings *locale_settings; - gchar *region; - - /* Set locale environment */ - locale_settings = g_settings_new ("org.gnome.system.locale"); - region = g_settings_get_string (locale_settings, "region"); - if (region[0]) { - /* Only set the locale settings if the user has ever customized them */ - set_session_env (proxy, "LC_TIME", region); - set_session_env (proxy, "LC_NUMERIC", region); - set_session_env (proxy, "LC_MONETARY", region); - set_session_env (proxy, "LC_MEASUREMENT", region); - set_session_env (proxy, "LC_PAPER", region); - } - g_free (region); - - g_object_unref (locale_settings); -} - -static gboolean -is_program_in_path (const char *binary) -{ - char *path; - - path = g_find_program_in_path (binary); - if (path == NULL) - return FALSE; - g_free (path); - return TRUE; -} - -static void -set_legacy_ibus_env_vars (GDBusProxy *proxy) -{ - const char *p; - if (is_program_in_path ("ibus-daemon")) { - p = getenv ("QT_IM_MODULE"); - if (!p || !*p) - p = "ibus"; - set_session_env (proxy, "QT_IM_MODULE", p); - p = getenv ("XMODIFIERS"); - if (!p || !*p) - p = "@im=ibus"; - set_session_env (proxy, "XMODIFIERS", p); - } -} - -static void -register_with_gnome_session (GDBusProxy *proxy) -{ - const char *startup_id; - - startup_id = g_getenv ("DESKTOP_AUTOSTART_ID"); - g_dbus_proxy_call (proxy, - "RegisterClient", - g_variant_new ("(ss)", "gnome-settings-daemon", startup_id ? startup_id : ""), - G_DBUS_CALL_FLAGS_NONE, - -1, - NULL, - (GAsyncReadyCallback) on_client_registered, - manager); -} - -static gboolean -on_term_signal (gpointer user_data) -{ - g_debug ("Received SIGTERM - shutting down"); - /* Got SIGTERM, time to clean up and get out - */ - gtk_main_quit (); - - return FALSE; -} - -static void -name_acquired_handler (GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - GDBusProxy *proxy; - - proxy = G_DBUS_PROXY (gnome_settings_bus_get_session_proxy ()); - /* Always call this first, as Setenv can only be called before - any client registers */ - set_locale (proxy); - set_legacy_ibus_env_vars (proxy); - - start_settings_manager (); - register_with_gnome_session (proxy); - g_unix_signal_add (SIGTERM, on_term_signal, manager); -} - -static void -name_lost_handler (GDBusConnection *connection, - const gchar *name, - gpointer user_data) -{ - if (ignore_name_lost) - return; - - /* Name was already taken, or the bus went away */ - - g_warning ("Name taken or bus went away - shutting down"); - - gtk_main_quit (); - -} - -static void -bus_register (void) -{ - GBusNameOwnerFlags flags; - - flags = G_BUS_NAME_OWNER_FLAGS_ALLOW_REPLACEMENT; - - if (replace) - flags |= G_BUS_NAME_OWNER_FLAGS_REPLACE; - - name_id = g_bus_own_name (G_BUS_TYPE_SESSION, - GSD_DBUS_NAME, - flags, - NULL, - (GBusNameAcquiredCallback) name_acquired_handler, - (GBusNameLostCallback) name_lost_handler, - NULL, - NULL); -} - -static void -gsd_log_default_handler (const gchar *log_domain, - GLogLevelFlags log_level, - const gchar *message, - gpointer unused_data) -{ - /* filter out DEBUG messages if debug isn't set */ - if ((log_level & G_LOG_LEVEL_MASK) == G_LOG_LEVEL_DEBUG - && ! debug) { - return; - } - - g_log_default_handler (log_domain, - log_level, - message, - unused_data); -} - -static void -parse_args (int *argc, char ***argv) -{ - GError *error; - GOptionContext *context; - - gnome_settings_profile_start (NULL); - - - context = g_option_context_new (NULL); - - g_option_context_add_main_entries (context, entries, NULL); - g_option_context_add_group (context, gtk_get_option_group (FALSE)); - - error = NULL; - if (!g_option_context_parse (context, argc, argv, &error)) { - if (error != NULL) { - g_warning ("%s", error->message); - g_error_free (error); - } else { - g_warning ("Unable to initialize GTK+"); - } - exit (EXIT_FAILURE); - } - - g_option_context_free (context); - - gnome_settings_profile_end (NULL); - - if (debug) - g_setenv ("G_MESSAGES_DEBUG", "all", FALSE); -} - -int -main (int argc, char *argv[]) -{ - gnome_settings_profile_start (NULL); - - bindtextdomain (GETTEXT_PACKAGE, GNOME_SETTINGS_LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - setlocale (LC_ALL, ""); - - parse_args (&argc, &argv); - - gdk_set_allowed_backends ("x11"); - - gnome_settings_profile_start ("opening gtk display"); - if (! gtk_init_check (NULL, NULL)) { - g_warning ("Unable to initialize GTK+"); - exit (EXIT_FAILURE); - } - gnome_settings_profile_end ("opening gtk display"); - - g_log_set_default_handler (gsd_log_default_handler, NULL); - - notify_init ("gnome-settings-daemon"); - - bus_register (); - - if (do_timed_exit) { - g_timeout_add_seconds (30, (GSourceFunc) timed_exit_cb, NULL); - } - - gtk_main (); - - g_debug ("Shutting down"); - - if (name_id > 0) { - g_bus_unown_name (name_id); - name_id = 0; - } - - g_clear_object (&manager); - - g_debug ("SettingsDaemon finished"); - gnome_settings_profile_end (NULL); - - return 0; -} diff --git a/man/Makefile.am b/man/Makefile.am deleted file mode 100644 index 644259d2..00000000 --- a/man/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -XSLTPROC_FLAGS = \ - --nonet \ - --stringparam man.output.quietly 1 \ - --stringparam funcsynopsis.style ansi \ - --stringparam man.th.extra1.suppress 1 \ - --stringparam man.authors.section.enabled 0 \ - --stringparam man.copyright.section.enabled 0 - -.xml.1: - $(AM_V_GEN) $(XSLTPROC) $(XSLTPROC_FLAGS) http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl $< - -man_MANS = \ - gnome-settings-daemon.1 - -xml_files = $(man_MANS:.1=.xml) - -EXTRA_DIST = $(xml_files) - -DISTCLEANFILES = $(man_MANS) diff --git a/man/gnome-settings-daemon.xml b/man/gnome-settings-daemon.xml deleted file mode 100644 index b5678e2f..00000000 --- a/man/gnome-settings-daemon.xml +++ /dev/null @@ -1,140 +0,0 @@ -<?xml version='1.0'?> -<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" - "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd"> - -<refentry id="gnome-settings-daemon"> - - <refentryinfo> - <title>gnome-settings-daemon</title> - <productname>GNOME</productname> - - <authorgroup> - <author> - <contrib>Maintainer</contrib> - <firstname>Bastien</firstname> - <surname>Nocera</surname> - <email>hadess@hadess.net</email> - </author> - </authorgroup> - - </refentryinfo> - - <refmeta> - <refentrytitle>gnome-settings-daemon</refentrytitle> - <manvolnum>1</manvolnum> - <refmiscinfo class="manual">User Commands</refmiscinfo> - </refmeta> - - <refnamediv> - <refname>gnome-settings-daemon</refname> - <refpurpose>GNOME settings daemon</refpurpose> - </refnamediv> - - <refsynopsisdiv> - <cmdsynopsis> - <command>gnome-settings-daemon <arg choice="opt" rep="repeat">OPTION</arg></command> - </cmdsynopsis> - </refsynopsisdiv> - - <refsect1> - <title>Description</title> - - <para><command>gnome-settings-daemon</command> provides many - session-wide services and functions that require a - long-running process. - Among the services implemented by gnome-settings-daemon - are an XSettings manager, which provides theming, font - and other settings to GTK+ applications, and a clipboard - manager, which preserves clipboard contents when an - application exits. - Many user interface elements of - <command>gnome-shell</command> and - <command>gnome-control-center</command> rely on - gnome-settings-daemon for their functionality. - </para> - - <para>The internal architecture of gnome-settings-daemon - consists of a number of plugins, which provide functionality - such as printer notifications, software update monitoring, - background changing, etc. For debugging purposes, these - plugins can be individually disabled by changing the - gsettings key <literal>org.gnome.settings-daemon.plugins.<replaceable>plugin-name</replaceable>.active</literal>, where - <replaceable>plugin-name</replaceable> is - the name of the plugin. To see a list of all plugins, - use the command - <userinput> - gsettings list-children org.gnome.settings-daemon.plugins - </userinput> - </para> - - <para>gnome-settings-daemon takes the name - org.gnome.SettingsDaemon on the session bus to ensure - that only one instance is running. Some plugins export - objects under this name to make their functionality - available to other applications. The interfaces of - these objects should generally be considered private - and unstable.</para> - - <para>gnome-settings-daemon is a required component of - the GNOME desktop, i.e. it is listed in the - RequiredComponents field of - <filename>/usr/share/gnome-session/sessions/gnome.session</filename>. - It is started in the initialization phase of the session, - and <command>gnome-session</command> will restart it - if it crashes. - </para> - - </refsect1> - - <refsect1> - <title>Options</title> - - <variablelist> - <varlistentry> - <term><option>-h</option>, <option>--help</option></term> - - <listitem><para>Prints a short help - text and exits.</para></listitem> - </varlistentry> - - <varlistentry> - <term><option>--debug</option></term> - - <listitem><para>Enables debugging code.</para></listitem> - </varlistentry> - - <varlistentry> - <term><option>--timed-exit</option></term> - - <listitem><para>Exits after a timeout (30 seconds) for debugging.</para></listitem> - </varlistentry> - - </variablelist> - </refsect1> - - <refsect1> - <title>Files</title> - <variablelist> - <varlistentry> - <term><filename>/usr/share/gnome-session/sessions/gnome.session</filename></term> - - <listitem><para>GNOME session definition file where gnome-settings-daemon is listed as a required component.</para></listitem> - </varlistentry> - <varlistentry> - <term><filename>/etc/xdg/autostart/gnome-settings-daemon.desktop</filename></term> - - <listitem><para>Autostart file for gnome-settings-daemon, where its autostart phase is set.</para></listitem> - </varlistentry> - </variablelist> - </refsect1> - - <refsect1> - <title>See Also</title> - <para> - <citerefentry><refentrytitle>gnome-shell</refentrytitle><manvolnum>1</manvolnum></citerefentry>, - <citerefentry><refentrytitle>gnome-control-center</refentrytitle><manvolnum>1</manvolnum></citerefentry>, - <citerefentry><refentrytitle>gnome-session</refentrytitle><manvolnum>1</manvolnum></citerefentry> - </para> - </refsect1> - -</refentry> diff --git a/po/POTFILES.in b/po/POTFILES.in index cac24feb..aa00f341 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1,6 +1,5 @@ # Files with translatable strings. # Please keep this file in alphabetical order. -data/gnome-settings-daemon.desktop.in.in data/org.gnome.settings-daemon.peripherals.gschema.xml.in.in data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in.in data/org.gnome.settings-daemon.plugins.color.gschema.xml.in.in @@ -11,7 +10,6 @@ data/org.gnome.settings-daemon.plugins.power.gschema.xml.in.in data/org.gnome.settings-daemon.plugins.sharing.gschema.xml.in.in data/org.gnome.settings-daemon.plugins.xrandr.gschema.xml.in.in data/org.gnome.settings-daemon.plugins.xsettings.gschema.xml.in.in -gnome-settings-daemon/main.c plugins/a11y-keyboard/gsd-a11y-keyboard-manager.c plugins/color/gsd-color-calibrate.c plugins/color/gsd-color-manager.c diff --git a/po/POTFILES.skip b/po/POTFILES.skip index aedab979..886cf0ff 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -1,12 +1,6 @@ # Files with translatable strings to skip. # Please keep this file in alphabetical order. # -# The following three desktop.in files are generated files, so -# it is not necessary to check them for translatable strings. -# Without these files, "make distcheck" fails. Please do not -# remove these unless you fix "make distcheck" a different way. -# -data/gnome-settings-daemon.desktop.in data/org.gnome.settings-daemon.peripherals.gschema.xml.in data/org.gnome.settings-daemon.peripherals.wacom.gschema.xml.in data/org.gnome.settings-daemon.plugins.color.gschema.xml.in |