← Back to team overview

ayatana-commits team mailing list archive

[Merge] lp:~ted/libindicate/better-properties into lp:libindicate

 

Ted Gould has proposed merging lp:~ted/libindicate/better-properties into lp:libindicate with lp:~ted/libindicate/ayatanize as a prerequisite.

    Requested reviews:
    Indicator Applet Developers (indicator-applet-developers)


Use the properties.xml file to generate the properties interface and use it.  Also clean up the generation of dbus interface files to header files.
-- 
https://code.launchpad.net/~ted/libindicate/better-properties/+merge/18581
Your team ayatana-commits is subscribed to branch lp:libindicate.
=== modified file 'libindicate-gtk/listener.c'
--- libindicate-gtk/listener.c	2010-02-04 00:14:10 +0000
+++ libindicate-gtk/listener.c	2010-02-04 00:14:10 +0000
@@ -30,7 +30,7 @@
 #include "listener.h"
 #include <dbus/dbus-glib-bindings.h>
 
-#include "../libindicate/dbus-indicate-client.h"
+#include "../libindicate/indicate-interface-client.h"
 #include "../libindicate/listener-private.h"
 
 typedef enum _get_property_type get_property_type;

=== modified file 'libindicate/Makefile.am'
--- libindicate/Makefile.am	2010-02-04 00:14:10 +0000
+++ libindicate/Makefile.am	2010-02-04 00:14:10 +0000
@@ -6,17 +6,12 @@
 	-DG_LOG_DOMAIN=\"libindicate\"
 
 EXTRA_DIST = \
-	indicate-interface.xml \
-	indicate-listener.xml \
+	$(DBUS_SPECS) \
 	listener-marshal.list \
 	server-marshal.list \
 	indicate.pc.in
 
 BUILT_SOURCES = \
-	dbus-indicate-server.h \
-	dbus-indicate-client.h \
-	dbus-listener-server.h \
-	dbus-listener-client.h \
 	listener-marshal.c \
 	listener-marshal.h \
 	server-marshal.c \
@@ -42,10 +37,6 @@
 
 libindicate_la_SOURCES = \
 	$(indicate_headers) \
-	dbus-indicate-server.h \
-	dbus-indicate-client.h \
-	dbus-listener-server.h \
-	dbus-listener-client.h \
 	dbus-shared.h \
 	indicate-enum-types.c \
 	server.c \
@@ -70,33 +61,32 @@
 libindicate_la_LIBADD = \
 	$(LIBINDICATE_LIBS)
 
-dbus-indicate-server.h: indicate-interface.xml
-	dbus-binding-tool \
-		--prefix=_indicate_server \
-		--mode=glib-server \
-		--output=dbus-indicate-server.h \
-		$(srcdir)/indicate-interface.xml
-
-dbus-indicate-client.h: indicate-interface.xml
-	dbus-binding-tool \
-		--prefix=_indicate_client \
-		--mode=glib-client \
-		--output=dbus-indicate-client.h \
-		$(srcdir)/indicate-interface.xml
-
-dbus-listener-server.h: indicate-listener.xml
-	dbus-binding-tool \
-		--prefix=_indicate_listener \
-		--mode=glib-server \
-		--output=dbus-listener-server.h \
-		$(srcdir)/indicate-listener.xml
-
-dbus-listener-client.h: indicate-listener.xml
-	dbus-binding-tool \
-		--prefix=_indicate_listener \
-		--mode=glib-client \
-		--output=dbus-listener-client.h \
-		$(srcdir)/indicate-listener.xml
+##################################
+# DBus Specs
+##################################
+
+DBUS_SPECS = \
+	dbus-properties.xml \
+	indicate-interface.xml \
+	indicate-listener.xml
+
+%-client.h: %.xml
+	dbus-binding-tool \
+		--prefix=_$(notdir $(subst -,_,$(<:.xml=)))_client \
+		--mode=glib-client \
+		--output=$@ \
+		$<
+
+%-server.h: %.xml
+	dbus-binding-tool \
+		--prefix=_$(notdir $(subst -,_,$(<:.xml=)))_server \
+		--mode=glib-server \
+		--output=$@ \
+		$<
+
+BUILT_SOURCES += \
+	$(DBUS_SPECS:.xml=-client.h) \
+	$(DBUS_SPECS:.xml=-server.h)
 
 listener-marshal.h: $(srcdir)/listener-marshal.list
 	glib-genmarshal --header \

