00001 #ifndef _SM_OBJECT_H
00002 #define _SM_OBJECT_H
00003
00004 #include <glib.h>
00005 #include <glib-object.h>
00006
00007 GQuark sm_error_quark (void);
00008
00009 #define SM_ERROR (sm_error_quark ())
00010
00011 typedef enum
00012 {
00013 SM_ERROR_INVALID_STATE = 0,
00014 SM_ERROR_NAME_IN_USE,
00015 SM_NUM_ERRORS
00016 } SMError;
00017
00018 GType sm_error_get_type (void);
00019 #define SM_TYPE_ERROR (sm_error_get_type ())
00020
00021 typedef enum
00022 {
00023 SM_OBJECT_STATE_SHUTDOWN = 0,
00024 SM_OBJECT_STATE_INITIALIZED,
00025 SM_OBJECT_STATE_ACQUIRED,
00026 SM_OBJECT_STATE_OPERATING,
00027 SM_OBJECT_NUM_STATES
00028 } SMObjectState;
00029
00030 GType sm_object_state_get_type (void);
00031
00032 #define SM_TYPE_OBJECT_STATE (sm_object_state_get_type ())
00033
00034 typedef struct SMObject SMObject;
00035 typedef struct SMObjectClass SMObjectClass;
00036
00037 struct SMObject
00038 {
00039 GObject parent;
00040
00041
00042 char *name;
00043 SMObjectState state;
00044 double acquisition_progress;
00045
00046 GSList *pending_tasks;
00047
00048 SMObjectState requested_state;
00049 };
00050
00051 struct SMObjectClass
00052 {
00053 GObjectClass parent;
00054 };
00055
00056 #define SM_TYPE_OBJECT (sm_object_get_type ())
00057 #define SM_OBJECT(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), SM_TYPE_OBJECT, SMObject))
00058 #define SM_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), SM_TYPE_OBJECT, SMObjectClass))
00059 #define SM_IS_OBJECT(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), SM_TYPE_OBJECT))
00060 #define SM_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), SM_TYPE_OBJECT))
00061 #define SM_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), SM_TYPE_OBJECT, SMObjectClass))
00062
00063 GType sm_object_get_type (void);
00064
00065 gboolean sm_object_get_info (SMObject *object, char **name, char **state, GError **error);
00066
00067 gboolean sm_object_start (SMObject *object, GError **error);
00068
00069 gboolean sm_object_shutdown (SMObject *object, GError **error);
00070
00071 gboolean sm_object_reinitialize (SMObject *object, GError **error);
00072
00073 gboolean sm_object_reacquire (SMObject *object, GError **error);
00074
00075 gboolean sm_object_get_acquiring_progress (SMObject *object, gdouble *out, GError **error);
00076
00077 #endif