## PhoshNotification

PhoshNotification — A notification

## Functions

PhoshNotification * | phosh_notification_new ()
void | phosh_notification_set_id ()
guint | phosh_notification_get_id ()
void | phosh_notification_set_summary ()
const char * | phosh_notification_get_summary ()
void | phosh_notification_set_body ()
const char * | phosh_notification_get_body ()
void | phosh_notification_set_app_name ()
const char * | phosh_notification_get_app_name ()
GDateTime * | phosh_notification_get_timestamp ()
void | phosh_notification_set_timestamp ()
void | phosh_notification_set_app_icon ()
GIcon * | phosh_notification_get_app_icon ()
void | phosh_notification_set_app_info ()
GAppInfo * | phosh_notification_get_app_info ()
void | phosh_notification_set_image ()
GIcon * | phosh_notification_get_image ()
void | phosh_notification_set_urgency ()
PhoshNotificationUrgency | phosh_notification_get_urgency ()
void | phosh_notification_set_actions ()
GStrv | phosh_notification_get_actions ()
void | phosh_notification_set_transient ()
gboolean | phosh_notification_get_transient ()
void | phosh_notification_set_resident ()
gboolean | phosh_notification_get_resident ()
void | phosh_notification_set_category ()
const char * | phosh_notification_get_category ()
void | phosh_notification_activate ()
void | phosh_notification_expires ()
void | phosh_notification_close ()
void | phosh_notification_do_action ()

## Properties

GStrv | actions | Read / Write
GIcon * | app-icon | Read / Write
GAppInfo * | app-info | Read / Write
char * | app-name | Read / Write
char * | body | Read / Write
char * | category | Read / Write
guint | id | Read / Write
GIcon * | image | Read / Write
gboolean | resident | Read / Write
char * | summary | Read / Write
GDateTime * | timestamp | Read / Write
gboolean | transient | Read / Write
PhoshNotificationUrgency | urgency | Read / Write

## Signals

void | actioned | Run Last
void | closed | Run Last
void | expired | Run Last

## Types and Values

enum | PhoshNotificationUrgency
enum | PhoshNotificationReason
#define | PHOSH_NOTIFICATION_DEFAULT_ACTION
#define | PHOSH_TYPE_NOTIFICATION
struct | PhoshNotificationClass
| PhoshNotification

## Object Hierarchy

        GEnum
        ├── PhoshNotificationReason
        ╰── PhoshNotificationUrgency
        GObject
        ╰── PhoshNotification
            ├── PhoshDBusNotification
            ╰── PhoshMountNotification

## Description

A PhoshNotification with summary, body, icon, actions, etc.

## Functions

### phosh_notification_new ()

    PhoshNotification *
    phosh_notification_new (guint id,
                            const char *app_name,
                            GAppInfo *info,
                            const char *summary,
                            const char *body,
                            GIcon *icon,
                            GIcon *image,
                            PhoshNotificationUrgency urgency,
                            GStrv actions,
                            gboolean transient,
                            gboolean resident,
                            const char *category,
                            GDateTime *timestamp);

### phosh_notification_set_id ()

    void
    phosh_notification_set_id (PhoshNotification *self,
                               guint id);

### phosh_notification_get_id ()

    guint
    phosh_notification_get_id (PhoshNotification *self);

### phosh_notification_set_summary ()

    void
    phosh_notification_set_summary (PhoshNotification *self,
                                    const char *summary);

### phosh_notification_get_summary ()

    const char *
    phosh_notification_get_summary (PhoshNotification *self);

### phosh_notification_set_body ()

    void
    phosh_notification_set_body (PhoshNotification *self,
                                 const char *body);

### phosh_notification_get_body ()

    const char *
    phosh_notification_get_body (PhoshNotification *self);

### phosh_notification_set_app_name ()

    void
    phosh_notification_set_app_name (PhoshNotification *self,
                                     const char *app_name);

### phosh_notification_get_app_name ()

    const char *
    phosh_notification_get_app_name (PhoshNotification *self);

### phosh_notification_get_timestamp ()

    GDateTime *
    phosh_notification_get_timestamp (PhoshNotification *self);

