GtdTask: GNOME To Do - Reference Manual

## GtdTask GtdTask — a task |

## Stability Level

Unstable, unless otherwise indicated

## Functions

GtdTask * | gtd_task_new ()
gboolean | gtd_task_get_complete ()
void | gtd_task_set_complete ()
ECalComponent * | gtd_task_get_component ()
GDateTime * | gtd_task_get_creation_date ()
const gchar * | gtd_task_get_description ()
void | gtd_task_set_description ()
GDateTime * | gtd_task_get_due_date ()
void | gtd_task_set_due_date ()
GtdTaskList * | gtd_task_get_list ()
void | gtd_task_set_list ()
gint | gtd_task_get_priority ()
void | gtd_task_set_priority ()
const gchar * | gtd_task_get_title ()
void | gtd_task_set_title ()
void | gtd_task_abort ()
void | gtd_task_save ()
gint | gtd_task_compare ()

## Properties

gboolean | complete | Read / Write
ECalComponent * | component | Read / Write / Construct Only
GDateTime * | creation-date | Read
guint | depth | Read
gchar * | description | Read / Write
GDateTime * | due-date | Read / Write
GtdTaskList * | list | Read / Write
GtdTask * | parent | Read
gint | priority | Read / Write
gchar * | title | Read / Write

## Signals

void | subtask-added | Run Last
void | subtask-removed | Run Last

## Types and Values

#define | GTD_TYPE_TASK
struct | GtdTaskClass
| GtdTask

## Object Hierarchy

        GObject
        ╰── GtdObject
            ╰── GtdTask

## Description

A GtdTask is an object that represents a task. All GtdTasks must be inside a GtdTaskList.

## Functions

### gtd_task_new ()

    GtdTask *
    gtd_task_new (ECalComponent *component);

Creates a new GtdTask

#### Parameters

component | a ECalComponent. | [nullable]

#### Returns

a GtdTask.

[transfer full]

### gtd_task_get_complete ()

    gboolean
    gtd_task_get_complete (GtdTask *task);

Retrieves whether the task is complete or not.

#### Parameters

task | a GtdTask |

#### Returns

`TRUE` if the task is complete, `FALSE` otherwise

### gtd_task_set_complete ()

    void
    gtd_task_set_complete (GtdTask *task,
                           gboolean complete);

Updates the complete state of `task` .

#### Parameters

task | a GtdTask |
complete | the new value |

### gtd_task_get_component ()

    ECalComponent *
    gtd_task_get_component (GtdTask *task);

Retrieves the internal ECalComponent of `task` .

#### Parameters

task | a GtdTask |

#### Returns

a ECalComponent.

[transfer none]

### gtd_task_get_creation_date ()

    GDateTime *
    gtd_task_get_creation_date (GtdTask *task);

Returns the GDateTime that represents the task's creation date. The value is referenced for thread safety. Returns `NULL` if no date is set.

#### Parameters

task | a GtdTask |

#### Returns

the internal GDateTime referenced for thread safety, or `NULL`. Unreference it after use.

[transfer full]

### gtd_task_get_description ()

    const gchar *
    gtd_task_get_description (GtdTask *task);

Retrieves the description of the task.

#### Parameters

task | a GtdTask |

#### Returns

the description of `task` .

[transfer none]

### gtd_task_set_description ()

    void
    gtd_task_set_description (GtdTask *task,
                              const gchar *description);

Updates the description of `task` . The string is not stripped off of spaces to preserve user data.

#### Parameters

task | a GtdTask |
description | the new description, or `NULL`. | [nullable]

### gtd_task_get_due_date ()

    GDateTime *
    gtd_task_get_due_date (GtdTask *task);

Returns the GDateTime that represents the task's due date. The value is referenced for thread safety. Returns `NULL` if no date is set.

#### Parameters

task | a GtdTask |

#### Returns

the internal GDateTime referenced for thread safety, or `NULL`. Unreference it after use.

[transfer full]

### gtd_task_set_due_date ()

    void
    gtd_task_set_due_date (GtdTask *task,
                           GDateTime *dt);

Updates the internal `GtdTask` ::due-date property.

#### Parameters

task | a GtdTask |
dt | a GDateTime. | [nullable]

### gtd_task_get_list ()

    GtdTaskList *
    gtd_task_get_list (GtdTask *task);

Returns a weak reference to the GtdTaskList that owns the given `task` .

#### Returns

