From f05e80edf6df916ad4bc6d3df4fd29847f774105 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Wed, 25 Jul 2012 06:57:52 +0200 Subject: [PATCH] new function: warn(...) --- dunst.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/dunst.c b/dunst.c index 36bc149..79fddda 100644 --- a/dunst.c +++ b/dunst.c @@ -133,6 +133,7 @@ void draw_win(void); void hide_win(void); void move_all_to_history(void); void print_version(void); +void warn(const char * text, int urg); void init_shortcut(keyboard_shortcut * shortcut); KeySym string_to_mask(char *str); @@ -143,6 +144,28 @@ void die(char *text, int exit_value) exit(exit_value); } +void warn(const char *text, int urg) +{ + notification *n = malloc(sizeof(notification)); + + if (n == NULL) + die("Unable to allocate memory", EXIT_FAILURE); + + n->appname = "dunst"; + n->summary = strdup(text); + if (n->summary == NULL) + die("Unable to allocate memory", EXIT_FAILURE); + n->body = ""; + n->icon = ""; + n->timeout = 0; + n->urgency = urg; + n->dbus_client = NULL; + n->color_strings[ColFG] = NULL; + n->color_strings[ColBG] = NULL; + init_notification(n, 0); + map_win(); +} + int cmp_notification(void *a, void *b) { if (a == NULL && b == NULL)