Don't spam the last message if the same.
authorRoy Marples <roy@marples.name>
Tue, 12 Oct 2010 10:58:35 +0000 (10:58 +0000)
committerRoy Marples <roy@marples.name>
Tue, 12 Oct 2010 10:58:35 +0000 (10:58 +0000)
src/dhcpcd-gtk/main.c

index 9734ad50e152675f51a7dbe9c44f09ed833e2bf7..222ef5c450a43088b59a99e63bc2ddc1320189da 100644 (file)
@@ -177,6 +177,8 @@ notify_close(void)
 }
 
 #ifdef NOTIFY
+static char *notify_last_msg;
+
 static void
 notify_closed(void)
 {
@@ -188,6 +190,14 @@ notify(const char *title, const char *msg, const char *icon)
 {
        char **msgs, **m;
 
+       /* Don't spam the same message */
+       if (notify_last_msg) {
+               if (strcmp(msg, notify_last_msg) == 0)
+                       return;
+               g_free(notify_last_msg);
+       }
+       notify_last_msg = g_strdup(msg);
+
        msgs = g_strsplit(msg, "\n", 0);
        for (m = msgs; *m; m++)
                g_message("%s", *m);