[dconf] writer: add @type argument to constructor
- From: Ryan Lortie <ryanl src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dconf] writer: add @type argument to constructor
- Date: Tue, 8 Jan 2013 18:21:26 +0000 (UTC)
commit 92c6f91b41c1e0a26c9ab52640201930aa6f3e88
Author: Ryan Lortie <desrt desrt ca>
Date: Mon Jan 7 18:30:47 2013 -0500
writer: add @type argument to constructor
dconf_writer_new() now takes a type so we can create subtypes of
DConfWriter.
service/dconf-service.c | 2 +-
service/dconf-writer.c | 7 +++++--
service/dconf-writer.h | 3 ++-
3 files changed, 8 insertions(+), 4 deletions(-)
---
diff --git a/service/dconf-service.c b/service/dconf-service.c
index f4b2515..63ffff6 100644
--- a/service/dconf-service.c
+++ b/service/dconf-service.c
@@ -110,7 +110,7 @@ dconf_service_get_writer (DConfService *service,
GError *error = NULL;
gchar *object_path;
- writer = dconf_writer_new (name);
+ writer = dconf_writer_new (DCONF_TYPE_WRITER, name);
g_hash_table_insert (service->writers, g_strdup (name), writer);
object_path = g_strjoin ("/", base_path, name, NULL);
g_dbus_interface_skeleton_export (writer, connection, object_path, &error);
diff --git a/service/dconf-writer.c b/service/dconf-writer.c
index 05519a1..46aaf2d 100644
--- a/service/dconf-writer.c
+++ b/service/dconf-writer.c
@@ -325,7 +325,10 @@ dconf_writer_get_name (DConfWriter *writer)
}
GDBusInterfaceSkeleton *
-dconf_writer_new (const gchar *name)
+dconf_writer_new (GType type,
+ const gchar *name)
{
- return g_object_new (DCONF_TYPE_WRITER, "name", name, NULL);
+ g_return_val_if_fail (g_type_is_a (type, DCONF_TYPE_WRITER), NULL);
+
+ return g_object_new (type, "name", name, NULL);
}
diff --git a/service/dconf-writer.h b/service/dconf-writer.h
index eb00422..7783c94 100644
--- a/service/dconf-writer.h
+++ b/service/dconf-writer.h
@@ -64,6 +64,7 @@ struct _DConfWriter
DConfWriterPrivate *priv;
};
-GDBusInterfaceSkeleton *dconf_writer_new (const gchar *filename);
+GDBusInterfaceSkeleton *dconf_writer_new (GType type,
+ const gchar *name);
#endif /* __dconf_writer_h__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]