GalagoPerson

## GalagoPerson GalagoPerson — A representation of a person. |

## Synopsis

                GalagoPerson;
    #define     GALAGO_DBUS_PERSON_INTERFACE
    #define     GALAGO_PERSON_ATTR_UID
    #define     GALAGO_PERSON_ATTR_FIRST_NAME
    #define     GALAGO_PERSON_ATTR_MIDDLE_NAME
    #define     GALAGO_PERSON_ATTR_LAST_NAME
    #define     GALAGO_PERSON_ATTR_ADDRESS
    #define     GALAGO_PERSON_ATTR_CITY
    #define     GALAGO_PERSON_ATTR_STATE
    #define     GALAGO_PERSON_ATTR_COUNTRY
    #define     GALAGO_PERSON_ATTR_ZIPCODE
    void        galago_person_set_me            (GalagoPerson *person);
    gboolean    galago_person_is_me             (const GalagoPerson *person);
    const char* galago_person_get_id            (const GalagoPerson *person);
    const char* galago_person_get_session_id    (const GalagoPerson *person);
    const char* galago_person_get_display_name  (const GalagoPerson *person);
    void        galago_person_set_photo         (GalagoPerson *person,
                                                 GalagoImage *photo);
    GalagoImage* galago_person_get_photo        (const GalagoPerson *person,
                                                 gboolean query);
    gboolean    galago_person_has_accounts      (const GalagoPerson *person,
                                                 gboolean query);
    GList*      galago_person_get_accounts      (const GalagoPerson *person,
                                                 gboolean query);
    GalagoAccount* galago_person_get_priority_account
                                                (const GalagoPerson *person);
    GalagoAccount* galago_person_get_account    (const GalagoPerson *person,
                                                 const GalagoService *service,
                                                 const char *username,
                                                 gboolean query);

## Object Hierarchy

      GObject
       +----GalagoObject
             +----GalagoPerson

## Properties

      "id"                   gchararray            : Read / Write / Construct Only
      "photo"                GalagoImage           : Read / Write
      "session-id"           gchararray            : Read / Write / Construct Only

## Signals

    "account-added"
                void        user_function      (GalagoPerson *person,
                                                gpointer      account,
                                                gpointer      user_data)      : Run last / Action
    "account-removed"
                void        user_function      (GalagoPerson *person,
                                                gpointer      account,
                                                gpointer      user_data)      : Run last / Action
    "photo-set" void        user_function      (GalagoPerson *person,
                                                gpointer      photo,
                                                gpointer      user_data)      : Run last / Action

## Description

GalagoPerson objects represent an individual user, usually one that owns one or more GalagoAccounts. This is really a fancy container object.

Not all GalagoPersons map to a real person. A GalagoPerson may have a unique ID provided by a feed, in which case it probably does represent a real person in an addressbook. However, it may be ID-less, in which case it's pretty much just a container.

GalagoPersons are created through `galago_create_person()`.

## Details

### GalagoPerson

    typedef struct _GalagoPerson GalagoPerson;

This is an opaque structure representing a person. This should not be used directly. Use the accessor functions below.

### GALAGO_DBUS_PERSON_INTERFACE

    #define     GALAGO_DBUS_PERSON_INTERFACE

The D-BUS interface that GalagoPerson maps to.

### GALAGO_PERSON_ATTR_UID

    #define     GALAGO_PERSON_ATTR_UID

A unique ID attribute.

### GALAGO_PERSON_ATTR_FIRST_NAME

    #define     GALAGO_PERSON_ATTR_FIRST_NAME

A first name attribute.

### GALAGO_PERSON_ATTR_MIDDLE_NAME

    #define     GALAGO_PERSON_ATTR_MIDDLE_NAME

A middle name attribute.

### GALAGO_PERSON_ATTR_LAST_NAME

    #define     GALAGO_PERSON_ATTR_LAST_NAME

A last name attribute.

### GALAGO_PERSON_ATTR_ADDRESS

    #define     GALAGO_PERSON_ATTR_ADDRESS

A street address attribute.

### GALAGO_PERSON_ATTR_CITY

    #define     GALAGO_PERSON_ATTR_CITY

A city attribute.

### GALAGO_PERSON_ATTR_STATE

    #define     GALAGO_PERSON_ATTR_STATE

A state attribute.

### GALAGO_PERSON_ATTR_COUNTRY

    #define     GALAGO_PERSON_ATTR_COUNTRY

A country attribute.

### GALAGO_PERSON_ATTR_ZIPCODE

    #define     GALAGO_PERSON_ATTR_ZIPCODE

