display warning notification on depricated settings

This commit is contained in:
Sascha Kruse 2012-07-25 06:58:23 +02:00
parent f05e80edf6
commit b06a94c8fc
2 changed files with 11 additions and 11 deletions

20
dunst.c
View File

@ -104,6 +104,9 @@ static enum follow_mode f_mode = FOLLOW_NONE;
int next_notification_id = 1; int next_notification_id = 1;
int depricated_mod = False;
int depricated_dunstrc_shortcuts;
/* notification lists */ /* notification lists */
list *notification_queue = NULL; /* all new notifications get into here */ list *notification_queue = NULL; /* all new notifications get into here */
list *displayed_notifications = NULL; /* currently displayed notifications */ list *displayed_notifications = NULL; /* currently displayed notifications */
@ -1280,8 +1283,7 @@ void parse_cmdline(int argc, char *argv[])
format = optarg; format = optarg;
break; break;
case 'M': case 'M':
fprintf(stderr, depricated_mod = True;
"-mod is depricated. Use \"-key mod+key\" instead\n");
mod = string_to_mask(optarg); mod = string_to_mask(optarg);
close_ks.mask = mod; close_ks.mask = mod;
close_all_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) else if (strcmp(name, "geometry") == 0)
geom = dunst_ini_get_string(value); geom = dunst_ini_get_string(value);
else if (strcmp(name, "modifier") == 0) { else if (strcmp(name, "modifier") == 0) {
fprintf(stderr, depricated_dunstrc_shortcuts = True;
"WARNING: Keyboard Shortcuts in [global] are depricated. See example dunstrc for new [shortcuts] section\n");
KeySym mod = KeySym mod =
string_to_mask(dunst_ini_get_string(value)); 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; close_all_ks.mask = mod;
history_ks.mask = mod; history_ks.mask = mod;
} else if (strcmp(name, "key") == 0) { } 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); close_ks.str = dunst_ini_get_string(value);
} else if (strcmp(name, "all_key") == 0) { } 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); close_all_ks.str = dunst_ini_get_string(value);
} else if (strcmp(name, "history_key") == 0) { } 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); history_ks.str = dunst_ini_get_string(value);
} else if (strcmp(name, "alignment") == 0) { } else if (strcmp(name, "alignment") == 0) {
@ -1589,6 +1584,11 @@ int main(int argc, char *argv[])
color_strings[ColBG][CRIT] = critbgcolor; color_strings[ColBG][CRIT] = critbgcolor;
setup(); 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(); run();
return 0; return 0;
} }

View File

@ -256,7 +256,7 @@ void notificationClosed(notification * n, int reason)
DBusMessageIter args; DBusMessageIter args;
int id; int id;
if (n == NULL) { if (n == NULL || n->dbus_client == NULL) {
return; return;
} }