Logo Search packages:      
Sourcecode: libnotify version File versions  Download package

void notify_notification_add_action ( NotifyNotification *  notification,
const char *  action,
const char *  label,
NotifyActionCallback  callback,
gpointer  user_data,
GFreeFunc  free_func 
)

notify_notification_add_action: : The notification. : The action ID. : The human-readable action label. : The action's callback function. : Optional custom data to pass to . : An optional function to free when the notification is destroyed.

Adds an action to a notification. When the action is invoked, the specified callback function will be called, along with the value passed to .

Definition at line 1173 of file notification.c.

{
      NotifyNotificationPrivate *priv;
      CallbackPair *pair;

      g_return_if_fail(notification != NULL);
      g_return_if_fail(NOTIFY_IS_NOTIFICATION(notification));
      g_return_if_fail(action != NULL && *action != '\0');
      g_return_if_fail(label != NULL && *label != '\0');
      g_return_if_fail(callback != NULL);

      priv = notification->priv;

      priv->actions = g_slist_append(priv->actions, g_strdup(action));
      priv->actions = g_slist_append(priv->actions, g_strdup(label));

      pair = g_new0(CallbackPair, 1);
      pair->cb = callback;
      pair->user_data = user_data;
      g_hash_table_insert(priv->action_map, g_strdup(action), pair);

      if (notification->priv->has_nondefault_actions &&
            g_ascii_strcasecmp(action, "default"))
      {
            notification->priv->has_nondefault_actions = TRUE;
      }
}


Generated by  Doxygen 1.6.0   Back to index