diff options
| author | Colin Walters <walters@verbum.org> | 2005-07-09 01:46:51 +0000 | 
|---|---|---|
| committer | Colin Walters <walters@verbum.org> | 2005-07-09 01:46:51 +0000 | 
| commit | 0ccef79d7e9d1b19cdb10b3a147b64b41686905d (patch) | |
| tree | 78df63d544586877804afe2cdef873f20771ce0d /glib/examples/statemachine/statemachine-server.c | |
| parent | d8e7405eb35974518b0b579e2e2789fd065cb477 (diff) | |
2005-07-08  Colin Walters  <walters@verbum.org>
	* test/glib/test-service-glib.xml:
	* test/glib/test-service-glib.c:
	* test/glib/test-dbus-glib.c: Test a{sv}.
	* glib/examples/statemachine/statemachine.c:
	* glib/examples/statemachine/statemachine-server.c:
	* glib/examples/statemachine/statemachine-client.c: Fix some bugs,
	add progress bar, etc.
	* glib/dbus-gvalue.c (register_array, register_dict): Delete; not
	needed anymore due to generic array/map marshalling.
	(dbus_g_value_types_init): Don't register basic arrays or the
	string/string hash.
	(dbus_gtype_from_signature_iter): Don't try to recurse into
	variants.
	(dbus_gtype_to_signature): Check collection/map before type
	metadata.
	(demarshal_garray_basic): Renamed to demarshal_collection_array.
	(demarshal_ghashtable): Renamed to demarshal_map; fix to use new
	generic map creation/append functions instead of hash table
	specifically.
	(get_type_demarshaller): Handle maps.
	(demarshal_collection): Dispatch on collection type to either
	demarshal_collection_ptrarray or demarshal_collection_array.
	(get_type_marshaller): Handle maps.
	(marshal_collection): Dispatch collection type to either
	marshal_collection_ptrarray or marshal_collection_array.
	(_dbus_gvalue_test): New test.
	* glib/dbus-gvalue-utils.c (unset_and_free_g_value): New function.
	(hash_free_from_gtype): Use it to free GValues.
	(hashtable_append): New function.
	(ptrarray_append): Fix prototype.
	(slist_append): Ditto.
	(_dbus_gvalue_utils_test): Extend tests.
	* glib/dbus-gtype-specialized.c
	(dbus_g_type_specialized_init_append): Renamed from
	dbus_g_type_specialized_collection_init_append.  Remove const from
	value, since we steal it.
	(dbus_g_type_specialized_map_append): New function.
	* glib/dbus-gtype-specialized.h: Update prototypes.
	Add DBusGTypeSpecializedMapAppendFunc.
	* glib/dbus-gtest.c (dbus_glib_internal_do_not_use_run_tests): Run
	_dbus_gvalue_test.
	* glib/dbus-gtest.h: Prototype it.
Diffstat (limited to 'glib/examples/statemachine/statemachine-server.c')
| -rw-r--r-- | glib/examples/statemachine/statemachine-server.c | 27 | 
1 files changed, 27 insertions, 0 deletions
| diff --git a/glib/examples/statemachine/statemachine-server.c b/glib/examples/statemachine/statemachine-server.c index 7cadf1fe..2cbf39fe 100644 --- a/glib/examples/statemachine/statemachine-server.c +++ b/glib/examples/statemachine/statemachine-server.c @@ -104,6 +104,26 @@ sm_server_get_property (GObject *object,      }  } +static void +machine_state_changed_cb (SMObject *obj, const char *state, gpointer data) +{ +  char *name; + +  g_object_get (obj, "name", &name, NULL); +  g_print ("Machine %s switching to state %s\n", name, state); +  g_free (name); +} + +static void +machine_acquisition_changed_cb (SMObject *obj, gdouble progress, gpointer data) +{ +  char *name; + +  g_object_get (obj, "name", &name, NULL); +  g_print ("Machine %s got progress %f\n", name, progress); +  g_free (name); +} +  gboolean  sm_server_create_machine (SMServer *server, const char *name, GError **error)  { @@ -130,6 +150,13 @@ sm_server_create_machine (SMServer *server, const char *name, GError **error)    g_print ("Created state machine with name %s at %s\n", name, path); +  g_signal_connect_object (machine, "state-changed", +			   G_CALLBACK (machine_state_changed_cb), +			   NULL, 0); +  g_signal_connect_object (machine, "acquisition-progress", +			   G_CALLBACK (machine_acquisition_changed_cb), +			   NULL, 0); +    g_signal_emit (server, sm_server_signals[MACHINE_CREATED], 0, name, path);    return TRUE; | 
