## GtdManager GtdManager — bridge between plugins and GNOME To Do |

## Stability Level

Unstable, unless otherwise indicated

## Functions

GtdManager * | gtd_manager_new ()
GtdManager * | gtd_manager_get_default ()
GList * | gtd_manager_get_task_lists ()
GList * | gtd_manager_get_providers ()
GList * | gtd_manager_get_panels ()
void | gtd_manager_create_task_list ()
void | gtd_manager_remove_task_list ()
void | gtd_manager_save_task_list ()
void | gtd_manager_create_task ()
void | gtd_manager_remove_task ()
void | gtd_manager_update_task ()
GtdProvider * | gtd_manager_get_default_provider ()
void | gtd_manager_set_default_provider ()
GSettings * | gtd_manager_get_settings ()
gboolean | gtd_manager_get_is_first_run ()
void | gtd_manager_set_is_first_run ()
void | gtd_manager_emit_error_message ()

## Properties

GtdProvider * | default-provider | Read / Write
GtdTaskList * | default-task-list | Read / Write
GtdPluginManager * | plugin-manager | Read
GtdTimer * | timer | Read

## Signals

void | list-added | Run Last
void | list-changed | Run Last
void | list-removed | Run Last
void | panel-added | Run Last
void | panel-removed | Run Last
void | provider-added | Run Last
void | provider-removed | Run Last
void | show-error-message | Run Last

## Types and Values

#define | GTD_TYPE_MANAGER
| GtdManager

## Object Hierarchy

        GObject
        ╰── GtdObject
            ╰── GtdManager

## Description

The GtdManager object is a singleton object that exposes all the data inside the plugin to GNOME To Do, and vice-versa. From here, plugins have access to all the tasklists, tasks and panels of the other plugins.

Objects can use `gtd_manager_emit_error_message()` to send errors to GNOME To Do. This will create a GtdNotification internally.

## Functions

### gtd_manager_new ()

    GtdManager *
    gtd_manager_new (void);

### gtd_manager_get_default ()

    GtdManager *
    gtd_manager_get_default (void);

Retrieves the singleton GtdManager instance. You should always use this function instead of `gtd_manager_new` .

#### Returns

the singleton GtdManager instance.

[transfer none]

### gtd_manager_get_task_lists ()

    GList *
    gtd_manager_get_task_lists (GtdManager *manager);

Retrieves the list of GtdTaskList already loaded.

#### Parameters

manager | a GtdManager |

#### Returns

a newly allocated list of GtdTaskList, or `NULL` if none.

[transfer container][element-type Gtd.TaskList]

### gtd_manager_get_providers ()

    GList *
    gtd_manager_get_providers (GtdManager *manager);

Retrieves the list of available GtdProvider.

#### Parameters

manager | a GtdManager |

#### Returns

a newly allocated GList of GtdStorage. Free with `g_list_free` after use.

[transfer container][element-type Gtd.Provider]

### gtd_manager_get_panels ()

    GList *
    gtd_manager_get_panels (GtdManager *manager);

Retrieves the list of currently loaded GtdPanel instances.

#### Parameters

manager | a GtdManager |

#### Returns

a GList of GtdPanel.

[transfer container][element-type Gtd.Panel]

### gtd_manager_create_task_list ()

    void
    gtd_manager_create_task_list (GtdManager *manager,
                                  GtdTaskList *list);

Creates a new task list at the given source.

#### Parameters

manager | a GtdManager |
list | a GtdTaskList |

### gtd_manager_remove_task_list ()

    void
    gtd_manager_remove_task_list (GtdManager *manager,
                                  GtdTaskList *list);

Deletes `list` from the registry.

#### Parameters

manager | a GtdManager |
list | a GtdTaskList |

### gtd_manager_save_task_list ()

    void
    gtd_manager_save_task_list (GtdManager *manager,
                                GtdTaskList *list);

Save or create `list` .

#### Parameters

manager | a GtdManager |
list | a GtdTaskList |

### gtd_manager_create_task ()

    void
    gtd_manager_create_task (GtdManager *manager,
                             GtdTask *task);

Ask for `task` 's parent list source to create `task` .

#### Parameters

manager | a GtdManager |
task | a GtdTask |

### gtd_manager_remove_task ()

    void
    gtd_manager_remove_task (GtdManager *manager,
                             GtdTask *task);

Ask for `task` 's parent list source to remove `task` .

#### Parameters

manager | a GtdManager |
task | a GtdTask |

### gtd_manager_update_task ()

    void
    gtd_manager_update_task (GtdManager *manager,
                             GtdTask *task);

Ask for `task` 's parent list source to update `task` .

#### Parameters

manager | a GtdManager |
task | a GtdTask |

### gtd_manager_get_default_provider ()

    GtdProvider *
    gtd_manager_get_default_provider (GtdManager *manager);