### phosh_notification_set_timestamp ()

    void
    phosh_notification_set_timestamp (PhoshNotification *self,
                                      GDateTime *timestamp);

Sets the timestamp of a notification. If `NULL` is passed it's set to the current date and time.

#### Parameters

self | A PhoshNotification |
timestamp | A timestamp or `NULL`. | [nullable]

### phosh_notification_set_app_icon ()

    void
    phosh_notification_set_app_icon (PhoshNotification *self,
                                     GIcon *icon);

### phosh_notification_get_app_icon ()

    GIcon *
    phosh_notification_get_app_icon (PhoshNotification *self);

### phosh_notification_set_app_info ()

    void
    phosh_notification_set_app_info (PhoshNotification *self,
                                     GAppInfo *info);

### phosh_notification_get_app_info ()

    GAppInfo *
    phosh_notification_get_app_info (PhoshNotification *self);

### phosh_notification_set_image ()

    void
    phosh_notification_set_image (PhoshNotification *self,
                                  GIcon *icon);

### phosh_notification_get_image ()

    GIcon *
    phosh_notification_get_image (PhoshNotification *self);

### phosh_notification_set_urgency ()

    void
    phosh_notification_set_urgency (PhoshNotification *self,
                                    PhoshNotificationUrgency urgency);

### phosh_notification_get_urgency ()

    PhoshNotificationUrgency
    phosh_notification_get_urgency (PhoshNotification *self);

### phosh_notification_set_actions ()

    void
    phosh_notification_set_actions (PhoshNotification *self,
                                    GStrv actions);

### phosh_notification_get_actions ()

    GStrv
    phosh_notification_get_actions (PhoshNotification *self);

#### Parameters

self | The PhoshNotification |

#### Returns

The notification's actions.

[transfer none]

### phosh_notification_set_transient ()

    void
    phosh_notification_set_transient (PhoshNotification *self,
                                      gboolean transient);

Set if `self` should go to the message tray

#### Parameters

self | the PhoshNotification |
transient | if `self` is transient |

### phosh_notification_get_transient ()

    gboolean
    phosh_notification_get_transient (PhoshNotification *self);

Transient notifications don't go to the message tray

#### Parameters

self | the PhoshNotification |

#### Returns

`TRUE` when transient, otherwise `FALSE`

### phosh_notification_set_resident ()

    void
    phosh_notification_set_resident (PhoshNotification *self,
                                     gboolean resident);

Set whether of not invoking actions dismiss `self`

#### Parameters

self | the PhoshNotification |
resident | is the notification resident |

### phosh_notification_get_resident ()

    gboolean
    phosh_notification_get_resident (PhoshNotification *self);

When `TRUE` invoking an action _doesn't_ dismiss the notification

#### Parameters

self | the PhoshNotification |

#### Returns

`TRUE` when resident, otherwise `FALSE`

### phosh_notification_set_category ()

    void
    phosh_notification_set_category (PhoshNotification *self,
                                     const char *category);

Set the type of notification, such as "email.arrived"

#### Parameters

self | the PhoshNotification |
category | the new category |

### phosh_notification_get_category ()

    const char *
    phosh_notification_get_category (PhoshNotification *self);

Get the category hint the notification was sent with

See https://people.gnome.org/~mccann/docs/notification-spec/notification-spec-latest.htmlcategories

#### Parameters

self | the PhoshNotification |

#### Returns

the category or `NULL`

### phosh_notification_activate ()

    void
    phosh_notification_activate (PhoshNotification *self,
                                 const char *action);

### phosh_notification_expires ()

    void
    phosh_notification_expires (PhoshNotification *self,
                                int timeout);

Set `self` to expire after `timeout` (from this call)

Note doesn't close the notification, for that call `phosh_notification_close()` is response to “expired”

#### Parameters

self | the PhoshNotification |
timeout | delay (in milliseconds) |

### phosh_notification_close ()

    void
    phosh_notification_close (PhoshNotification *self,
                              PhoshNotificationReason reason);

#### Parameters

