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

D-BUS 0.30 in my yum repository - porting guide attached

I have D-BUS version 0.30 in my yum repository at 

name=J5's Experimental Project Utopia Repository

You will have to --force --nodeps the packages for now until all the
packages are updated to use the new dbus.

Attached is a short porting guide.  Ask me if you have any more
complicated questions about the new API's.

Please patch your rpm's to reflect the new API. We will make the
switchover in a couple of weeks or whenever all the packages are done.
Send me the srpm's so I can add packages to the repository as they are
done.  Here is a list of packages in core that need to be updated:

gnome-volume-manager - me 
hal - davidz
NetworkManager - dcbw
NetworkManager-gnome - dcbw
desktop-printing - walters
cups - twaugh

I'm posting this to fedora-devel so that packagers outside of core can
consider themselves warned.  Massive API breakage for anything that uses
D-BUS is on the horizon as we move closer to 1.0.  The 0.30 series
should mark the biggest change moving to 1.0 and I don't expect anymore
API breakage other than the glib bindings in the future.  If there is
I'll let you know.


John (J5) Palmieri
Associate Software Engineer
Desktop Group
Red Hat, Inc.
Blog: http://martianrock.com
C API Changes:
	- s/dbus_bus_acquire_service/dbus_bus_request_name
	- s/dbus_bus_activate_service/dbus_bus_start_service_by_name
	- s/dbus_bus_get_base_service/dbus_bus_get_unique_name
	- s/dbus_bus_service_exists/dbus_bus_name_has_owner
	- If you wish to append to an itterator you must now initalize it with dbus_message_iter_init_append

DBUS API Changes:
	* Methods
	- s/org.freedesktop.DBus.AquireService/org.freedesktop.DBus.RequestName
	- s/org.freedesktop.DBus.ListServices/org.freedesktop.DBus.ListNames
	- s/org.freedesktop.DBus.ServiceExists/org.freedesktop.DBus.NameHasOwner
	- s/org.freedesktop.DBus.ActivateService/org.freedesktop.DBus.StartServiceByName
	- s/org.freedesktop.DBus.GetServiceOwner/org.freedesktop.DBus.GetNameOwner
	* Signals
	- s/org.freedesktop.DBus.ServiceAcquired/org.freedesktop.DBus.NameAcquired
	- s/org.freedesktop.DBus.ServiceLost/org.freedesktop.DBus.NameLost
	- s/org.freedesktop.DBus.ServiceOwnerChanged/org.freedesktop.DBus.NameOwnerChanged

Changes to Defaults:
	- DBUS_HEADER_FLAG_AUTO_START - auto starting(activation) is on by default
	* New
	- DBUS_TYPE_INT16       - 16bit integer
	- DBUS_TYPE_UINT16      - 16bit unsigned integer
	- DBUS_TYPE_DICT_ENTRY  - Dictionaries (array of key value pair structs)
	- DBUS_TYPE_SIGNATURE   - dbus type signature string
	- DBUS_TYPE_VARIENT     - a value that has its signature embeded
	- DBUS_TYPE_STRUCT      - an array of different types 

	* Removed

Type Iterator Changes:

	- All specific type API's have been removed. Use dbus_message_get_basic
		dbus_int32_t i;
		/* i = dbus_message_iter_get_int32 (&iter); */
		dbus_message_iter_get_basic (&iter, &i);

	This goes for writting too.
		dbus_int32_t i;
		i = 10
		/* dbus_message_iter_append_int32 (&iter, i); */
		dbus_message_iter_append_basic (&iter, DBUS_TYPE_INT32, &i);

	- When appending to a message use dbus_message_iter_init_append to 
	get an iterator that can be written to.
	- Use dbus_message_iter_recurse to read values in a container type such
	as an array, varient, dict or struct.
		int arg_type;
		DBusMessageIter main_iter;
		arg_type = dbus_message_iter_get_arg_type (&main_iter);
		/* you should use a switch here */
		if (arg_type == DBUS_TYPE_ARRAY) 
		    DBusMessageIter array_iter;
		    /* assuming that we know the array is an array
		       of strings*/
		    gchar *item;

		    assert (dbus_message_iter_get_element_type (&main_iter) 
		             == DBUS_TYPE_STRING);

		    dbus_message_iter_recurse (&main_iter, &array_iter);

		    do {
		      const char *value;
		      char *str;
		      dbus_message_iter_get_basic (&array_iter, &value);
		      str = g_strdup (value);
		      g_print ("The value of the array element is: %s\n", str);
		      g_free (str);

		    } while (dbus_message_iter_next(&array_iter));

	One may also use the convinience function for fixed length arrays:
	dbus_message_iter_get_fixed_array (DBusMessageIter *iter, 
	                                   void *value, 
					   int *n_elements);

	- When appending container types to iterators use the 
	dbus_message_iter_open_container and it's complement
		DBusMessageIter main_iter, array_iter;
		int i;
		/* open an array of strings container */
		arg_type = dbus_message_iter_open_container (&main_iter,

		for (i = 0; i < 10; i++)
		  gchar buffer[255];

		  g_sprintf (buffer, "Array element %i", i);
		  dbus_message_iter_append_basic (&array_iter, 
		dbus_message_iter_close_container (&main_iter, &array_iter);
	One may also use the convinience function for fixed length arrays:
	dbus_message_iter_append_fixed_array (DBusMessageIter *iter,
	                                      int element_type,
	                                      void *value, 
				 	      int *n_elements);

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