gnome-settings-daemon r184 - in trunk: . gnome-settings-daemon
- From: mccann svn gnome org
- To: svn-commits-list gnome org
- Subject: gnome-settings-daemon r184 - in trunk: . gnome-settings-daemon
- Date: Fri, 29 Feb 2008 00:50:57 +0000 (GMT)
Author: mccann
Date: Fri Feb 29 00:50:57 2008
New Revision: 184
URL: http://svn.gnome.org/viewvc/gnome-settings-daemon?rev=184&view=rev
Log:
2008-02-28 William Jon McCann <jmccann redhat com>
* gnome-settings-daemon/gnome-settings-manager.c:
(gnome_settings_manager_error_quark), (_load_file),
(gnome_settings_manager_awake), (gnome_settings_manager_start),
(gnome_settings_manager_start_with_settings_prefix),
(_set_settings_prefix), (gnome_settings_manager_set_property),
(gnome_settings_manager_get_property),
(gnome_settings_manager_class_init),
(gnome_settings_manager_finalize), (gnome_settings_manager_new):
* gnome-settings-daemon/gnome-settings-manager.h:
* gnome-settings-daemon/gnome-settings-manager.xml:
* gnome-settings-daemon/main.c: (main):
When dbus activated only load the plugins when requested
instead of at startup. Add a new method to start and set
plugin settings prefix. This allows gdm to use dbus
activation. It also fixes cases where g-s-d is activated
and plugins are loaded unintentionally.
Modified:
trunk/ChangeLog
trunk/gnome-settings-daemon/gnome-settings-manager.c
trunk/gnome-settings-daemon/gnome-settings-manager.h
trunk/gnome-settings-daemon/gnome-settings-manager.xml
trunk/gnome-settings-daemon/main.c
Modified: trunk/gnome-settings-daemon/gnome-settings-manager.c
==============================================================================
--- trunk/gnome-settings-daemon/gnome-settings-manager.c (original)
+++ trunk/gnome-settings-daemon/gnome-settings-manager.c Fri Feb 29 00:50:57 2008
@@ -39,6 +39,8 @@
#define GSD_MANAGER_DBUS_PATH "/org/gnome/SettingsDaemon"
+#define DEFAULT_SETTINGS_PREFIX "/apps/gnome_settings_daemon/plugins"
+
#define PLUGIN_EXT ".gnome-settings-plugin"
#define GNOME_SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManagerPrivate))
@@ -46,13 +48,13 @@
struct GnomeSettingsManagerPrivate
{
DBusGConnection *connection;
- char *gconf_prefix;
+ char *settings_prefix;
GSList *plugins;
};
enum {
PROP_0,
- PROP_GCONF_PREFIX,
+ PROP_SETTINGS_PREFIX,
};
enum {
@@ -71,6 +73,17 @@
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
maybe_activate_plugin (GnomeSettingsPluginInfo *info, gpointer user_data)
{
@@ -166,13 +179,13 @@
G_CALLBACK (on_plugin_deactivated), manager);
key_name = g_strdup_printf ("%s/%s/active",
- manager->priv->gconf_prefix,
+ manager->priv->settings_prefix,
gnome_settings_plugin_info_get_location (info));
gnome_settings_plugin_info_set_enabled_key_name (info, key_name);
g_free (key_name);
key_name = g_strdup_printf ("%s/%s/priority",
- manager->priv->gconf_prefix,
+ manager->priv->settings_prefix,
gnome_settings_plugin_info_get_location (info));
client = gconf_client_get_default ();
error = NULL;
@@ -253,7 +266,7 @@
GError **error)
{
g_debug ("Awake called");
- return TRUE;
+ return gnome_settings_manager_start (manager, error);
}
static gboolean
@@ -286,6 +299,11 @@
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,
+ "%s", "Plugins not supported");
+
return FALSE;
}
@@ -295,6 +313,16 @@
return ret;
}
+gboolean
+gnome_settings_manager_start_with_settings_prefix (GnomeSettingsManager *manager,
+ const char *settings_prefix,
+ GError **error)
+{
+ g_object_set (manager, "settings-prefix", settings_prefix, NULL);
+
+ return gnome_settings_manager_start (manager, error);
+}
+
void
gnome_settings_manager_stop (GnomeSettingsManager *manager)
{
@@ -313,11 +341,11 @@
}
static void
-_set_gconf_prefix (GnomeSettingsManager *self,
+_set_settings_prefix (GnomeSettingsManager *self,
const char *prefix)
{
- g_free (self->priv->gconf_prefix);
- self->priv->gconf_prefix = g_strdup (prefix);
+ g_free (self->priv->settings_prefix);
+ self->priv->settings_prefix = g_strdup (prefix);
}
static void
@@ -331,8 +359,8 @@
self = GNOME_SETTINGS_MANAGER (object);
switch (prop_id) {
- case PROP_GCONF_PREFIX:
- _set_gconf_prefix (self, g_value_get_string (value));
+ case PROP_SETTINGS_PREFIX:
+ _set_settings_prefix (self, g_value_get_string (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -351,8 +379,8 @@
self = GNOME_SETTINGS_MANAGER (object);
switch (prop_id) {
- case PROP_GCONF_PREFIX:
- g_value_set_string (value, self->priv->gconf_prefix);
+ case PROP_SETTINGS_PREFIX:
+ g_value_set_string (value, self->priv->settings_prefix);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
@@ -422,11 +450,11 @@
1, G_TYPE_STRING);
g_object_class_install_property (object_class,
- PROP_GCONF_PREFIX,
- g_param_spec_string ("gconf-prefix",
- "gconf-prefix",
- "gconf-prefix",
- NULL,
+ PROP_SETTINGS_PREFIX,
+ g_param_spec_string ("settings-prefix",
+ "settings-prefix",
+ "settings-prefix",
+ DEFAULT_SETTINGS_PREFIX,
G_PARAM_READWRITE | G_PARAM_CONSTRUCT));
g_type_class_add_private (klass, sizeof (GnomeSettingsManagerPrivate));
@@ -453,13 +481,13 @@
g_return_if_fail (manager->priv != NULL);
- g_free (manager->priv->gconf_prefix);
+ g_free (manager->priv->settings_prefix);
G_OBJECT_CLASS (gnome_settings_manager_parent_class)->finalize (object);
}
GnomeSettingsManager *
-gnome_settings_manager_new (const char *gconf_prefix)
+gnome_settings_manager_new (void)
{
if (manager_object != NULL) {
g_object_ref (manager_object);
@@ -467,7 +495,6 @@
gboolean res;
manager_object = g_object_new (GNOME_TYPE_SETTINGS_MANAGER,
- "gconf-prefix", gconf_prefix,
NULL);
g_object_add_weak_pointer (manager_object,
(gpointer *) &manager_object);
Modified: trunk/gnome-settings-daemon/gnome-settings-manager.h
==============================================================================
--- trunk/gnome-settings-daemon/gnome-settings-manager.h (original)
+++ trunk/gnome-settings-daemon/gnome-settings-manager.h Fri Feb 29 00:50:57 2008
@@ -50,9 +50,21 @@
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 (const char *gconf_prefix);
+GnomeSettingsManager * gnome_settings_manager_new (void);
+gboolean gnome_settings_manager_start_with_settings_prefix
+ (GnomeSettingsManager *manager,
+ const char *settings_prefix,
+ GError **error);
gboolean gnome_settings_manager_start (GnomeSettingsManager *manager,
GError **error);
void gnome_settings_manager_stop (GnomeSettingsManager *manager);
Modified: trunk/gnome-settings-daemon/gnome-settings-manager.xml
==============================================================================
--- trunk/gnome-settings-daemon/gnome-settings-manager.xml (original)
+++ trunk/gnome-settings-daemon/gnome-settings-manager.xml Fri Feb 29 00:50:57 2008
@@ -3,6 +3,10 @@
<interface name="org.gnome.SettingsDaemon">
<annotation name="org.freedesktop.DBus.GLib.CSymbol" value="gnome_settings_manager"/>
<method name="Awake"/>
+ <method name="Start"/>
+ <method name="StartWithSettingsPrefix">
+ <arg name="settings_prefix" direction="in" type="s"/>
+ </method>
<signal name="PluginActivated">
<arg name="name" type="s"/>
</signal>
Modified: trunk/gnome-settings-daemon/main.c
==============================================================================
--- trunk/gnome-settings-daemon/main.c (original)
+++ trunk/gnome-settings-daemon/main.c Fri Feb 29 00:50:57 2008
@@ -37,12 +37,9 @@
#define GSD_DBUS_NAME "org.gnome.SettingsDaemon"
-#define DEFAULT_GCONF_PREFIX "/apps/gnome_settings_daemon/plugins"
-#define GCONF_PREFIX_ENV "GNOME_SETTINGS_DAEMON_GCONF_PREFIX"
-
static char *gconf_prefix = NULL;
static gboolean no_daemon = TRUE;
-static gboolean debug = FALSE;
+static gboolean debug = TRUE;
static GOptionEntry entries[] = {
{"debug", 0, 0, G_OPTION_ARG_NONE, &debug, "Enable debugging code", NULL },
@@ -219,13 +216,6 @@
g_log_set_default_handler (gsd_log_default_handler, NULL);
- if (gconf_prefix == NULL) {
- gconf_prefix = g_strdup (g_getenv (GCONF_PREFIX_ENV));
- if (gconf_prefix == NULL) {
- gconf_prefix = g_strdup (DEFAULT_GCONF_PREFIX);
- }
- }
-
if (! no_daemon && daemon (0, 0)) {
g_error ("Could not daemonize: %s", g_strerror (errno));
}
@@ -241,15 +231,28 @@
argv,
GNOME_PARAM_NONE);
- manager = gnome_settings_manager_new (gconf_prefix);
-
- res = gnome_settings_manager_start (manager, &error);
- if (! res) {
- g_warning ("Unable to start: %s", error->message);
- g_error_free (error);
+ manager = gnome_settings_manager_new ();
+ if (manager == NULL) {
+ g_warning ("Unable to register object");
goto out;
}
+ /* If we aren't started by dbus then load the plugins
+ automatically. Otherwise, wait for an Awake etc. */
+ if (g_getenv ("DBUS_STARTER_BUS_TYPE") == NULL) {
+ error = NULL;
+ if (gconf_prefix != NULL) {
+ res = gnome_settings_manager_start_with_settings_prefix (manager, gconf_prefix, &error);
+ } else {
+ res = gnome_settings_manager_start (manager, &error);
+ }
+ if (! res) {
+ g_warning ("Unable to start: %s", error->message);
+ g_error_free (error);
+ goto out;
+ }
+ }
+
gtk_main ();
g_free (gconf_prefix);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]