[gnome-settings-daemon/gnome-3-6] print-notifications: Don't show strange notifications when printing



commit e2621fe77c295850aff3b26dad422e7ed05e3d43
Author: Marek Kasik <mkasik redhat com>
Date:   Wed Dec 5 15:54:07 2012 +0100

    print-notifications: Don't show strange notifications when printing
    
    Don't show notifications for:
    - cups-remote-*
    - other
    - com.apple.print.recoverable
    printer state reasons.
    
    "cups-remote-*" are not real errors:
    https://bugzilla.redhat.com/show_bug.cgi?id=883401
    https://bugzilla.gnome.org/show_bug.cgi?id=683577
    
    "other" can be emitted for no reason:
    https://bugzilla.redhat.com/show_bug.cgi?id=520815
    
    "com.apple.print.recoverable" is for internal use only.

 .../gsd-print-notifications-manager.c              |   17 ++++++++++++++++-
 1 files changed, 16 insertions(+), 1 deletions(-)
---
diff --git a/plugins/print-notifications/gsd-print-notifications-manager.c b/plugins/print-notifications/gsd-print-notifications-manager.c
index 482a528..c191e5c 100644
--- a/plugins/print-notifications/gsd-print-notifications-manager.c
+++ b/plugins/print-notifications/gsd-print-notifications-manager.c
@@ -262,6 +262,20 @@ show_notification (gpointer user_data)
         return FALSE;
 }
 
+static gboolean
+reason_is_blacklisted (const gchar *reason) {
+        if (g_str_equal (reason, "none"))
+                return TRUE;
+        if (g_str_equal (reason, "other"))
+                return TRUE;
+        if (g_str_equal (reason, "com.apple.print.recoverable"))
+                return TRUE;
+        /* https://bugzilla.redhat.com/show_bug.cgi?id=883401 */
+        if (g_str_has_prefix (reason, "cups-remote-"))
+                return TRUE;
+        return FALSE;
+}
+
 static void
 on_cups_notification (GDBusConnection *connection,
                       const char      *sender_name,
@@ -683,7 +697,8 @@ on_cups_notification (GDBusConnection *connection,
                                         }
                                 }
 
-                                if (!known_reason && !g_str_equal (data, "none")) {
+                                if (!known_reason &&
+                                    !reason_is_blacklisted (data)) {
                                         NotifyNotification *notification;
                                         ReasonData         *reason_data;
                                         gchar              *first_row;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]