From b06a94c8fc5db4370dc035243ad257a27e853806 Mon Sep 17 00:00:00 2001 From: Sascha Kruse Date: Wed, 25 Jul 2012 06:58:23 +0200 Subject: [PATCH] display warning notification on depricated settings --- dunst.c | 20 ++++++++++---------- dunst_dbus.c | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/dunst.c b/dunst.c index 79fddda..d97368d 100644 --- a/dunst.c +++ b/dunst.c @@ -104,6 +104,9 @@ static enum follow_mode f_mode = FOLLOW_NONE; int next_notification_id = 1; +int depricated_mod = False; +int depricated_dunstrc_shortcuts; + /* notification lists */ list *notification_queue = NULL; /* all new notifications get into here */ list *displayed_notifications = NULL; /* currently displayed notifications */ @@ -1280,8 +1283,7 @@ void parse_cmdline(int argc, char *argv[]) format = optarg; break; case 'M': - fprintf(stderr, - "-mod is depricated. Use \"-key mod+key\" instead\n"); + depricated_mod = True; mod = string_to_mask(optarg); close_ks.mask = mod; close_all_ks.mask = mod; @@ -1401,8 +1403,7 @@ dunst_ini_handle(void *user_data, const char *section, else if (strcmp(name, "geometry") == 0) geom = dunst_ini_get_string(value); else if (strcmp(name, "modifier") == 0) { - fprintf(stderr, - "WARNING: Keyboard Shortcuts in [global] are depricated. See example dunstrc for new [shortcuts] section\n"); + depricated_dunstrc_shortcuts = True; KeySym mod = string_to_mask(dunst_ini_get_string(value)); @@ -1410,16 +1411,10 @@ dunst_ini_handle(void *user_data, const char *section, close_all_ks.mask = mod; history_ks.mask = mod; } else if (strcmp(name, "key") == 0) { - fprintf(stderr, - "WARNING: Keyboard Shortcuts in [global] are depricated. See example dunstrc for new [shortcuts] section\n"); close_ks.str = dunst_ini_get_string(value); } else if (strcmp(name, "all_key") == 0) { - fprintf(stderr, - "WARNING: Keyboard Shortcuts in [global] are depricated. See example dunstrc for new [shortcuts] section\n"); close_all_ks.str = dunst_ini_get_string(value); } else if (strcmp(name, "history_key") == 0) { - fprintf(stderr, - "WARNING: Keyboard Shortcuts in [global] are depricated. See example dunstrc for new [shortcuts] section\n"); history_ks.str = dunst_ini_get_string(value); } else if (strcmp(name, "alignment") == 0) { @@ -1589,6 +1584,11 @@ int main(int argc, char *argv[]) color_strings[ColBG][CRIT] = critbgcolor; setup(); + + if (depricated_mod) + warn("-mod is depricated. Use \"-key mod+key\" instead\n", CRIT); + if (depricated_dunstrc_shortcuts) + warn("You are using depricated settings. Please update your dunstrc. SEE [shortcuts]",CRIT); run(); return 0; } diff --git a/dunst_dbus.c b/dunst_dbus.c index a85e597..c1837f8 100644 --- a/dunst_dbus.c +++ b/dunst_dbus.c @@ -256,7 +256,7 @@ void notificationClosed(notification * n, int reason) DBusMessageIter args; int id; - if (n == NULL) { + if (n == NULL || n->dbus_client == NULL) { return; }