a weak reference to the GtdTaskList that owns `task` . Do not free after usage.

[transfer none]

### gtd_task_set_list ()

    void
    gtd_task_set_list (GtdTask *task,
                       GtdTaskList *list);

Sets the parent GtdTaskList of `task` .

#### Parameters

task | a GtdTask |
list | a GtdTaskList. | [nullable]

### gtd_task_get_priority ()

    gint
    gtd_task_get_priority (GtdTask *task);

Returns the priority of `task` inside the parent GtdTaskList, or -1 if not set.

#### Parameters

task | a GtdTask |

#### Returns

the priority of the task, or 0

### gtd_task_set_priority ()

    void
    gtd_task_set_priority (GtdTask *task,
                           gint priority);

Sets the `task` priority inside the parent GtdTaskList. It is up to the interface to handle two or more GtdTask with the same priority value.

#### Parameters

task | a GtdTask |
priority | the priority of `task` , or -1 |

### gtd_task_get_title ()

    const gchar *
    gtd_task_get_title (GtdTask *task);

Retrieves the title of the task, or `NULL`.

#### Parameters

task | a GtdTask |

#### Returns

the title of `task` , or `NULL`.

[transfer none]

### gtd_task_set_title ()

    void
    gtd_task_set_title (GtdTask *task,
                        const gchar *title);

Updates the title of `task` . The string is stripped off of leading spaces.

#### Parameters

task | a GtdTask |
title | the new title, or `NULL`. | [nullable]

### gtd_task_abort ()

    void
    gtd_task_abort (GtdTask *task);

Cancels any editing made on `task` after the latest call of `gtd_task_save` .

#### Parameters

task | a GtdTask |

### gtd_task_save ()

    void
    gtd_task_save (GtdTask *task);

Save any changes made on `task` .

#### Parameters

task | a GtdTask |

### gtd_task_compare ()

    gint
    gtd_task_compare (GtdTask *t1,
                      GtdTask *t2);

Compare `t1` and `t2` .

#### Parameters

t1 | a GtdTask. | [nullable]
t2 | a GtdTask. | [nullable]

#### Returns

`-1` if `t1` comes before `t2` , `1` for the opposite, `0` if they're equal

## Types and Values

### GTD_TYPE_TASK

    #define GTD_TYPE_TASK (gtd_task_get_type())

### struct GtdTaskClass

    struct GtdTaskClass {
      GtdObjectClass parent;

      /*< signals >*/
      void          (*subtask_added)                      (GtdTask              *self,
                                                           GtdTask              *subtask);

      void          (*subtask_removed)                    (GtdTask              *self,
                                                           GtdTask              *subtask);

      gpointer       padding[8];
    };

### GtdTask

    typedef struct _GtdTask GtdTask;

## Property Details

### The `“complete”` property

      “complete”                 gboolean

Whether the task is marked as completed by the user.

Flags: Read / Write

Default value: FALSE

### The `“component”` property

      “component”                ECalComponent *

The #ECalComponent this task handles.

Flags: Read / Write / Construct Only

### The `“creation-date”` property

      “creation-date”            GDateTime *

The day the task was created.

Flags: Read

### The `“depth”` property

      “depth”                    guint

The depth of the task inside the subtasks tree.

Flags: Read

Default value: 0

### The `“description”` property

      “description”              gchar *

Optional string describing the task.

Flags: Read / Write

Default value: NULL

### The `“due-date”` property

      “due-date”                 GDateTime *

The day the task is supposed to be completed.

Flags: Read / Write

### The `“list”` property

      “list”                     GtdTaskList *

The list that owns this task.

Flags: Read / Write

### The `“parent”` property

      “parent”                   GtdTask *

The GtdTask that is parent of this task.

Flags: Read

### The `“priority”` property

      “priority”                 gint

The priority of the task. 0 means no priority set, and tasks will be sorted alphabetically.

Flags: Read / Write

Allowed values: >= 0

Default value: 0

### The `“title”` property

      “title”                    gchar *

The title of the task.

Flags: Read / Write

Default value: NULL

## Signal Details

### The `“subtask-added”` signal

    void
    user_function (GtdTask *gtdtask,
                   GtdTask *arg1,
                   gpointer user_data)

Flags: Run Last

### The `“subtask-removed”` signal

    void
    user_function (GtdTask *gtdtask,
                   GtdTask *arg1,
                   gpointer user_data)

Flags: Run Last

## See Also

GtdTaskList