=== added file 'libindicate/dbus-properties.xml'
--- libindicate/dbus-properties.xml	1970-01-01 00:00:00 +0000
+++ libindicate/dbus-properties.xml	2010-02-04 00:14:10 +0000
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<node name="/">
+	<interface name="org.freedesktop.DBus.Properties">
+
+	<method name="Get">
+		<arg direction="in" type="s" name="Interface_Name"/>
+		<arg direction="in" type="s" name="Property_Name"/>
+		<arg direction="out" type="v" name="Value"/>
+	</method>
+
+	<method name="Set">
+		<arg direction="in" type="s" name="Interface_Name"/>
+		<arg direction="in" type="s" name="Property_Name"/>
+		<arg direction="in" type="v" name="Value"/>
+	</method>
+
+	<method name="GetAll">
+		<arg direction="in" type="s" name="Interface_Name"/>
+		<arg direction="out" type="a{sv}" name="Properties"/>
+	</method>
+
+	</interface>
+</node>

=== modified file 'libindicate/listener.c'
--- libindicate/listener.c	2010-02-04 00:14:10 +0000
+++ libindicate/listener.c	2010-02-04 00:14:10 +0000
@@ -32,10 +32,10 @@
 #include "listener-marshal.h"
 #include <dbus/dbus-glib-bindings.h>
 #include <dbus/dbus-glib-lowlevel.h>
-#include "dbus-indicate-client.h"
-#include "dbus-listener-client.h"
 #include "interests-priv.h"
 #include "dbus-shared.h"
+#include "indicate-interface-client.h"
+#include "dbus-properties-client.h"
 
 /* Errors */
 enum {
@@ -112,10 +112,10 @@
 static void proxy_get_indicator_list (DBusGProxy * proxy, GArray * indicators, GError * error, gpointer data);
 
 /* DBus interface */
-gboolean _indicate_listener_get_indicator_servers (IndicateListener * listener, GList * servers);
+gboolean _indicate_listener_server_get_indicator_servers (IndicateListener * listener, GList * servers);
 
 /* Need the above prototypes */
-#include "dbus-listener-server.h"
+#include "indicate-listener-server.h"
 
 /* Code */
 static void
@@ -186,7 +186,7 @@
 	                                  G_TYPE_INVALID);
 
 	dbus_g_object_type_install_info(INDICATE_TYPE_LISTENER,
-	                                &dbus_glib__indicate_listener_object_info);
+	                                &dbus_glib__indicate_listener_server_object_info);
 
 	return;
 }
@@ -884,7 +884,7 @@
 
 
 gboolean
