From: David Zeuthen Date: Wed, 13 Apr 2011 20:33:51 +0000 (-0400) Subject: GDBus: Use Skeleton instead of Stub X-Git-Tag: 2.29.4~69 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6ccca55752c41001f3af3430d3d93f587fd42383;p=platform%2Fupstream%2Fglib.git GDBus: Use Skeleton instead of Stub After some brainstorming with Simon, see https://bugzilla.gnome.org/show_bug.cgi?id=647577#c8 Signed-off-by: David Zeuthen --- diff --git a/docs/reference/gio/gdbus-codegen.xml b/docs/reference/gio/gdbus-codegen.xml index 789161b..cdfd289 100644 --- a/docs/reference/gio/gdbus-codegen.xml +++ b/docs/reference/gio/gdbus-codegen.xml @@ -57,11 +57,11 @@ #GTypeInterface-derived type is generated for each D-Bus interface. Additionally, for every generated type, FooBar, two concrete instantiable types, - FooBarProxy and FooBarStub, implementing + FooBarProxy and FooBarSkeleton, implementing said interface are also generated. The former is derived from #GDBusProxy and intended for use on the client side while the latter is derived from the - #GDBusInterfaceStub type making it easy to export on a + #GDBusInterfaceSkeleton type making it easy to export on a #GDBusConnection either directly or via a #GDBusObjectManagerServer instance. @@ -375,13 +375,13 @@ gdbus-codegen --generate-c-code myapp-generated \ #GTypeInterface-derived type called MyAppFrobber as well as two instantiable types with the same name but suffixed with Proxy and - Stub. The generated file, roughly, contains the + Skeleton. The generated file, roughly, contains the following facilities: Instead of subclassing, it is often easier to use the generated - MyAppFrobberStub subclass. To handle incoming + MyAppFrobberSkeleton subclass. To handle incoming method calls, use g_signal_connect() with the ::handle-* signals and instead of overriding #GObject's @@ -628,7 +628,7 @@ on_handle_hello_world (MyAppFrobber *object, [...] - object = my_app_frobber_stub_new (); + object = my_app_frobber_skeleton_new (); my_app_frobber_set_verbose (object, TRUE); g_signal_connect (object, @@ -651,7 +651,7 @@ on_handle_hello_world (MyAppFrobber *object, emissions of the org.freedesktop.DBus.Properties::PropertiesChanged signal with all the properties that has changed. Use - g_dbus_interface_stub_flush() or g_dbus_object_stub_flush() to + g_dbus_interface_skeleton_flush() or g_dbus_object_skeleton_flush() to empty the queue immediately. diff --git a/docs/reference/gio/gio-docs.xml b/docs/reference/gio/gio-docs.xml index 4a42fc4..d67b79e 100644 --- a/docs/reference/gio/gio-docs.xml +++ b/docs/reference/gio/gio-docs.xml @@ -165,10 +165,10 @@ - + - + diff --git a/docs/reference/gio/gio-sections.txt b/docs/reference/gio/gio-sections.txt index bd040f4..656417f 100644 --- a/docs/reference/gio/gio-sections.txt +++ b/docs/reference/gio/gio-sections.txt @@ -3145,33 +3145,33 @@ g_dbus_object_peek_with_typecheck
-gdbusinterfacestub -GDBusInterfaceStub -GDBusInterfaceStub -GDBusInterfaceStubClass -g_dbus_interface_stub_flush -g_dbus_interface_stub_get_info -g_dbus_interface_stub_get_vtable -g_dbus_interface_stub_get_properties -g_dbus_interface_stub_export -g_dbus_interface_stub_unexport -g_dbus_interface_stub_get_connection -g_dbus_interface_stub_get_object_path -GDBusInterfaceStubFlags -g_dbus_interface_stub_get_flags -g_dbus_interface_stub_set_flags - -G_DBUS_INTERFACE_STUB -G_IS_DBUS_INTERFACE_STUB -G_TYPE_DBUS_INTERFACE_STUB -g_dbus_interface_stub_get_type -G_DBUS_INTERFACE_STUB_CLASS -G_IS_DBUS_INTERFACE_STUB_CLASS -G_DBUS_INTERFACE_STUB_GET_CLASS - -GDBusInterfaceStubPrivate -G_TYPE_DBUS_INTERFACE_STUB_FLAGS -g_dbus_interface_stub_flags_get_type +gdbusinterfaceskeleton +GDBusInterfaceSkeleton +GDBusInterfaceSkeleton +GDBusInterfaceSkeletonClass +g_dbus_interface_skeleton_flush +g_dbus_interface_skeleton_get_info +g_dbus_interface_skeleton_get_vtable +g_dbus_interface_skeleton_get_properties +g_dbus_interface_skeleton_export +g_dbus_interface_skeleton_unexport +g_dbus_interface_skeleton_get_connection +g_dbus_interface_skeleton_get_object_path +GDBusInterfaceSkeletonFlags +g_dbus_interface_skeleton_get_flags +g_dbus_interface_skeleton_set_flags + +G_DBUS_INTERFACE_SKELETON +G_IS_DBUS_INTERFACE_SKELETON +G_TYPE_DBUS_INTERFACE_SKELETON +g_dbus_interface_skeleton_get_type +G_DBUS_INTERFACE_SKELETON_CLASS +G_IS_DBUS_INTERFACE_SKELETON_CLASS +G_DBUS_INTERFACE_SKELETON_GET_CLASS + +GDBusInterfaceSkeletonPrivate +G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS +g_dbus_interface_skeleton_flags_get_type
@@ -3209,26 +3209,26 @@ GDBusObjectProxyPrivate
-gdbusobjectstub -GDBusObjectStub -GDBusObjectStub -GDBusObjectStubClass -g_dbus_object_stub_new -g_dbus_object_stub_flush -g_dbus_object_stub_add_interface -g_dbus_object_stub_remove_interface -g_dbus_object_stub_remove_interface_by_name -g_dbus_object_stub_set_object_path +gdbusobjectskeleton +GDBusObjectSkeleton +GDBusObjectSkeleton +GDBusObjectSkeletonClass +g_dbus_object_skeleton_new +g_dbus_object_skeleton_flush +g_dbus_object_skeleton_add_interface +g_dbus_object_skeleton_remove_interface +g_dbus_object_skeleton_remove_interface_by_name +g_dbus_object_skeleton_set_object_path -G_DBUS_OBJECT_STUB -G_IS_DBUS_OBJECT_STUB -G_TYPE_DBUS_OBJECT_STUB -g_dbus_object_stub_get_type -G_DBUS_OBJECT_STUB_CLASS -G_IS_DBUS_OBJECT_STUB_CLASS -G_DBUS_OBJECT_STUB_GET_CLASS +G_DBUS_OBJECT_SKELETON +G_IS_DBUS_OBJECT_SKELETON +G_TYPE_DBUS_OBJECT_SKELETON +g_dbus_object_skeleton_get_type +G_DBUS_OBJECT_SKELETON_CLASS +G_IS_DBUS_OBJECT_SKELETON_CLASS +G_DBUS_OBJECT_SKELETON_GET_CLASS -GDBusObjectStubPrivate +GDBusObjectSkeletonPrivate
diff --git a/docs/reference/gio/gio.types b/docs/reference/gio/gio.types index 0169ff3..3a798f3 100644 --- a/docs/reference/gio/gio.types +++ b/docs/reference/gio/gio.types @@ -138,9 +138,9 @@ g_credentials_get_type g_unix_credentials_message_get_type g_time_zone_monitor_get_type g_dbus_interface_get_type -g_dbus_interface_stub_get_type +g_dbus_interface_skeleton_get_type g_dbus_object_get_type -g_dbus_object_stub_get_type +g_dbus_object_skeleton_get_type g_dbus_object_proxy_get_type g_dbus_object_manager_get_type g_dbus_object_manager_client_get_type diff --git a/gio/Makefile.am b/gio/Makefile.am index afcbc9e..32ad95a 100644 --- a/gio/Makefile.am +++ b/gio/Makefile.am @@ -83,9 +83,9 @@ gdbus_headers = \ gdbusmethodinvocation.h \ gdbusserver.h \ gdbusinterface.h \ - gdbusinterfacestub.h \ + gdbusinterfaceskeleton.h \ gdbusobject.h \ - gdbusobjectstub.h \ + gdbusobjectskeleton.h \ gdbusobjectproxy.h \ gdbusobjectmanager.h \ gdbusobjectmanagerclient.h \ @@ -112,9 +112,9 @@ gdbus_sources = \ gdbusmethodinvocation.h gdbusmethodinvocation.c \ gdbusserver.h gdbusserver.c \ gdbusinterface.h gdbusinterface.c \ - gdbusinterfacestub.h gdbusinterfacestub.c \ + gdbusinterfaceskeleton.h gdbusinterfaceskeleton.c \ gdbusobject.h gdbusobject.c \ - gdbusobjectstub.h gdbusobjectstub.c \ + gdbusobjectskeleton.h gdbusobjectskeleton.c \ gdbusobjectproxy.h gdbusobjectproxy.c \ gdbusobjectmanager.h gdbusobjectmanager.c \ gdbusobjectmanagerclient.h gdbusobjectmanagerclient.c \ diff --git a/gio/gdbus-codegen/codegen.py b/gio/gdbus-codegen/codegen.py index 9ad1293..e9bb95d 100644 --- a/gio/gdbus-codegen/codegen.py +++ b/gio/gdbus-codegen/codegen.py @@ -419,35 +419,35 @@ class CodeGenerator: self.h.write('#define %sPEEK_%s(object) (g_dbus_object_peek_with_typecheck (G_DBUS_OBJECT (object), "%s", %sTYPE_%s))\n'%(i.ns_upper, i.name_upper, i.name, i.ns_upper, i.name_upper)) self.h.write('\n') - # Then the stub + # Then the skeleton self.h.write('\n') self.h.write('/* ---- */\n') self.h.write('\n') - self.h.write('#define %sTYPE_%s_STUB (%s_stub_get_gtype ())\n'%(i.ns_upper, i.name_upper, i.name_lower)) - self.h.write('#define %s%s_STUB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), %sTYPE_%s_STUB, %sStub))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper, i.camel_name)) - self.h.write('#define %s%s_STUB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), %sTYPE_%s_STUB, %sStubClass))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper, i.camel_name)) - self.h.write('#define %s%s_STUB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), %sTYPE_%s_STUB, %sStubClass))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper, i.camel_name)) - self.h.write('#define %sIS_%s_STUB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), %sTYPE_%s_STUB))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper)) - self.h.write('#define %sIS_%s_STUB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), %sTYPE_%s_STUB))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper)) + self.h.write('#define %sTYPE_%s_SKELETON (%s_skeleton_get_gtype ())\n'%(i.ns_upper, i.name_upper, i.name_lower)) + self.h.write('#define %s%s_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), %sTYPE_%s_SKELETON, %sSkeleton))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper, i.camel_name)) + self.h.write('#define %s%s_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), %sTYPE_%s_SKELETON, %sSkeletonClass))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper, i.camel_name)) + self.h.write('#define %s%s_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), %sTYPE_%s_SKELETON, %sSkeletonClass))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper, i.camel_name)) + self.h.write('#define %sIS_%s_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), %sTYPE_%s_SKELETON))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper)) + self.h.write('#define %sIS_%s_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), %sTYPE_%s_SKELETON))\n'%(i.ns_upper, i.name_upper, i.ns_upper, i.name_upper)) self.h.write('\n') - self.h.write('typedef struct _%sStub %sStub;\n'%(i.camel_name, i.camel_name)) - self.h.write('typedef struct _%sStubClass %sStubClass;\n'%(i.camel_name, i.camel_name)) - self.h.write('typedef struct _%sStubPrivate %sStubPrivate;\n'%(i.camel_name, i.camel_name)) + self.h.write('typedef struct _%sSkeleton %sSkeleton;\n'%(i.camel_name, i.camel_name)) + self.h.write('typedef struct _%sSkeletonClass %sSkeletonClass;\n'%(i.camel_name, i.camel_name)) + self.h.write('typedef struct _%sSkeletonPrivate %sSkeletonPrivate;\n'%(i.camel_name, i.camel_name)) self.h.write('\n') - self.h.write('struct _%sStub\n'%(i.camel_name)) + self.h.write('struct _%sSkeleton\n'%(i.camel_name)) self.h.write('{\n') - self.h.write(' GDBusInterfaceStub parent_instance;\n') - self.h.write(' %sStubPrivate *priv;\n'%(i.camel_name)) + self.h.write(' GDBusInterfaceSkeleton parent_instance;\n') + self.h.write(' %sSkeletonPrivate *priv;\n'%(i.camel_name)) self.h.write('};\n') self.h.write('\n') - self.h.write('struct _%sStubClass\n'%(i.camel_name)) + self.h.write('struct _%sSkeletonClass\n'%(i.camel_name)) self.h.write('{\n') - self.h.write(' GDBusInterfaceStubClass parent_class;\n') + self.h.write(' GDBusInterfaceSkeletonClass parent_class;\n') self.h.write('};\n') self.h.write('\n') - self.h.write('GType %s_stub_get_gtype (void) G_GNUC_CONST;\n'%(i.name_lower)) + self.h.write('GType %s_skeleton_get_gtype (void) G_GNUC_CONST;\n'%(i.name_lower)) self.h.write('\n') - self.h.write('%s *%s_stub_new (void);\n'%(i.camel_name, i.name_lower)) + self.h.write('%s *%s_skeleton_new (void);\n'%(i.camel_name, i.name_lower)) self.h.write('\n') @@ -1327,12 +1327,12 @@ class CodeGenerator: # --------------------------------------------------------------------------------------------------- - def generate_stub(self, i): + def generate_skeleton(self, i): # class boilerplate self.c.write('/* ------------------------------------------------------------------------ */\n' '\n') - self.c.write('struct _%sStubPrivate\n' + self.c.write('struct _%sSkeletonPrivate\n' '{\n' ' GValueArray *properties;\n' ' GList *changed_properties;\n' @@ -1342,7 +1342,7 @@ class CodeGenerator: '\n'%i.camel_name) self.c.write('static void\n' - '_%s_stub_handle_method_call (\n' + '_%s_skeleton_handle_method_call (\n' ' GDBusConnection *connection,\n' ' const gchar *sender,\n' ' const gchar *object_path,\n' @@ -1352,7 +1352,7 @@ class CodeGenerator: ' GDBusMethodInvocation *invocation,\n' ' gpointer user_data)\n' '{\n' - ' %sStub *stub = %s%s_STUB (user_data);\n' + ' %sSkeleton *skeleton = %s%s_SKELETON (user_data);\n' ' _ExtendedGDBusMethodInfo *info;\n' ' GVariantIter iter;\n' ' GVariant *child;\n' @@ -1368,7 +1368,7 @@ class CodeGenerator: self.c.write (' num_params = g_variant_n_children (parameters);\n' ' paramv = g_new0 (GValue, num_params + 2);\n' ' g_value_init (¶mv[0], %sTYPE_%s);\n' - ' g_value_set_object (¶mv[0], stub);\n' + ' g_value_set_object (¶mv[0], skeleton);\n' ' g_value_init (¶mv[1], G_TYPE_DBUS_METHOD_INVOCATION);\n' ' g_value_set_object (¶mv[1], invocation);\n' %(i.ns_upper, i.name_upper)) @@ -1403,7 +1403,7 @@ class CodeGenerator: '\n') self.c.write('static GVariant *\n' - '_%s_stub_handle_get_property (\n' + '_%s_skeleton_handle_get_property (\n' ' GDBusConnection *connection,\n' ' const gchar *sender,\n' ' const gchar *object_path,\n' @@ -1412,7 +1412,7 @@ class CodeGenerator: ' GError **error,\n' ' gpointer user_data)\n' '{\n' - ' %sStub *stub = %s%s_STUB (user_data);\n' + ' %sSkeleton *skeleton = %s%s_SKELETON (user_data);\n' ' GValue value = {0};\n' ' GParamSpec *pspec;\n' ' _ExtendedGDBusPropertyInfo *info;\n' @@ -1421,7 +1421,7 @@ class CodeGenerator: self.c.write(' ret = NULL;\n' ' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info, property_name);\n' ' g_assert (info != NULL);\n' - ' pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (stub), info->hyphen_name);\n' + ' pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n' ' if (pspec == NULL)\n' ' {\n' ' g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %%s", property_name);\n' @@ -1429,7 +1429,7 @@ class CodeGenerator: ' else\n' ' {\n' ' g_value_init (&value, pspec->value_type);\n' - ' g_object_get_property (G_OBJECT (stub), info->hyphen_name, &value);\n' + ' g_object_get_property (G_OBJECT (skeleton), info->hyphen_name, &value);\n' ' ret = g_dbus_gvalue_to_gvariant (&value, G_VARIANT_TYPE (info->parent_struct.signature));\n' ' g_value_unset (&value);\n' ' }\n' @@ -1439,7 +1439,7 @@ class CodeGenerator: %(i.name_lower)) self.c.write('static gboolean\n' - '_%s_stub_handle_set_property (\n' + '_%s_skeleton_handle_set_property (\n' ' GDBusConnection *connection,\n' ' const gchar *sender,\n' ' const gchar *object_path,\n' @@ -1449,7 +1449,7 @@ class CodeGenerator: ' GError **error,\n' ' gpointer user_data)\n' '{\n' - ' %sStub *stub = %s%s_STUB (user_data);\n' + ' %sSkeleton *skeleton = %s%s_SKELETON (user_data);\n' ' GValue value = {0};\n' ' GParamSpec *pspec;\n' ' _ExtendedGDBusPropertyInfo *info;\n' @@ -1458,7 +1458,7 @@ class CodeGenerator: self.c.write(' ret = FALSE;\n' ' info = (_ExtendedGDBusPropertyInfo *) g_dbus_interface_info_lookup_property ((GDBusInterfaceInfo *) &_%s_interface_info, property_name);\n' ' g_assert (info != NULL);\n' - ' pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (stub), info->hyphen_name);\n' + ' pspec = g_object_class_find_property (G_OBJECT_GET_CLASS (skeleton), info->hyphen_name);\n' ' if (pspec == NULL)\n' ' {\n' ' g_set_error (error, G_DBUS_ERROR, G_DBUS_ERROR_INVALID_ARGS, "No property with name %%s", property_name);\n' @@ -1469,7 +1469,7 @@ class CodeGenerator: ' g_value_set_variant (&value, variant);\n' ' else\n' ' g_dbus_gvariant_to_gvalue (variant, &value);\n' - ' g_object_set_property (G_OBJECT (stub), info->hyphen_name, &value);\n' + ' g_object_set_property (G_OBJECT (skeleton), info->hyphen_name, &value);\n' ' g_value_unset (&value);\n' ' ret = TRUE;\n' ' }\n' @@ -1479,16 +1479,16 @@ class CodeGenerator: %(i.name_lower)) - self.c.write('static const GDBusInterfaceVTable _%s_stub_vtable =\n' + self.c.write('static const GDBusInterfaceVTable _%s_skeleton_vtable =\n' '{\n' - ' _%s_stub_handle_method_call,\n' - ' _%s_stub_handle_get_property,\n' - ' _%s_stub_handle_set_property\n' + ' _%s_skeleton_handle_method_call,\n' + ' _%s_skeleton_handle_get_property,\n' + ' _%s_skeleton_handle_set_property\n' '};\n' '\n'%(i.name_lower, i.name_lower, i.name_lower, i.name_lower)) self.c.write('static GDBusInterfaceInfo *\n' - '%s_stub_dbus_interface_get_info (GDBusInterfaceStub *stub)\n' + '%s_skeleton_dbus_interface_get_info (GDBusInterfaceSkeleton *skeleton)\n' '{\n' ' return %s_interface_info ();\n' %(i.name_lower, i.name_lower)) @@ -1496,17 +1496,17 @@ class CodeGenerator: '\n') self.c.write('static GDBusInterfaceVTable *\n' - '%s_stub_dbus_interface_get_vtable (GDBusInterfaceStub *stub)\n' + '%s_skeleton_dbus_interface_get_vtable (GDBusInterfaceSkeleton *skeleton)\n' '{\n' - ' return (GDBusInterfaceVTable *) &_%s_stub_vtable;\n' + ' return (GDBusInterfaceVTable *) &_%s_skeleton_vtable;\n' %(i.name_lower, i.name_lower)) self.c.write('}\n' '\n') self.c.write('static GVariant *\n' - '%s_stub_dbus_interface_get_properties (GDBusInterfaceStub *_stub)\n' + '%s_skeleton_dbus_interface_get_properties (GDBusInterfaceSkeleton *_skeleton)\n' '{\n' - ' %sStub *stub = %s%s_STUB (_stub);\n' + ' %sSkeleton *skeleton = %s%s_SKELETON (_skeleton);\n' %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper)) self.c.write('\n' ' GVariantBuilder builder;\n' @@ -1520,7 +1520,7 @@ class CodeGenerator: ' if (info->flags & G_DBUS_PROPERTY_INFO_FLAGS_READABLE)\n' ' {\n' ' GVariant *value;\n' - ' value = _%s_stub_handle_get_property (g_dbus_interface_stub_get_connection (G_DBUS_INTERFACE_STUB (stub)), NULL, g_dbus_interface_stub_get_object_path (G_DBUS_INTERFACE_STUB (stub)), "%s", info->name, NULL, stub);\n' + ' value = _%s_skeleton_handle_get_property (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)), NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "%s", info->name, NULL, skeleton);\n' ' if (value != NULL)\n' ' {\n' ' if (g_variant_is_floating (value))\n' @@ -1542,16 +1542,16 @@ class CodeGenerator: %(i.name_lower)) self.c.write('static void\n' - '%s_stub_dbus_interface_flush (GDBusInterfaceStub *_stub)\n' + '%s_skeleton_dbus_interface_flush (GDBusInterfaceSkeleton *_skeleton)\n' '{\n' %(i.name_lower)) if len(i.properties) > 0: - self.c.write(' %sStub *stub = %s%s_STUB (_stub);\n' - ' if (stub->priv->changed_properties_idle_source != NULL)\n' + self.c.write(' %sSkeleton *skeleton = %s%s_SKELETON (_skeleton);\n' + ' if (skeleton->priv->changed_properties_idle_source != NULL)\n' ' {\n' - ' g_source_destroy (stub->priv->changed_properties_idle_source);\n' - ' stub->priv->changed_properties_idle_source = NULL;\n' - ' _%s_emit_changed (stub);\n' + ' g_source_destroy (skeleton->priv->changed_properties_idle_source);\n' + ' skeleton->priv->changed_properties_idle_source = NULL;\n' + ' _%s_emit_changed (skeleton);\n' ' }\n' %(i.camel_name, i.ns_upper, i.name_upper, i.name_lower)) self.c.write('}\n' @@ -1565,13 +1565,13 @@ class CodeGenerator: self.c.write(',\n %s%s'%(a.ctype_in, a.name)) self.c.write(')\n' '{\n' - ' %sStub *stub = %s%s_STUB (object);\n' - ' GDBusConnection *connection = g_dbus_interface_stub_get_connection (G_DBUS_INTERFACE_STUB (stub));\n' + ' %sSkeleton *skeleton = %s%s_SKELETON (object);\n' + ' GDBusConnection *connection = g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton));\n' %(i.camel_name, i.ns_upper, i.name_upper)) self.c.write(' if (connection == NULL)\n' ' return;\n' ' g_dbus_connection_emit_signal (connection,\n' - ' NULL, g_dbus_interface_stub_get_object_path (G_DBUS_INTERFACE_STUB (stub)), "%s", "%s",\n' + ' NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)), "%s", "%s",\n' ' g_variant_new ("(' %(i.name, s.name)) for a in s.args: @@ -1584,7 +1584,7 @@ class CodeGenerator: '\n') self.c.write('static void\n' - '%s_stub_iface_init (%sIface *iface)\n' + '%s_skeleton_iface_init (%sIface *iface)\n' '{\n' %(i.name_lower, i.camel_name)) for s in i.signals: @@ -1592,39 +1592,39 @@ class CodeGenerator: %(s.name_lower, i.name_lower, s.name_lower)) self.c.write('}\n' '\n') - self.c.write('#define %s_stub_get_type %s_stub_get_gtype\n'%(i.name_lower, i.name_lower)) - self.c.write('G_DEFINE_TYPE_WITH_CODE (%sStub, %s_stub, G_TYPE_DBUS_INTERFACE_STUB,\n'%(i.camel_name, i.name_lower)) - self.c.write(' G_IMPLEMENT_INTERFACE (%sTYPE_%s, %s_stub_iface_init));\n'%(i.ns_upper, i.name_upper, i.name_lower)) - self.c.write('#undef %s_stub_get_type\n' + self.c.write('#define %s_skeleton_get_type %s_skeleton_get_gtype\n'%(i.name_lower, i.name_lower)) + self.c.write('G_DEFINE_TYPE_WITH_CODE (%sSkeleton, %s_skeleton, G_TYPE_DBUS_INTERFACE_SKELETON,\n'%(i.camel_name, i.name_lower)) + self.c.write(' G_IMPLEMENT_INTERFACE (%sTYPE_%s, %s_skeleton_iface_init));\n'%(i.ns_upper, i.name_upper, i.name_lower)) + self.c.write('#undef %s_skeleton_get_type\n' '\n'%(i.name_lower)) # finalize self.c.write('static void\n' - '%s_stub_finalize (GObject *object)\n' + '%s_skeleton_finalize (GObject *object)\n' '{\n'%(i.name_lower)) - self.c.write(' %sStub *stub = %s%s_STUB (object);\n'%(i.camel_name, i.ns_upper, i.name_upper)) + self.c.write(' %sSkeleton *skeleton = %s%s_SKELETON (object);\n'%(i.camel_name, i.ns_upper, i.name_upper)) if len(i.properties) > 0: - self.c.write(' g_value_array_free (stub->priv->properties);\n') - self.c.write(' g_list_foreach (stub->priv->changed_properties, (GFunc) _changed_property_free, NULL);\n') - self.c.write(' g_list_free (stub->priv->changed_properties);\n') - self.c.write(' if (stub->priv->changed_properties_idle_source != NULL)\n') - self.c.write(' g_source_destroy (stub->priv->changed_properties_idle_source);\n') - self.c.write(' if (stub->priv->context != NULL)\n') - self.c.write(' g_main_context_unref (stub->priv->context);\n') - self.c.write(' G_OBJECT_CLASS (%s_stub_parent_class)->finalize (object);\n' + self.c.write(' g_value_array_free (skeleton->priv->properties);\n') + self.c.write(' g_list_foreach (skeleton->priv->changed_properties, (GFunc) _changed_property_free, NULL);\n') + self.c.write(' g_list_free (skeleton->priv->changed_properties);\n') + self.c.write(' if (skeleton->priv->changed_properties_idle_source != NULL)\n') + self.c.write(' g_source_destroy (skeleton->priv->changed_properties_idle_source);\n') + self.c.write(' if (skeleton->priv->context != NULL)\n') + self.c.write(' g_main_context_unref (skeleton->priv->context);\n') + self.c.write(' G_OBJECT_CLASS (%s_skeleton_parent_class)->finalize (object);\n' '}\n' '\n'%(i.name_lower)) # property accessors (TODO: generate PropertiesChanged signals in setter) self.c.write('static void\n' - '%s_stub_get_property (GObject *object,\n' + '%s_skeleton_get_property (GObject *object,\n' ' guint prop_id,\n' ' GValue *value,\n' ' GParamSpec *pspec)\n' '{\n'%(i.name_lower)) - self.c.write(' %sStub *stub = %s%s_STUB (object);\n' + self.c.write(' %sSkeleton *skeleton = %s%s_SKELETON (object);\n' ' g_assert (prop_id - 1 >= 0 && prop_id - 1 < %d);\n' - ' g_value_copy (&stub->priv->properties->values[prop_id - 1], value);\n' + ' g_value_copy (&skeleton->priv->properties->values[prop_id - 1], value);\n' %(i.camel_name, i.ns_upper, i.name_upper, len(i.properties))) self.c.write('}\n' '\n') @@ -1632,14 +1632,14 @@ class CodeGenerator: self.c.write('static gboolean\n' '_%s_emit_changed (gpointer user_data)\n' '{\n' - ' %sStub *stub = %s%s_STUB (user_data);\n' + ' %sSkeleton *skeleton = %s%s_SKELETON (user_data);\n' %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper)) self.c.write(' GList *l;\n' ' GVariantBuilder builder;\n' ' GVariantBuilder invalidated_builder;\n' ' g_variant_builder_init (&builder, G_VARIANT_TYPE ("a{sv}"));\n' ' g_variant_builder_init (&invalidated_builder, G_VARIANT_TYPE ("as"));\n' - ' for (l = stub->priv->changed_properties; l != NULL; l = l->next)\n' + ' for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)\n' ' {\n' ' ChangedProperty *cp = l->data;\n' ' GVariant *variant;\n' @@ -1647,8 +1647,8 @@ class CodeGenerator: ' g_variant_builder_add (&builder, "{sv}", cp->info->parent_struct.name, variant);\n' ' g_variant_unref (variant);\n' ' }\n' - ' g_dbus_connection_emit_signal (g_dbus_interface_stub_get_connection (G_DBUS_INTERFACE_STUB (stub)),\n' - ' NULL, g_dbus_interface_stub_get_object_path (G_DBUS_INTERFACE_STUB (stub)),\n' + ' g_dbus_connection_emit_signal (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)),\n' + ' NULL, g_dbus_interface_skeleton_get_object_path (G_DBUS_INTERFACE_SKELETON (skeleton)),\n' ' "org.freedesktop.DBus.Properties",\n' ' "PropertiesChanged",\n' ' g_variant_new ("(sa{sv}as)",\n' @@ -1656,21 +1656,21 @@ class CodeGenerator: ' &builder, &invalidated_builder),\n' ' NULL);\n' %(i.name)) - self.c.write(' g_list_foreach (stub->priv->changed_properties, (GFunc) _changed_property_free, NULL);\n') - self.c.write(' g_list_free (stub->priv->changed_properties);\n') - self.c.write(' stub->priv->changed_properties = NULL;\n') - self.c.write(' stub->priv->changed_properties_idle_source = NULL;\n') + self.c.write(' g_list_foreach (skeleton->priv->changed_properties, (GFunc) _changed_property_free, NULL);\n') + self.c.write(' g_list_free (skeleton->priv->changed_properties);\n') + self.c.write(' skeleton->priv->changed_properties = NULL;\n') + self.c.write(' skeleton->priv->changed_properties_idle_source = NULL;\n') self.c.write(' return FALSE;\n' '}\n' '\n') # if property is already scheduled then re-use entry self.c.write('static void\n' - '_%s_schedule_emit_changed (%sStub *stub, const _ExtendedGDBusPropertyInfo *info, GParamSpec *pspec, const GValue *value)\n' + '_%s_schedule_emit_changed (%sSkeleton *skeleton, const _ExtendedGDBusPropertyInfo *info, GParamSpec *pspec, const GValue *value)\n' '{\n' ' ChangedProperty *cp;\n' ' GList *l;\n' ' cp = NULL;\n' - ' for (l = stub->priv->changed_properties; l != NULL; l = l->next)\n' + ' for (l = skeleton->priv->changed_properties; l != NULL; l = l->next)\n' ' {\n' ' ChangedProperty *i_cp = l->data;\n' ' if (i_cp->info == info)\n' @@ -1685,88 +1685,88 @@ class CodeGenerator: ' cp = g_new0 (ChangedProperty, 1);\n' ' cp->pspec = pspec;\n' ' cp->info = info;\n' - ' stub->priv->changed_properties = g_list_prepend (stub->priv->changed_properties, cp);\n' + ' skeleton->priv->changed_properties = g_list_prepend (skeleton->priv->changed_properties, cp);\n' ' }\n' ' g_value_init (&cp->value, G_VALUE_TYPE (value));\n' ' g_value_copy (value, &cp->value);\n' - ' if (stub->priv->changed_properties_idle_source == NULL)\n' + ' if (skeleton->priv->changed_properties_idle_source == NULL)\n' ' {\n' - ' stub->priv->changed_properties_idle_source = g_idle_source_new ();\n' - ' g_source_set_priority (stub->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);\n' - ' g_source_set_callback (stub->priv->changed_properties_idle_source, _%s_emit_changed, g_object_ref (stub), (GDestroyNotify) g_object_unref);\n' - ' g_source_attach (stub->priv->changed_properties_idle_source, stub->priv->context);\n' - ' g_source_unref (stub->priv->changed_properties_idle_source);\n' + ' skeleton->priv->changed_properties_idle_source = g_idle_source_new ();\n' + ' g_source_set_priority (skeleton->priv->changed_properties_idle_source, G_PRIORITY_DEFAULT);\n' + ' g_source_set_callback (skeleton->priv->changed_properties_idle_source, _%s_emit_changed, g_object_ref (skeleton), (GDestroyNotify) g_object_unref);\n' + ' g_source_attach (skeleton->priv->changed_properties_idle_source, skeleton->priv->context);\n' + ' g_source_unref (skeleton->priv->changed_properties_idle_source);\n' ' }\n' '}\n' '\n' %(i.name_lower, i.camel_name, i.name_lower)) self.c.write('static void\n' - '%s_stub_set_property (GObject *object,\n' + '%s_skeleton_set_property (GObject *object,\n' ' guint prop_id,\n' ' const GValue *value,\n' ' GParamSpec *pspec)\n' '{\n'%(i.name_lower)) if len(i.properties) > 0: - self.c.write(' %sStub *stub = %s%s_STUB (object);\n' + self.c.write(' %sSkeleton *skeleton = %s%s_SKELETON (object);\n' ' g_assert (prop_id - 1 >= 0 && prop_id - 1 < %d);\n' - ' if (!_g_value_equal (value, &stub->priv->properties->values[prop_id - 1]))\n' + ' if (!_g_value_equal (value, &skeleton->priv->properties->values[prop_id - 1]))\n' ' {\n' - ' g_value_copy (value, &stub->priv->properties->values[prop_id - 1]);\n' + ' g_value_copy (value, &skeleton->priv->properties->values[prop_id - 1]);\n' ' g_object_notify_by_pspec (object, pspec);\n' - ' if (g_dbus_interface_stub_get_connection (G_DBUS_INTERFACE_STUB (stub)) != NULL)\n' - ' _%s_schedule_emit_changed (stub, _%s_property_info_pointers[prop_id - 1], pspec, value);\n' + ' if (g_dbus_interface_skeleton_get_connection (G_DBUS_INTERFACE_SKELETON (skeleton)) != NULL)\n' + ' _%s_schedule_emit_changed (skeleton, _%s_property_info_pointers[prop_id - 1], pspec, value);\n' ' }\n' %(i.camel_name, i.ns_upper, i.name_upper, len(i.properties), i.name_lower, i.name_lower)) self.c.write('}\n' '\n') self.c.write('static void\n' - '%s_stub_init (%sStub *stub)\n' + '%s_skeleton_init (%sSkeleton *skeleton)\n' '{\n' - ' stub->priv = G_TYPE_INSTANCE_GET_PRIVATE (stub, %sTYPE_%s_STUB, %sStubPrivate);\n' + ' skeleton->priv = G_TYPE_INSTANCE_GET_PRIVATE (skeleton, %sTYPE_%s_SKELETON, %sSkeletonPrivate);\n' %(i.name_lower, i.camel_name, i.ns_upper, i.name_upper, i.camel_name)) - self.c.write(' stub->priv->context = g_main_context_get_thread_default ();\n') - self.c.write(' if (stub->priv->context != NULL)\n') - self.c.write(' g_main_context_ref (stub->priv->context);\n') + self.c.write(' skeleton->priv->context = g_main_context_get_thread_default ();\n') + self.c.write(' if (skeleton->priv->context != NULL)\n') + self.c.write(' g_main_context_ref (skeleton->priv->context);\n') if len(i.properties) > 0: - self.c.write(' stub->priv->properties = g_value_array_new (%d);\n'%(len(i.properties))) + self.c.write(' skeleton->priv->properties = g_value_array_new (%d);\n'%(len(i.properties))) n = 0 for p in i.properties: - self.c.write(' g_value_array_append (stub->priv->properties, NULL);\n') - self.c.write(' g_value_init (&stub->priv->properties->values[%d], %s);\n'%(n, p.arg.gtype)) + self.c.write(' g_value_array_append (skeleton->priv->properties, NULL);\n') + self.c.write(' g_value_init (&skeleton->priv->properties->values[%d], %s);\n'%(n, p.arg.gtype)) n += 1 self.c.write('}\n' '\n') self.c.write('static void\n' - '%s_stub_class_init (%sStubClass *klass)\n' + '%s_skeleton_class_init (%sSkeletonClass *klass)\n' '{\n' ' GObjectClass *gobject_class;\n' - ' GDBusInterfaceStubClass *stub_class;\n' + ' GDBusInterfaceSkeletonClass *skeleton_class;\n' '\n' - ' g_type_class_add_private (klass, sizeof (%sStubPrivate));\n' + ' g_type_class_add_private (klass, sizeof (%sSkeletonPrivate));\n' '\n' ' gobject_class = G_OBJECT_CLASS (klass);\n' - ' gobject_class->finalize = %s_stub_finalize;\n' - ' gobject_class->get_property = %s_stub_get_property;\n' - ' gobject_class->set_property = %s_stub_set_property;\n' + ' gobject_class->finalize = %s_skeleton_finalize;\n' + ' gobject_class->get_property = %s_skeleton_get_property;\n' + ' gobject_class->set_property = %s_skeleton_set_property;\n' '\n'%(i.name_lower, i.camel_name, i.camel_name, i.name_lower, i.name_lower, i.name_lower)) if len(i.properties) > 0: self.c.write('\n' ' %s_override_properties (gobject_class, 1);\n'%(i.name_lower)) self.c.write('\n' - ' stub_class = G_DBUS_INTERFACE_STUB_CLASS (klass);\n'); - self.c.write(' stub_class->get_info = %s_stub_dbus_interface_get_info;\n'%(i.name_lower)) - self.c.write(' stub_class->get_properties = %s_stub_dbus_interface_get_properties;\n'%(i.name_lower)) - self.c.write(' stub_class->flush = %s_stub_dbus_interface_flush;\n'%(i.name_lower)) - self.c.write(' stub_class->get_vtable = %s_stub_dbus_interface_get_vtable;\n'%(i.name_lower)) + ' skeleton_class = G_DBUS_INTERFACE_SKELETON_CLASS (klass);\n'); + self.c.write(' skeleton_class->get_info = %s_skeleton_dbus_interface_get_info;\n'%(i.name_lower)) + self.c.write(' skeleton_class->get_properties = %s_skeleton_dbus_interface_get_properties;\n'%(i.name_lower)) + self.c.write(' skeleton_class->flush = %s_skeleton_dbus_interface_flush;\n'%(i.name_lower)) + self.c.write(' skeleton_class->get_vtable = %s_skeleton_dbus_interface_get_vtable;\n'%(i.name_lower)) self.c.write('}\n' '\n') # constructors self.c.write('%s *\n' - '%s_stub_new (void)\n' + '%s_skeleton_new (void)\n' '{\n' - ' return %s%s (g_object_new (%sTYPE_%s_STUB, NULL));\n' + ' return %s%s (g_object_new (%sTYPE_%s_SKELETON, NULL));\n' '}\n' '\n'%(i.camel_name, i.name_lower, i.ns_upper, i.name_upper, i.ns_upper, i.name_upper)) @@ -1950,7 +1950,7 @@ class CodeGenerator: self.generate_method_calls(i) self.generate_method_completers(i) self.generate_proxy(i) - self.generate_stub(i) + self.generate_skeleton(i) if self.generate_objmanager: self.generate_object_manager_client() self.generate_outro() diff --git a/gio/gdbusinterface.c b/gio/gdbusinterface.c index 7384149..5bb0244 100644 --- a/gio/gdbusinterface.c +++ b/gio/gdbusinterface.c @@ -34,8 +34,8 @@ * @include: gio/gio.h * * The #GDBusInterface type is the base type for D-Bus interfaces both - * on the service side (see #GDBusInterfaceStub) and client side (see - * #GDBusProxy). + * on the service side (see #GDBusInterfaceSkeleton) and client side + * (see #GDBusProxy). */ typedef GDBusInterfaceIface GDBusInterfaceInterface; diff --git a/gio/gdbusinterfacestub.c b/gio/gdbusinterfaceskeleton.c similarity index 67% rename from gio/gdbusinterfacestub.c rename to gio/gdbusinterfaceskeleton.c index 7fdb3c0..2f3860c 100644 --- a/gio/gdbusinterfacestub.c +++ b/gio/gdbusinterfaceskeleton.c @@ -23,8 +23,8 @@ #include "config.h" #include "gdbusinterface.h" -#include "gdbusinterfacestub.h" -#include "gdbusobjectstub.h" +#include "gdbusinterfaceskeleton.h" +#include "gdbusobjectskeleton.h" #include "gio-marshal.h" #include "gioenumtypes.h" #include "gdbusprivate.h" @@ -36,17 +36,17 @@ #include "glibintl.h" /** - * SECTION:gdbusinterfacestub + * SECTION:gdbusinterfaceskeleton * @short_description: Service-side D-Bus interface * @include: gio/gio.h * * Abstract base class for D-Bus interfaces on the service side. */ -struct _GDBusInterfaceStubPrivate +struct _GDBusInterfaceSkeletonPrivate { GDBusObject *object; - GDBusInterfaceStubFlags flags; + GDBusInterfaceSkeletonFlags flags; guint registration_id; GDBusConnection *connection; @@ -70,16 +70,16 @@ static guint signals[LAST_SIGNAL] = {0}; static void dbus_interface_interface_init (GDBusInterfaceIface *iface); -G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GDBusInterfaceStub, g_dbus_interface_stub, G_TYPE_OBJECT, +G_DEFINE_ABSTRACT_TYPE_WITH_CODE (GDBusInterfaceSkeleton, g_dbus_interface_skeleton, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_INTERFACE, dbus_interface_interface_init)); static void -g_dbus_interface_stub_finalize (GObject *object) +g_dbus_interface_skeleton_finalize (GObject *object) { - GDBusInterfaceStub *interface = G_DBUS_INTERFACE_STUB (object); + GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (object); /* unexport if already exported */ if (interface->priv->registration_id > 0) - g_dbus_interface_stub_unexport (interface); + g_dbus_interface_skeleton_unexport (interface); g_assert (interface->priv->connection == NULL); g_assert (interface->priv->object_path == NULL); @@ -87,21 +87,21 @@ g_dbus_interface_stub_finalize (GObject *object) if (interface->priv->object != NULL) g_object_remove_weak_pointer (G_OBJECT (interface->priv->object), (gpointer *) &interface->priv->object); - G_OBJECT_CLASS (g_dbus_interface_stub_parent_class)->finalize (object); + G_OBJECT_CLASS (g_dbus_interface_skeleton_parent_class)->finalize (object); } static void -g_dbus_interface_stub_get_property (GObject *object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +g_dbus_interface_skeleton_get_property (GObject *object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - GDBusInterfaceStub *interface = G_DBUS_INTERFACE_STUB (object); + GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (object); switch (prop_id) { case PROP_G_FLAGS: - g_value_set_flags (value, g_dbus_interface_stub_get_flags (interface)); + g_value_set_flags (value, g_dbus_interface_skeleton_get_flags (interface)); break; default: @@ -111,17 +111,17 @@ g_dbus_interface_stub_get_property (GObject *object, } static void -g_dbus_interface_stub_set_property (GObject *object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +g_dbus_interface_skeleton_set_property (GObject *object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - GDBusInterfaceStub *interface = G_DBUS_INTERFACE_STUB (object); + GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (object); switch (prop_id) { case PROP_G_FLAGS: - g_dbus_interface_stub_set_flags (interface, g_value_get_flags (value)); + g_dbus_interface_skeleton_set_flags (interface, g_value_get_flags (value)); break; default: @@ -131,28 +131,28 @@ g_dbus_interface_stub_set_property (GObject *object, } static gboolean -g_dbus_interface_stub_g_authorize_method_default (GDBusInterfaceStub *interface, - GDBusMethodInvocation *invocation) +g_dbus_interface_skeleton_g_authorize_method_default (GDBusInterfaceSkeleton *interface, + GDBusMethodInvocation *invocation) { return TRUE; } static void -g_dbus_interface_stub_class_init (GDBusInterfaceStubClass *klass) +g_dbus_interface_skeleton_class_init (GDBusInterfaceSkeletonClass *klass) { GObjectClass *gobject_class; gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = g_dbus_interface_stub_finalize; - gobject_class->set_property = g_dbus_interface_stub_set_property; - gobject_class->get_property = g_dbus_interface_stub_get_property; + gobject_class->finalize = g_dbus_interface_skeleton_finalize; + gobject_class->set_property = g_dbus_interface_skeleton_set_property; + gobject_class->get_property = g_dbus_interface_skeleton_get_property; - klass->g_authorize_method = g_dbus_interface_stub_g_authorize_method_default; + klass->g_authorize_method = g_dbus_interface_skeleton_g_authorize_method_default; /** - * GDBusInterfaceStub:g-flags: + * GDBusInterfaceSkeleton:g-flags: * - * Flags from the #GDBusInterfaceStubFlags enumeration. + * Flags from the #GDBusInterfaceSkeletonFlags enumeration. * * Since: 2.30 */ @@ -160,16 +160,16 @@ g_dbus_interface_stub_class_init (GDBusInterfaceStubClass *klass) PROP_G_FLAGS, g_param_spec_flags ("g-flags", "g-flags", - "Flags for the interface stub", - G_TYPE_DBUS_INTERFACE_STUB_FLAGS, - G_DBUS_INTERFACE_STUB_FLAGS_NONE, + "Flags for the interface skeleton", + G_TYPE_DBUS_INTERFACE_SKELETON_FLAGS, + G_DBUS_INTERFACE_SKELETON_FLAGS_NONE, G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_STATIC_STRINGS)); /** - * GDBusInterfaceStub::g-authorize-method: - * @interface: The #GDBusInterfaceStub emitting the signal. + * GDBusInterfaceSkeleton::g-authorize-method: + * @interface: The #GDBusInterfaceSkeleton emitting the signal. * @invocation: A #GDBusMethodInvocation. * * Emitted when a method is invoked by a remote caller and used to @@ -190,18 +190,18 @@ g_dbus_interface_stub_class_init (GDBusInterfaceStubClass *klass) * * Otherwise, if %TRUE is returned, signal emission continues. If no * handlers return %FALSE, then the method is dispatched. If - * @interface has an enclosing #GDBusObjectStub, then the - * #GDBusObjectStub::authorize-method signal handlers run before the - * handlers for this signal. + * @interface has an enclosing #GDBusObjectSkeleton, then the + * #GDBusObjectSkeleton::authorize-method signal handlers run before + * the handlers for this signal. * * The default class handler just returns %TRUE. * * Please note that the common case is optimized: if no signals * handlers are connected and the default class handler isn't * overridden (for both @interface and the enclosing - * #GDBusObjectStub, if any) and #GDBusInterfaceStub:g-flags does + * #GDBusObjectSkeleton, if any) and #GDBusInterfaceSkeleton:g-flags does * not have the - * %G_DBUS_INTERFACE_STUB_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD + * %G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD * flags set, no dedicated thread is ever used and the call will be * handled in the same thread as the object that @interface belongs * to was exported in. @@ -212,9 +212,9 @@ g_dbus_interface_stub_class_init (GDBusInterfaceStubClass *klass) */ signals[G_AUTHORIZE_METHOD_SIGNAL] = g_signal_new ("g-authorize-method", - G_TYPE_DBUS_INTERFACE_STUB, + G_TYPE_DBUS_INTERFACE_SKELETON, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GDBusInterfaceStubClass, g_authorize_method), + G_STRUCT_OFFSET (GDBusInterfaceSkeletonClass, g_authorize_method), _g_signal_accumulator_false_handled, NULL, _gio_marshal_BOOLEAN__OBJECT, @@ -222,49 +222,49 @@ g_dbus_interface_stub_class_init (GDBusInterfaceStubClass *klass) 1, G_TYPE_DBUS_METHOD_INVOCATION); - g_type_class_add_private (klass, sizeof (GDBusInterfaceStubPrivate)); + g_type_class_add_private (klass, sizeof (GDBusInterfaceSkeletonPrivate)); } static void -g_dbus_interface_stub_init (GDBusInterfaceStub *interface) +g_dbus_interface_skeleton_init (GDBusInterfaceSkeleton *interface) { - interface->priv = G_TYPE_INSTANCE_GET_PRIVATE (interface, G_TYPE_DBUS_INTERFACE_STUB, GDBusInterfaceStubPrivate); + interface->priv = G_TYPE_INSTANCE_GET_PRIVATE (interface, G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonPrivate); } /* ---------------------------------------------------------------------------------------------------- */ /** - * g_dbus_interface_stub_get_flags: - * @interface_: A #GDBusInterfaceStub. + * g_dbus_interface_skeleton_get_flags: + * @interface_: A #GDBusInterfaceSkeleton. * - * Gets the #GDBusInterfaceStubFlags that describes what the behavior + * Gets the #GDBusInterfaceSkeletonFlags that describes what the behavior * of @interface_ * - * Returns: One or more flags from the #GDBusInterfaceStubFlags enumeration. + * Returns: One or more flags from the #GDBusInterfaceSkeletonFlags enumeration. * * Since: 2.30 */ -GDBusInterfaceStubFlags -g_dbus_interface_stub_get_flags (GDBusInterfaceStub *interface_) +GDBusInterfaceSkeletonFlags +g_dbus_interface_skeleton_get_flags (GDBusInterfaceSkeleton *interface_) { - g_return_val_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_), G_DBUS_INTERFACE_STUB_FLAGS_NONE); + g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), G_DBUS_INTERFACE_SKELETON_FLAGS_NONE); return interface_->priv->flags; } /** - * g_dbus_interface_stub_set_flags: - * @interface_: A #GDBusInterfaceStub. - * @flags: Flags from the #GDBusInterfaceStubFlags enumeration. + * g_dbus_interface_skeleton_set_flags: + * @interface_: A #GDBusInterfaceSkeleton. + * @flags: Flags from the #GDBusInterfaceSkeletonFlags enumeration. * - * Sets flags describing what the behavior of @stub should be. + * Sets flags describing what the behavior of @skeleton should be. * * Since: 2.30 */ void -g_dbus_interface_stub_set_flags (GDBusInterfaceStub *interface_, - GDBusInterfaceStubFlags flags) +g_dbus_interface_skeleton_set_flags (GDBusInterfaceSkeleton *interface_, + GDBusInterfaceSkeletonFlags flags) { - g_return_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_)); + g_return_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_)); if (interface_->priv->flags != flags) { interface_->priv->flags = flags; @@ -273,8 +273,8 @@ g_dbus_interface_stub_set_flags (GDBusInterfaceStub *interface_, } /** - * g_dbus_interface_stub_get_info: - * @interface_: A #GDBusInterfaceStub. + * g_dbus_interface_skeleton_get_info: + * @interface_: A #GDBusInterfaceSkeleton. * * Gets D-Bus introspection information for the D-Bus interface * implemented by @interface_. @@ -284,18 +284,18 @@ g_dbus_interface_stub_set_flags (GDBusInterfaceStub *interface_, * Since: 2.30 */ GDBusInterfaceInfo * -g_dbus_interface_stub_get_info (GDBusInterfaceStub *interface_) +g_dbus_interface_skeleton_get_info (GDBusInterfaceSkeleton *interface_) { GDBusInterfaceInfo *ret; - g_return_val_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_), NULL); - ret = G_DBUS_INTERFACE_STUB_GET_CLASS (interface_)->get_info (interface_); + g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), NULL); + ret = G_DBUS_INTERFACE_SKELETON_GET_CLASS (interface_)->get_info (interface_); g_warn_if_fail (ret != NULL); return ret; } /** - * g_dbus_interface_stub_get_vtable: - * @interface_: A #GDBusInterfaceStub. + * g_dbus_interface_skeleton_get_vtable: + * @interface_: A #GDBusInterfaceSkeleton. * * Gets the interface vtable for the D-Bus interface implemented by * @interface_. The returned function pointers should expect @interface_ @@ -306,18 +306,18 @@ g_dbus_interface_stub_get_info (GDBusInterfaceStub *interface_) * Since: 2.30 */ GDBusInterfaceVTable * -g_dbus_interface_stub_get_vtable (GDBusInterfaceStub *interface_) +g_dbus_interface_skeleton_get_vtable (GDBusInterfaceSkeleton *interface_) { GDBusInterfaceVTable *ret; - g_return_val_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_), NULL); - ret = G_DBUS_INTERFACE_STUB_GET_CLASS (interface_)->get_vtable (interface_); + g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), NULL); + ret = G_DBUS_INTERFACE_SKELETON_GET_CLASS (interface_)->get_vtable (interface_); g_warn_if_fail (ret != NULL); return ret; } /** - * g_dbus_interface_stub_get_properties: - * @interface_: A #GDBusInterfaceStub. + * g_dbus_interface_skeleton_get_properties: + * @interface_: A #GDBusInterfaceSkeleton. * * Gets all D-Bus properties for @interface_. * @@ -326,18 +326,18 @@ g_dbus_interface_stub_get_vtable (GDBusInterfaceStub *interface_) * Since: 2.30 */ GVariant * -g_dbus_interface_stub_get_properties (GDBusInterfaceStub *interface_) +g_dbus_interface_skeleton_get_properties (GDBusInterfaceSkeleton *interface_) { GVariant *ret; - g_return_val_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_), NULL); - ret = G_DBUS_INTERFACE_STUB_GET_CLASS (interface_)->get_properties (interface_); + g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), NULL); + ret = G_DBUS_INTERFACE_SKELETON_GET_CLASS (interface_)->get_properties (interface_); g_warn_if_fail (g_variant_is_floating (ret)); return ret; } /** - * g_dbus_interface_stub_flush: - * @interface_: A #GDBusInterfaceStub. + * g_dbus_interface_skeleton_flush: + * @interface_: A #GDBusInterfaceSkeleton. * * If @interface_ has outstanding changes, request for these changes to be * emitted immediately. @@ -351,33 +351,33 @@ g_dbus_interface_stub_get_properties (GDBusInterfaceStub *interface_) * Since: 2.30 */ void -g_dbus_interface_stub_flush (GDBusInterfaceStub *interface_) +g_dbus_interface_skeleton_flush (GDBusInterfaceSkeleton *interface_) { - g_return_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_)); - G_DBUS_INTERFACE_STUB_GET_CLASS (interface_)->flush (interface_); + g_return_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_)); + G_DBUS_INTERFACE_SKELETON_GET_CLASS (interface_)->flush (interface_); } /* ---------------------------------------------------------------------------------------------------- */ static GDBusInterfaceInfo * -_g_dbus_interface_stub_get_info (GDBusInterface *interface_) +_g_dbus_interface_skeleton_get_info (GDBusInterface *interface_) { - GDBusInterfaceStub *interface = G_DBUS_INTERFACE_STUB (interface_); - return g_dbus_interface_stub_get_info (interface); + GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (interface_); + return g_dbus_interface_skeleton_get_info (interface); } static GDBusObject * -g_dbus_interface_stub_get_object (GDBusInterface *interface_) +g_dbus_interface_skeleton_get_object (GDBusInterface *interface_) { - GDBusInterfaceStub *interface = G_DBUS_INTERFACE_STUB (interface_); + GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (interface_); return interface->priv->object; } static void -g_dbus_interface_stub_set_object (GDBusInterface *interface_, - GDBusObject *object) +g_dbus_interface_skeleton_set_object (GDBusInterface *interface_, + GDBusObject *object) { - GDBusInterfaceStub *interface = G_DBUS_INTERFACE_STUB (interface_); + GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (interface_); if (interface->priv->object != NULL) g_object_remove_weak_pointer (G_OBJECT (interface->priv->object), (gpointer *) &interface->priv->object); interface->priv->object = object; @@ -388,9 +388,9 @@ g_dbus_interface_stub_set_object (GDBusInterface *interface_, static void dbus_interface_interface_init (GDBusInterfaceIface *iface) { - iface->get_info = _g_dbus_interface_stub_get_info; - iface->get_object = g_dbus_interface_stub_get_object; - iface->set_object = g_dbus_interface_stub_set_object; + iface->get_info = _g_dbus_interface_skeleton_get_info; + iface->get_object = g_dbus_interface_skeleton_get_object; + iface->set_object = g_dbus_interface_skeleton_set_object; } /* ---------------------------------------------------------------------------------------------------- */ @@ -398,7 +398,7 @@ dbus_interface_interface_init (GDBusInterfaceIface *iface) typedef struct { volatile gint ref_count; - GDBusInterfaceStub *interface; + GDBusInterfaceSkeleton *interface; GDBusInterfaceMethodCallFunc method_call_func; GDBusMethodInvocation *invocation; GMainContext *context; @@ -467,7 +467,7 @@ dispatch_in_thread_func (GIOSchedulerJob *job, if (authorized) { gboolean run_in_thread; - run_in_thread = (data->interface->priv->flags & G_DBUS_INTERFACE_STUB_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD); + run_in_thread = (data->interface->priv->flags & G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD); if (run_in_thread) { /* might as well just re-use the existing thread */ @@ -499,7 +499,7 @@ dispatch_in_thread_func (GIOSchedulerJob *job, } static void -g_dbus_interface_method_dispatch_helper (GDBusInterfaceStub *interface, +g_dbus_interface_method_dispatch_helper (GDBusInterfaceSkeleton *interface, GDBusInterfaceMethodCallFunc method_call_func, GDBusMethodInvocation *invocation) { @@ -508,7 +508,7 @@ g_dbus_interface_method_dispatch_helper (GDBusInterfaceStub *interface gboolean emit_authorized_signal; gboolean run_in_thread; - g_return_if_fail (G_IS_DBUS_INTERFACE_STUB (interface)); + g_return_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface)); g_return_if_fail (method_call_func != NULL); g_return_if_fail (G_IS_DBUS_METHOD_INVOCATION (invocation)); @@ -521,17 +521,17 @@ g_dbus_interface_method_dispatch_helper (GDBusInterfaceStub *interface signals[G_AUTHORIZE_METHOD_SIGNAL], 0, TRUE); - has_default_class_handler = (G_DBUS_INTERFACE_STUB_GET_CLASS (interface)->g_authorize_method == - g_dbus_interface_stub_g_authorize_method_default); + has_default_class_handler = (G_DBUS_INTERFACE_SKELETON_GET_CLASS (interface)->g_authorize_method == + g_dbus_interface_skeleton_g_authorize_method_default); emit_authorized_signal = (has_handlers || !has_default_class_handler); if (!emit_authorized_signal) { if (interface->priv->object != NULL) - emit_authorized_signal = _g_dbus_object_stub_has_authorize_method_handlers (G_DBUS_OBJECT_STUB (interface->priv->object)); + emit_authorized_signal = _g_dbus_object_skeleton_has_authorize_method_handlers (G_DBUS_OBJECT_SKELETON (interface->priv->object)); } - run_in_thread = (interface->priv->flags & G_DBUS_INTERFACE_STUB_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD); + run_in_thread = (interface->priv->flags & G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD); if (!emit_authorized_signal && !run_in_thread) { method_call_func (g_dbus_method_invocation_get_connection (invocation), @@ -563,26 +563,26 @@ g_dbus_interface_method_dispatch_helper (GDBusInterfaceStub *interface } static void -stub_intercept_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) +skeleton_intercept_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) { - GDBusInterfaceStub *interface = G_DBUS_INTERFACE_STUB (user_data); + GDBusInterfaceSkeleton *interface = G_DBUS_INTERFACE_SKELETON (user_data); g_dbus_interface_method_dispatch_helper (interface, - g_dbus_interface_stub_get_vtable (interface)->method_call, + g_dbus_interface_skeleton_get_vtable (interface)->method_call, invocation); } /* ---------------------------------------------------------------------------------------------------- */ /** - * g_dbus_interface_stub_get_connection: - * @interface_: A #GDBusInterfaceStub. + * g_dbus_interface_skeleton_get_connection: + * @interface_: A #GDBusInterfaceSkeleton. * * Gets the connection that @interface_ is exported on, if any. * @@ -592,15 +592,15 @@ stub_intercept_handle_method_call(GDBusConnection *connection, * Since: 2.30 */ GDBusConnection * -g_dbus_interface_stub_get_connection (GDBusInterfaceStub *interface_) +g_dbus_interface_skeleton_get_connection (GDBusInterfaceSkeleton *interface_) { - g_return_val_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_), NULL); + g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), NULL); return interface_->priv->connection; } /** - * g_dbus_interface_stub_get_object_path: - * @interface_: A #GDBusInterfaceStub. + * g_dbus_interface_skeleton_get_object_path: + * @interface_: A #GDBusInterfaceSkeleton. * * Gets the object path that @interface_ is exported on, if any. * @@ -610,14 +610,14 @@ g_dbus_interface_stub_get_connection (GDBusInterfaceStub *interface_) * Since: 2.30 */ const gchar * -g_dbus_interface_stub_get_object_path (GDBusInterfaceStub *interface_) +g_dbus_interface_skeleton_get_object_path (GDBusInterfaceSkeleton *interface_) { - g_return_val_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_), NULL); + g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), NULL); return interface_->priv->object_path; } /** - * g_dbus_interface_stub_export: + * g_dbus_interface_skeleton_export: * @interface_: The D-Bus interface to export. * @connection: A #GDBusConnection to export @interface_ on. * @object_path: The path to export the interface at. @@ -625,7 +625,7 @@ g_dbus_interface_stub_get_object_path (GDBusInterfaceStub *interface_) * * Exports @interface_ at @object_path on @connection. * - * Use g_dbus_interface_stub_unexport() to unexport the object. + * Use g_dbus_interface_skeleton_unexport() to unexport the object. * * Returns: %TRUE if the interface was exported, other %FALSE with * @error set. @@ -633,14 +633,14 @@ g_dbus_interface_stub_get_object_path (GDBusInterfaceStub *interface_) * Since: 2.30 */ gboolean -g_dbus_interface_stub_export (GDBusInterfaceStub *interface_, - GDBusConnection *connection, - const gchar *object_path, - GError **error) +g_dbus_interface_skeleton_export (GDBusInterfaceSkeleton *interface_, + GDBusConnection *connection, + const gchar *object_path, + GError **error) { gboolean ret; - g_return_val_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_), 0); + g_return_val_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_), 0); g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), 0); g_return_val_if_fail (g_variant_is_object_path (object_path), 0); g_return_val_if_fail (error == NULL || *error == NULL, 0); @@ -663,14 +663,14 @@ g_dbus_interface_stub_export (GDBusInterfaceStub *interface_, * ::g-authorize-method and for dispatching in thread vs * context */ - interface_->priv->hooked_vtable = g_memdup (g_dbus_interface_stub_get_vtable (interface_), sizeof (GDBusInterfaceVTable)); - interface_->priv->hooked_vtable->method_call = stub_intercept_handle_method_call; + interface_->priv->hooked_vtable = g_memdup (g_dbus_interface_skeleton_get_vtable (interface_), sizeof (GDBusInterfaceVTable)); + interface_->priv->hooked_vtable->method_call = skeleton_intercept_handle_method_call; interface_->priv->connection = g_object_ref (connection); interface_->priv->object_path = g_strdup (object_path); interface_->priv->registration_id = g_dbus_connection_register_object (connection, object_path, - g_dbus_interface_stub_get_info (interface_), + g_dbus_interface_skeleton_get_info (interface_), interface_->priv->hooked_vtable, interface_, NULL, /* user_data_free_func */ @@ -685,18 +685,18 @@ g_dbus_interface_stub_export (GDBusInterfaceStub *interface_, } /** - * g_dbus_interface_stub_unexport: - * @interface_: A #GDBusInterfaceStub. + * g_dbus_interface_skeleton_unexport: + * @interface_: A #GDBusInterfaceSkeleton. * * Stops exporting an interface previously exported with - * g_dbus_interface_stub_export(). + * g_dbus_interface_skeleton_export(). * * Since: 2.30 */ void -g_dbus_interface_stub_unexport (GDBusInterfaceStub *interface_) +g_dbus_interface_skeleton_unexport (GDBusInterfaceSkeleton *interface_) { - g_return_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_)); + g_return_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_)); g_return_if_fail (interface_->priv->registration_id > 0); g_assert (interface_->priv->connection != NULL); diff --git a/gio/gdbusinterfaceskeleton.h b/gio/gdbusinterfaceskeleton.h new file mode 100644 index 0000000..ff322e1 --- /dev/null +++ b/gio/gdbusinterfaceskeleton.h @@ -0,0 +1,109 @@ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_INTERFACE_SKELETON_H__ +#define __G_DBUS_INTERFACE_SKELETON_H__ + +#include + +G_BEGIN_DECLS + +#define G_TYPE_DBUS_INTERFACE_SKELETON (g_dbus_interface_skeleton_get_type ()) +#define G_DBUS_INTERFACE_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeleton)) +#define G_DBUS_INTERFACE_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonClass)) +#define G_DBUS_INTERFACE_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_INTERFACE_SKELETON, GDBusInterfaceSkeletonClass)) +#define G_IS_DBUS_INTERFACE_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE_SKELETON)) +#define G_IS_DBUS_INTERFACE_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_INTERFACE_SKELETON)) + +typedef struct _GDBusInterfaceSkeletonClass GDBusInterfaceSkeletonClass; +typedef struct _GDBusInterfaceSkeletonPrivate GDBusInterfaceSkeletonPrivate; + +/** + * GDBusInterfaceSkeleton: + * + * The #GDBusInterfaceSkeleton structure contains private data and should + * only be accessed using the provided API. + * + * Since: 2.30 + */ +struct _GDBusInterfaceSkeleton +{ + /*< private >*/ + GObject parent_instance; + GDBusInterfaceSkeletonPrivate *priv; +}; + +/** + * GDBusInterfaceSkeletonClass: + * @parent_class: The parent class. + * @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_skeleton_get_info() for details. + * @get_vtable: Returns a #GDBusInterfaceVTable. See g_dbus_interface_skeleton_get_vtable() for details. + * @get_properties: Returns a new, floating, #GVariant with all properties. See g_dbus_interface_skeleton_get_properties(). + * @flush: Emits outstanding changes, if any. See g_dbus_interface_skeleton_flush(). + * @g_authorize_method: Signal class handler for the #GDBusInterfaceSkeleton::g-authorize-method signal. + * + * Class structure for #GDBusInterfaceSkeleton. + * + * Since: 2.30 + */ +struct _GDBusInterfaceSkeletonClass +{ + GObjectClass parent_class; + + /* Virtual Functions */ + GDBusInterfaceInfo *(*get_info) (GDBusInterfaceSkeleton *interface_); + GDBusInterfaceVTable *(*get_vtable) (GDBusInterfaceSkeleton *interface_); + GVariant *(*get_properties) (GDBusInterfaceSkeleton *interface_); + void (*flush) (GDBusInterfaceSkeleton *interface_); + + /*< private >*/ + gpointer vfunc_padding[8]; + /*< public >*/ + + /* Signals */ + gboolean (*g_authorize_method) (GDBusInterfaceSkeleton *interface_, + GDBusMethodInvocation *invocation); + + /*< private >*/ + gpointer signal_padding[8]; +}; + +GType g_dbus_interface_skeleton_get_type (void) G_GNUC_CONST; +GDBusInterfaceSkeletonFlags g_dbus_interface_skeleton_get_flags (GDBusInterfaceSkeleton *interface_); +void g_dbus_interface_skeleton_set_flags (GDBusInterfaceSkeleton *interface_, + GDBusInterfaceSkeletonFlags flags); +GDBusInterfaceInfo *g_dbus_interface_skeleton_get_info (GDBusInterfaceSkeleton *interface_); +GDBusInterfaceVTable *g_dbus_interface_skeleton_get_vtable (GDBusInterfaceSkeleton *interface_); +GVariant *g_dbus_interface_skeleton_get_properties (GDBusInterfaceSkeleton *interface_); +void g_dbus_interface_skeleton_flush (GDBusInterfaceSkeleton *interface_); + +gboolean g_dbus_interface_skeleton_export (GDBusInterfaceSkeleton *interface_, + GDBusConnection *connection, + const gchar *object_path, + GError **error); +void g_dbus_interface_skeleton_unexport (GDBusInterfaceSkeleton *interface_); +GDBusConnection *g_dbus_interface_skeleton_get_connection (GDBusInterfaceSkeleton *interface_); +const gchar *g_dbus_interface_skeleton_get_object_path (GDBusInterfaceSkeleton *interface_); + +G_END_DECLS + +#endif /* __G_DBUS_INTERFACE_SKELETON_H */ diff --git a/gio/gdbusinterfacestub.h b/gio/gdbusinterfacestub.h deleted file mode 100644 index 30c79eb..0000000 --- a/gio/gdbusinterfacestub.h +++ /dev/null @@ -1,109 +0,0 @@ -/* GDBus - GLib D-Bus Library - * - * Copyright (C) 2008-2010 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: David Zeuthen - */ - -#ifndef __G_DBUS_INTERFACE_STUB_H__ -#define __G_DBUS_INTERFACE_STUB_H__ - -#include - -G_BEGIN_DECLS - -#define G_TYPE_DBUS_INTERFACE_STUB (g_dbus_interface_stub_get_type ()) -#define G_DBUS_INTERFACE_STUB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_INTERFACE_STUB, GDBusInterfaceStub)) -#define G_DBUS_INTERFACE_STUB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_INTERFACE_STUB, GDBusInterfaceStubClass)) -#define G_DBUS_INTERFACE_STUB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_INTERFACE_STUB, GDBusInterfaceStubClass)) -#define G_IS_DBUS_INTERFACE_STUB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_INTERFACE_STUB)) -#define G_IS_DBUS_INTERFACE_STUB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_INTERFACE_STUB)) - -typedef struct _GDBusInterfaceStubClass GDBusInterfaceStubClass; -typedef struct _GDBusInterfaceStubPrivate GDBusInterfaceStubPrivate; - -/** - * GDBusInterfaceStub: - * - * The #GDBusInterfaceStub structure contains private data and should - * only be accessed using the provided API. - * - * Since: 2.30 - */ -struct _GDBusInterfaceStub -{ - /*< private >*/ - GObject parent_instance; - GDBusInterfaceStubPrivate *priv; -}; - -/** - * GDBusInterfaceStubClass: - * @parent_class: The parent class. - * @get_info: Returns a #GDBusInterfaceInfo. See g_dbus_interface_stub_get_info() for details. - * @get_vtable: Returns a #GDBusInterfaceVTable. See g_dbus_interface_stub_get_vtable() for details. - * @get_properties: Returns a new, floating, #GVariant with all properties. See g_dbus_interface_stub_get_properties(). - * @flush: Emits outstanding changes, if any. See g_dbus_interface_stub_flush(). - * @g_authorize_method: Signal class handler for the #GDBusInterfaceStub::g-authorize-method signal. - * - * Class structure for #GDBusInterfaceStub. - * - * Since: 2.30 - */ -struct _GDBusInterfaceStubClass -{ - GObjectClass parent_class; - - /* Virtual Functions */ - GDBusInterfaceInfo *(*get_info) (GDBusInterfaceStub *interface_); - GDBusInterfaceVTable *(*get_vtable) (GDBusInterfaceStub *interface_); - GVariant *(*get_properties) (GDBusInterfaceStub *interface_); - void (*flush) (GDBusInterfaceStub *interface_); - - /*< private >*/ - gpointer vfunc_padding[8]; - /*< public >*/ - - /* Signals */ - gboolean (*g_authorize_method) (GDBusInterfaceStub *interface_, - GDBusMethodInvocation *invocation); - - /*< private >*/ - gpointer signal_padding[8]; -}; - -GType g_dbus_interface_stub_get_type (void) G_GNUC_CONST; -GDBusInterfaceStubFlags g_dbus_interface_stub_get_flags (GDBusInterfaceStub *interface_); -void g_dbus_interface_stub_set_flags (GDBusInterfaceStub *interface_, - GDBusInterfaceStubFlags flags); -GDBusInterfaceInfo *g_dbus_interface_stub_get_info (GDBusInterfaceStub *interface_); -GDBusInterfaceVTable *g_dbus_interface_stub_get_vtable (GDBusInterfaceStub *interface_); -GVariant *g_dbus_interface_stub_get_properties (GDBusInterfaceStub *interface_); -void g_dbus_interface_stub_flush (GDBusInterfaceStub *interface_); - -gboolean g_dbus_interface_stub_export (GDBusInterfaceStub *interface_, - GDBusConnection *connection, - const gchar *object_path, - GError **error); -void g_dbus_interface_stub_unexport (GDBusInterfaceStub *interface_); -GDBusConnection *g_dbus_interface_stub_get_connection (GDBusInterfaceStub *interface_); -const gchar *g_dbus_interface_stub_get_object_path (GDBusInterfaceStub *interface_); - -G_END_DECLS - -#endif /* __G_DBUS_INTERFACE_STUB_H */ diff --git a/gio/gdbusobject.c b/gio/gdbusobject.c index 492eac9..d3ffd6b 100644 --- a/gio/gdbusobject.c +++ b/gio/gdbusobject.c @@ -35,8 +35,8 @@ * @include: gio/gio.h * * The #GDBusObject type is the base type for D-Bus objects on both - * the service side (see #GDBusObjectStub) and the client side (see - * #GDBusObjectProxy). It is essentially just a container of + * the service side (see #GDBusObjectSkeleton) and the client side + * (see #GDBusObjectProxy). It is essentially just a container of * interfaces. */ diff --git a/gio/gdbusobjectmanagerserver.c b/gio/gdbusobjectmanagerserver.c index 3b305ca..7c860a4 100644 --- a/gio/gdbusobjectmanagerserver.c +++ b/gio/gdbusobjectmanagerserver.c @@ -25,8 +25,8 @@ #include "gdbusobjectmanager.h" #include "gdbusobjectmanagerserver.h" #include "gdbusobject.h" -#include "gdbusobjectstub.h" -#include "gdbusinterfacestub.h" +#include "gdbusobjectskeleton.h" +#include "gdbusinterfaceskeleton.h" #include "gdbusconnection.h" #include "gdbusintrospection.h" #include "gdbusmethodinvocation.h" @@ -54,7 +54,7 @@ typedef struct { - GDBusObjectStub *object; + GDBusObjectSkeleton *object; GDBusObjectManagerServer *manager; GHashTable *map_iface_name_to_iface; gboolean exported; @@ -270,8 +270,8 @@ g_dbus_object_manager_server_get_connection (GDBusObjectManagerServer *manager) /* ---------------------------------------------------------------------------------------------------- */ static void -registration_data_export_interface (RegistrationData *data, - GDBusInterfaceStub *interface_stub) +registration_data_export_interface (RegistrationData *data, + GDBusInterfaceSkeleton *interface_skeleton) { GDBusInterfaceInfo *info; GError *error; @@ -279,12 +279,12 @@ registration_data_export_interface (RegistrationData *data, object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)); - info = g_dbus_interface_stub_get_info (interface_stub); + info = g_dbus_interface_skeleton_get_info (interface_skeleton); error = NULL; - if (!g_dbus_interface_stub_export (interface_stub, - data->manager->priv->connection, - object_path, - &error)) + if (!g_dbus_interface_skeleton_export (interface_skeleton, + data->manager->priv->connection, + object_path, + &error)) { /* TODO: probably wrong to complain on stderr */ g_warning ("%s: Error registering object at %s with interface %s: %s", @@ -299,7 +299,7 @@ registration_data_export_interface (RegistrationData *data, g_assert (g_hash_table_lookup (data->map_iface_name_to_iface, info->name) == NULL); g_hash_table_insert (data->map_iface_name_to_iface, info->name, - g_object_ref (interface_stub)); + g_object_ref (interface_skeleton)); /* if we are already exported, then... */ if (data->exported) @@ -316,17 +316,17 @@ registration_data_export_interface (RegistrationData *data, } static void -registration_data_unexport_interface (RegistrationData *data, - GDBusInterfaceStub *interface_stub) +registration_data_unexport_interface (RegistrationData *data, + GDBusInterfaceSkeleton *interface_skeleton) { GDBusInterfaceInfo *info; - GDBusInterfaceStub *iface; + GDBusInterfaceSkeleton *iface; - info = g_dbus_interface_stub_get_info (interface_stub); + info = g_dbus_interface_skeleton_get_info (interface_skeleton); iface = g_hash_table_lookup (data->map_iface_name_to_iface, info->name); g_assert (iface != NULL); - g_dbus_interface_stub_unexport (iface); + g_dbus_interface_skeleton_unexport (iface); g_warn_if_fail (g_hash_table_remove (data->map_iface_name_to_iface, info->name)); @@ -349,7 +349,7 @@ on_interface_added (GDBusObject *object, gpointer user_data) { RegistrationData *data = user_data; - registration_data_export_interface (data, G_DBUS_INTERFACE_STUB (interface)); + registration_data_export_interface (data, G_DBUS_INTERFACE_SKELETON (interface)); } static void @@ -358,7 +358,7 @@ on_interface_removed (GDBusObject *object, gpointer user_data) { RegistrationData *data = user_data; - registration_data_unexport_interface (data, G_DBUS_INTERFACE_STUB (interface)); + registration_data_unexport_interface (data, G_DBUS_INTERFACE_SKELETON (interface)); } /* ---------------------------------------------------------------------------------------------------- */ @@ -368,13 +368,13 @@ static void registration_data_free (RegistrationData *data) { GHashTableIter iter; - GDBusInterfaceStub *iface; + GDBusInterfaceSkeleton *iface; data->exported = FALSE; g_hash_table_iter_init (&iter, data->map_iface_name_to_iface); while (g_hash_table_iter_next (&iter, NULL, (gpointer) &iface)) - g_dbus_interface_stub_unexport (iface); + g_dbus_interface_skeleton_unexport (iface); g_signal_handlers_disconnect_by_func (data->object, G_CALLBACK (on_interface_added), data); g_signal_handlers_disconnect_by_func (data->object, G_CALLBACK (on_interface_removed), data); @@ -388,7 +388,7 @@ registration_data_free (RegistrationData *data) /** * g_dbus_object_manager_server_export: * @manager: A #GDBusObjectManagerServer. - * @object: A #GDBusObjectStub. + * @object: A #GDBusObjectSkeleton. * * Exports @object on @manager. * @@ -405,7 +405,7 @@ registration_data_free (RegistrationData *data) */ void g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager, - GDBusObjectStub *object) + GDBusObjectSkeleton *object) { RegistrationData *data; GList *existing_interfaces; @@ -448,9 +448,9 @@ g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager, existing_interfaces = g_dbus_object_get_interfaces (G_DBUS_OBJECT (object)); for (l = existing_interfaces; l != NULL; l = l->next) { - GDBusInterfaceStub *interface_stub = G_DBUS_INTERFACE_STUB (l->data); - registration_data_export_interface (data, interface_stub); - g_ptr_array_add (interface_names, g_dbus_interface_stub_get_info (interface_stub)->name); + GDBusInterfaceSkeleton *interface_skeleton = G_DBUS_INTERFACE_SKELETON (l->data); + registration_data_export_interface (data, interface_skeleton); + g_ptr_array_add (interface_names, g_dbus_interface_skeleton_get_info (interface_skeleton)->name); } g_list_foreach (existing_interfaces, (GFunc) g_object_unref, NULL); g_list_free (existing_interfaces); @@ -481,8 +481,8 @@ g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager, * Since: 2.30 */ void -g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager, - GDBusObjectStub *object) +g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager, + GDBusObjectSkeleton *object) { gchar *orig_object_path; gchar *object_path; @@ -512,7 +512,7 @@ g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager } if (modified) - g_dbus_object_stub_set_object_path (G_DBUS_OBJECT_STUB (object), object_path); + g_dbus_object_skeleton_set_object_path (G_DBUS_OBJECT_SKELETON (object), object_path); g_dbus_object_manager_server_export (manager, object); @@ -705,7 +705,7 @@ manager_method_call (GDBusConnection *connection, { GVariantBuilder interfaces_builder; GHashTableIter interface_iter; - GDBusInterfaceStub *iface; + GDBusInterfaceSkeleton *iface; const gchar *iter_object_path; g_variant_builder_init (&interfaces_builder, G_VARIANT_TYPE ("a{sa{sv}}")); @@ -714,8 +714,8 @@ manager_method_call (GDBusConnection *connection, { g_variant_builder_add_value (&interfaces_builder, g_variant_new ("{s@a{sv}}", - g_dbus_interface_stub_get_info (iface)->name, - g_dbus_interface_stub_get_properties (iface))); + g_dbus_interface_skeleton_get_info (iface)->name, + g_dbus_interface_skeleton_get_properties (iface))); } iter_object_path = g_dbus_object_get_object_path (G_DBUS_OBJECT (data->object)); g_variant_builder_add (&array_builder, @@ -788,13 +788,13 @@ g_dbus_object_manager_server_emit_interfaces_added (GDBusObjectManagerServer *ma g_variant_builder_init (&array_builder, G_VARIANT_TYPE ("a{sa{sv}}")); for (n = 0; interfaces[n] != NULL; n++) { - GDBusInterfaceStub *iface; + GDBusInterfaceSkeleton *iface; iface = g_hash_table_lookup (data->map_iface_name_to_iface, interfaces[n]); g_assert (iface != NULL); g_variant_builder_add_value (&array_builder, g_variant_new ("{s@a{sv}}", interfaces[n], - g_dbus_interface_stub_get_properties (iface))); + g_dbus_interface_skeleton_get_properties (iface))); } error = NULL; diff --git a/gio/gdbusobjectmanagerserver.h b/gio/gdbusobjectmanagerserver.h index e2bff9c..67eb626 100644 --- a/gio/gdbusobjectmanagerserver.h +++ b/gio/gdbusobjectmanagerserver.h @@ -73,9 +73,9 @@ GDBusObjectManagerServer *g_dbus_object_manager_server_new (GDBu const gchar *object_path); GDBusConnection *g_dbus_object_manager_server_get_connection (GDBusObjectManagerServer *manager); void g_dbus_object_manager_server_export (GDBusObjectManagerServer *manager, - GDBusObjectStub *object); + GDBusObjectSkeleton *object); void g_dbus_object_manager_server_export_uniquely (GDBusObjectManagerServer *manager, - GDBusObjectStub *object); + GDBusObjectSkeleton *object); void g_dbus_object_manager_server_unexport (GDBusObjectManagerServer *manager, const gchar *object_path); diff --git a/gio/gdbusobjectstub.c b/gio/gdbusobjectskeleton.c similarity index 56% rename from gio/gdbusobjectstub.c rename to gio/gdbusobjectskeleton.c index 10f7f1d..3362846 100644 --- a/gio/gdbusobjectstub.c +++ b/gio/gdbusobjectskeleton.c @@ -23,8 +23,8 @@ #include "config.h" #include "gdbusobject.h" -#include "gdbusobjectstub.h" -#include "gdbusinterfacestub.h" +#include "gdbusobjectskeleton.h" +#include "gdbusinterfaceskeleton.h" #include "gio-marshal.h" #include "gdbusprivate.h" #include "gdbusmethodinvocation.h" @@ -35,18 +35,18 @@ #include "glibintl.h" /** - * SECTION:gdbusobjectstub + * SECTION:gdbusobjectskeleton * @short_description: Service-side D-Bus object * @include: gio/gio.h * - * A #GDBusObjectStub instance is essentially a group of D-Bus + * A #GDBusObjectSkeleton instance is essentially a group of D-Bus * interfaces. The set of exported interfaces on the object may be * dynamic and change at runtime. * * This type is intended to be used with #GDBusObjectManager. */ -struct _GDBusObjectStubPrivate +struct _GDBusObjectSkeletonPrivate { gchar *object_path; GHashTable *map_name_to_iface; @@ -68,29 +68,29 @@ static guint signals[LAST_SIGNAL] = {0}; static void dbus_object_interface_init (GDBusObjectIface *iface); -G_DEFINE_TYPE_WITH_CODE (GDBusObjectStub, g_dbus_object_stub, G_TYPE_OBJECT, +G_DEFINE_TYPE_WITH_CODE (GDBusObjectSkeleton, g_dbus_object_skeleton, G_TYPE_OBJECT, G_IMPLEMENT_INTERFACE (G_TYPE_DBUS_OBJECT, dbus_object_interface_init)); static void -g_dbus_object_stub_finalize (GObject *_object) +g_dbus_object_skeleton_finalize (GObject *_object) { - GDBusObjectStub *object = G_DBUS_OBJECT_STUB (_object); + GDBusObjectSkeleton *object = G_DBUS_OBJECT_SKELETON (_object); g_free (object->priv->object_path); g_hash_table_unref (object->priv->map_name_to_iface); - if (G_OBJECT_CLASS (g_dbus_object_stub_parent_class)->finalize != NULL) - G_OBJECT_CLASS (g_dbus_object_stub_parent_class)->finalize (_object); + if (G_OBJECT_CLASS (g_dbus_object_skeleton_parent_class)->finalize != NULL) + G_OBJECT_CLASS (g_dbus_object_skeleton_parent_class)->finalize (_object); } static void -g_dbus_object_stub_get_property (GObject *_object, - guint prop_id, - GValue *value, - GParamSpec *pspec) +g_dbus_object_skeleton_get_property (GObject *_object, + guint prop_id, + GValue *value, + GParamSpec *pspec) { - GDBusObjectStub *object = G_DBUS_OBJECT_STUB (_object); + GDBusObjectSkeleton *object = G_DBUS_OBJECT_SKELETON (_object); switch (prop_id) { @@ -105,17 +105,17 @@ g_dbus_object_stub_get_property (GObject *_object, } static void -g_dbus_object_stub_set_property (GObject *_object, - guint prop_id, - const GValue *value, - GParamSpec *pspec) +g_dbus_object_skeleton_set_property (GObject *_object, + guint prop_id, + const GValue *value, + GParamSpec *pspec) { - GDBusObjectStub *object = G_DBUS_OBJECT_STUB (_object); + GDBusObjectSkeleton *object = G_DBUS_OBJECT_SKELETON (_object); switch (prop_id) { case PROP_OBJECT_PATH: - g_dbus_object_stub_set_object_path (object, g_value_get_string (value)); + g_dbus_object_skeleton_set_object_path (object, g_value_get_string (value)); break; default: @@ -125,26 +125,26 @@ g_dbus_object_stub_set_property (GObject *_object, } static gboolean -g_dbus_object_stub_authorize_method_default (GDBusObjectStub *object, - GDBusInterfaceStub *interface, - GDBusMethodInvocation *invocation) +g_dbus_object_skeleton_authorize_method_default (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface, + GDBusMethodInvocation *invocation) { return TRUE; } static void -g_dbus_object_stub_class_init (GDBusObjectStubClass *klass) +g_dbus_object_skeleton_class_init (GDBusObjectSkeletonClass *klass) { GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - gobject_class->finalize = g_dbus_object_stub_finalize; - gobject_class->set_property = g_dbus_object_stub_set_property; - gobject_class->get_property = g_dbus_object_stub_get_property; + gobject_class->finalize = g_dbus_object_skeleton_finalize; + gobject_class->set_property = g_dbus_object_skeleton_set_property; + gobject_class->get_property = g_dbus_object_skeleton_get_property; - klass->authorize_method = g_dbus_object_stub_authorize_method_default; + klass->authorize_method = g_dbus_object_skeleton_authorize_method_default; /** - * GDBusObjectStub:object-path: + * GDBusObjectSkeleton:object-path: * * The object path where the object is exported. * @@ -162,16 +162,16 @@ g_dbus_object_stub_class_init (GDBusObjectStubClass *klass) G_PARAM_STATIC_STRINGS)); /** - * GDBusObjectStub::authorize-method: - * @object: The #GDBusObjectStub emitting the signal. - * @interface: The #GDBusInterfaceStub that @invocation is on. + * GDBusObjectSkeleton::authorize-method: + * @object: The #GDBusObjectSkeleton emitting the signal. + * @interface: The #GDBusInterfaceSkeleton that @invocation is on. * @invocation: A #GDBusMethodInvocation. * * Emitted when a method is invoked by a remote caller and used to * determine if the method call is authorized. * - * This signal is like #GDBusInterfaceStub's - * #GDBusInterfaceStub::g-authorize-method signal, except that it is + * This signal is like #GDBusInterfaceSkeleton's + * #GDBusInterfaceSkeleton::g-authorize-method signal, except that it is * for the enclosing object. * * The default class handler just returns %TRUE. @@ -182,24 +182,24 @@ g_dbus_object_stub_class_init (GDBusObjectStubClass *klass) */ signals[AUTHORIZE_METHOD_SIGNAL] = g_signal_new ("authorize-method", - G_TYPE_DBUS_OBJECT_STUB, + G_TYPE_DBUS_OBJECT_SKELETON, G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (GDBusObjectStubClass, authorize_method), + G_STRUCT_OFFSET (GDBusObjectSkeletonClass, authorize_method), _g_signal_accumulator_false_handled, NULL, _gio_marshal_BOOLEAN__OBJECT_OBJECT, G_TYPE_BOOLEAN, 2, - G_TYPE_DBUS_INTERFACE_STUB, + G_TYPE_DBUS_INTERFACE_SKELETON, G_TYPE_DBUS_METHOD_INVOCATION); - g_type_class_add_private (klass, sizeof (GDBusObjectStubPrivate)); + g_type_class_add_private (klass, sizeof (GDBusObjectSkeletonPrivate)); } static void -g_dbus_object_stub_init (GDBusObjectStub *object) +g_dbus_object_skeleton_init (GDBusObjectSkeleton *object) { - object->priv = G_TYPE_INSTANCE_GET_PRIVATE (object, G_TYPE_DBUS_OBJECT_STUB, GDBusObjectStubPrivate); + object->priv = G_TYPE_INSTANCE_GET_PRIVATE (object, G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeletonPrivate); object->priv->map_name_to_iface = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, @@ -207,27 +207,27 @@ g_dbus_object_stub_init (GDBusObjectStub *object) } /** - * g_dbus_object_stub_new: + * g_dbus_object_skeleton_new: * @object_path: An object path. * - * Creates a new #GDBusObjectStub. + * Creates a new #GDBusObjectSkeleton. * - * Returns: A #GDBusObjectStub. Free with g_object_unref(). + * Returns: A #GDBusObjectSkeleton. Free with g_object_unref(). * * Since: 2.30 */ -GDBusObjectStub * -g_dbus_object_stub_new (const gchar *object_path) +GDBusObjectSkeleton * +g_dbus_object_skeleton_new (const gchar *object_path) { g_return_val_if_fail (g_variant_is_object_path (object_path), NULL); - return G_DBUS_OBJECT_STUB (g_object_new (G_TYPE_DBUS_OBJECT_STUB, - "object-path", object_path, - NULL)); + return G_DBUS_OBJECT_SKELETON (g_object_new (G_TYPE_DBUS_OBJECT_SKELETON, + "object-path", object_path, + NULL)); } /** - * g_dbus_object_stub_set_object_path: - * @object: A #GDBusObjectStub. + * g_dbus_object_skeleton_set_object_path: + * @object: A #GDBusObjectSkeleton. * @object_path: A valid D-Bus object path. * * Sets the object path for @object. @@ -235,10 +235,10 @@ g_dbus_object_stub_new (const gchar *object_path) * Since: 2.30 */ void -g_dbus_object_stub_set_object_path (GDBusObjectStub *object, - const gchar *object_path) +g_dbus_object_skeleton_set_object_path (GDBusObjectSkeleton *object, + const gchar *object_path) { - g_return_if_fail (G_IS_DBUS_OBJECT_STUB (object)); + g_return_if_fail (G_IS_DBUS_OBJECT_SKELETON (object)); g_return_if_fail (object_path == NULL || g_variant_is_object_path (object_path)); /* TODO: fail if object is currently exported */ if (g_strcmp0 (object->priv->object_path, object_path) != 0) @@ -250,20 +250,20 @@ g_dbus_object_stub_set_object_path (GDBusObjectStub *object, } static const gchar * -g_dbus_object_stub_get_object_path (GDBusObject *_object) +g_dbus_object_skeleton_get_object_path (GDBusObject *_object) { - GDBusObjectStub *object = G_DBUS_OBJECT_STUB (_object); + GDBusObjectSkeleton *object = G_DBUS_OBJECT_SKELETON (_object); return object->priv->object_path; } /** - * g_dbus_object_stub_add_interface: - * @object: A #GDBusObjectStub. - * @interface_: A #GDBusInterfaceStub. + * g_dbus_object_skeleton_add_interface: + * @object: A #GDBusObjectSkeleton. + * @interface_: A #GDBusInterfaceSkeleton. * * Adds @interface_ to @object. * - * If @object already contains a #GDBusInterfaceStub with the same + * If @object already contains a #GDBusInterfaceSkeleton with the same * interface name, it is removed before @interface_ is added. * * Note that @object takes its own reference on @interface_ and holds @@ -272,17 +272,17 @@ g_dbus_object_stub_get_object_path (GDBusObject *_object) * Since: 2.30 */ void -g_dbus_object_stub_add_interface (GDBusObjectStub *object, - GDBusInterfaceStub *interface_) +g_dbus_object_skeleton_add_interface (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface_) { GDBusInterfaceInfo *info; - g_return_if_fail (G_IS_DBUS_OBJECT_STUB (object)); - g_return_if_fail (G_IS_DBUS_INTERFACE_STUB (interface_)); + g_return_if_fail (G_IS_DBUS_OBJECT_SKELETON (object)); + g_return_if_fail (G_IS_DBUS_INTERFACE_SKELETON (interface_)); - info = g_dbus_interface_stub_get_info (interface_); + info = g_dbus_interface_skeleton_get_info (interface_); g_object_ref (interface_); - g_dbus_object_stub_remove_interface_by_name (object, info->name); + g_dbus_object_skeleton_remove_interface_by_name (object, info->name); g_hash_table_insert (object->priv->map_name_to_iface, g_strdup (info->name), interface_); @@ -293,25 +293,25 @@ g_dbus_object_stub_add_interface (GDBusObjectStub *object, } /** - * g_dbus_object_stub_remove_interface: - * @object: A #GDBusObjectStub. - * @interface_: A #GDBusInterfaceStub. + * g_dbus_object_skeleton_remove_interface: + * @object: A #GDBusObjectSkeleton. + * @interface_: A #GDBusInterfaceSkeleton. * * Removes @interface_ from @object. * * Since: 2.30 */ void -g_dbus_object_stub_remove_interface (GDBusObjectStub *object, - GDBusInterfaceStub *interface_) +g_dbus_object_skeleton_remove_interface (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface_) { - GDBusInterfaceStub *other_interface; + GDBusInterfaceSkeleton *other_interface; GDBusInterfaceInfo *info; - g_return_if_fail (G_IS_DBUS_OBJECT_STUB (object)); + g_return_if_fail (G_IS_DBUS_OBJECT_SKELETON (object)); g_return_if_fail (G_IS_DBUS_INTERFACE (interface_)); - info = g_dbus_interface_stub_get_info (interface_); + info = g_dbus_interface_skeleton_get_info (interface_); other_interface = g_hash_table_lookup (object->priv->map_name_to_iface, info->name); if (other_interface == NULL) @@ -344,8 +344,8 @@ g_dbus_object_stub_remove_interface (GDBusObjectStub *object, /** - * g_dbus_object_stub_remove_interface_by_name: - * @object: A #GDBusObjectStub. + * g_dbus_object_skeleton_remove_interface_by_name: + * @object: A #GDBusObjectSkeleton. * @interface_name: A D-Bus interface name. * * Removes the #GDBusInterface with @interface_name from @object. @@ -356,12 +356,12 @@ g_dbus_object_stub_remove_interface (GDBusObjectStub *object, * Since: 2.30 */ void -g_dbus_object_stub_remove_interface_by_name (GDBusObjectStub *object, - const gchar *interface_name) +g_dbus_object_skeleton_remove_interface_by_name (GDBusObjectSkeleton *object, + const gchar *interface_name) { GDBusInterface *interface; - g_return_if_fail (G_IS_DBUS_OBJECT_STUB (object)); + g_return_if_fail (G_IS_DBUS_OBJECT_SKELETON (object)); g_return_if_fail (g_dbus_is_interface_name (interface_name)); interface = g_hash_table_lookup (object->priv->map_name_to_iface, interface_name); @@ -378,13 +378,13 @@ g_dbus_object_stub_remove_interface_by_name (GDBusObjectStub *object, } static GDBusInterface * -g_dbus_object_stub_get_interface (GDBusObject *_object, - const gchar *interface_name) +g_dbus_object_skeleton_get_interface (GDBusObject *_object, + const gchar *interface_name) { - GDBusObjectStub *object = G_DBUS_OBJECT_STUB (_object); + GDBusObjectSkeleton *object = G_DBUS_OBJECT_SKELETON (_object); GDBusInterface *ret; - g_return_val_if_fail (G_IS_DBUS_OBJECT_STUB (object), NULL); + g_return_val_if_fail (G_IS_DBUS_OBJECT_SKELETON (object), NULL); g_return_val_if_fail (g_dbus_is_interface_name (interface_name), NULL); ret = g_hash_table_lookup (object->priv->map_name_to_iface, interface_name); @@ -394,14 +394,14 @@ g_dbus_object_stub_get_interface (GDBusObject *_object, } static GList * -g_dbus_object_stub_get_interfaces (GDBusObject *_object) +g_dbus_object_skeleton_get_interfaces (GDBusObject *_object) { - GDBusObjectStub *object = G_DBUS_OBJECT_STUB (_object); + GDBusObjectSkeleton *object = G_DBUS_OBJECT_SKELETON (_object); GList *ret; GHashTableIter iter; GDBusInterface *interface; - g_return_val_if_fail (G_IS_DBUS_OBJECT_STUB (object), NULL); + g_return_val_if_fail (G_IS_DBUS_OBJECT_SKELETON (object), NULL); ret = NULL; @@ -413,37 +413,37 @@ g_dbus_object_stub_get_interfaces (GDBusObject *_object) } /** - * g_dbus_object_stub_flush: - * @object: A #GDBusObjectStub. + * g_dbus_object_skeleton_flush: + * @object: A #GDBusObjectSkeleton. * - * This method simply calls g_dbus_interface_stub_flush() on all - * interfaces stubs belonging to @object. See that method for when - * flushing is useful. + * This method simply calls g_dbus_interface_skeleton_flush() on all + * interfaces belonging to @object. See that method for when flushing + * is useful. * * Since: 2.30 */ void -g_dbus_object_stub_flush (GDBusObjectStub *object) +g_dbus_object_skeleton_flush (GDBusObjectSkeleton *object) { GHashTableIter iter; - GDBusInterfaceStub *interface_stub; + GDBusInterfaceSkeleton *interface_skeleton; g_hash_table_iter_init (&iter, object->priv->map_name_to_iface); - while (g_hash_table_iter_next (&iter, NULL, (gpointer) &interface_stub)) + while (g_hash_table_iter_next (&iter, NULL, (gpointer) &interface_skeleton)) { - g_dbus_interface_stub_flush (interface_stub); + g_dbus_interface_skeleton_flush (interface_skeleton); } } static gpointer -g_dbus_object_stub_lookup_with_typecheck (GDBusObject *object, - const gchar *interface_name, - GType type) +g_dbus_object_skeleton_lookup_with_typecheck (GDBusObject *object, + const gchar *interface_name, + GType type) { - GDBusObjectStub *stub = G_DBUS_OBJECT_STUB (object); + GDBusObjectSkeleton *skeleton = G_DBUS_OBJECT_SKELETON (object); GDBusProxy *ret; - ret = g_hash_table_lookup (stub->priv->map_name_to_iface, interface_name); + ret = g_hash_table_lookup (skeleton->priv->map_name_to_iface, interface_name); if (ret != NULL) { g_warn_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (ret, type)); @@ -453,12 +453,12 @@ g_dbus_object_stub_lookup_with_typecheck (GDBusObject *object, } static gpointer -g_dbus_object_stub_peek_with_typecheck (GDBusObject *object, - const gchar *interface_name, - GType type) +g_dbus_object_skeleton_peek_with_typecheck (GDBusObject *object, + const gchar *interface_name, + GType type) { - GDBusInterfaceStub *ret; - ret = g_dbus_object_stub_lookup_with_typecheck (object, interface_name, type); + GDBusInterfaceSkeleton *ret; + ret = g_dbus_object_skeleton_lookup_with_typecheck (object, interface_name, type); if (ret != NULL) g_object_unref (ret); return ret; @@ -467,25 +467,25 @@ g_dbus_object_stub_peek_with_typecheck (GDBusObject *object, static void dbus_object_interface_init (GDBusObjectIface *iface) { - iface->get_object_path = g_dbus_object_stub_get_object_path; - iface->get_interfaces = g_dbus_object_stub_get_interfaces; - iface->get_interface = g_dbus_object_stub_get_interface; - iface->lookup_with_typecheck = g_dbus_object_stub_lookup_with_typecheck; - iface->peek_with_typecheck = g_dbus_object_stub_peek_with_typecheck; + iface->get_object_path = g_dbus_object_skeleton_get_object_path; + iface->get_interfaces = g_dbus_object_skeleton_get_interfaces; + iface->get_interface = g_dbus_object_skeleton_get_interface; + iface->lookup_with_typecheck = g_dbus_object_skeleton_lookup_with_typecheck; + iface->peek_with_typecheck = g_dbus_object_skeleton_peek_with_typecheck; } gboolean -_g_dbus_object_stub_has_authorize_method_handlers (GDBusObjectStub *stub) +_g_dbus_object_skeleton_has_authorize_method_handlers (GDBusObjectSkeleton *object) { gboolean has_handlers; gboolean has_default_class_handler; - has_handlers = g_signal_has_handler_pending (stub, + has_handlers = g_signal_has_handler_pending (object, signals[AUTHORIZE_METHOD_SIGNAL], 0, TRUE); - has_default_class_handler = (G_DBUS_OBJECT_STUB_GET_CLASS (stub)->authorize_method == - g_dbus_object_stub_authorize_method_default); + has_default_class_handler = (G_DBUS_OBJECT_SKELETON_GET_CLASS (object)->authorize_method == + g_dbus_object_skeleton_authorize_method_default); return has_handlers || !has_default_class_handler; } diff --git a/gio/gdbusobjectskeleton.h b/gio/gdbusobjectskeleton.h new file mode 100644 index 0000000..918a335 --- /dev/null +++ b/gio/gdbusobjectskeleton.h @@ -0,0 +1,91 @@ +/* GDBus - GLib D-Bus Library + * + * Copyright (C) 2008-2010 Red Hat, Inc. + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General + * Public License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place, Suite 330, + * Boston, MA 02111-1307, USA. + * + * Author: David Zeuthen + */ + +#ifndef __G_DBUS_OBJECT_SKELETON_H__ +#define __G_DBUS_OBJECT_SKELETON_H__ + +#include + +G_BEGIN_DECLS + +#define G_TYPE_DBUS_OBJECT_SKELETON (g_dbus_object_skeleton_get_type ()) +#define G_DBUS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeleton)) +#define G_DBUS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeletonClass)) +#define G_DBUS_OBJECT_SKELETON_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_SKELETON, GDBusObjectSkeletonClass)) +#define G_IS_DBUS_OBJECT_SKELETON(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_SKELETON)) +#define G_IS_DBUS_OBJECT_SKELETON_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_SKELETON)) + +typedef struct _GDBusObjectSkeletonClass GDBusObjectSkeletonClass; +typedef struct _GDBusObjectSkeletonPrivate GDBusObjectSkeletonPrivate; + +/** + * GDBusObjectSkeleton: + * + * The #GDBusObjectSkeleton structure contains private data and should only be + * accessed using the provided API. + * + * Since: 2.30 + */ +struct _GDBusObjectSkeleton +{ + /*< private >*/ + GObject parent_instance; + GDBusObjectSkeletonPrivate *priv; +}; + +/** + * GDBusObjectSkeletonClass: + * @parent_class: The parent class. + * @authorize_method: Signal class handler for the #GDBusObjectSkeleton::authorize-method signal. + * + * Class structure for #GDBusObjectSkeleton. + * + * Since: 2.30 + */ +struct _GDBusObjectSkeletonClass +{ + GObjectClass parent_class; + + /* Signals */ + gboolean (*authorize_method) (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface_, + GDBusMethodInvocation *invocation); + + /*< private >*/ + gpointer padding[8]; +}; + +GType g_dbus_object_skeleton_get_type (void) G_GNUC_CONST; +GDBusObjectSkeleton *g_dbus_object_skeleton_new (const gchar *object_path); +void g_dbus_object_skeleton_flush (GDBusObjectSkeleton *object); +void g_dbus_object_skeleton_add_interface (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface_); +void g_dbus_object_skeleton_remove_interface (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface_); +void g_dbus_object_skeleton_remove_interface_by_name (GDBusObjectSkeleton *object, + const gchar *interface_name); +void g_dbus_object_skeleton_set_object_path (GDBusObjectSkeleton *object, + const gchar *object_path); + +G_END_DECLS + +#endif /* __G_DBUS_OBJECT_SKELETON_H */ diff --git a/gio/gdbusobjectstub.h b/gio/gdbusobjectstub.h deleted file mode 100644 index c93d476..0000000 --- a/gio/gdbusobjectstub.h +++ /dev/null @@ -1,91 +0,0 @@ -/* GDBus - GLib D-Bus Library - * - * Copyright (C) 2008-2010 Red Hat, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General - * Public License along with this library; if not, write to the - * Free Software Foundation, Inc., 59 Temple Place, Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: David Zeuthen - */ - -#ifndef __G_DBUS_OBJECT_STUB_H__ -#define __G_DBUS_OBJECT_STUB_H__ - -#include - -G_BEGIN_DECLS - -#define G_TYPE_DBUS_OBJECT_STUB (g_dbus_object_stub_get_type ()) -#define G_DBUS_OBJECT_STUB(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), G_TYPE_DBUS_OBJECT_STUB, GDBusObjectStub)) -#define G_DBUS_OBJECT_STUB_CLASS(k) (G_TYPE_CHECK_CLASS_CAST((k), G_TYPE_DBUS_OBJECT_STUB, GDBusObjectStubClass)) -#define G_DBUS_OBJECT_STUB_GET_CLASS(o) (G_TYPE_INSTANCE_GET_CLASS ((o), G_TYPE_DBUS_OBJECT_STUB, GDBusObjectStubClass)) -#define G_IS_DBUS_OBJECT_STUB(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), G_TYPE_DBUS_OBJECT_STUB)) -#define G_IS_DBUS_OBJECT_STUB_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), G_TYPE_DBUS_OBJECT_STUB)) - -typedef struct _GDBusObjectStubClass GDBusObjectStubClass; -typedef struct _GDBusObjectStubPrivate GDBusObjectStubPrivate; - -/** - * GDBusObjectStub: - * - * The #GDBusObjectStub structure contains private data and should only be - * accessed using the provided API. - * - * Since: 2.30 - */ -struct _GDBusObjectStub -{ - /*< private >*/ - GObject parent_instance; - GDBusObjectStubPrivate *priv; -}; - -/** - * GDBusObjectStubClass: - * @parent_class: The parent class. - * @authorize_method: Signal class handler for the #GDBusObjectStub::authorize-method signal. - * - * Class structure for #GDBusObjectStub. - * - * Since: 2.30 - */ -struct _GDBusObjectStubClass -{ - GObjectClass parent_class; - - /* Signals */ - gboolean (*authorize_method) (GDBusObjectStub *stub, - GDBusInterfaceStub *interface_stub, - GDBusMethodInvocation *invocation); - - /*< private >*/ - gpointer padding[8]; -}; - -GType g_dbus_object_stub_get_type (void) G_GNUC_CONST; -GDBusObjectStub *g_dbus_object_stub_new (const gchar *object_path); -void g_dbus_object_stub_flush (GDBusObjectStub *object); -void g_dbus_object_stub_add_interface (GDBusObjectStub *object, - GDBusInterfaceStub *interface_); -void g_dbus_object_stub_remove_interface (GDBusObjectStub *object, - GDBusInterfaceStub *interface_); -void g_dbus_object_stub_remove_interface_by_name (GDBusObjectStub *object, - const gchar *interface_name); -void g_dbus_object_stub_set_object_path (GDBusObjectStub *object, - const gchar *object_path); - -G_END_DECLS - -#endif /* __G_DBUS_OBJECT_STUB_H */ diff --git a/gio/gdbusprivate.h b/gio/gdbusprivate.h index a39c192..203c4ac 100644 --- a/gio/gdbusprivate.h +++ b/gio/gdbusprivate.h @@ -131,7 +131,7 @@ gboolean _g_signal_accumulator_false_handled (GSignalInvocationHint *ihint, const GValue *handler_return, gpointer dummy); -gboolean _g_dbus_object_stub_has_authorize_method_handlers (GDBusObjectStub *stub); +gboolean _g_dbus_object_skeleton_has_authorize_method_handlers (GDBusObjectSkeleton *object); GDBusObjectProxy *_g_dbus_object_proxy_new (GDBusConnection *connection, const gchar *object_path); diff --git a/gio/gio.h b/gio/gio.h index 70cfe9f..2958059 100644 --- a/gio/gio.h +++ b/gio/gio.h @@ -131,9 +131,9 @@ #include #include #include -#include +#include #include -#include +#include #include #include #include diff --git a/gio/gio.symbols b/gio/gio.symbols index 29085b3..0dfcb61 100644 --- a/gio/gio.symbols +++ b/gio/gio.symbols @@ -2098,20 +2098,20 @@ g_dbus_interface_set_object #endif #endif -#if IN_HEADER(__G_DBUS_INTERFACE_STUB_H__) -#if IN_FILE(__G_DBUS_INTERFACE_STUB_C__) -g_dbus_interface_stub_export -g_dbus_interface_stub_flags_get_type -g_dbus_interface_stub_flush -g_dbus_interface_stub_get_connection -g_dbus_interface_stub_get_flags -g_dbus_interface_stub_get_info -g_dbus_interface_stub_get_object_path -g_dbus_interface_stub_get_properties -g_dbus_interface_stub_get_type -g_dbus_interface_stub_get_vtable -g_dbus_interface_stub_set_flags -g_dbus_interface_stub_unexport +#if IN_HEADER(__G_DBUS_INTERFACE_SKELETON_H__) +#if IN_FILE(__G_DBUS_INTERFACE_SKELETON_C__) +g_dbus_interface_skeleton_export +g_dbus_interface_skeleton_flags_get_type +g_dbus_interface_skeleton_flush +g_dbus_interface_skeleton_get_connection +g_dbus_interface_skeleton_get_flags +g_dbus_interface_skeleton_get_info +g_dbus_interface_skeleton_get_object_path +g_dbus_interface_skeleton_get_properties +g_dbus_interface_skeleton_get_type +g_dbus_interface_skeleton_get_vtable +g_dbus_interface_skeleton_set_flags +g_dbus_interface_skeleton_unexport #endif #endif @@ -2133,15 +2133,15 @@ g_dbus_object_proxy_get_type #endif #endif -#if IN_HEADER(__G_DBUS_OBJECT_STUB_H__) -#if IN_FILE(__G_DBUS_OBJECT_STUB_C__) -g_dbus_object_stub_add_interface -g_dbus_object_stub_flush -g_dbus_object_stub_get_type -g_dbus_object_stub_new -g_dbus_object_stub_remove_interface -g_dbus_object_stub_remove_interface_by_name -g_dbus_object_stub_set_object_path +#if IN_HEADER(__G_DBUS_OBJECT_SKELETON_H__) +#if IN_FILE(__G_DBUS_OBJECT_SKELETON_C__) +g_dbus_object_skeleton_add_interface +g_dbus_object_skeleton_flush +g_dbus_object_skeleton_get_type +g_dbus_object_skeleton_new +g_dbus_object_skeleton_remove_interface +g_dbus_object_skeleton_remove_interface_by_name +g_dbus_object_skeleton_set_object_path #endif #endif diff --git a/gio/gioenums.h b/gio/gioenums.h index 8961914..59a985d 100644 --- a/gio/gioenums.h +++ b/gio/gioenums.h @@ -1384,22 +1384,22 @@ typedef enum { } GTlsRehandshakeMode; /** - * GDBusInterfaceStubFlags: - * @G_DBUS_INTERFACE_STUB_FLAGS_NONE: No flags set. - * @G_DBUS_INTERFACE_STUB_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD: Each method invocation is handled in + * GDBusInterfaceSkeletonFlags: + * @G_DBUS_INTERFACE_SKELETON_FLAGS_NONE: No flags set. + * @G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD: Each method invocation is handled in * a thread dedicated to the invocation. This means that the method implementation can use blocking IO * without blocking any other part of the process. It also means that the method implementation must * use locking to access data structures used by other threads. * - * Flags describing the behavior of a #GDBusInterfaceStub class. + * Flags describing the behavior of a #GDBusInterfaceSkeleton instance. * * Since: 2.30 */ typedef enum { - G_DBUS_INTERFACE_STUB_FLAGS_NONE = 0, - G_DBUS_INTERFACE_STUB_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD = (1<<0) -} GDBusInterfaceStubFlags; + G_DBUS_INTERFACE_SKELETON_FLAGS_NONE = 0, + G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD = (1<<0) +} GDBusInterfaceSkeletonFlags; /** * GDBusObjectManagerClientFlags: diff --git a/gio/giotypes.h b/gio/giotypes.h index 848336a..a91eb10 100644 --- a/gio/giotypes.h +++ b/gio/giotypes.h @@ -419,9 +419,9 @@ typedef gboolean (*GPollableSourceFunc) (GObject *pollable_stream, gpointer user_data); typedef struct _GDBusInterface GDBusInterface; /* Dummy typedef */ -typedef struct _GDBusInterfaceStub GDBusInterfaceStub; +typedef struct _GDBusInterfaceSkeleton GDBusInterfaceSkeleton; typedef struct _GDBusObject GDBusObject; /* Dummy typedef */ -typedef struct _GDBusObjectStub GDBusObjectStub; +typedef struct _GDBusObjectSkeleton GDBusObjectSkeleton; typedef struct _GDBusObjectProxy GDBusObjectProxy; typedef struct _GDBusObjectManager GDBusObjectManager; /* Dummy typedef */ typedef struct _GDBusObjectManagerClient GDBusObjectManagerClient; diff --git a/gio/tests/gdbus-example-objectmanager-server.c b/gio/tests/gdbus-example-objectmanager-server.c index 97e39b1..79d866c 100644 --- a/gio/tests/gdbus-example-objectmanager-server.c +++ b/gio/tests/gdbus-example-objectmanager-server.c @@ -62,7 +62,7 @@ on_bus_acquired (GDBusConnection *connection, const gchar *name, gpointer user_data) { - GDBusObjectStub *object; + GDBusObjectSkeleton *object; guint n; g_print ("Acquired a message bus connection\n"); @@ -77,16 +77,16 @@ on_bus_acquired (GDBusConnection *connection, /* Create a new D-Bus object at the path /example/Animals/N where N is 000..009 */ s = g_strdup_printf ("/example/Animals/%03d", n); - object = g_dbus_object_stub_new (s); + object = g_dbus_object_skeleton_new (s); g_free (s); /* Make the newly created object export the interface * org.gtk.GDBus.Example.ObjectManager.Animal (note * that @object takes its own reference to @animal). */ - animal = example_animal_stub_new (); + animal = example_animal_skeleton_new (); example_animal_set_mood (animal, "Happy"); - g_dbus_object_stub_add_interface (object, G_DBUS_INTERFACE_STUB (animal)); + g_dbus_object_skeleton_add_interface (object, G_DBUS_INTERFACE_SKELETON (animal)); g_object_unref (animal); /* Cats are odd animals - so some of our objects implement the @@ -96,8 +96,8 @@ on_bus_acquired (GDBusConnection *connection, if (n % 2 == 1) { ExampleCat *cat; - cat = example_cat_stub_new (); - g_dbus_object_stub_add_interface (object, G_DBUS_INTERFACE_STUB (cat)); + cat = example_cat_skeleton_new (); + g_dbus_object_skeleton_add_interface (object, G_DBUS_INTERFACE_SKELETON (cat)); g_object_unref (cat); } diff --git a/gio/tests/gdbus-test-codegen.c b/gio/tests/gdbus-test-codegen.c index ea85a4b..d0f0f99 100644 --- a/gio/tests/gdbus-test-codegen.c +++ b/gio/tests/gdbus-test-codegen.c @@ -93,7 +93,7 @@ on_handle_hello_world (FooBar *object, gpointer user_data) { gchar *response; - response = g_strdup_printf ("Word! You said `%s'. I'm Stub, btw!", greeting); + response = g_strdup_printf ("Word! You said `%s'. I'm Skeleton, btw!", greeting); foo_bar_complete_hello_world (object, invocation, response); g_free (response); return TRUE; @@ -205,7 +205,7 @@ on_handle_request_multi_property_mods (FooBar *object, foo_bar_set_i (object, foo_bar_get_i (object) + 1); foo_bar_set_y (object, foo_bar_get_y (object) + 1); foo_bar_set_i (object, foo_bar_get_i (object) + 1); - g_dbus_interface_stub_flush (G_DBUS_INTERFACE_STUB (object)); + g_dbus_interface_skeleton_flush (G_DBUS_INTERFACE_SKELETON (object)); foo_bar_set_y (object, foo_bar_get_y (object) + 1); foo_bar_set_i (object, foo_bar_get_i (object) + 1); foo_bar_complete_request_multi_property_mods (object, invocation); @@ -271,9 +271,9 @@ on_handle_force_method (FooBat *object, /* ---------------------------------------------------------------------------------------------------- */ static gboolean -my_g_authorize_method_handler (GDBusInterfaceStub *interface, - GDBusMethodInvocation *invocation, - gpointer user_data) +my_g_authorize_method_handler (GDBusInterfaceSkeleton *interface, + GDBusMethodInvocation *invocation, + gpointer user_data) { const gchar *method_name; gboolean authorized; @@ -309,10 +309,10 @@ my_g_authorize_method_handler (GDBusInterfaceStub *interface, } static gboolean -my_object_authorize_method_handler (GDBusObjectStub *object, - GDBusInterfaceStub *interface, - GDBusMethodInvocation *invocation, - gpointer user_data) +my_object_authorize_method_handler (GDBusObjectSkeleton *object, + GDBusInterfaceSkeleton *interface, + GDBusMethodInvocation *invocation, + gpointer user_data) { const gchar *method_name; gboolean authorized; @@ -395,7 +395,7 @@ static GThread *method_handler_thread = NULL; static FooBar *exported_bar_object = NULL; static FooBat *exported_bat_object = NULL; static FooAuthorize *exported_authorize_object = NULL; -static GDBusObjectStub *authorize_enclosing_object = NULL; +static GDBusObjectSkeleton *authorize_enclosing_object = NULL; static FooMethodThreads *exported_thread_object_1 = NULL; static FooMethodThreads *exported_thread_object_2 = NULL; @@ -407,7 +407,7 @@ on_bus_acquired (GDBusConnection *connection, GError *error; /* Test that we can export an object using the generated - * FooBarStub subclass. Notes: + * FooBarSkeleton subclass. Notes: * * 1. We handle methods by simply connecting to the appropriate * GObject signal. @@ -417,23 +417,23 @@ on_bus_acquired (GDBusConnection *connection, * C bindings at will) */ error = NULL; - exported_bar_object = foo_bar_stub_new (); + exported_bar_object = foo_bar_skeleton_new (); foo_bar_set_ay (exported_bar_object, "ABCabc"); foo_bar_set_y (exported_bar_object, 42); foo_bar_set_d (exported_bar_object, 43.0); foo_bar_set_finally_normal_name (exported_bar_object, "There aint no place like home"); foo_bar_set_writeonly_property (exported_bar_object, "Mr. Burns"); - /* The following works because it's on the Stub object - it will + /* The following works because it's on the Skeleton object - it will * fail (at run-time) on a Proxy (see on_proxy_appeared() below) */ foo_bar_set_readonly_property (exported_bar_object, "blah"); g_assert_cmpstr (foo_bar_get_writeonly_property (exported_bar_object), ==, "Mr. Burns"); - g_dbus_interface_stub_export (G_DBUS_INTERFACE_STUB (exported_bar_object), - connection, - "/bar", - &error); + g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (exported_bar_object), + connection, + "/bar", + &error); g_assert_no_error (error); g_signal_connect (exported_bar_object, "handle-hello-world", @@ -456,11 +456,11 @@ on_bus_acquired (GDBusConnection *connection, G_CALLBACK (on_handle_request_multi_property_mods), NULL); - exported_bat_object = foo_bat_stub_new (); - g_dbus_interface_stub_export (G_DBUS_INTERFACE_STUB (exported_bat_object), - connection, - "/bat", - &error); + exported_bat_object = foo_bat_skeleton_new (); + g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (exported_bat_object), + connection, + "/bat", + &error); g_assert_no_error (error); g_signal_connect (exported_bat_object, "handle-force-method", @@ -473,18 +473,18 @@ on_bus_acquired (GDBusConnection *connection, "force-struct", g_variant_new ("(i)", 4300), NULL); - authorize_enclosing_object = g_dbus_object_stub_new ("/authorize"); + authorize_enclosing_object = g_dbus_object_skeleton_new ("/authorize"); g_signal_connect (authorize_enclosing_object, "authorize-method", G_CALLBACK (my_object_authorize_method_handler), NULL); - exported_authorize_object = foo_authorize_stub_new (); - g_dbus_object_stub_add_interface (authorize_enclosing_object, - G_DBUS_INTERFACE_STUB (exported_authorize_object)); - g_dbus_interface_stub_export (G_DBUS_INTERFACE_STUB (exported_authorize_object), - connection, - "/authorize", - &error); + exported_authorize_object = foo_authorize_skeleton_new (); + g_dbus_object_skeleton_add_interface (authorize_enclosing_object, + G_DBUS_INTERFACE_SKELETON (exported_authorize_object)); + g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (exported_authorize_object), + connection, + "/authorize", + &error); g_assert_no_error (error); g_signal_connect (exported_authorize_object, "g-authorize-method", @@ -504,25 +504,25 @@ on_bus_acquired (GDBusConnection *connection, NULL); - /* only object 1 has the G_DBUS_INTERFACE_STUB_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD flag set */ - exported_thread_object_1 = foo_method_threads_stub_new (); - g_dbus_interface_stub_set_flags (G_DBUS_INTERFACE_STUB (exported_thread_object_1), - G_DBUS_INTERFACE_STUB_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD); - g_dbus_interface_stub_export (G_DBUS_INTERFACE_STUB (exported_thread_object_1), - connection, - "/method_threads_1", - &error); + /* only object 1 has the G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD flag set */ + exported_thread_object_1 = foo_method_threads_skeleton_new (); + g_dbus_interface_skeleton_set_flags (G_DBUS_INTERFACE_SKELETON (exported_thread_object_1), + G_DBUS_INTERFACE_SKELETON_FLAGS_HANDLE_METHOD_INVOCATIONS_IN_THREAD); + g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (exported_thread_object_1), + connection, + "/method_threads_1", + &error); g_assert_no_error (error); g_signal_connect (exported_thread_object_1, "handle-get-self", G_CALLBACK (on_handle_get_self), NULL); - exported_thread_object_2 = foo_method_threads_stub_new (); - g_dbus_interface_stub_export (G_DBUS_INTERFACE_STUB (exported_thread_object_2), - connection, - "/method_threads_2", - &error); + exported_thread_object_2 = foo_method_threads_skeleton_new (); + g_dbus_interface_skeleton_export (G_DBUS_INTERFACE_SKELETON (exported_thread_object_2), + connection, + "/method_threads_2", + &error); g_assert_no_error (error); g_signal_connect (exported_thread_object_2, "handle-get-self", @@ -1648,29 +1648,29 @@ on_object_proxy_removed (GDBusObjectManagerClient *manager, static void om_check_property_and_signal_emission (GMainLoop *loop, - FooBar *stub, + FooBar *skeleton, FooBar *proxy) { /* First PropertiesChanged */ - g_assert_cmpint (foo_bar_get_i (stub), ==, 0); + g_assert_cmpint (foo_bar_get_i (skeleton), ==, 0); g_assert_cmpint (foo_bar_get_i (proxy), ==, 0); - foo_bar_set_i (stub, 1); + foo_bar_set_i (skeleton, 1); _g_assert_property_notify (proxy, "i"); - g_assert_cmpint (foo_bar_get_i (stub), ==, 1); + g_assert_cmpint (foo_bar_get_i (skeleton), ==, 1); g_assert_cmpint (foo_bar_get_i (proxy), ==, 1); /* Then just a regular signal */ - foo_bar_emit_another_signal (stub, "word"); + foo_bar_emit_another_signal (skeleton, "word"); _g_assert_signal_received (proxy, "another-signal"); } static void check_object_manager (void) { - GDBusObjectStub *o; - GDBusObjectStub *o2; - GDBusInterfaceStub *i; - GDBusInterfaceStub *i2; + GDBusObjectSkeleton *o; + GDBusObjectSkeleton *o2; + GDBusInterfaceSkeleton *i; + GDBusInterfaceSkeleton *i2; GDBusConnection *c; GDBusObjectManagerServer *manager; GDBusNodeInfo *info; @@ -1683,7 +1683,7 @@ check_object_manager (void) GList *proxies; GDBusObject *op; GDBusProxy *p; - FooBar *bar_stub; + FooBar *bar_skeleton; FooBar *bar_p; FooBar *bar_p2; FooComAcmeCoyote *coyote_p; @@ -1777,19 +1777,19 @@ check_object_manager (void) /* First, export an object with a single interface (also check that * g_dbus_interface_get_object() works and that the object isn't reffed) */ - o = g_dbus_object_stub_new ("/managed/first"); - i = G_DBUS_INTERFACE_STUB (foo_bar_stub_new ()); + o = g_dbus_object_skeleton_new ("/managed/first"); + i = G_DBUS_INTERFACE_SKELETON (foo_bar_skeleton_new ()); g_assert (g_dbus_interface_get_object (G_DBUS_INTERFACE (i)) == NULL); g_assert_cmpint (G_OBJECT (o)->ref_count, ==, 1); - g_dbus_object_stub_add_interface (o, i); + g_dbus_object_skeleton_add_interface (o, i); g_assert_cmpint (G_OBJECT (o)->ref_count, ==, 1); g_assert (g_dbus_interface_get_object (G_DBUS_INTERFACE (i)) == G_DBUS_OBJECT (o)); g_assert_cmpint (G_OBJECT (o)->ref_count, ==, 1); g_assert_cmpint (G_OBJECT (o)->ref_count, ==, 1); - g_dbus_object_stub_remove_interface (o, i); + g_dbus_object_skeleton_remove_interface (o, i); g_assert (g_dbus_interface_get_object (G_DBUS_INTERFACE (i)) == NULL); g_assert_cmpint (G_OBJECT (o)->ref_count, ==, 1); - g_dbus_object_stub_add_interface (o, i); + g_dbus_object_skeleton_add_interface (o, i); g_assert (g_dbus_interface_get_object (G_DBUS_INTERFACE (i)) == G_DBUS_OBJECT (o)); g_assert_cmpint (G_OBJECT (o)->ref_count, ==, 1); g_dbus_object_manager_server_export (manager, o); @@ -1809,7 +1809,7 @@ check_object_manager (void) g_dbus_node_info_unref (info); /* Now, check adding the same interface replaces the existing one */ - g_dbus_object_stub_add_interface (o, i); + g_dbus_object_skeleton_add_interface (o, i); /* ... check we get the InterfacesRemoved */ om_data->state = 3; g_main_loop_run (om_data->loop); @@ -1827,8 +1827,8 @@ check_object_manager (void) g_object_unref (i); /* check adding an interface of same type (but not same object) replaces the existing one */ - i = G_DBUS_INTERFACE_STUB (foo_bar_stub_new ()); - g_dbus_object_stub_add_interface (o, i); + i = G_DBUS_INTERFACE_SKELETON (foo_bar_skeleton_new ()); + g_dbus_object_skeleton_add_interface (o, i); /* ... check we get the InterfacesRemoved and then InterfacesAdded */ om_data->state = 7; g_main_loop_run (om_data->loop); @@ -1845,8 +1845,8 @@ check_object_manager (void) g_object_unref (i); /* check adding an interface of another type doesn't replace the existing one */ - i = G_DBUS_INTERFACE_STUB (foo_bat_stub_new ()); - g_dbus_object_stub_add_interface (o, i); + i = G_DBUS_INTERFACE_SKELETON (foo_bat_skeleton_new ()); + g_dbus_object_skeleton_add_interface (o, i); g_object_unref (i); /* ... check we get the InterfacesAdded */ om_data->state = 11; @@ -1864,7 +1864,7 @@ check_object_manager (void) g_dbus_node_info_unref (info); /* check we can remove an interface */ - g_dbus_object_stub_remove_interface_by_name (o, "org.project.Bar"); + g_dbus_object_skeleton_remove_interface_by_name (o, "org.project.Bar"); /* ... check we get the InterfacesRemoved */ om_data->state = 13; g_main_loop_run (om_data->loop); @@ -1883,7 +1883,7 @@ check_object_manager (void) * (Note: if a signal was emitted we'd assert in the signal handler * because we're in state 14) */ - g_dbus_object_stub_remove_interface_by_name (o, "org.project.Bar"); + g_dbus_object_skeleton_remove_interface_by_name (o, "org.project.Bar"); /* ... check introspection data */ info = introspect (c, g_dbus_connection_get_unique_name (c), "/managed/first", loop); g_assert_cmpint (count_interfaces (info), ==, 4); /* Bat + Properties,Introspectable,Peer */ @@ -1891,7 +1891,7 @@ check_object_manager (void) g_dbus_node_info_unref (info); /* remove the last interface */ - g_dbus_object_stub_remove_interface_by_name (o, "org.project.Bat"); + g_dbus_object_skeleton_remove_interface_by_name (o, "org.project.Bat"); /* ... check we get the InterfacesRemoved */ om_data->state = 15; g_main_loop_run (om_data->loop); @@ -1906,8 +1906,8 @@ check_object_manager (void) g_dbus_node_info_unref (info); /* and add an interface again */ - i = G_DBUS_INTERFACE_STUB (foo_com_acme_coyote_stub_new ()); - g_dbus_object_stub_add_interface (o, i); + i = G_DBUS_INTERFACE_SKELETON (foo_com_acme_coyote_skeleton_new ()); + g_dbus_object_skeleton_add_interface (o, i); g_object_unref (i); /* ... check we get the InterfacesAdded */ om_data->state = 17; @@ -1930,13 +1930,13 @@ check_object_manager (void) /* -------------------------------------------------- */ /* create a new object with two interfaces */ - o2 = g_dbus_object_stub_new ("/managed/second"); - i = G_DBUS_INTERFACE_STUB (foo_bar_stub_new ()); - bar_stub = FOO_BAR (i); /* save for later test */ - g_dbus_object_stub_add_interface (o2, i); + o2 = g_dbus_object_skeleton_new ("/managed/second"); + i = G_DBUS_INTERFACE_SKELETON (foo_bar_skeleton_new ()); + bar_skeleton = FOO_BAR (i); /* save for later test */ + g_dbus_object_skeleton_add_interface (o2, i); g_object_unref (i); - i = G_DBUS_INTERFACE_STUB (foo_bat_stub_new ()); - g_dbus_object_stub_add_interface (o2, i); + i = G_DBUS_INTERFACE_SKELETON (foo_bat_skeleton_new ()); + g_dbus_object_skeleton_add_interface (o2, i); g_object_unref (i); /* ... add it */ g_dbus_object_manager_server_export (manager, o2); @@ -1962,9 +1962,9 @@ check_object_manager (void) g_assert (i == NULL); i = FOO_PEEK_COM_ACME_COYOTE (o); g_assert (i != NULL); - g_assert (g_type_is_a (G_TYPE_FROM_INSTANCE (i), G_TYPE_DBUS_INTERFACE_STUB)); + g_assert (g_type_is_a (G_TYPE_FROM_INSTANCE (i), G_TYPE_DBUS_INTERFACE_SKELETON)); g_assert (g_type_is_a (G_TYPE_FROM_INSTANCE (i), FOO_TYPE_COM_ACME_COYOTE)); - g_assert (g_type_is_a (G_TYPE_FROM_INSTANCE (i), FOO_TYPE_COM_ACME_COYOTE_STUB)); + g_assert (g_type_is_a (G_TYPE_FROM_INSTANCE (i), FOO_TYPE_COM_ACME_COYOTE_SKELETON)); /* ... and that PEEK doesn't increase the ref_count but GET does */ g_assert_cmpint (G_OBJECT (i)->ref_count, ==, 2); i2 = FOO_PEEK_COM_ACME_COYOTE (o); @@ -2018,7 +2018,7 @@ check_object_manager (void) /* ... now that we have a Bar instance around, also check that we get signals * and property changes... */ - om_check_property_and_signal_emission (loop, bar_stub, FOO_BAR (p)); + om_check_property_and_signal_emission (loop, bar_skeleton, FOO_BAR (p)); g_object_unref (p); p = (GDBusProxy *) g_dbus_object_get_interface (op, "org.project.NonExisting"); g_assert (p == NULL);