diff options
author | Zdenek Dohnal <zdohnal@redhat.com> | 2020-06-23 13:52:31 +0200 |
---|---|---|
committer | Zdenek Dohnal <zdohnal@redhat.com> | 2020-06-23 13:52:31 +0200 |
commit | 5574f6ee1ce9a45b96ea9da6ec33b55b6dd9a37d (patch) | |
tree | 760606f2b60408946030a0fab34a652432a8c514 /plugins | |
parent | b94e05894b4d8719831f9f454dfe3ae1073e4f4f (diff) | |
download | gnome-settings-daemon-5574f6ee1ce9a45b96ea9da6ec33b55b6dd9a37d.tar.gz |
Ignore 'Printer-added' notifications for queues created by cups-browsed
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/print-notifications/gsd-print-notifications-manager.c | 31 |
1 files changed, 30 insertions, 1 deletions
diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c b/plugins/print-notifications/gsd-print-notifications-manager.c index 395fdd7c..4e0b3ab1 100644 --- a/plugins/print-notifications/gsd-print-notifications-manager.c +++ b/plugins/print-notifications/gsd-print-notifications-manager.c @@ -147,6 +147,34 @@ get_dest_attr (const char *dest_name, } static gboolean +is_cupsbrowsed_dest (const char *name) +{ + const char *val = NULL; + gboolean is_cupsbrowsed = FALSE; + cups_dest_t *found_dest = NULL; + + found_dest = cupsGetNamedDest (CUPS_HTTP_DEFAULT, name, NULL); + if (found_dest == NULL) { + goto out; + } + + val = cupsGetOption ("cups-browsed", found_dest->num_options, found_dest->options); + if (val == NULL) { + goto out; + } + + if (g_str_equal (val, "yes") || g_str_equal (val, "on") || g_str_equal (val, "true")) { + is_cupsbrowsed = TRUE; + } +out: + if (found_dest != NULL) { + cupsFreeDests (1, found_dest); + } + + return is_cupsbrowsed; +} + +static gboolean is_local_dest (const char *name, cups_dest_t *dests, int num_dests) @@ -665,7 +693,8 @@ process_cups_notification (GsdPrintNotificationsManager *manager, if (is_local_dest (printer_name, manager->dests, - manager->num_dests)) { + manager->num_dests) && + !is_cupsbrowsed_dest (printer_name)) { /* Translators: New printer has been added */ primary_text = g_strdup (_("Printer added")); secondary_text = g_strdup (printer_name); |