int main(void) { const char *path = "/home/netstar"; notify_t *notify = notify_new(); notify_path_set(notify, path); notify_event_callback_set(notify, NOTIFY_EVENT_CALLBACK_FILE_ADD, _change_cb, NULL); notify_event_callback_set(notify, NOTIFY_EVENT_CALLBACK_FILE_DEL, _change_cb, NULL); notify_event_callback_set(notify, NOTIFY_EVENT_CALLBACK_FILE_MOD, _change_cb, NULL); notify_event_callback_set(notify, NOTIFY_EVENT_CALLBACK_DIR_ADD, _change_cb, NULL); notify_event_callback_set(notify, NOTIFY_EVENT_CALLBACK_DIR_DEL, _change_cb, NULL); notify_event_callback_set(notify, NOTIFY_EVENT_CALLBACK_DIR_MOD, _change_cb, NULL); int res = notify_background_run(notify); if (res) { fprintf(stderr, "failed to put notify into the background!"); exit(EXIT_FAILURE); } for (int i = 0; i < 20; i++) { sleep(1); printf("other code!\n"); } notify_stop_wait(notify); notify_free(notify); return EXIT_SUCCESS; }
GtkWidget* popup_notifier_notify( const gchar *caption, const gchar *text, GtkWidget* parent, GCallback click_cb, gpointer click_cb_data) { if (! notifier_initialized) return NULL; if (text && *text) return notify_new( caption, text, parent, click_cb, click_cb_data); return NULL; }