00001 #ifndef GTASK_GENERIC_TASK_H
00002 #define GTASK_GENERIC_TASK_H
00003
00004 #include <glib-2.0/glib-object.h>
00005 #include <glib/glist.h>
00006 #include <libxml/tree.h>
00007
00008 #include <gtask/gtask-connection-group.h>
00009 #include <gtask/gtask-file.h>
00010
00011
00014
00015
00016 typedef struct _GTaskGenericTask GTaskGenericTask;
00017 typedef struct _GTaskGenericTaskPrivate GTaskGenericTaskPrivate;
00018 typedef struct _GTaskGenericTaskClass GTaskGenericTaskClass;
00019
00021 #define GTASK_GENERIC_TASK_TYPE (gtask_generic_task_get_type())
00022
00024 #define GTASK_GENERIC_TASK(obj) (G_TYPE_CHECK_INSTANCE_CAST( (obj), \
00025 GTASK_GENERIC_TASK_TYPE, \
00026 GTaskGenericTask))
00027
00029 #define GTASK_GENERIC_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST( (klass), \
00030 GTASK_GENERIC_TASK_TYPE, \
00031 GTaskGenericTaskClass ))
00032
00037 #define GTASK_IS_GENERIC_TASK(obj) (G_TYPE_CHECK_INSTANCE_TYPE( (obj), \
00038 GTASK_GENERIC_TASK_TYPE ))
00039
00044 #define GTASK_IS_GENERIC_TASK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE( (klass), \
00045 GTASK_GENERIC_TASK_TYPE ))
00046
00047 #define GTASK_GENERIC_TASK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS( (obj), \
00048 GTASK_GENERIC_TASK_TYPE, \
00049 GTaskGenericClass ))
00050
00053 typedef enum {
00054 GTASK_ACTIVITY_STATE_ACTIVE = 1 << 0,
00055 GTASK_ACTIVITY_STATE_INACTIVE = 1 << 1,
00056 GTASK_ACTIVITY_STATE_COMPLETED = 1 << 2
00057 } GTaskActivityState;
00058
00059 #define GTASK_TIME_LEFT_UNKNOWN -1
00060
00061 #define GTASK_ACTIVITY_STATE_TYPE (gtask_activity_state_get_type())
00062
00063 struct _GTaskGenericTaskPrivate {
00064 GTaskConnectionGroup *conn_group;
00065
00066 GString *application;
00067 GString *task_id;
00068
00069 GString *title;
00070 GString *category;
00071
00072 GString *thumbnail_uri;
00073
00074 GList *files;
00075
00076 gfloat percent_done;
00077 GTaskActivityState activity_state;
00078
00079 glong time_left;
00080
00081 GString *status_msg;
00082 GString *error_msg;
00083
00084 gboolean dispose_has_run;
00085 };
00086
00087 struct _GTaskGenericTask {
00088 GObject parent;
00089 GTaskGenericTaskPrivate *private;
00090 };
00091
00092 struct _GTaskGenericTaskClass {
00093 GObjectClass parent;
00094 };
00095
00096 GType gtask_activity_state_get_type( void );
00097
00098 GType gtask_generic_task_get_type( void );
00099
00100 GTaskGenericTask *
00101 gtask_generic_task_new( void );
00102
00103 GTaskGenericTask *
00104 gtask_generic_task_new_with_connection_group( GTaskConnectionGroup *conn_group );
00105
00106 gboolean
00107 gtask_generic_task_serialize( GTaskGenericTask *task );
00108
00109 gboolean
00110 gtask_generic_task_serialize_to( GTaskGenericTask *task,
00111 GTaskConnection *conn );
00112
00113 void
00114 gtask_generic_task_set_title( GTaskGenericTask *task, const gchar *title );
00115
00116 const gchar *
00117 gtask_generic_task_get_title( GTaskGenericTask *task );
00118
00119 void
00120 gtask_generic_task_set_thumbnail_uri( GTaskGenericTask *task,
00121 const gchar *uri );
00122
00123 const gchar*
00124 gtask_generic_task_get_thumbnail_uri( GTaskGenericTask *task );
00125
00126 void
00127 gtask_generic_task_set_percent_done( GTaskGenericTask *task, gfloat percent );
00128
00129 gfloat
00130 gtask_generic_task_get_percent_done( GTaskGenericTask *task );
00131
00132 void
00133 gtask_generic_task_set_activity_state( GTaskGenericTask *task,
00134 GTaskActivityState state );
00135 void
00136 gtask_generic_task_set_activity_state_from_string( GTaskGenericTask *task,
00137 const gchar *state );
00138
00139 GTaskActivityState
00140 gtask_generic_task_get_activity_state( GTaskGenericTask *task );
00141
00142 const gchar *
00143 gtask_generic_task_get_activity_state_as_string( GTaskGenericTask *task );
00144
00145 void
00146 gtask_generic_task_set_status_message( GTaskGenericTask *task,
00147 const gchar *msg );
00148
00149 const gchar *
00150 gtask_generic_task_get_status_message( GTaskGenericTask *task );
00151
00152 void
00153 gtask_generic_task_set_error_message( GTaskGenericTask *task,
00154 const gchar *msg );
00155
00156 const gchar *
00157 gtask_generic_task_get_error_message( GTaskGenericTask *task );
00158
00159 void
00160 gtask_generic_task_set_application( GTaskGenericTask *task, const gchar *app );
00161
00162 const gchar *
00163 gtask_generic_task_get_application( GTaskGenericTask *task );
00164
00165 void
00166 gtask_generic_task_set_id( GTaskGenericTask *task, const gchar *id );
00167
00168 const gchar *
00169 gtask_generic_task_get_id( GTaskGenericTask *task );
00170
00171 void
00172 gtask_generic_task_set_category( GTaskGenericTask *task, const gchar *cat );
00173
00174 const gchar *
00175 gtask_generic_task_get_category( GTaskGenericTask *task );
00176
00177 void
00178 gtask_generic_task_dump( GTaskGenericTask *task );
00179
00180 void
00181 gtask_generic_task_set_time_left( GTaskGenericTask *task, glong time_left );
00182
00183 glong
00184 gtask_generic_task_get_time_left( GTaskGenericTask *task );
00185
00186 void
00187 gtask_generic_task_add_file( GTaskGenericTask *task, GTaskFile *file );
00188
00189 void
00190 gtask_generic_task_add_files( GTaskGenericTask *task, GList *files );
00191
00192 GList *
00193 gtask_generic_task_get_files( GTaskGenericTask *task );
00194
00195 void
00196 gtask_generic_task_clear_files( GTaskGenericTask *task );
00197
00198
00199
00200 #endif