diff options
author | Colin Walters <walters@verbum.org> | 2005-07-08 16:25:39 +0000 |
---|---|---|
committer | Colin Walters <walters@verbum.org> | 2005-07-08 16:25:39 +0000 |
commit | e888647a70094d5761f931e1a812764330ee5a2b (patch) | |
tree | 5d911fc2542f1df2bf1d6c1841aed97392523d81 /glib/examples/statemachine/statemachine.h | |
parent | b1e21dad20a42eb000ec4c850e416a0dc7d63fe6 (diff) |
2005-07-08 Colin Walters <walters@verbum.org>
* tools/Makefile.am: Kill of print-introspect in favor of using
dbus-send --print-reply=literal.
* tools/print-introspect.c: Deleted.
* test/glib/test-service-glib.xml:
* test/glib/test-service-glib.c (my_object_get_objs): New test
for "ao".
* test/glib/test-dbus-glib.c (echo_received_cb): Free echo data.
(main): Test GetObjs.
* glib/examples/statemachine/Makefile.am:
* glib/examples/statemachine/sm-marshal.list:
* glib/examples/statemachine/statemachine-client.c:
* glib/examples/statemachine/statemachine-server.c:
* glib/examples/statemachine/statemachine-server.xml:
* glib/examples/statemachine/statemachine.c:
* glib/examples/statemachine/statemachine.h:
* glib/examples/statemachine/statemachine.xml:
New example.
* glib/examples/example-service.c (main): Move invocation
of dbus_g_object_type_install_info earlier, to emphasize it
should only be done once.
* glib/examples/example-signal-emitter.c (main): Ditto.
* glib/examples/Makefile.am (SUBDIRS): Include statemachine.
* glib/dbus-gvalue.h (dbus_gtype_to_signature)
(dbus_gvalue_marshal): Update prototypes.
* glib/dbus-gvalue.c: Update all marshalling functions to take
const GValue instead of GValue.
(signature_iter_to_g_type_array): Return a GPtrArray for nonfixed
types.
(dbus_gvalue_to_signature): Update for dbus_gtype_to_signature
change.
(dbus_gtype_to_signature): Handle generic collecitons and maps.
Return a newly-allocated string.
(demarshal_proxy, demarshal_object_path, demarshal_object)
(demarshal_strv, demarshal_ghashtable): Set error, don't assert if
we get the wrong types from message.
(get_type_demarshaller): New function, extracted from
dbus_gvalue_demarshal.
(demarshal_collection): New function, demarshals generic
collection.
(dbus_gvalue_demarshal): Just invoke result of
get_type_demarshaller. Throw error if we don't have one.
(marshal_garray_basic): Abort on OOM.
(get_type_marshaller): New function, extracted from
dbus_gvalue_marshal.
(collection_marshal_iterator, marshal_collection): New functions;
implements generic marshalling for an iteratable specialized
collection.
(dbus_gvalue_marshal): Just invoke result of get_type_marshaller.
* glib/dbus-gvalue-utils.c (gvalue_from_ptrarray_value): Handle
G_TYPE_STRING.
(ptrarray_value_from_gvalue): Ditto.
(ptrarray_append, ptrarray_free): New functions.
(slist_constructor, slist_iterator, slist_copy_elt, slist_copy)
(slist_append, slist_end_append, slist_free): New functions.
(dbus_g_type_specialized_builtins_init): Add append fuctions
for GPtrArray and GSList. Register GSList.
(test_specialized_hash, _dbus_gvalue_utils_test): New functions.
* glib/dbus-gtype-specialized.h (DBusGTypeSpecializedAppendContext):
New.
(dbus_g_type_specialized_collection_init_append)
(dbus_g_type_specialized_collection_append)
(dbus_g_type_specialized_collection_end_append): Prototype.
(DBusGTypeSpecializedCollectionVtable): Add append_func and
end_append_func.
* glib/dbus-gtype-specialized.c (dbus_g_type_specialized_collection_init_append)
(dbus_g_type_specialized_collection_append)
(dbus_g_type_specialized_collection_end_append): New functions.
(dbus_g_type_map_value_iterate): Take const GValue.
(dbus_g_type_collection_value_iterate): Ditto.
* glib/dbus-gtest.c (dbus_glib_internal_do_not_use_run_tests): Run
_dbus_gvalue_utils_test.
* glib/dbus-gtest.h: Prototype it.
* glib/dbus-gproxy.c (dbus_g_proxy_manager_filter): Avoid
using uninitialized owner_list.
(dbus_g_proxy_begin_call_internal): Move return_if_fail to
public API.
(dbus_g_proxy_end_call_internal): Update to use error set
from dbus_gvalue_demarshal instead of setting it here.
(dbus_g_proxy_begin_call): Move return_if_fail here.
* glib/dbus-gobject.c (write_interface): Update for
dbus_gtype_to_signature returning new string.
* configure.in: Add glib/examples/statemachine.
Diffstat (limited to 'glib/examples/statemachine/statemachine.h')
-rw-r--r-- | glib/examples/statemachine/statemachine.h | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/glib/examples/statemachine/statemachine.h b/glib/examples/statemachine/statemachine.h new file mode 100644 index 00000000..ac6047bd --- /dev/null +++ b/glib/examples/statemachine/statemachine.h @@ -0,0 +1,77 @@ +#ifndef _SM_OBJECT_H +#define _SM_OBJECT_H + +#include <glib.h> +#include <glib-object.h> + +GQuark sm_error_quark (void); + +#define SM_ERROR (sm_error_quark ()) + +typedef enum +{ + SM_ERROR_INVALID_STATE = 0, + SM_ERROR_NAME_IN_USE, + SM_NUM_ERRORS +} SMError; + +GType sm_error_get_type (void); +#define SM_TYPE_ERROR (sm_error_get_type ()) + +typedef enum +{ + SM_OBJECT_STATE_SHUTDOWN = 0, + SM_OBJECT_STATE_INITIALIZED, + SM_OBJECT_STATE_ACQUIRED, + SM_OBJECT_STATE_OPERATING, + SM_OBJECT_NUM_STATES +} SMObjectState; + +GType sm_object_state_get_type (void); + +#define SM_TYPE_OBJECT_STATE (sm_object_state_get_type ()) + +typedef struct SMObject SMObject; +typedef struct SMObjectClass SMObjectClass; + +struct SMObject +{ + GObject parent; + + /* Private */ + char *name; + SMObjectState state; + double acquisition_progress; + + GSList /* guint */ *pending_tasks; + + SMObjectState requested_state; +}; + +struct SMObjectClass +{ + GObjectClass parent; +}; + +#define SM_TYPE_OBJECT (sm_object_get_type ()) +#define SM_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SM_TYPE_OBJECT, SMObject)) +#define SM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SM_TYPE_OBJECT, SMObjectClass)) +#define SM_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SM_TYPE_OBJECT)) +#define SM_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SM_TYPE_OBJECT)) +#define SM_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SM_TYPE_OBJECT, SMObjectClass)) + +GType sm_object_get_type (void); + +gboolean sm_object_get_info (SMObject *object, char **name, char **state, GError **error); + +gboolean sm_object_start (SMObject *object, GError **error); + +gboolean sm_object_shutdown (SMObject *object, GError **error); + +gboolean sm_object_reinitialize (SMObject *object, GError **error); + +gboolean sm_object_reacquire (SMObject *object, GError **error); + +gboolean sm_object_get_acquiring_progress (SMObject *object, gdouble *out, GError **error); + +#endif |