new function: warn(...)
This commit is contained in:
parent
03411ac365
commit
f05e80edf6
23
dunst.c
23
dunst.c
@ -133,6 +133,7 @@ void draw_win(void);
|
|||||||
void hide_win(void);
|
void hide_win(void);
|
||||||
void move_all_to_history(void);
|
void move_all_to_history(void);
|
||||||
void print_version(void);
|
void print_version(void);
|
||||||
|
void warn(const char * text, int urg);
|
||||||
|
|
||||||
void init_shortcut(keyboard_shortcut * shortcut);
|
void init_shortcut(keyboard_shortcut * shortcut);
|
||||||
KeySym string_to_mask(char *str);
|
KeySym string_to_mask(char *str);
|
||||||
@ -143,6 +144,28 @@ void die(char *text, int exit_value)
|
|||||||
exit(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)
|
int cmp_notification(void *a, void *b)
|
||||||
{
|
{
|
||||||
if (a == NULL && b == NULL)
|
if (a == NULL && b == NULL)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user