diff options
author | William Jon McCann <mccann@jhu.edu> | 2007-12-18 05:04:28 +0000 |
---|---|---|
committer | William Jon McCann <mccann@src.gnome.org> | 2007-12-18 05:04:28 +0000 |
commit | 5a911d9be55ee68a3c44dd6bbef27276422c4851 (patch) | |
tree | d6f717eb7d12af21bdab4ec012eb39f8fe431a7c | |
parent | 9277baad3d26c3e5f225a98abe13917be22b1eac (diff) | |
download | gnome-settings-daemon-5a911d9be55ee68a3c44dd6bbef27276422c4851.tar.gz |
Provide the awake method and install the dbus api header.
2007-12-18 William Jon McCann <mccann@jhu.edu>
* src/Makefile.am:
* src/gnome-settings-manager.c: (gnome_settings_manager_awake),
(register_manager), (gnome_settings_manager_class_init),
(gnome_settings_manager_new):
* src/gnome-settings-manager.h:
* src/gnome-settings-manager.xml:
Provide the awake method and install the dbus api header.
svn path=/trunk/; revision=28
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | src/Makefile.am | 20 | ||||
-rw-r--r-- | src/gnome-settings-manager.c | 46 | ||||
-rw-r--r-- | src/gnome-settings-manager.h | 13 | ||||
-rw-r--r-- | src/gnome-settings-manager.xml | 7 |
5 files changed, 90 insertions, 6 deletions
@@ -1,3 +1,13 @@ +2007-12-18 William Jon McCann <mccann@jhu.edu> + + * src/Makefile.am: + * src/gnome-settings-manager.c: (gnome_settings_manager_awake), + (register_manager), (gnome_settings_manager_class_init), + (gnome_settings_manager_new): + * src/gnome-settings-manager.h: + * src/gnome-settings-manager.xml: + Provide the awake method and install the dbus api header. + 2007-12-17 William Jon McCann <mccann@jhu.edu> * plugins/background/Makefile.am: diff --git a/src/Makefile.am b/src/Makefile.am index a4c16b58..693d12dd 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -14,6 +14,20 @@ libexec_PROGRAMS = \ gnome-settings-daemon \ $(NULL) +gnome-settings-manager-glue.h: gnome-settings-manager.xml Makefile.am + dbus-binding-tool --prefix=gnome_settings_manager --mode=glib-server --output=gnome-settings-manager-glue.h gnome-settings-manager.xml + +gnome-settings-client.h: gnome-settings-manager.xml Makefile.am + dbus-binding-tool --prefix=gnome_settings_manager --mode=glib-client $< > $@ + +BUILT_SOURCES = \ + gnome-settings-manager-glue.h \ + gnome-settings-client.h \ + $(NULL) + +Dbusapidir = $(includedir)/gnome-settings-daemon-2.0/gnome-settings-daemon +Dbusapi_DATA = gnome-settings-client.h + gnome_settings_daemon_SOURCES = \ main.c \ gnome-settings-manager.c \ @@ -43,4 +57,10 @@ gnome_settings_daemon_LDADD = \ $(NULL) EXTRA_DIST = \ + $(Dbusapi_DATA) \ + gnome-settings-manager.xml \ + $(NULL) + +CLEANFILES = \ + $(BUILT_SOURCES) \ $(NULL) diff --git a/src/gnome-settings-manager.c b/src/gnome-settings-manager.c index fc0d2180..6447ebc6 100644 --- a/src/gnome-settings-manager.c +++ b/src/gnome-settings-manager.c @@ -28,15 +28,23 @@ #include <glib.h> #include <glib/gi18n.h> #include <glib-object.h> +#define DBUS_API_SUBJECT_TO_CHANGE +#include <dbus/dbus-glib.h> +#include <dbus/dbus-glib-lowlevel.h> #include "gnome-settings-manager.h" #include "gnome-settings-plugins-engine.h" +#include "gnome-settings-manager-glue.h" + +#define GSD_MANAGER_DBUS_PATH "/org/gnome/SettingsDaemon" + #define GNOME_SETTINGS_MANAGER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), GNOME_TYPE_SETTINGS_MANAGER, GnomeSettingsManagerPrivate)) struct GnomeSettingsManagerPrivate { - char *gconf_prefix; + DBusGConnection *connection; + char *gconf_prefix; }; enum { @@ -53,6 +61,33 @@ G_DEFINE_TYPE (GnomeSettingsManager, gnome_settings_manager, G_TYPE_OBJECT) static gpointer manager_object = NULL; gboolean +gnome_settings_manager_awake (GnomeSettingsManager *manager, + GError **error) +{ + return TRUE; +} + +static gboolean +register_manager (GnomeSettingsManager *manager) +{ + GError *error = NULL; + + error = NULL; + manager->priv->connection = dbus_g_bus_get (DBUS_BUS_SESSION, &error); + if (manager->priv->connection == NULL) { + if (error != NULL) { + g_critical ("error getting system bus: %s", error->message); + g_error_free (error); + } + return FALSE; + } + + dbus_g_connection_register_g_object (manager->priv->connection, GSD_MANAGER_DBUS_PATH, G_OBJECT (manager)); + + return TRUE; +} + +gboolean gnome_settings_manager_start (GnomeSettingsManager *manager, GError **error) { @@ -171,6 +206,8 @@ gnome_settings_manager_class_init (GnomeSettingsManagerClass *klass) G_PARAM_READWRITE | G_PARAM_CONSTRUCT)); g_type_class_add_private (klass, sizeof (GnomeSettingsManagerPrivate)); + + dbus_g_object_type_install_info (GNOME_TYPE_SETTINGS_MANAGER, &dbus_glib_gnome_settings_manager_object_info); } static void @@ -203,11 +240,18 @@ gnome_settings_manager_new (const char *gconf_prefix) if (manager_object != NULL) { g_object_ref (manager_object); } else { + 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); + res = register_manager (manager_object); + if (! res) { + g_object_unref (manager_object); + return NULL; + } } return GNOME_SETTINGS_MANAGER (manager_object); diff --git a/src/gnome-settings-manager.h b/src/gnome-settings-manager.h index f3b15b15..ae41d360 100644 --- a/src/gnome-settings-manager.h +++ b/src/gnome-settings-manager.h @@ -45,12 +45,15 @@ typedef struct GObjectClass parent_class; } GnomeSettingsManagerClass; -GType gnome_settings_manager_get_type (void); +GType gnome_settings_manager_get_type (void); -GnomeSettingsManager * gnome_settings_manager_new (const char *gconf_prefix); -gboolean gnome_settings_manager_start (GnomeSettingsManager *manager, - GError **error); -void gnome_settings_manager_stop (GnomeSettingsManager *manager); +GnomeSettingsManager * gnome_settings_manager_new (const char *gconf_prefix); +gboolean gnome_settings_manager_start (GnomeSettingsManager *manager, + GError **error); +void gnome_settings_manager_stop (GnomeSettingsManager *manager); + +gboolean gnome_settings_manager_awake (GnomeSettingsManager *manager, + GError **error); G_END_DECLS diff --git a/src/gnome-settings-manager.xml b/src/gnome-settings-manager.xml new file mode 100644 index 00000000..e1964b2e --- /dev/null +++ b/src/gnome-settings-manager.xml @@ -0,0 +1,7 @@ +<!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/SettingsDaemon"> + <interface name="org.gnome.SettingsDaemon"> + <annotation name="org.freedesktop.DBus.GLib.CSymbol" value="gnome_settings_manager"/> + <method name="Awake"/> + </interface> +</node> |