--- cc-online-accounts-panel.c	2012-11-29 18:12:03.000000000 +0200
+++ new_panel.c	2012-11-29 18:13:42.000000000 +0200
@@ -21,7 +21,7 @@
  */
 
 #include "config.h"
-
+#include <gio/gio.h>
 #include <string.h>
 #include <glib/gi18n-lib.h>
 
@@ -52,6 +52,7 @@
   GtkWidget *toolbar_remove_button;
   GtkWidget *accounts_treeview;
   GtkWidget *accounts_vbox;
+  GNetworkMonitor *monitor;
 };
 
 struct _GoaPanelClass
@@ -130,6 +131,17 @@
   G_OBJECT_CLASS (goa_panel_parent_class)->finalize (object);
 }
 
+static void 
+netw_status(monitor){
+        if (g_network_monitor_get_network_available (monitor)){
+                gtk_widget_set_sensitive(button,TRUE);
+		gtk_widget_set_sensitive(toolbar_add_button,TRUE);
+	}
+        else{ gtk_widget_set_sensitive(button,FALSE);
+	      gtk_widget_set_sensitive(toolbar_add_button,FALSE);
+	}
+}
+
 static void
 goa_panel_init (GoaPanel *panel)
 {
@@ -143,6 +155,9 @@
 
   panel->builder = gtk_builder_new ();
   error = NULL;
+  panel->monitor = g_network_monitor_get_default ();
+  netw_status(monitor);
+  g_signal_connect(monitor,"network-changed",G_CALLBACK(netw_changed),panel);  
   if (gtk_builder_add_from_file (panel->builder,
                                  GNOMECC_UI_DIR "/online-accounts.ui",
                                  &error) == 0)