A zipcode attribute.

### galago_person_set_me ()

    void        galago_person_set_me            (GalagoPerson *person);

Sets a person to be the "Me" person. This is a one-way thing. You can't make a "Me" person a normal person.

This is an internal function. Please use `galago_get_me()` instead of ever using this.

`person` : | The person.

### galago_person_is_me ()

    gboolean    galago_person_is_me             (const GalagoPerson *person);

Returns whether or not a person is the "Me" person.

`person` : | The person.
Returns : | TRUE if the person is the "Me" person, or FALSE.

### galago_person_get_id ()

    const char* galago_person_get_id            (const GalagoPerson *person);

Returns a person's application-specific unique ID.

`person` : | The person.
Returns : | The person's ID.

### galago_person_get_session_id ()

    const char* galago_person_get_session_id    (const GalagoPerson *person);

Returns a person's session ID.

`person` : | The person.
Returns : | The person's session ID.

### galago_person_get_display_name ()

    const char* galago_person_get_display_name  (const GalagoPerson *person);

Returns the display name of a person, if any.

The returned display name is from a static buffer. If you wish to store the name, you must g_strdup it.

`person` : | The person.
Returns : | The person's display name, or NULL.

### galago_person_set_photo ()

    void        galago_person_set_photo         (GalagoPerson *person,
                                                 GalagoImage *photo);

Sets the person's photo.

The person should be a local person.

`person` : | The person.
`photo` : | The photo to set.

### galago_person_get_photo ()

    GalagoImage* galago_person_get_photo        (const GalagoPerson *person,
                                                 gboolean query);

Returns the person's photo.

`person` : | The person.
`query` : | TRUE if a remote query should be done if there is no local photo found, or FALSE.
Returns : | The photo, if found, or NULL.

### galago_person_has_accounts ()

    gboolean    galago_person_has_accounts      (const GalagoPerson *person,
                                                 gboolean query);

Returns whether the person has any accounts at all.

`person` : | The person.
`query` : | TRUE if a query should be done to check the server-side state of the accounts, or FALSE.
Returns : | TRUE if the person has at least one account, or FALSE otherwise.

### galago_person_get_accounts ()

    GList*      galago_person_get_accounts      (const GalagoPerson *person,
                                                 gboolean query);

Returns a list of accounts in the person.

`person` : | The person.
`query` : | TRUE if a remote query should be done if there is no local account found, or FALSE.
Returns : | The list of accounts.

### galago_person_get_priority_account ()

    GalagoAccount* galago_person_get_priority_account
                                                (const GalagoPerson *person);

Returns the most available "priority" account.

`person` : | The person.
Returns : | The priority account.

### galago_person_get_account ()

    GalagoAccount* galago_person_get_account    (const GalagoPerson *person,
                                                 const GalagoService *service,
                                                 const char *username,
                                                 gboolean query);

Returns the account with the specified username and service.

`person` : | The person.
`service` : | The service.
`username` : | The username.
`query` : | TRUE if a remote query should be done if there is no local account found, or FALSE.
Returns : | The account, if found, or NULL.

## Property Details

### The "`id`" property

      "id"                   gchararray            : Read / Write / Construct Only

The person's unique ID.

Default value: NULL

### The "`photo`" property

      "photo"                GalagoImage           : Read / Write

The person's unique ID.

### The "`session-id`" property

      "session-id"           gchararray            : Read / Write / Construct Only

The person's session ID.

Default value: NULL

## Signal Details

### The "account-added" signal

    void        user_function                  (GalagoPerson *person,
                                                gpointer      account,
                                                gpointer      user_data)      : Run last / Action

Emitted whenever an account has been added to this person.

`person` : | The object which received the signal.
`account` : | The account added to this person.
`user_data` : | user data set when the signal handler was connected.

### The "account-removed" signal

    void        user_function                  (GalagoPerson *person,
                                                gpointer      account,
                                                gpointer      user_data)      : Run last / Action

Emitted whenever an account has been removed from this person.

`person` : | The object which received the signal.
`account` : | The account added to this person.
`user_data` : | user data set when the signal handler was connected.

### The "photo-set" signal

    void        user_function                  (GalagoPerson *person,
                                                gpointer      photo,
                                                gpointer      user_data)      : Run last / Action

Emitted whenever a photo has been set on this person.

`person` : | The object which received the signal.
`photo` : | The photo set on this person.
`user_data` : | user data set when the signal handler was connected.

## See Also

GalagoAccount