[gnome-settings-daemon] daemon: Drop dbus activation capability



commit b778aad98bf5e1acc9899e757345dcee3a5294fd
Author: Ray Strode <rstrode redhat com>
Date:   Thu Apr 5 12:16:31 2012 -0400

    daemon: Drop dbus activation capability
    
    Years ago, GDM activated gnome-settings-daemon via dbus as
    part of its hand-rolled greeter session. These days it uses
    gnome-session instead of a hand-rolled session, and so
    gnome-settings-daemon no longer needs to be activatable.
    
    Furthermore, when gnome-settings-daemon is activated, the only
    way it functions is if it's subsequently given an "Awake" call.
    This limitation was added because it was getting unintentionally
    activated in none-GNOME sessions (when those sessions were hosting
    gnome apps, like rhythmbox), causing all sorts of havoc.
    
    This doesn't-function-until-Awake-called limitation means that if
    settings daemon ever crashes and gets unintentionally dbus activated
    before gnome-session has a chance to respawn it, then the whole desktop
    breaks (since whatever accidentally activates it won't call Awake).
    This actually happens in practice because gnome-shell's power indicator
    tries to track the power plugin's object properties.
    
    This commit removes the ability for gnome-settings-daemon to be dbus
    activated. It only causes problems, and no longer solves anyway.
    
    https://bugzilla.gnome.org/show_bug.cgi?id=673586

 data/Makefile.am                               |    9 ----
 data/org.gnome.SettingsDaemon.service.in       |    3 -
 gnome-settings-daemon/gnome-settings-manager.c |   56 +-----------------------
 gnome-settings-daemon/gnome-settings-manager.h |    3 -
 gnome-settings-daemon/main.c                   |   16 +++----
 5 files changed, 8 insertions(+), 79 deletions(-)
---
diff --git a/data/Makefile.am b/data/Makefile.am
index 5af5170..5fc9f64 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -53,13 +53,6 @@ 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 $@
 
-servicedir = $(datadir)/dbus-1/services
-service_in_files = org.gnome.SettingsDaemon.service.in
-service_DATA = $(service_in_files:.service.in=.service)
-
-org.gnome.SettingsDaemon.service: org.gnome.SettingsDaemon.service.in Makefile
-	$(AM_V_GEN) sed -e "s|\ libexecdir\@|$(libexecdir)|" $< > $@
-
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = gnome-settings-daemon.pc
 
@@ -71,7 +64,6 @@ EXTRA_DIST = 					\
 	$(man_MANS)				\
 	$(convert_DATA)				\
 	$(all_schemas:.xml=.xml.in.in)		\
-	$(service_in_files)			\
 	$(desktop_in_files)			\
 	$(gsettings_ENUM_FILES)			\
 	gnome-settings-daemon.pc.in		\
@@ -80,7 +72,6 @@ EXTRA_DIST = 					\
 
 DISTCLEANFILES = 			\
 	$(all_schemas)			\
-	$(service_DATA)			\
 	$(desktop_DATA)			\
 	gnome-settings-daemon.desktop.in \
 	$(NULL)
diff --git a/gnome-settings-daemon/gnome-settings-manager.c b/gnome-settings-daemon/gnome-settings-manager.c
index 13faeba..10dfe9f 100644
--- a/gnome-settings-daemon/gnome-settings-manager.c
+++ b/gnome-settings-daemon/gnome-settings-manager.c
@@ -50,8 +50,6 @@ 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'/>"
-"    <method name='Awake'/>"
-"    <method name='Start'/>"
 "    <signal name='PluginActivated'>"
 "      <arg name='name' type='s'/>"
 "    </signal>"
@@ -324,56 +322,6 @@ _unload_all (GnomeSettingsManager *manager)
          manager->priv->plugins = NULL;
 }
 
-/*
-  Example:
-  dbus-send --session --dest=org.gnome.SettingsDaemon \
-  --type=method_call --print-reply --reply-timeout=2000 \
-  /org/gnome/SettingsDaemon \
-  org.gnome.SettingsDaemon.Awake
-*/
-gboolean
-gnome_settings_manager_awake (GnomeSettingsManager *manager,
-                              GError              **error)
-{
-        g_debug ("Awake called");
-        return gnome_settings_manager_start (manager, error);
-}
-
-static void
-handle_method_call (GDBusConnection       *connection,
-                    const gchar           *sender,
-                    const gchar           *object_path,
-                    const gchar           *interface_name,
-                    const gchar           *method_name,
-                    GVariant              *parameters,
-                    GDBusMethodInvocation *invocation,
-                    gpointer               user_data)
-{
-        GnomeSettingsManager *manager = (GnomeSettingsManager *) user_data;
-        GError *error = NULL;
-
-        g_debug ("Calling method '%s' for settings daemon", method_name);
-
-        if (g_strcmp0 (method_name, "Awake") == 0) {
-                if (gnome_settings_manager_awake (manager, &error) == FALSE)
-                        g_dbus_method_invocation_return_gerror (invocation, error);
-                else
-                        g_dbus_method_invocation_return_value (invocation, NULL);
-        } else if (g_strcmp0 (method_name, "Start") == 0) {
-                if (gnome_settings_manager_start (manager, &error) == FALSE)
-                        g_dbus_method_invocation_return_gerror (invocation, error);
-                else
-                        g_dbus_method_invocation_return_value (invocation, NULL);
-        }
-}
-
-static const GDBusInterfaceVTable interface_vtable =
-{
-        handle_method_call,
-        NULL, /* Get Property */
-        NULL, /* Set Property */
-};
-
 static void
 on_bus_gotten (GObject             *source_object,
                GAsyncResult        *res,
@@ -393,8 +341,8 @@ on_bus_gotten (GObject             *source_object,
         g_dbus_connection_register_object (connection,
                                            GSD_MANAGER_DBUS_PATH,
                                            manager->priv->introspection_data->interfaces[0],
-                                           &interface_vtable,
-                                           manager,
+                                           NULL,
+                                           NULL,
                                            NULL,
                                            NULL);
 }
diff --git a/gnome-settings-daemon/gnome-settings-manager.h b/gnome-settings-daemon/gnome-settings-manager.h
index 39c1b0c..be0a69c 100644
--- a/gnome-settings-daemon/gnome-settings-manager.h
+++ b/gnome-settings-daemon/gnome-settings-manager.h
@@ -65,9 +65,6 @@ gboolean               gnome_settings_manager_start      (GnomeSettingsManager *
                                                           GError              **error);
 void                   gnome_settings_manager_stop       (GnomeSettingsManager *manager);
 
-gboolean               gnome_settings_manager_awake      (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
index 2013349..476dc00 100644
--- a/gnome-settings-daemon/main.c
+++ b/gnome-settings-daemon/main.c
@@ -437,16 +437,12 @@ main (int argc, char *argv[])
                 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;
-                res = gnome_settings_manager_start (manager, &error);
-                if (! res) {
-                        g_warning ("Unable to start: %s", error->message);
-                        g_error_free (error);
-                        goto out;
-                }
+        error = NULL;
+        res = gnome_settings_manager_start (manager, &error);
+        if (! res) {
+                g_warning ("Unable to start: %s", error->message);
+                g_error_free (error);
+                goto out;
         }
 
         if (do_timed_exit) {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]