void setNotificationHints() { if (notification) { notify_notification_clear_hints(NOTIFY_NOTIFICATION(notification)); if (!hints.isEmpty()) { QMapIterator<QString, QVariant> iterator(hints); while (iterator.hasNext()) { iterator.next(); switch (iterator.value().type()) { case QVariant::Int: case QVariant::Double: notify_notification_set_hint_int32(NOTIFY_NOTIFICATION(notification), QGSTRING(iterator.key()), iterator.value().toInt()); break; default: notify_notification_set_hint_string(NOTIFY_NOTIFICATION(notification), QGSTRING(iterator.key()), QGSTRING(iterator.value().toString())); break; } } } } }
void hideNotification() { showOnInit = false; if ((notification) && (isVisible) && (notify_notification_close(NOTIFY_NOTIFICATION(notification), NULL))) { isRejectable = false; } }
/** * notify_uninit: * * Uninitialized libmatenotify. * * This should be called when the program no longer needs libmatenotify for * the rest of its lifecycle, typically just before exitting. */ void notify_uninit (void) { GList *l; if (!_initted) { return; } if (_app_name != NULL) { g_free (_app_name); _app_name = NULL; } for (l = _active_notifications; l != NULL; l = l->next) { NotifyNotification *n = NOTIFY_NOTIFICATION (l->data); if (_notify_notification_get_timeout (n) == 0 || _notify_notification_has_nondefault_actions (n)) { notify_notification_close (n, NULL); } } g_object_unref (_proxy); _initted = FALSE; }
static void on_exposed(GtkWidget *widget, GdkEventExpose *ev, void *user_data) { NotifyNotification *n = NOTIFY_NOTIFICATION(user_data); g_signal_handlers_disconnect_by_func(widget, on_exposed, user_data); notify_notification_show(n, NULL); }
static void lbi_notification_parent_weak_notify(gpointer data, GObject * parent) { NotifyNotification *note = NOTIFY_NOTIFICATION(data); g_signal_handlers_disconnect_by_func(note, lbi_notification_closed_cb, parent); notify_notification_close(note, NULL); g_object_unref(note); }
void showNotification() { showOnInit = true; if ((notification) && (!isVisible) && (notify_notification_show(NOTIFY_NOTIFICATION(notification), NULL))) { Q_Q(QchNotification); isRejectable = true; isVisible = true; emit q->visibleChanged(); } }
static void on_clicked(GtkButton *button, void *user_data) { gchar *buf; NotifyNotification *n = NOTIFY_NOTIFICATION(user_data); count++; buf = g_strdup_printf("You clicked the button %i times", count); notify_notification_update(n, "Widget Attachment Test", buf, NULL); g_free(buf); notify_notification_show(n, NULL); }
void init() { if (!notify_is_initted()) { notify_init(QGSTRING(QCoreApplication::applicationName())); } Q_Q(QchNotification); notification = hildon_notification_new(QGSTRING(title), QGSTRING(text), QGSTRING(iconSource), NULL); notify_notification_add_action(NOTIFY_NOTIFICATION(notification), "default", QGSTRING(QCoreApplication::applicationName()), NOTIFY_ACTION_CALLBACK(onNotificationClicked), q, NULL); g_signal_connect(G_OBJECT(notification), "closed", G_CALLBACK(onNotificationClosed), q); setNotificationCategory(); setNotificationHints(); setNotificationSound(); setNotificationTimeout(); if (showOnInit) { showNotification(); } }
void setNotificationCategory() { if (notification) { notify_notification_set_category(NOTIFY_NOTIFICATION(notification), QGSTRING(category)); } }
void updateNotification() { if (notification) { notify_notification_update(NOTIFY_NOTIFICATION(notification), QGSTRING(title), QGSTRING(text), QGSTRING(iconSource)); } }
void setNotificationTimeout() { if (notification) { notify_notification_set_timeout(NOTIFY_NOTIFICATION(notification), timeout); } }