diff options
author | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-21 12:53:43 +0200 |
---|---|---|
committer | Sergey Poznyakoff <gray@gnu.org.ua> | 2009-02-21 12:53:43 +0200 |
commit | 12fd740c530106f4a74c5ff2c6ce6d0ea305ab70 (patch) | |
tree | 6064e3770a3fa4210443cfc9f8cd390b932aee94 /src/config.c | |
parent | 62758ace16e756050f15b81e66ee5ab3bdd062ab (diff) | |
download | wydawca-12fd740c530106f4a74c5ff2c6ce6d0ea305ab70.tar.gz wydawca-12fd740c530106f4a74c5ff2c6ce6d0ea305ab70.tar.bz2 |
Implement per-directory notifications
* src/config.c (default_notification): New static.
(cb_notify_event): Explicitly link new notification to the chain.
(directory_kw): New keyword "notify-event".
(cb_directory): Use previously defined global notifications.
* src/mail.c (register_notification): Remove.
(notify): Tak a list of notifications to run as an argument.
* src/directive.c, src/gpg.c, src/verify.c: Update calls to notify.
* src/wydawca.h (struct directory_pair.notification): New member.
* tests/notify-upl.at: Define notifications before the directory pair in
the configuration file.
Diffstat (limited to 'src/config.c')
-rw-r--r-- | src/config.c | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/src/config.c b/src/config.c index d2b0154..61cf324 100644 --- a/src/config.c +++ b/src/config.c @@ -27,6 +27,7 @@ static struct archive_descr default_archive_descr = { }; static struct access_method *default_access_method[access_method_count]; +static struct notification *default_notification = NULL; /* safe_file_name: convert a file name possibly containig relative @@ -896,9 +897,12 @@ cb_notify_event (enum gconf_callback_command cmd, if (!ntf->msg) gconf_error (locus, 0, _("missing message definition")); else - /* FIXME: check ev and tgt? */ - register_notification (ntf); - free (ntf); + { + struct notification **p = (struct notification **) varptr; + ntf->next = *p; + *p = ntf; + /* FIXME: check ev and tgt? */ + } break; case gconf_callback_set_value: @@ -1101,6 +1105,10 @@ static struct gconf_keyword directory_kw[] = { { "archive", N_("type: string"), N_("Set up archivation"), gconf_type_section, NULL, offsetof(struct directory_pair, archive), cb_archive, NULL, archive_kw }, + { "notify-event", NULL, N_("Configure notification"), + gconf_type_section, NULL, offsetof(struct directory_pair, notification), + cb_notify_event, NULL, notify_event_kw }, + { NULL } }; @@ -1164,6 +1172,9 @@ cb_directory (enum gconf_callback_command cmd, gconf_error (locus, 0, _("Sorry, method type `external' is not yet supported")); } + + if (!dpair->notification) + dpair->notification = default_notification; register_directory_pair (dpair); free (dpair); @@ -1219,7 +1230,8 @@ static struct gconf_keyword wydawca_kw[] = { gconf_type_section, NULL, 0, NULL, NULL, mail_statistics_kw }, { "notify-event", NULL, N_("Configure notification"), - gconf_type_section, NULL, 0, cb_notify_event, NULL, notify_event_kw }, + gconf_type_section, &default_notification, 0, + cb_notify_event, NULL, notify_event_kw }, { "access-method", N_("ident"), N_("Define access method"), gconf_type_section, default_access_method, 0, |