Retrieves the default provider location. Default is "local".

#### Parameters

manager | a GtdManager |

#### Returns

the default provider.

[transfer none]

### gtd_manager_set_default_provider ()

    void
    gtd_manager_set_default_provider (GtdManager *manager,
                                      GtdProvider *provider);

Sets the provider.

#### Parameters

manager | a GtdManager |
provider | the default provider. | [nullable]

### gtd_manager_get_settings ()

    GSettings *
    gtd_manager_get_settings (GtdManager *manager);

Retrieves the internal GSettings from `manager` .

#### Parameters

manager | a GtdManager |

#### Returns

the internal GSettings of `manager` .

[transfer none]

### gtd_manager_get_is_first_run ()

    gboolean
    gtd_manager_get_is_first_run (GtdManager *manager);

Retrieves the 'first-run' setting.

#### Parameters

manager | a GtdManager |

#### Returns

`TRUE` if GNOME To Do was never run before, `FALSE` otherwise.

### gtd_manager_set_is_first_run ()

    void
    gtd_manager_set_is_first_run (GtdManager *manager,
                                  gboolean is_first_run);

Sets the 'first-run' setting.

#### Parameters

manager | a GtdManager |
is_first_run | `TRUE` to make it first run, `FALSE` otherwise. |

### gtd_manager_emit_error_message ()

    void
    gtd_manager_emit_error_message (GtdManager *manager,
                                    const gchar *primary_message,
                                    const gchar *secondary_message,
                                    GtdNotificationActionFunc function,
                                    gpointer user_data);

## Types and Values

### GTD_TYPE_MANAGER

    #define GTD_TYPE_MANAGER (gtd_manager_get_type())

### GtdManager

    typedef struct _GtdManager GtdManager;

## Property Details

### The `“default-provider”` property

      “default-provider”         GtdProvider *

The default provider of the application.

Flags: Read / Write

### The `“default-task-list”` property

      “default-task-list”        GtdTaskList *

The default task list of the application.

Flags: Read / Write

### The `“plugin-manager”` property

      “plugin-manager”           GtdPluginManager *

The plugin manager of the application.

Flags: Read

### The `“timer”` property

      “timer”                    GtdTimer *

The timer of the application.

Flags: Read

## Signal Details

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

    void
    user_function (GtdManager  *manager,
                   GtdTaskList *list,
                   gpointer     user_data)

The ::list-added signal is emmited after a GtdTaskList is connected.

#### Parameters

manager | a GtdManager |
list | a GtdTaskList |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“list-changed”` signal

    void
    user_function (GtdManager  *manager,
                   GtdTaskList *list,
                   gpointer     user_data)

The ::list-changed signal is emmited after a GtdTaskList has any of it's properties changed.

#### Parameters

manager | a GtdManager |
list | a GtdTaskList |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

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

    void
    user_function (GtdManager  *manager,
                   GtdTaskList *list,
                   gpointer     user_data)

The ::list-removed signal is emmited after a GtdTaskList is disconnected.

#### Parameters

manager | a GtdManager |
list | a GtdTaskList |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

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

    void
    user_function (GtdManager *manager,
                   GtdPanel   *panel,
                   gpointer    user_data)

The ::panel-added signal is emmited after a GtdPanel is added.

#### Parameters

manager | a GtdManager |
panel | a GtdPanel |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

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

    void
    user_function (GtdManager *manager,
                   GtdPanel   *panel,
                   gpointer    user_data)

The ::panel-removed signal is emmited after a GtdPanel is removed from the list.

#### Parameters

manager | a GtdManager |
panel | a GtdPanel |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

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

    void
    user_function (GtdManager  *manager,
                   GtdProvider *provider,
                   gpointer     user_data)

The ::provider-added signal is emmited after a GtdProvider is added.

#### Parameters

manager | a GtdManager |
provider | a GtdProvider |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

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

    void
    user_function (GtdManager  *manager,
                   GtdProvider *provider,
                   gpointer     user_data)

The ::provider-removed signal is emmited after a GtdProvider is removed from the list.

#### Parameters

manager | a GtdManager |
provider | a GtdProvider |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

### The `“show-error-message”` signal

    void
    user_function (GtdManager *manager,
                   gchar      *primary_text,
                   gchar      *secondary_text,
                   gpointer    action,
                   gpointer    user_data,
                   gpointer    user_data)

Notifies about errors, and sends the error message for widgets to display.

#### Parameters

manager | a GtdManager |
primary_text | the primary message |
secondary_text | the detailed explanation of the error or the text to the notification button. |
action | optionally action of type GtdNotificationActionFunc ignored if it's null. |
user_data | user data passed to the action. |
user_data | user data set when the signal handler was connected. |

Flags: Run Last

## See Also

GtdNotification,GtdActivatable