-_indicate_listener_get_indicator_servers (IndicateListener * listener, GList * servers)
+_indicate_listener_server_get_indicator_servers (IndicateListener * listener, GList * servers)
 {
 
 	return TRUE;
@@ -961,21 +961,13 @@
    as data and calls back the call back that was in it with
    the appropriate data, also unrolled. */
 static void
-property_cb (DBusGProxy * proxy, DBusGProxyCall * call, void * data)
+property_cb (DBusGProxy * proxy, GValue property, GError * error, gpointer data)
 {
 	/* g_debug("Callback for property %s %s %s", dbus_g_proxy_get_bus_name(proxy), dbus_g_proxy_get_path(proxy), dbus_g_proxy_get_interface(proxy)); */
 	property_cb_t * propertyt = data;
-	GError * error = NULL;
-
-	GValue property = {0};
-
-	/* Finish the call and get our value.  There might
-	   be an error as if someone was using v1 API and
-	   not v2.  Let's handle that early. */
-	dbus_g_proxy_end_call(proxy, call, &error, G_TYPE_VALUE, &property, G_TYPE_INVALID);
+
 	if (error != NULL) {
 		/* g_warning("Unable to get property: %s", error->message); */
-		g_error_free(error);
 		g_free(propertyt);
 		return;
 	}
@@ -1050,14 +1042,11 @@
 	localdata->cb_uint = callback_uint;
 	localdata->data = data;
 
-	dbus_g_proxy_begin_call (proxyt->property_proxy,
-	                         "Get",
-	                         property_cb,
-	                         localdata,
-	                         NULL,
-	                         G_TYPE_STRING, INDICATE_DBUS_IFACE,
-	                         G_TYPE_STRING, property_name,
-	                         G_TYPE_INVALID, G_TYPE_VALUE, G_TYPE_INVALID);
+	org_freedesktop_DBus_Properties_get_async(proxyt->property_proxy,
+	                                          INDICATE_DBUS_IFACE,
+	                                          property_name,
+	                                          property_cb,
+	                                          localdata);
 
 	return;
 }

=== modified file 'libindicate/server.c'
--- libindicate/server.c	2010-02-04 00:14:10 +0000
+++ libindicate/server.c	2010-02-04 00:14:10 +0000
@@ -160,19 +160,19 @@
 static void indicate_server_interested_folks_destroy(IndicateServerInterestedFolk * folk);
 
 /* DBus API */
-gboolean _indicate_server_get_indicator_count (IndicateServer * server, guint * count, GError **error);
-gboolean _indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error);
-gboolean _indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error);
-gboolean _indicate_server_get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error);
-gboolean _indicate_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error);
-gboolean _indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GError ** error);
-gboolean _indicate_server_indicator_displayed (IndicateServer * server, guint id, gboolean displayed, DBusGMethodInvocation * method);
-gboolean _indicate_server_show_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method);
-gboolean _indicate_server_remove_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method);
-gboolean _indicate_server_set_max_indicators (IndicateServer * server, gint max, DBusGMethodInvocation * method);
+gboolean _indicate_interface_server_get_indicator_count (IndicateServer * server, guint * count, GError **error);
+gboolean _indicate_interface_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error);
+gboolean _indicate_interface_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error);
+gboolean _indicate_interface_server_get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error);
+gboolean _indicate_interface_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error);
+gboolean _indicate_interface_server_show_indicator_to_user (IndicateServer * server, guint id, GError ** error);
+gboolean _indicate_interface_server_indicator_displayed (IndicateServer * server, guint id, gboolean displayed, DBusGMethodInvocation * method);
+gboolean _indicate_interface_server_show_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method);
+gboolean _indicate_interface_server_remove_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method);
+gboolean _indicate_interface_server_set_max_indicators (IndicateServer * server, gint max, DBusGMethodInvocation * method);
 
 /* Has to be after the dbus prototypes */
-#include "dbus-indicate-server.h"
+#include "indicate-interface-server.h"
 
 
 
@@ -366,7 +366,7 @@
 	                                              G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
 	dbus_g_object_type_install_info(INDICATE_TYPE_SERVER,
-	                                &dbus_glib__indicate_server_object_info);
+	                                &dbus_glib__indicate_interface_server_object_info);
 
 	class->get_indicator_count = get_indicator_count;
 	class->get_indicator_list = get_indicator_list;
@@ -1135,7 +1135,7 @@
 	return;
 }
 