self | the PhoshNotification |
reason | Why the notification is closing |

### phosh_notification_do_action ()

    void
    phosh_notification_do_action (PhoshNotification *notification,
                                  guint id,
                                  const char *action);

## Types and Values

### enum PhoshNotificationUrgency

#### Members

PHOSH_NOTIFICATION_URGENCY_LOW | low urgency |
PHOSH_NOTIFICATION_URGENCY_NORMAL | normal urgency |
PHOSH_NOTIFICATION_URGENCY_CRITICAL | critical urgency |

### enum PhoshNotificationReason

#### Members

PHOSH_NOTIFICATION_REASON_EXPIRED | notification expired |
PHOSH_NOTIFICATION_REASON_DISMISSED | notification was dismissed |
PHOSH_NOTIFICATION_REASON_CLOSED | notification was closed |
PHOSH_NOTIFICATION_REASON_UNDEFINED | undefined reason |

### PHOSH_NOTIFICATION_DEFAULT_ACTION

    #define PHOSH_NOTIFICATION_DEFAULT_ACTION "default"

### PHOSH_TYPE_NOTIFICATION

    #define PHOSH_TYPE_NOTIFICATION (phosh_notification_get_type ())

### struct PhoshNotificationClass

    struct PhoshNotificationClass {
      GObjectClass parent_class;

      void (*do_action)(PhoshNotification *self, guint id, const char *action);
    };

#### Members

`do_action` () | This function allows the notification to implement their own action behaviour instead of the default DBus interface. |

### PhoshNotification

    typedef struct _PhoshNotification PhoshNotification;

## Property Details

### The `“actions”` property

      “actions”                  GStrv

Notification actions.

Owner: PhoshNotification

Flags: Read / Write

### The `“app-icon”` property

      “app-icon”                 GIcon *

Application icon.

Owner: PhoshNotification

Flags: Read / Write

### The `“app-info”` property

      “app-info”                 GAppInfo *

When non-`NULL` this overrides the values of “app-name” and “app-icon” with those from the GAppInfo

Owner: PhoshNotification

Flags: Read / Write

### The `“app-name”` property

      “app-name”                 char *

The applications's name.

Owner: PhoshNotification

Flags: Read / Write

Default value: ""

### The `“body”` property

      “body”                     char *

The notification's body.

Owner: PhoshNotification

Flags: Read / Write

Default value: ""

### The `“category”` property

      “category”                 char *

The notification's category.

Owner: PhoshNotification

Flags: Read / Write

Default value: ""

### The `“id”` property

      “id”                       guint

Notification ID.

Owner: PhoshNotification

Flags: Read / Write

Default value: 0

### The `“image”` property

      “image”                    GIcon *

Notification image.

Owner: PhoshNotification

Flags: Read / Write

### The `“resident”` property

      “resident”                 gboolean

The notification is resident.

Owner: PhoshNotification

Flags: Read / Write

Default value: FALSE

### The `“summary”` property

      “summary”                  char *

The notification's summary.

Owner: PhoshNotification

Flags: Read / Write

Default value: ""

### The `“timestamp”` property

      “timestamp”                GDateTime *

The time that notification came in.

Owner: PhoshNotification

Flags: Read / Write

### The `“transient”` property

      “transient”                gboolean

The notification is transient.

Owner: PhoshNotification

Flags: Read / Write

Default value: FALSE

### The `“urgency”` property

      “urgency”                  PhoshNotificationUrgency

Notification urgency.

Owner: PhoshNotification

Flags: Read / Write

Default value: PHOSH_NOTIFICATION_URGENCY_NORMAL

## Signal Details

### The `“actioned”` signal

    void
    user_function (PhoshNotification *phoshnotification,
                   char              *arg1,
                   gpointer           user_data)

Flags: Run Last

### The `“closed”` signal

    void
    user_function (PhoshNotification      *phoshnotification,
                   PhoshNotificationReason arg1,
                   gpointer                user_data)

Flags: Run Last

### The `“expired”` signal

    void
    user_function (PhoshNotification *phoshnotification,
                   gpointer           user_data)

Flags: Run Last