Notification: Add NotifyClosedReason enum to define closed reasons
We don't change the formal type of notify_notification_get_closed_reason but it's safe enough to compare the two returned values.
This commit is contained in:
parent
cc30d8b8dd
commit
9e9cb423b9
|
@ -4,6 +4,7 @@ NOTIFY_EXPIRES_DEFAULT
|
|||
NOTIFY_EXPIRES_NEVER
|
||||
<TITLE>NotifyNotification</TITLE>
|
||||
NotifyNotification
|
||||
NotifyClosedReason
|
||||
NotifyUrgency
|
||||
NotifyActionCallback
|
||||
NOTIFY_ACTION_CALLBACK
|
||||
|
|
|
@ -234,9 +234,9 @@ notify_notification_class_init (NotifyNotificationClass *klass)
|
|||
g_param_spec_int ("closed-reason",
|
||||
"Closed Reason",
|
||||
"The reason code for why the notification was closed",
|
||||
-1,
|
||||
NOTIFY_CLOSED_REASON_UNSET,
|
||||
G_MAXINT32,
|
||||
-1,
|
||||
NOTIFY_CLOSED_REASON_UNSET,
|
||||
G_PARAM_READABLE
|
||||
| G_PARAM_STATIC_NAME
|
||||
| G_PARAM_STATIC_NICK
|
||||
|
@ -357,7 +357,7 @@ notify_notification_init (NotifyNotification *obj)
|
|||
{
|
||||
obj->priv = g_new0 (NotifyNotificationPrivate, 1);
|
||||
obj->priv->timeout = NOTIFY_EXPIRES_DEFAULT;
|
||||
obj->priv->closed_reason = -1;
|
||||
obj->priv->closed_reason = NOTIFY_CLOSED_REASON_UNSET;
|
||||
obj->priv->hints = g_hash_table_new_full (g_str_hash,
|
||||
g_str_equal,
|
||||
g_free,
|
||||
|
@ -1361,13 +1361,17 @@ notify_notification_close (NotifyNotification *notification,
|
|||
* Returns the closed reason code for the notification. This is valid only
|
||||
* after the "closed" signal is emitted.
|
||||
*
|
||||
* Returns: The closed reason code.
|
||||
* Since version 0.8.0 the returned value is of type #NotifyClosedReason.
|
||||
*
|
||||
* Returns: An integer representing the closed reason code
|
||||
* (Since 0.8.0 it's also a #NotifyClosedReason).
|
||||
*/
|
||||
gint
|
||||
notify_notification_get_closed_reason (const NotifyNotification *notification)
|
||||
{
|
||||
g_return_val_if_fail (notification != NULL, -1);
|
||||
g_return_val_if_fail (NOTIFY_IS_NOTIFICATION (notification), -1);
|
||||
g_return_val_if_fail (notification != NULL, NOTIFY_CLOSED_REASON_UNSET);
|
||||
g_return_val_if_fail (NOTIFY_IS_NOTIFICATION (notification),
|
||||
NOTIFY_CLOSED_REASON_UNSET);
|
||||
|
||||
return notification->priv->closed_reason;
|
||||
}
|
||||
|
|
|
@ -93,6 +93,29 @@ typedef enum
|
|||
|
||||
} NotifyUrgency;
|
||||
|
||||
|
||||
/**
|
||||
* NotifyClosedReason:
|
||||
* @NOTIFY_CLOSED_REASON_UNSET: Notification not closed.
|
||||
* @NOTIFY_CLOSED_REASON_EXPIRED: Timeout has expired.
|
||||
* @NOTIFY_CLOSED_REASON_DISMISSED: It has been dismissed by the user.
|
||||
* @NOTIFY_CLOSED_REASON_API_REQUEST: It has been closed by a call to
|
||||
* notify_notification_close().
|
||||
* @NOTIFY_CLOSED_REASON_UNDEFIEND: Closed by undefined/reserved reasons.
|
||||
*
|
||||
* The reason for which the notification has been closed.
|
||||
*
|
||||
* Since: 0.8.0
|
||||
*/
|
||||
typedef enum
|
||||
{
|
||||
NOTIFY_CLOSED_REASON_UNSET = -1,
|
||||
NOTIFY_CLOSED_REASON_EXPIRED = 1,
|
||||
NOTIFY_CLOSED_REASON_DISMISSED = 2,
|
||||
NOTIFY_CLOSED_REASON_API_REQUEST = 3,
|
||||
NOTIFY_CLOSED_REASON_UNDEFIEND = 4,
|
||||
} NotifyClosedReason;
|
||||
|
||||
/**
|
||||
* NotifyActionCallback:
|
||||
* @notification: a #NotifyActionCallback notification
|
||||
|
|
Loading…
Reference in New Issue