-static IndicateServer * default_indicate_server = NULL;
+static IndicateServer * default_indicate_interface_server = NULL;
 
 /**
 	indicate_server_ref_default:
@@ -1151,15 +1151,15 @@
 IndicateServer *
 indicate_server_ref_default (void)
 {
-	if (default_indicate_server != NULL) {
-		g_object_ref(default_indicate_server);
+	if (default_indicate_interface_server != NULL) {
+		g_object_ref(default_indicate_interface_server);
 	} else {
-		default_indicate_server = g_object_new(INDICATE_TYPE_SERVER, NULL);
-		g_object_add_weak_pointer(G_OBJECT(default_indicate_server),
-		                          (gpointer *)&default_indicate_server);
+		default_indicate_interface_server = g_object_new(INDICATE_TYPE_SERVER, NULL);
+		g_object_add_weak_pointer(G_OBJECT(default_indicate_interface_server),
+		                          (gpointer *)&default_indicate_interface_server);
 	}
 
-	return default_indicate_server;
+	return default_indicate_interface_server;
 }
 
 /**
@@ -1175,14 +1175,14 @@
 void
 indicate_server_set_default (IndicateServer * server)
 {
-	if (default_indicate_server != NULL) {
+	if (default_indicate_interface_server != NULL) {
 		g_warning("Setting a default Indicator Server when one has already been created.  I'm not going to destroy that one, but let it live.  This may create some odd results if you don't know what you're doing.");
 	}
 
 	if (server != NULL) {
-		default_indicate_server = server;
-		g_object_add_weak_pointer(G_OBJECT(default_indicate_server),
-		                          (gpointer *)&default_indicate_server);
+		default_indicate_interface_server = server;
+		g_object_add_weak_pointer(G_OBJECT(default_indicate_interface_server),
+		                          (gpointer *)&default_indicate_interface_server);
 	}
 
 	return;
@@ -1362,7 +1362,7 @@
 
 /* Virtual Functions */
 gboolean 
-_indicate_server_get_indicator_count (IndicateServer * server, guint * count, GError **error)
+_indicate_interface_server_get_indicator_count (IndicateServer * server, guint * count, GError **error)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1383,7 +1383,7 @@
 }
 
 gboolean 
-_indicate_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error)
+_indicate_interface_server_get_indicator_list (IndicateServer * server, GArray ** indicators, GError ** error)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1404,7 +1404,7 @@
 }
 
 gboolean 
-_indicate_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error)
+_indicate_interface_server_get_indicator_property (IndicateServer * server, guint id, gchar * property, gchar ** value, GError **error)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1425,7 +1425,7 @@
 }
 
 gboolean 
-_indicate_server_get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error)
+_indicate_interface_server_get_indicator_property_group (IndicateServer * server, guint id, GPtrArray * properties, gchar *** value, GError **error)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1446,7 +1446,7 @@
 }
 
 gboolean 
-_indicate_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error)
+_indicate_interface_server_get_indicator_properties (IndicateServer * server, guint id, gchar *** properties, GError **error)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1467,7 +1467,7 @@
 }
 
 gboolean 
-_indicate_server_show_indicator_to_user (IndicateServer * server, guint id, GError ** error)
+_indicate_interface_server_show_indicator_to_user (IndicateServer * server, guint id, GError ** error)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1490,7 +1490,7 @@
 /* DBus function to wrap a virtual function call so that
    it can be subclassed if someone so chooses */
 gboolean
-_indicate_server_indicator_displayed (IndicateServer * server, guint id, gboolean displayed, DBusGMethodInvocation * method)
+_indicate_interface_server_indicator_displayed (IndicateServer * server, guint id, gboolean displayed, DBusGMethodInvocation * method)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1565,7 +1565,7 @@
 }
 
 gboolean
-_indicate_server_show_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method)
+_indicate_interface_server_show_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1598,7 +1598,7 @@
 }
 
 gboolean
-_indicate_server_remove_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method)
+_indicate_interface_server_remove_interest (IndicateServer * server, gchar * interest, DBusGMethodInvocation * method)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 
@@ -1631,7 +1631,7 @@
 }
 
 gboolean
-_indicate_server_set_max_indicators (IndicateServer * server, gint max, DBusGMethodInvocation * method)
+_indicate_interface_server_set_max_indicators (IndicateServer * server, gint max, DBusGMethodInvocation * method)
 {
 	IndicateServerClass * class = INDICATE_SERVER_GET_CLASS(server);
 


Follow ups