/** * g_notification_add_button_with_target_value: (rename-to g_notification_add_button_with_target) * @notification: a #GNotification * @label: label of the button * @action: an action name * @target: (allow-none): a #GVariant to use as @action's parameter, or %NULL * * Adds a button to @notification that activates @action when clicked. * @action must be an application-wide action (it must start with "app."). * * If @target is non-%NULL, @action will be activated with @target as * its parameter. * * Since: 2.40 */ void g_notification_add_button_with_target_value (GNotification *notification, const gchar *label, const gchar *action, GVariant *target) { Button *button; g_return_if_fail (G_IS_NOTIFICATION (notification)); g_return_if_fail (label != NULL); g_return_if_fail (action != NULL && g_action_name_is_valid (action)); if (!g_str_has_prefix (action, "app.")) { g_warning ("%s: action '%s' does not start with 'app.'." "This is unlikely to work properly.", G_STRFUNC, action); } button = g_slice_new0 (Button); button->label = g_strdup (label); button->action_name = g_strdup (action); if (target) button->target = g_variant_ref_sink (target); g_ptr_array_add (notification->buttons, button); }
/*< private > * g_notification_get_icon: * @notification: a #GNotification * * Gets the icon currently set on @notification. * * Returns: (transfer none): the icon associated with @notification * * Since: 2.40 */ GIcon * g_notification_get_icon (GNotification *notification) { g_return_val_if_fail (G_IS_NOTIFICATION (notification), NULL); return notification->icon; }
/*< private > * g_notification_get_priority: * @notification: a #GNotification * * Returns the priority of @notification * * Since: 2.42 */ GNotificationPriority g_notification_get_priority (GNotification *notification) { g_return_val_if_fail (G_IS_NOTIFICATION (notification), G_NOTIFICATION_PRIORITY_NORMAL); return notification->priority; }
/*< private > * g_notification_get_body: * @notification: a #GNotification * * Gets the current body of @notification. * * Returns: (allow-none): the body of @notification * * Since: 2.40 */ const gchar * g_notification_get_body (GNotification *notification) { g_return_val_if_fail (G_IS_NOTIFICATION (notification), NULL); return notification->body; }
/** * g_notification_set_priority: * @notification: a #GNotification * @priority: a #GNotificationPriority * * Sets the priority of @notification to @priority. See * #GNotificationPriority for possible values. */ void g_notification_set_priority (GNotification *notification, GNotificationPriority priority) { g_return_if_fail (G_IS_NOTIFICATION (notification)); notification->priority = priority; }
/** * g_notification_set_urgent: * @notification: a #GNotification * @urgent: %TRUE if @notification is urgent * * Deprecated in favor of g_notification_set_priority(). * * Since: 2.40 */ void g_notification_set_urgent (GNotification *notification, gboolean urgent) { g_return_if_fail (G_IS_NOTIFICATION (notification)); g_notification_set_priority (notification, G_NOTIFICATION_PRIORITY_URGENT); }
void g_notification_backend_send_notification (GNotificationBackend *backend, const gchar *id, GNotification *notification) { g_return_if_fail (G_IS_NOTIFICATION_BACKEND (backend)); g_return_if_fail (G_IS_NOTIFICATION (notification)); G_NOTIFICATION_BACKEND_GET_CLASS (backend)->send_notification (backend, id, notification); }
/** * g_notification_set_icon: * @notification: a #GNotification * @icon: the icon to be shown in @notification, as a #GIcon * * Sets the icon of @notification to @icon. * * Since: 2.40 */ void g_notification_set_icon (GNotification *notification, GIcon *icon) { g_return_if_fail (G_IS_NOTIFICATION (notification)); if (notification->icon) g_object_unref (notification->icon); notification->icon = g_object_ref (icon); }
/** * g_notification_set_body: * @notification: a #GNotification * @body: (allow-none): the new body for @notification, or %NULL * * Sets the body of @notification to @body. * * Since: 2.40 */ void g_notification_set_body (GNotification *notification, const gchar *body) { g_return_if_fail (G_IS_NOTIFICATION (notification)); g_return_if_fail (body != NULL); g_free (notification->body); notification->body = g_strdup (body); }
/** * g_notification_set_title: * @notification: a #GNotification * @title: the new title for @notification * * Sets the title of @notification to @title. * * Since: 2.40 */ void g_notification_set_title (GNotification *notification, const gchar *title) { g_return_if_fail (G_IS_NOTIFICATION (notification)); g_return_if_fail (title != NULL); g_free (notification->title); notification->title = g_strdup (title); }
/** * g_notification_set_default_action_and_target_value: (rename-to g_notification_set_default_action_and_target) * @notification: a #GNotification * @action: an action name * @target: (allow-none): a #GVariant to use as @action's parameter, or %NULL * * Sets the default action of @notification to @action. This action is * activated when the notification is clicked on. It must be an * application-wide action (start with "app."). * * If @target is non-%NULL, @action will be activated with @target as * its parameter. * * When no default action is set, the application that the notification * was sent on is activated. * * Since: 2.40 */ void g_notification_set_default_action_and_target_value (GNotification *notification, const gchar *action, GVariant *target) { g_return_if_fail (G_IS_NOTIFICATION (notification)); g_return_if_fail (action != NULL && g_action_name_is_valid (action)); if (!g_str_has_prefix (action, "app.")) { g_warning ("%s: action '%s' does not start with 'app.'." "This is unlikely to work properly.", G_STRFUNC, action); } g_free (notification->default_action); g_clear_pointer (¬ification->default_action_target, g_variant_unref); notification->default_action = g_strdup (action); if (target) notification->default_action_target = g_variant_ref_sink (target); }