Don't popup a menu if no scan results.
authorRoy Marples <roy@marples.name>
Wed, 11 Feb 2009 00:06:55 +0000 (00:06 +0000)
committerRoy Marples <roy@marples.name>
Wed, 11 Feb 2009 00:06:55 +0000 (00:06 +0000)
menu.c

diff --git a/menu.c b/menu.c
index fe5ce9637603cfa431aec9abeb88cc440acb94af..a826c9f34fe6d6d6cdd7a41a8cc3a7ff5844fdee 100644 (file)
--- a/menu.c
+++ b/menu.c
@@ -150,18 +150,21 @@ on_activate(GtkStatusIcon *icon, _unused guint button, _unused guint32 atime, _u
        GtkMenu *menu;
        const struct if_msg *ifm;
        GList *gl;
-       size_t n;
+       size_t n, na;
 
        notify_close();
 
-       n = 0;
+       n = na =0;
        for (gl = interfaces; gl; gl = gl->next) {
                ifm = (const struct if_msg *)gl->data;
-               if (ifm->wireless)
-                       if (++n > 1)
+               if (ifm->wireless) {
+                       if (ifm->scan_results != NULL)
+                               ++na;
+                       if (++n > 1 && na != 0)
                                break;
+               }
        }
-       if (n == 0)
+       if (n == 0 || (n == 1 && na == 0))
                return;
 
        menu = (GtkMenu *)gtk_menu_new();