Close down the menu when losing dhcpcd connection in dhcpcd-gtk.
authorRoy Marples <roy@marples.name>
Thu, 18 Sep 2014 12:00:03 +0000 (12:00 +0000)
committerRoy Marples <roy@marples.name>
Thu, 18 Sep 2014 12:00:03 +0000 (12:00 +0000)
Don't close down the about screen when losing dhcpcd connection in dhcpcd-qt.

src/dhcpcd-gtk/dhcpcd-gtk.h
src/dhcpcd-gtk/main.c
src/dhcpcd-gtk/menu.c
src/dhcpcd-qt/dhcpcd-qt.cpp

index 8f771b94c77408cf4334d387967a12bfbae05024..df48627c90f0e6b9ec0e9243d3bd32902f9f13bc 100644 (file)
@@ -63,6 +63,7 @@ void notify_close(void);
 
 void dhcpcd_prefs_show(DHCPCD_CONNECTION *con);
 void dhcpcd_prefs_abort(void);
+void dhcpcd_menu_abort(void);
 
 bool wpa_configure(DHCPCD_WPA *, DHCPCD_WI_SCAN *);
 
index 5b9d8abf8d1bff1d84b9fd9981273afe5117c4a3..2da08c6446831c0e8655384da709d24071aa66c8 100644 (file)
@@ -342,6 +342,7 @@ dhcpcd_status_cb(DHCPCD_CONNECTION *con, const char *status,
                    "network-offline");
                gtk_status_icon_set_tooltip_text(status_icon, msg);
                dhcpcd_prefs_abort();
+               dhcpcd_menu_abort();
                while (wi_scans) {
                        w = wi_scans->next;
                        dhcpcd_wi_scans_free(wi_scans->scans);
index 2216ca01748b77c3573925eab80f8b19a0a1a319..4c7bf1dca0801b9fc4c29cb51edc5d957c305480 100644 (file)
@@ -199,6 +199,16 @@ add_scans(WI_SCAN *scan)
        return menu;
 }
 
+void
+dhcpcd_menu_abort(void)
+{
+
+       if (menu != NULL) {
+               gtk_widget_destroy(menu);
+               menu = NULL;
+       }
+}
+
 static void
 on_activate(GtkStatusIcon *icon)
 {
index 4be2b4df27ca8b428e85130897ed6b267ef3d3da..6cb9d9a9acad2a9a1acdd137edddaa34b30ec8f2 100644 (file)
@@ -200,10 +200,6 @@ void DhcpcdQt::statusCallback(const char *status)
                        delete ssidMenu;
                        ssidMenu = NULL;
                }
-               if (about) {
-                       delete about;
-                       about = NULL;
-               }
                if (preferences) {
                        delete preferences;
                        preferences = NULL;