[Xfce4-commits] <xfce4-cellmodem-plugin:master> Preprocess everything using indent

Alvaro Lopes noreply at xfce.org
Tue Oct 13 21:28:01 CEST 2009


Updating branch refs/heads/master
         to 88797e9040978fdf32f31680134ffa141664d83f (commit)
       from bd685a5982eb3cd1e7c16301542ad3fb72e3d5b0 (commit)

commit 88797e9040978fdf32f31680134ffa141664d83f
Author: Alvaro Lopes <alvieboy at alvie.com>
Date:   Mon Oct 12 09:14:29 2009 +0100

    Preprocess everything using indent

 panel-plugin/autodetect.c           |  248 +++---
 panel-plugin/autodetect.h           |   36 +-
 panel-plugin/cellmodem.c            | 1866 +++++++++++++++++++----------------
 panel-plugin/cellmodem.h            |  142 ++--
 panel-plugin/cellmodem_options.h    |   22 +-
 panel-plugin/leds.c                 |  138 ++--
 panel-plugin/leds.h                 |   28 +-
 panel-plugin/modem_driver.c         |   43 +-
 panel-plugin/modem_driver.h         |   33 +-
 panel-plugin/modem_driver_fake.c    |  368 ++++----
 panel-plugin/modem_driver_fake.h    |   14 +-
 panel-plugin/modem_driver_generic.c |  310 +++---
 panel-plugin/modem_driver_generic.h |   10 +-
 panel-plugin/pin_helper.c           |  101 +-
 panel-plugin/pin_helper.h           |   13 +-
 panel-plugin/preferences.c          |  580 ++++++-----
 panel-plugin/preferences.h          |   32 +-
 17 files changed, 2155 insertions(+), 1829 deletions(-)

diff --git a/panel-plugin/autodetect.c b/panel-plugin/autodetect.c
index e7d6b57..76723c6 100644
--- a/panel-plugin/autodetect.c
+++ b/panel-plugin/autodetect.c
@@ -39,201 +39,211 @@
 #define NOZOMI_DEVICE "/dev/noz2"
 #define GENERIC_USB_DEVICE "/dev/ttyUSB2"
 
-struct device_info *device_info_new()
+struct device_info *
+device_info_new ()
 {
-    struct device_info *info;
+  struct device_info *info;
 
-    info = g_new0( struct device_info, 1 );
+  info = g_new0 (struct device_info, 1);
 
-    return info;
+  return info;
 }
 
-void device_info_free( struct device_info *i )
+void
+device_info_free (struct device_info *i)
 {
-    if ( i->device != NULL )
-	g_free ( i->device );
-    if ( i->device_description != NULL )
-	g_free ( i->device_description );
-    if ( i->error_reason != NULL )
-	g_free ( i->error_reason );
-    g_free( i );
+  if (i->device != NULL)
+    g_free (i->device);
+  if (i->device_description != NULL)
+    g_free (i->device_description);
+  if (i->error_reason != NULL)
+    g_free (i->error_reason);
+  g_free (i);
 
 }
 
-gboolean nozomi_detect( struct known_device *dev )
+gboolean
+nozomi_detect (struct known_device *dev)
 {
-    struct stat st;
-    /*   int fd;*/
+  struct stat st;
+  /*   int fd; */
 
-    if ( ! dev->info )
-	dev->info = device_info_new();
+  if (!dev->info)
+    dev->info = device_info_new ();
 
-    if ( dev->info->error_reason )
-	g_free(dev->info->error_reason);
+  if (dev->info->error_reason)
+    g_free (dev->info->error_reason);
 
-    dev->info->error_reason = NULL;
+  dev->info->error_reason = NULL;
 
-    if ( stat( NOZOMI_DEVICE, &st ) < 0 )
+  if (stat (NOZOMI_DEVICE, &st) < 0)
     {
-	/* Does not exist?? */
-        dev->info->error_reason = g_strdup( g_strerror(errno) );
-        return FALSE;
+      /* Does not exist?? */
+      dev->info->error_reason = g_strdup (g_strerror (errno));
+      return FALSE;
     }
 
-    /* just try to open the device */
+  /* just try to open the device */
 
-    dev->info->device = g_strdup( NOZOMI_DEVICE );
+  dev->info->device = g_strdup (NOZOMI_DEVICE);
 
-    return TRUE;
+  return TRUE;
 }
 
-gboolean serial_detect( struct known_device *dev )
+gboolean
+serial_detect (struct known_device * dev)
 {
 
-	dev->info->device = g_strdup( GENERIC_USB_DEVICE );
+  dev->info->device = g_strdup (GENERIC_USB_DEVICE);
 
-    return TRUE;
+  return TRUE;
 }
 
 
-static struct known_device devs[] =
-{
-    {
-	"Option N.V. Qualcomm MSM6275 UMTS chip",
-	"Generic Driver",
-	DEVICE_TYPE_PCI,
-	PCI_VENDOR_OPTION_NV,
-	PCI_DEVICE_QUALCOMM_MSM6275,
-	&nozomi_detect
-    },
-
-    {
-	"Option UMTS device",
-	"Generic Driver",
-	DEVICE_TYPE_USB,
-	USB_VENDOR_OPTION,
-	USB_DEVICE_OPTION_UMTS_CARD,
-	&serial_detect
-    },
-
-	{
-	"Huawei E630 HSDPA-Card",
-	"Generic Driver",
-	DEVICE_TYPE_USB,
-	USB_VENDOR_HUAWEI_TECHNOLOGIES,
-	USB_DEVICE_HUAWEI_MOBILE,
-	&serial_detect
-    },
-
-    { NULL, NULL, DEVICE_TYPE_NONE, 0, 0, NULL }
+static struct known_device devs[] = {
+  {
+   "Option N.V. Qualcomm MSM6275 UMTS chip",
+   "Generic Driver",
+   DEVICE_TYPE_PCI,
+   PCI_VENDOR_OPTION_NV,
+   PCI_DEVICE_QUALCOMM_MSM6275,
+   &nozomi_detect},
+
+  {
+   "Option UMTS device",
+   "Generic Driver",
+   DEVICE_TYPE_USB,
+   USB_VENDOR_OPTION,
+   USB_DEVICE_OPTION_UMTS_CARD,
+   &serial_detect},
+
+  {
+   "Huawei E630 HSDPA-Card",
+   "Generic Driver",
+   DEVICE_TYPE_USB,
+   USB_VENDOR_HUAWEI_TECHNOLOGIES,
+   USB_DEVICE_HUAWEI_MOBILE,
+   &serial_detect},
+
+  {NULL, NULL, DEVICE_TYPE_NONE, 0, 0, NULL}
 };
 
-void free_single_device( struct known_device *d, void *data )
+void
+free_single_device (struct known_device *d, void *data)
 {
-    if (d==NULL)
-        return;
-    if ( d->info == NULL )
-	return;
-    device_info_free( d->info );
+  if (d == NULL)
+    return;
+  if (d->info == NULL)
+    return;
+  device_info_free (d->info);
 
-    d->info = NULL;
+  d->info = NULL;
 
 }
 
-void free_detected_devices( GList *l )
+void
+free_detected_devices (GList * l)
 {
-    g_list_foreach( l, (GFunc) free_single_device, NULL );
+  g_list_foreach (l, (GFunc) free_single_device, NULL);
 
-    g_list_free( l );
+  g_list_free (l);
 }
 
 
 
-static GList *detect_pci_devices(GList *l)
+static GList *
+detect_pci_devices (GList * l)
 {
 #ifdef HAVE_PCIUTILS
-    struct pci_access *pcia;
-    struct pci_dev *pdev;
-    struct known_device *d;
+  struct pci_access *pcia;
+  struct pci_dev *pdev;
+  struct known_device *d;
 
-    pcia = pci_alloc();
+  pcia = pci_alloc ();
 
-    if ( NULL == pcia )
-	return NULL;
+  if (NULL == pcia)
+    return NULL;
 
-    pci_init( pcia );
+  pci_init (pcia);
 
-    pci_scan_bus( pcia );
+  pci_scan_bus (pcia);
 
-    if ( pcia->devices == NULL ) {
-        return NULL;
+  if (pcia->devices == NULL)
+    {
+      return NULL;
     }
 
-    for ( pdev = pcia->devices; pdev; pdev=pdev->next ) {
+  for (pdev = pcia->devices; pdev; pdev = pdev->next)
+    {
 
-	for ( d = devs; d->description; d++ ) {
+      for (d = devs; d->description; d++)
+	{
 
-	    if ( d->type == DEVICE_TYPE_PCI &&
-		pdev->vendor_id == d->vendor &&
-		pdev->device_id == d->product )
+	  if (d->type == DEVICE_TYPE_PCI &&
+	      pdev->vendor_id == d->vendor && pdev->device_id == d->product)
 	    {
-		printf("Found PCI device '%s'\n", d->description);
-		l = g_list_append( l, d );
-                d->detect_device( d );
+	      printf ("Found PCI device '%s'\n", d->description);
+	      l = g_list_append (l, d);
+	      d->detect_device (d);
 	    }
 	}
     }
 
 /* pci_exit_cleanup: */
-    pci_cleanup( pcia );
+  pci_cleanup (pcia);
 #endif
-    return l;
+  return l;
 }
 
-static GList *detect_usb_devices(GList *l)
+static GList *
+detect_usb_devices (GList * l)
 {
 #ifdef HAVE_USBUTILS
-    struct usb_bus *bus;
-    struct usb_device *dev;
-    struct known_device *d;
+  struct usb_bus *bus;
+  struct usb_device *dev;
+  struct known_device *d;
 
-    usb_init();
-    usb_find_busses();
-    usb_find_devices();
+  usb_init ();
+  usb_find_busses ();
+  usb_find_devices ();
 
-    bus = usb_get_busses();
+  bus = usb_get_busses ();
 
-    while ( bus ) {
-	dev = bus->devices;
-	while (dev) {
-	    fprintf(stderr,"%s\n", dev->filename );
-	    for ( d = devs; d->description; d++ ) {
+  while (bus)
+    {
+      dev = bus->devices;
+      while (dev)
+	{
+	  fprintf (stderr, "%s\n", dev->filename);
+	  for (d = devs; d->description; d++)
+	    {
 
-		if ( d->type == DEVICE_TYPE_USB &&
-		    dev->descriptor.idVendor == d->vendor &&
-		    dev->descriptor.idProduct == d->product )
+	      if (d->type == DEVICE_TYPE_USB &&
+		  dev->descriptor.idVendor == d->vendor &&
+		  dev->descriptor.idProduct == d->product)
 		{
-		    printf("Found USB device '%s'\n", d->description);
-		    l = g_list_append( l, d );
+		  printf ("Found USB device '%s'\n", d->description);
+		  l = g_list_append (l, d);
 
-		    /* Fill in the real name of the device */
+		  /* Fill in the real name of the device */
 
-		    d->detect_device( d );
+		  d->detect_device (d);
 		}
 	    }
-	    dev=dev->next;
+	  dev = dev->next;
 	}
-	bus = bus->next;
+      bus = bus->next;
     }
 
 #endif
-    return l;
+  return l;
 }
 
-GList *detect_devices()
+GList *
+detect_devices ()
 {
-    GList *l = NULL;
-    l = detect_pci_devices( l );
-    l = detect_usb_devices( l );
-    return l;
+  GList *l = NULL;
+  l = detect_pci_devices (l);
+  l = detect_usb_devices (l);
+  return l;
 }
diff --git a/panel-plugin/autodetect.h b/panel-plugin/autodetect.h
index 2ecafa7..c52fdfd 100644
--- a/panel-plugin/autodetect.h
+++ b/panel-plugin/autodetect.h
@@ -33,42 +33,42 @@
 
 enum device_type_t
 {
-    DEVICE_TYPE_NONE,
-    DEVICE_TYPE_USB,
-    DEVICE_TYPE_PCI
+  DEVICE_TYPE_NONE,
+  DEVICE_TYPE_USB,
+  DEVICE_TYPE_PCI
 };
 
 struct device_info
 {
-    gchar *device;
-    gchar *device_description;
-    gchar *error_reason;
+  gchar *device;
+  gchar *device_description;
+  gchar *error_reason;
 };
 
 struct known_device
 {
-    const gchar *description;
-    const gchar *driver;
-    /*
+  const gchar *description;
+  const gchar *driver;
+  /*
      We can fill device_description for USB devices,
      reading the ID directly from the card. Otherwise is
      NULL, so use the description field instead
-     */
-    enum device_type_t type;
-    int vendor;
-    int product;
-    gboolean (*detect_device)( struct known_device *dev );
+   */
+  enum device_type_t type;
+  int vendor;
+  int product;
+    gboolean (*detect_device) (struct known_device * dev);
 
-    /* This can be changed - depends on driver */
+  /* This can be changed - depends on driver */
 
-    struct device_info *info;
+  struct device_info *info;
 };
 
 /*
  Prototypes
  */
 
-GList *detect_devices();
-void free_detected_devices( GList *l );
+GList *detect_devices ();
+void free_detected_devices (GList * l);
 
 #endif
diff --git a/panel-plugin/cellmodem.c b/panel-plugin/cellmodem.c
index 7a371d6..88ad323 100644
--- a/panel-plugin/cellmodem.c
+++ b/panel-plugin/cellmodem.c
@@ -31,26 +31,32 @@ int cellmodem_debug_level = 0;
 
 /* Prototypes */
 
-static gboolean cellmodem_t_send_at_command(cellmodem_t *monitor,
-					    modem_reply_callback_t callback,
-					    const gchar *command,
-					    const gchar *expect);
-static gboolean get_network_info( cellmodem_t *monitor );
-static void cellmodem_t_is_registered( cellmodem_t *monitor );
-
-static void cellmodem_t_identify_network( cellmodem_t *monitor );
-static gboolean cellmodem_t_close_modem(cellmodem_t *monitor /*, gboolean failure */);
-static gboolean reschedule_open( cellmodem_t *monitor /*, gboolean failure */);
-static gboolean cellmodem_t_at_command_timeout( cellmodem_t *monitor );
-static void cellmodem_t_cancel_pending_at_command_timeout( cellmodem_t *monitor );
-static void cellmodem_t_get_quality( cellmodem_t *monitor );
-static void cellmodem_t_get_pin_status( cellmodem_t *monitor );
-static void cellmodem_t_send_pin( cellmodem_t *monitor, const gchar *pin );
-static void cellmodem_t_set_tooltip_info( cellmodem_t *monitor );
-static void cellmodem_t_get_ohcip_status( cellmodem_t *monitor );
-static gboolean cellmodem_button_event(GtkEventBox *box, GdkEventButton *button, cellmodem_t *monitor);
-static gboolean cellmodem_t_open_modem(cellmodem_t *monitor);
-static void cellmodem_t_switch_status( cellmodem_t *monitor, modem_status_t status );
+static gboolean cellmodem_t_send_at_command (cellmodem_t * monitor,
+					     modem_reply_callback_t callback,
+					     const gchar * command,
+					     const gchar * expect);
+static gboolean get_network_info (cellmodem_t * monitor);
+static void cellmodem_t_is_registered (cellmodem_t * monitor);
+
+static void cellmodem_t_identify_network (cellmodem_t * monitor);
+static gboolean cellmodem_t_close_modem (cellmodem_t *
+					 monitor /*, gboolean failure */ );
+static gboolean reschedule_open (cellmodem_t *
+				 monitor /*, gboolean failure */ );
+static gboolean cellmodem_t_at_command_timeout (cellmodem_t * monitor);
+static void cellmodem_t_cancel_pending_at_command_timeout (cellmodem_t *
+							   monitor);
+static void cellmodem_t_get_quality (cellmodem_t * monitor);
+static void cellmodem_t_get_pin_status (cellmodem_t * monitor);
+static void cellmodem_t_send_pin (cellmodem_t * monitor, const gchar * pin);
+static void cellmodem_t_set_tooltip_info (cellmodem_t * monitor);
+static void cellmodem_t_get_ohcip_status (cellmodem_t * monitor);
+static gboolean cellmodem_button_event (GtkEventBox * box,
+					GdkEventButton * button,
+					cellmodem_t * monitor);
+static gboolean cellmodem_t_open_modem (cellmodem_t * monitor);
+static void cellmodem_t_switch_status (cellmodem_t * monitor,
+				       modem_status_t status);
 
 
 
@@ -65,123 +71,132 @@ static void cellmodem_t_switch_status( cellmodem_t *monitor, modem_status_t stat
  */
 
 
-static void cellmodem_t_set_error( cellmodem_t *monitor )
+static void
+cellmodem_t_set_error (cellmodem_t * monitor)
 {
-    led_t_set_color( monitor->status_led, LED_RED );
-    led_t_set_flashing( monitor->status_led, TRUE );
-    led_t_set_color( monitor->network_led, LED_OFF );
-    led_t_set_flashing( monitor->network_led, FALSE );
+  led_t_set_color (monitor->status_led, LED_RED);
+  led_t_set_flashing (monitor->status_led, TRUE);
+  led_t_set_color (monitor->network_led, LED_OFF);
+  led_t_set_flashing (monitor->network_led, FALSE);
 }
 
-static void cellmodem_t_set_ok( cellmodem_t *monitor )
+static void
+cellmodem_t_set_ok (cellmodem_t * monitor)
 {
-    led_t_set_color( monitor->status_led, LED_GREEN );
-    led_t_set_flashing( monitor->status_led, FALSE );
+  led_t_set_color (monitor->status_led, LED_GREEN);
+  led_t_set_flashing (monitor->status_led, FALSE);
 }
 
-static gboolean cellmodem_t_in_error_status( cellmodem_t *monitor )
+static gboolean
+cellmodem_t_in_error_status (cellmodem_t * monitor)
 {
-    return monitor->modem_status == MODEM_ERROR;
+  return monitor->modem_status == MODEM_ERROR;
 }
 
-static void cellmodem_t_switch_to_error( cellmodem_t *monitor,
-					const char *fmt, ... )
+static void
+cellmodem_t_switch_to_error (cellmodem_t * monitor, const char *fmt, ...)
 {
-    va_list ap;
-    va_start( ap, fmt );
+  va_list ap;
+  va_start (ap, fmt);
 
-    if ( monitor->lasterror != NULL ) {
-	g_free( monitor->lasterror );
+  if (monitor->lasterror != NULL)
+    {
+      g_free (monitor->lasterror);
     }
 
-    vasprintf( &monitor->lasterror, fmt, ap );
+  vasprintf (&monitor->lasterror, fmt, ap);
 
-    va_end( ap );
+  va_end (ap);
 
-    cellmodem_t_switch_status( monitor, MODEM_ERROR );
-    cellmodem_t_set_tooltip_info( monitor );
+  cellmodem_t_switch_status (monitor, MODEM_ERROR);
+  cellmodem_t_set_tooltip_info (monitor);
 }
 
-static void cellmodem_t_switch_to_error_and_restart( cellmodem_t *monitor,
-						    const char *fmt, ... )
+static void
+cellmodem_t_switch_to_error_and_restart (cellmodem_t * monitor,
+					 const char *fmt, ...)
 {
-    va_list ap;
-    va_start( ap, fmt );
+  va_list ap;
+  va_start (ap, fmt);
 
-    if ( monitor->lasterror != NULL ) {
-	g_free( monitor->lasterror );
+  if (monitor->lasterror != NULL)
+    {
+      g_free (monitor->lasterror);
     }
 
-    vasprintf( &monitor->lasterror, fmt, ap );
+  vasprintf (&monitor->lasterror, fmt, ap);
 
-    va_end( ap );
+  va_end (ap);
 
-    cellmodem_t_switch_status( monitor, MODEM_ERROR );
-    cellmodem_t_set_tooltip_info( monitor );
-    reschedule_open( monitor );
+  cellmodem_t_switch_status (monitor, MODEM_ERROR);
+  cellmodem_t_set_tooltip_info (monitor);
+  reschedule_open (monitor);
 }
 
 
-static void cellmodem_t_switch_status( cellmodem_t *monitor,
-				      modem_status_t status )
+static void
+cellmodem_t_switch_status (cellmodem_t * monitor, modem_status_t status)
 {
-    CELLMODEM_DEBUG(5,"Switching modem status from %d to %d",
-          monitor->modem_status, status );
+  CELLMODEM_DEBUG (5, "Switching modem status from %d to %d",
+		   monitor->modem_status, status);
 
-    switch ( status ) {
+  switch (status)
+    {
     case MODEM_ERROR:
-	cellmodem_t_set_error( monitor );
-	break;
+      cellmodem_t_set_error (monitor);
+      break;
     case MODEM_WAIT_CSQ_RESPONSE:
     case MODEM_WAIT_CPIN_RESPONSE:
     case MODEM_WAIT_COPS_RESPONSE:
-	case MODEM_WAIT_PINE_RESPONSE:
+    case MODEM_WAIT_PINE_RESPONSE:
     case MODEM_CLOSED:
-	cellmodem_t_set_ok( monitor );
-	break;
+      cellmodem_t_set_ok (monitor);
+      break;
     case MODEM_WAIT_CREG_RESPONSE:
-	case MODEM_WAIT_REGISTRATION:
-	case MODEM_WAIT_CMGF_RESPONSE:
-	case MODEM_WAIT_SET_CMGF_RESPONSE:
+    case MODEM_WAIT_REGISTRATION:
+    case MODEM_WAIT_CMGF_RESPONSE:
+    case MODEM_WAIT_SET_CMGF_RESPONSE:
     case MODEM_WAIT_OHCIP_RESPONSE:
-        break;
+      break;
     }
 
-    monitor->modem_status = status;
+  monitor->modem_status = status;
 }
 
-static void cellmodem_t_switch_network_status( cellmodem_t *monitor,
-					      registration_type_t status )
+static void
+cellmodem_t_switch_network_status (cellmodem_t * monitor,
+				   registration_type_t status)
 {
-    switch (status) {
+  switch (status)
+    {
     case REGISTRATION_UNKNOWN:
-	led_t_set_color( monitor->network_led, LED_YELLOW );
-	led_t_set_flashing( monitor->network_led, FALSE );
-	break;
+      led_t_set_color (monitor->network_led, LED_YELLOW);
+      led_t_set_flashing (monitor->network_led, FALSE);
+      break;
     case REGISTRATION_NOT_REGISTERED:
-	led_t_set_color( monitor->network_led, LED_RED );
-	led_t_set_flashing( monitor->network_led, TRUE );
-	break;
+      led_t_set_color (monitor->network_led, LED_RED);
+      led_t_set_flashing (monitor->network_led, TRUE);
+      break;
     case REGISTRATION_REGISTERING:
-	led_t_set_color( monitor->network_led, LED_GREEN );
-	led_t_set_flashing( monitor->network_led, TRUE );
-	break;
+      led_t_set_color (monitor->network_led, LED_GREEN);
+      led_t_set_flashing (monitor->network_led, TRUE);
+      break;
     case REGISTRATION_NEEDS_PIN:
-	led_t_set_color( monitor->network_led, LED_YELLOW );
-	led_t_set_flashing( monitor->network_led, TRUE );
-	break;
+      led_t_set_color (monitor->network_led, LED_YELLOW);
+      led_t_set_flashing (monitor->network_led, TRUE);
+      break;
     case REGISTRATION_HSDPA:
-	led_t_set_color( monitor->network_led, LED_BLUE );
-	led_t_set_flashing( monitor->network_led, FALSE );
-        break;
+      led_t_set_color (monitor->network_led, LED_BLUE);
+      led_t_set_flashing (monitor->network_led, FALSE);
+      break;
     default:
-	led_t_set_color( monitor->network_led, LED_GREEN );
-	led_t_set_flashing( monitor->network_led, FALSE );
+      led_t_set_color (monitor->network_led, LED_GREEN);
+      led_t_set_flashing (monitor->network_led, FALSE);
     }
 
-    monitor->registration_status = status;
+  monitor->registration_status = status;
 
-    cellmodem_t_set_tooltip_info( monitor );
+  cellmodem_t_set_tooltip_info (monitor);
 }
 
 /**
@@ -193,30 +208,30 @@ static void cellmodem_t_switch_network_status( cellmodem_t *monitor,
  */
 
 static gboolean
-is_AT_error_reply( const gchar *c )
+is_AT_error_reply (const gchar * c)
 {
-    if ( strcmp(c,"ERROR") == 0 )
-	return TRUE;
+  if (strcmp (c, "ERROR") == 0)
+    return TRUE;
 
-    /* This is sometimes issued when
+  /* This is sometimes issued when
      the card is still initializing */
-    /*
+  /*
      Got response: '+CME ERROR: SIM interface not started yet' command 'AT+CPIN?'
-     */
-    if ( strncmp(c,"+CME ERROR",10) == 0 )
-	return TRUE;
-    if ( strncmp(c,"COMMAND NOT",11) == 0 )
-	return TRUE;
-	/*    if ( strcmp(c,"NO CARRIER") == 0 )
-	 return TRUE;
-	 if ( strcmp(c,"BUSY") == 0 )
-	 return TRUE;
-	 if ( strcmp(c,"NO DIALTONE") == 0 )
-	 return TRUE;
-	 */
+   */
+  if (strncmp (c, "+CME ERROR", 10) == 0)
+    return TRUE;
+  if (strncmp (c, "COMMAND NOT", 11) == 0)
+    return TRUE;
+  /*    if ( strcmp(c,"NO CARRIER") == 0 )
+     return TRUE;
+     if ( strcmp(c,"BUSY") == 0 )
+     return TRUE;
+     if ( strcmp(c,"NO DIALTONE") == 0 )
+     return TRUE;
+   */
 
 
-    return FALSE;
+  return FALSE;
 }
 
 /**
@@ -228,10 +243,11 @@ is_AT_error_reply( const gchar *c )
  */
 
 static gboolean
-is_AT_success_reply( const gchar *c )
+is_AT_success_reply (const gchar * c)
 {
-    return strcmp(c,"OK") == 0;
+  return strcmp (c, "OK") == 0;
 }
+
 /**
  * @brief Remove leading characters from string
  *
@@ -244,19 +260,24 @@ is_AT_success_reply( const gchar *c )
  */
 
 static char *
-remove_leading_chars( char *buffer, const char *c )
+remove_leading_chars (char *buffer, const char *c)
 {
-    size_t position = 0;
+  size_t position = 0;
 
-    while ( buffer[position] > 0 ) {
-	if ( strchr( c, buffer[position] ) > 0 ) {
-            position++;
-	} else {
-            break;
+  while (buffer[position] > 0)
+    {
+      if (strchr (c, buffer[position]) > 0)
+	{
+	  position++;
+	}
+      else
+	{
+	  break;
 	}
     }
-    return buffer + position;
+  return buffer + position;
 }
+
 /**
  * @brief Remove trailing characters from string
  *
@@ -269,17 +290,22 @@ remove_leading_chars( char *buffer, const char *c )
  */
 
 static void
-remove_trailing_chars( char *buffer, const char *c )
+remove_trailing_chars (char *buffer, const char *c)
 {
-    size_t position = strlen(buffer);
-    do {
-	if ( strchr( c, buffer[position] ) > 0 ) {
-	    buffer[ position ] = '\0';
-            position--;
-	} else {
-            break;
+  size_t position = strlen (buffer);
+  do
+    {
+      if (strchr (c, buffer[position]) > 0)
+	{
+	  buffer[position] = '\0';
+	  position--;
+	}
+      else
+	{
+	  break;
 	}
-    } while ( position > 0 );
+    }
+  while (position > 0);
 }
 
 /**
@@ -291,18 +317,19 @@ remove_trailing_chars( char *buffer, const char *c )
  */
 
 static gboolean
-is_only_spaces( const char *buffer )
+is_only_spaces (const char *buffer)
 {
-    int i;
+  int i;
 
-    if ( strlen( buffer )==0 )
-	return TRUE;
-    
-    for (i=0; i<strlen(buffer); i++) {
-	if (buffer[i]!=' ')
-	    return FALSE;
-    }
+  if (strlen (buffer) == 0)
     return TRUE;
+
+  for (i = 0; i < strlen (buffer); i++)
+    {
+      if (buffer[i] != ' ')
+	return FALSE;
+    }
+  return TRUE;
 }
 
 /**
@@ -311,9 +338,10 @@ is_only_spaces( const char *buffer )
  * @return Nothing
  */
 
-static void cellmodem_t_reset_buffer( cellmodem_t *monitor )
+static void
+cellmodem_t_reset_buffer (cellmodem_t * monitor)
 {
-    monitor->line_buffer_size = 0;
+  monitor->line_buffer_size = 0;
 }
 
 
@@ -323,21 +351,22 @@ static void cellmodem_t_reset_buffer( cellmodem_t *monitor )
  */
 
 static gboolean
-cellmodem_set_size(XfcePanelPlugin *plugin, int size, cellmodem_t *monitor)
+cellmodem_set_size (XfcePanelPlugin * plugin, int size, cellmodem_t * monitor)
 {
-    CELLMODEM_DEBUG(8,"Set size request");
-    if (xfce_panel_plugin_get_orientation (plugin) == GTK_ORIENTATION_HORIZONTAL)
+  CELLMODEM_DEBUG (8, "Set size request");
+  if (xfce_panel_plugin_get_orientation (plugin) ==
+      GTK_ORIENTATION_HORIZONTAL)
     {
-	gtk_widget_set_size_request(GTK_WIDGET( monitor->qualpbar ),
-				    BORDER, size - 4);
+      gtk_widget_set_size_request (GTK_WIDGET (monitor->qualpbar),
+				   BORDER, size - 4);
     }
-    else
+  else
     {
-	gtk_widget_set_size_request(GTK_WIDGET( monitor->qualpbar ),
-				    size - 4, BORDER);
+      gtk_widget_set_size_request (GTK_WIDGET (monitor->qualpbar),
+				   size - 4, BORDER);
     }
-    CELLMODEM_DEBUG(8,"Done set size request");
-    return TRUE;
+  CELLMODEM_DEBUG (8, "Done set size request");
+  return TRUE;
 }
 
 
@@ -348,100 +377,102 @@ cellmodem_set_size(XfcePanelPlugin *plugin, int size, cellmodem_t *monitor)
  */
 
 static void
-cellmodem_t_setup_widgets( cellmodem_t *monitor, gboolean destroy )
+cellmodem_t_setup_widgets (cellmodem_t * monitor, gboolean destroy)
 {
-    monitor->status_led =
-	led_t_new();
-    monitor->network_led =
-	led_t_new();
+  monitor->status_led = led_t_new ();
+  monitor->network_led = led_t_new ();
 
-    led_t_set_color( monitor->status_led, LED_OFF );
+  led_t_set_color (monitor->status_led, LED_OFF);
 
-    led_t_set_color( monitor->network_led, LED_OFF );
+  led_t_set_color (monitor->network_led, LED_OFF);
 
 
-    /*   led_t_set_flashing( monitor->testled, TRUE );*/
+  /*   led_t_set_flashing( monitor->testled, TRUE ); */
 
-    GtkOrientation orientation =
-	xfce_panel_plugin_get_orientation(monitor->plugin);
+  GtkOrientation orientation =
+    xfce_panel_plugin_get_orientation (monitor->plugin);
 
-    monitor->tooltips = gtk_tooltips_new();
-    g_object_ref(monitor->tooltips);
-    gtk_object_sink(GTK_OBJECT(monitor->tooltips));
+  monitor->tooltips = gtk_tooltips_new ();
+  g_object_ref (monitor->tooltips);
+  gtk_object_sink (GTK_OBJECT (monitor->tooltips));
 
-    monitor->eventbox = gtk_event_box_new();
-    monitor->qualpbar = gtk_progress_bar_new();
+  monitor->eventbox = gtk_event_box_new ();
+  monitor->qualpbar = gtk_progress_bar_new ();
 
-    if (orientation == GTK_ORIENTATION_HORIZONTAL)
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
     {
-	gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(monitor->qualpbar),
-					 GTK_PROGRESS_BOTTOM_TO_TOP);
+      gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (monitor->qualpbar),
+					GTK_PROGRESS_BOTTOM_TO_TOP);
 
-	monitor->gbox = gtk_hbox_new(FALSE, 0);
-	monitor->box=gtk_hbox_new(FALSE, 0);
-    } else {
-	gtk_progress_bar_set_orientation(GTK_PROGRESS_BAR(monitor->qualpbar),
-					 GTK_PROGRESS_LEFT_TO_RIGHT);
+      monitor->gbox = gtk_hbox_new (FALSE, 0);
+      monitor->box = gtk_hbox_new (FALSE, 0);
+    }
+  else
+    {
+      gtk_progress_bar_set_orientation (GTK_PROGRESS_BAR (monitor->qualpbar),
+					GTK_PROGRESS_LEFT_TO_RIGHT);
 
-	monitor->gbox = gtk_vbox_new(FALSE, 0);
-	monitor->box=gtk_vbox_new(FALSE, 0);
+      monitor->gbox = gtk_vbox_new (FALSE, 0);
+      monitor->box = gtk_vbox_new (FALSE, 0);
     }
 
 
-    gtk_container_set_border_width(GTK_CONTAINER(monitor->box), BORDER/2);
+  gtk_container_set_border_width (GTK_CONTAINER (monitor->box), BORDER / 2);
 
-    gtk_box_pack_start(GTK_BOX(monitor->box),
-		       GTK_WIDGET(monitor->qualpbar),
-		       FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (monitor->box),
+		      GTK_WIDGET (monitor->qualpbar), FALSE, FALSE, 0);
 
 
-    /* LEDS */
-    GtkWidget *led_box;
+  /* LEDS */
+  GtkWidget *led_box;
 
-    if (orientation == GTK_ORIENTATION_HORIZONTAL)
+  if (orientation == GTK_ORIENTATION_HORIZONTAL)
+    {
+      led_box = gtk_vbox_new (FALSE, 0);
+    }
+  else
     {
-        led_box = gtk_vbox_new(FALSE,0);
-    } else {
-	led_box = gtk_hbox_new(FALSE,0);
+      led_box = gtk_hbox_new (FALSE, 0);
     }
-    
 
-    gtk_box_pack_start(GTK_BOX(led_box),
-		       GTK_WIDGET(monitor->status_led->image),
-		       FALSE, FALSE, 0);
-    gtk_widget_show( monitor->status_led->image );
 
-    gtk_box_pack_start(GTK_BOX(led_box),
-		       GTK_WIDGET(monitor->network_led->image),
-		       FALSE, FALSE, 0);
-    gtk_widget_show( monitor->network_led->image );
+  gtk_box_pack_start (GTK_BOX (led_box),
+		      GTK_WIDGET (monitor->status_led->image),
+		      FALSE, FALSE, 0);
+  gtk_widget_show (monitor->status_led->image);
+
+  gtk_box_pack_start (GTK_BOX (led_box),
+		      GTK_WIDGET (monitor->network_led->image),
+		      FALSE, FALSE, 0);
+  gtk_widget_show (monitor->network_led->image);
 
-    gtk_box_pack_start(GTK_BOX(monitor->box),
-                       led_box, FALSE,FALSE,0);
+  gtk_box_pack_start (GTK_BOX (monitor->box), led_box, FALSE, FALSE, 0);
 
-    gtk_box_set_spacing(GTK_BOX(led_box), BORDER/4);
+  gtk_box_set_spacing (GTK_BOX (led_box), BORDER / 4);
 
 
-    gtk_widget_show( led_box );
+  gtk_widget_show (led_box);
 
-    gtk_box_pack_start(GTK_BOX(monitor->gbox),
-		       GTK_WIDGET(monitor->box), FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (monitor->gbox),
+		      GTK_WIDGET (monitor->box), FALSE, FALSE, 0);
 
 
-    gtk_widget_show( monitor->box );
-    gtk_widget_show( monitor->gbox );
+  gtk_widget_show (monitor->box);
+  gtk_widget_show (monitor->gbox);
 
-    gtk_widget_show( monitor->qualpbar );
+  gtk_widget_show (monitor->qualpbar);
 
-    gtk_container_add(GTK_CONTAINER(monitor->eventbox),
-		      GTK_WIDGET(monitor->gbox));
+  gtk_container_add (GTK_CONTAINER (monitor->eventbox),
+		     GTK_WIDGET (monitor->gbox));
 
-    gtk_widget_show(monitor->eventbox);
-    gtk_widget_set_size_request(monitor->eventbox, -1, -1);
+  gtk_widget_show (monitor->eventbox);
+  gtk_widget_set_size_request (monitor->eventbox, -1, -1);
 
-    gtk_signal_connect( GTK_OBJECT(monitor->eventbox), "button-press-event", G_CALLBACK (cellmodem_button_event), monitor );
+  gtk_signal_connect (GTK_OBJECT (monitor->eventbox), "button-press-event",
+		      G_CALLBACK (cellmodem_button_event), monitor);
 
 }
+
 /**
  * @brief [cellmodem_t CTOR] Create a new cellmodem object
  * Creates the new cellmodem object, setting up some default values
@@ -451,39 +482,39 @@ cellmodem_t_setup_widgets( cellmodem_t *monitor, gboolean destroy )
  */
 
 static cellmodem_t *
-cellmodem_t_new(XfcePanelPlugin *plugin)
+cellmodem_t_new (XfcePanelPlugin * plugin)
 {
-    cellmodem_t *monitor;
+  cellmodem_t *monitor;
 
-    monitor = g_new0(cellmodem_t, 1);
+  monitor = g_new0 (cellmodem_t, 1);
 
-    monitor->plugin = plugin;
-    monitor->lasterror = NULL;
-    monitor->lastcmd = g_new( gchar, 128 );
+  monitor->plugin = plugin;
+  monitor->lasterror = NULL;
+  monitor->lastcmd = g_new (gchar, 128);
 
-    monitor->options.modem_device = NULL;
-    monitor->options.critical_threshold = 20;
-    monitor->options.low_threshold = 40;
-    monitor->options.max_quality = MAX_QUAL;
-	monitor->options.check_for_sms = FALSE;
-    monitor->options.sms_check_interval = 10;
+  monitor->options.modem_device = NULL;
+  monitor->options.critical_threshold = 20;
+  monitor->options.low_threshold = 40;
+  monitor->options.max_quality = MAX_QUAL;
+  monitor->options.check_for_sms = FALSE;
+  monitor->options.sms_check_interval = 10;
 
 
-	monitor->no_sms_support = FALSE;
+  monitor->no_sms_support = FALSE;
 
-    /* Setup colors */
+  /* Setup colors */
 
-    gdk_color_parse("#ff0000", &(monitor->red_color));
-    gdk_color_parse("#ffff00", &(monitor->yellow_color));
-    gdk_color_parse("#00ff00", &(monitor->green_color));
+  gdk_color_parse ("#ff0000", &(monitor->red_color));
+  gdk_color_parse ("#ffff00", &(monitor->yellow_color));
+  gdk_color_parse ("#00ff00", &(monitor->green_color));
 
-    cellmodem_t_setup_widgets( monitor, FALSE );
+  cellmodem_t_setup_widgets (monitor, FALSE);
 
-    cellmodem_t_switch_to_error( monitor, _("Initializing plugin now") );
+  cellmodem_t_switch_to_error (monitor, _("Initializing plugin now"));
 
-    cellmodem_t_switch_network_status(  monitor, REGISTRATION_UNKNOWN );
+  cellmodem_t_switch_network_status (monitor, REGISTRATION_UNKNOWN);
 
-    return monitor;
+  return monitor;
 }
 
 /**
@@ -493,45 +524,53 @@ cellmodem_t_new(XfcePanelPlugin *plugin)
  */
 
 static void
-cellmodem_t_set_tooltip_info( cellmodem_t *monitor )
+cellmodem_t_set_tooltip_info (cellmodem_t * monitor)
 {
-    gchar buffer[512];
+  gchar buffer[512];
 
-    gint qp = monitor->quality*100;
-    gint q = monitor->signal_strength;
+  gint qp = monitor->quality * 100;
+  gint q = monitor->signal_strength;
 
-    if ( cellmodem_t_in_error_status ( monitor ) )
+  if (cellmodem_t_in_error_status (monitor))
     {
-	g_snprintf( buffer, 512, _("Error detected:\n%s"), monitor->lasterror );
+      g_snprintf (buffer, 512, _("Error detected:\n%s"), monitor->lasterror);
     }
-    else {
-	switch( monitor->registration_status )
+  else
+    {
+      switch (monitor->registration_status)
 	{
 	case REGISTRATION_NOT_REGISTERED:
-	    g_snprintf(buffer, 512, _("Not registered"));
-	    break;
+	  g_snprintf (buffer, 512, _("Not registered"));
+	  break;
 	case REGISTRATION_NEEDS_PIN:
-	    g_snprintf(buffer, 512, _("Modem needs PIN"));
-	    break;
+	  g_snprintf (buffer, 512, _("Modem needs PIN"));
+	  break;
 	case REGISTRATION_REGISTERING:
-	    g_snprintf(buffer, 512, _("Registering"));
-	    break;
+	  g_snprintf (buffer, 512, _("Registering"));
+	  break;
 	case REGISTRATION_GPRS:
-	    g_snprintf(buffer, 512, _("Registered [GPRS] to %s\nQuality: %d (%d%%)"), monitor->network, q,qp );
-            break;
+	  g_snprintf (buffer, 512,
+		      _("Registered [GPRS] to %s\nQuality: %d (%d%%)"),
+		      monitor->network, q, qp);
+	  break;
 	case REGISTRATION_UMTS:
-	    g_snprintf(buffer, 512, _("Registered [UMTS] to %s\nQuality: %d (%d%%)"), monitor->network,q,qp );
-            break;
+	  g_snprintf (buffer, 512,
+		      _("Registered [UMTS] to %s\nQuality: %d (%d%%)"),
+		      monitor->network, q, qp);
+	  break;
 	case REGISTRATION_HSDPA:
-	    g_snprintf(buffer, 512, _("Registered [HSDPA] to %s\nQuality: %d (%d%%)"), monitor->network,q,qp );
-	    break;
+	  g_snprintf (buffer, 512,
+		      _("Registered [HSDPA] to %s\nQuality: %d (%d%%)"),
+		      monitor->network, q, qp);
+	  break;
 	case REGISTRATION_UNKNOWN:
-	    g_snprintf(buffer, 512, _("Registered to %s\nQuality: %d (%d%%)"), monitor->network,q,qp);
-            break;
+	  g_snprintf (buffer, 512, _("Registered to %s\nQuality: %d (%d%%)"),
+		      monitor->network, q, qp);
+	  break;
 	}
     }
 
-    gtk_tooltips_set_tip (monitor->tooltips, monitor->eventbox, buffer, NULL);
+  gtk_tooltips_set_tip (monitor->tooltips, monitor->eventbox, buffer, NULL);
 }
 
 
@@ -544,9 +583,9 @@ cellmodem_t_set_tooltip_info( cellmodem_t *monitor )
 
 
 static void
-cellmodem_t_set_bar_color(cellmodem_t *monitor, GdkColor *color )
+cellmodem_t_set_bar_color (cellmodem_t * monitor, GdkColor * color)
 {
-    gtk_widget_modify_bg( monitor->qualpbar, GTK_STATE_PRELIGHT, color );
+  gtk_widget_modify_bg (monitor->qualpbar, GTK_STATE_PRELIGHT, color);
 }
 
 /**
@@ -557,30 +596,38 @@ cellmodem_t_set_bar_color(cellmodem_t *monitor, GdkColor *color )
 
 
 static void
-cellmodem_t_update_progressbar( cellmodem_t *monitor )
+cellmodem_t_update_progressbar (cellmodem_t * monitor)
 {
-    gint qual = (gint)(100.0*monitor->quality);
+  gint qual = (gint) (100.0 * monitor->quality);
 
-    if ( monitor->registration_status == REGISTRATION_NOT_REGISTERED ) {
-	gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(monitor->qualpbar), 0.0 );
-	cellmodem_t_set_bar_color( monitor, NULL );
+  if (monitor->registration_status == REGISTRATION_NOT_REGISTERED)
+    {
+      gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (monitor->qualpbar),
+				     0.0);
+      cellmodem_t_set_bar_color (monitor, NULL);
     }
-    else {
+  else
+    {
 
-	if( qual <= monitor->options.critical_threshold ) {
-	    cellmodem_t_set_bar_color( monitor, &(monitor->red_color) );
+      if (qual <= monitor->options.critical_threshold)
+	{
+	  cellmodem_t_set_bar_color (monitor, &(monitor->red_color));
 	}
-	else if( qual <= monitor->options.low_threshold ) {
-	    cellmodem_t_set_bar_color( monitor, &(monitor->yellow_color) );
+      else if (qual <= monitor->options.low_threshold)
+	{
+	  cellmodem_t_set_bar_color (monitor, &(monitor->yellow_color));
 	}
-	else {
-	    cellmodem_t_set_bar_color( monitor, &(monitor->green_color) );
+      else
+	{
+	  cellmodem_t_set_bar_color (monitor, &(monitor->green_color));
 	}
     }
 
-    gtk_progress_bar_set_fraction(GTK_PROGRESS_BAR(monitor->qualpbar), monitor->quality );
+  gtk_progress_bar_set_fraction (GTK_PROGRESS_BAR (monitor->qualpbar),
+				 monitor->quality);
 
 }
+
 /**
  * @brief [cellmodem_t member] Update the monitors
  *
@@ -590,10 +637,10 @@ cellmodem_t_update_progressbar( cellmodem_t *monitor )
  */
 
 static void
-cellmodem_t_update_monitors( cellmodem_t *monitor )
+cellmodem_t_update_monitors (cellmodem_t * monitor)
 {
-    cellmodem_t_set_tooltip_info( monitor );
-    cellmodem_t_update_progressbar( monitor );
+  cellmodem_t_set_tooltip_info (monitor);
+  cellmodem_t_update_progressbar (monitor);
 }
 
 /**
@@ -605,16 +652,16 @@ cellmodem_t_update_monitors( cellmodem_t *monitor )
  */
 
 static void
-cellmodem_t_delete(cellmodem_t *monitor)
+cellmodem_t_delete (cellmodem_t * monitor)
 {
-    CELLMODEM_DEBUG(7,"Destroying cellmodem object");
-    cellmodem_t_close_modem( monitor /*, TRUE*/ );
+  CELLMODEM_DEBUG (7, "Destroying cellmodem object");
+  cellmodem_t_close_modem (monitor /*, TRUE */ );
 
-    g_object_unref (monitor->tooltips);
+  g_object_unref (monitor->tooltips);
 
-    g_free( monitor->lastcmd );
+  g_free (monitor->lastcmd);
 
-    g_free(monitor);
+  g_free (monitor);
 }
 
 /**
@@ -626,40 +673,41 @@ cellmodem_t_delete(cellmodem_t *monitor)
  */
 
 static gboolean
-cellmodem_t_close_modem(cellmodem_t *monitor  /*, gboolean failure */)
+cellmodem_t_close_modem (cellmodem_t * monitor /*, gboolean failure */ )
 {
-    if (NULL == monitor->modem_instance)
-	return FALSE;
+  if (NULL == monitor->modem_instance)
+    return FALSE;
 
-    if (NULL == monitor->driver)
-	return FALSE;
+  if (NULL == monitor->driver)
+    return FALSE;
 
-    monitor->driver->close(monitor->modem_instance);
+  monitor->driver->close (monitor->modem_instance);
 
-    return TRUE;
+  return TRUE;
 }
 
-static void pin_callback( const gchar *pin, void *pvt )
+static void
+pin_callback (const gchar * pin, void *pvt)
 {
-    cellmodem_t *monitor = (cellmodem_t *)pvt;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
 
-    cellmodem_t_send_pin( monitor, pin );
+  cellmodem_t_send_pin (monitor, pin);
 }
 
 static void
-cellmodem_t_request_pin( cellmodem_t *monitor )
+cellmodem_t_request_pin (cellmodem_t * monitor)
 {
-    /*
+  /*
      if ( monitor->options.ask_for_pin )
-	pin_helper_launch( GTK_WIDGET(monitor->plugin), pin_callback, monitor );
-	else {
-        */
-    cellmodem_t_switch_status( monitor, MODEM_CLOSED );
-    cellmodem_t_switch_network_status( monitor, REGISTRATION_NEEDS_PIN );
+     pin_helper_launch( GTK_WIDGET(monitor->plugin), pin_callback, monitor );
+     else {
+   */
+  cellmodem_t_switch_status (monitor, MODEM_CLOSED);
+  cellmodem_t_switch_network_status (monitor, REGISTRATION_NEEDS_PIN);
 
-    /* End here */
+  /* End here */
 
-    cellmodem_t_close_modem( monitor );
+  cellmodem_t_close_modem (monitor);
 
 }
 
@@ -678,65 +726,84 @@ cellmodem_t_request_pin( cellmodem_t *monitor )
  */
 
 static void
-cellmodem_t_registration_callback(gboolean success, GString *response, void *pvt)
+cellmodem_t_registration_callback (gboolean success, GString * response,
+				   void *pvt)
 {
-    cellmodem_t *monitor = (cellmodem_t*)pvt;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
 
-    if ( !success || response==NULL || response->str==NULL ) {
-	/* Error */
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Error in modem reply to CREG") );
-	return;
+  if (!success || response == NULL || response->str == NULL)
+    {
+      /* Error */
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Error in modem reply to CREG"));
+      return;
     }
 
-    CELLMODEM_DEBUG(4,"Got registration callback: %s", response->str);
-    if ( strncmp( response->str ,"+CREG: ", 7 )==0 ) {
+  CELLMODEM_DEBUG (4, "Got registration callback: %s", response->str);
+  if (strncmp (response->str, "+CREG: ", 7) == 0)
+    {
 
-	gchar *start = response->str + 7;
-	if ( strtok( start, ",") == NULL) {
-	    cellmodem_t_switch_to_error_and_restart( monitor, _("Invalid reply to +CREG") );
-	    return;
+      gchar *start = response->str + 7;
+      if (strtok (start, ",") == NULL)
+	{
+	  cellmodem_t_switch_to_error_and_restart (monitor,
+						   _
+						   ("Invalid reply to +CREG"));
+	  return;
 	}
-	gchar *delim = strtok ( NULL, "," );
+      gchar *delim = strtok (NULL, ",");
 
-	int i = atoi( delim );
+      int i = atoi (delim);
 
-	CELLMODEM_DEBUG(4,"Registration reply: %d", i);
+      CELLMODEM_DEBUG (4, "Registration reply: %d", i);
 
-	switch (i) {
+      switch (i)
+	{
 	case 1:
 
-	    /* We only should switch status here after +COPS response */
+	  /* We only should switch status here after +COPS response */
 
-	    cellmodem_t_switch_network_status( monitor, REGISTRATION_UNKNOWN );
-	    break;
+	  cellmodem_t_switch_network_status (monitor, REGISTRATION_UNKNOWN);
+	  break;
 	case 2:
-	    cellmodem_t_switch_network_status( monitor, REGISTRATION_REGISTERING );
-	    break;
+	  cellmodem_t_switch_network_status (monitor,
+					     REGISTRATION_REGISTERING);
+	  break;
 	default:
-	    cellmodem_t_switch_network_status( monitor, REGISTRATION_NOT_REGISTERED );
-            break;
+	  cellmodem_t_switch_network_status (monitor,
+					     REGISTRATION_NOT_REGISTERED);
+	  break;
 	}
-    } else {
-	CELLMODEM_DEBUG(2,"Modem error in reply");
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Invalid CREG reply from modem") );
-        return;
+    }
+  else
+    {
+      CELLMODEM_DEBUG (2, "Modem error in reply");
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Invalid CREG reply from modem"));
+      return;
     }
 
 
-    if ( monitor->registration_status != REGISTRATION_NOT_REGISTERED  &&
-         monitor->registration_status != REGISTRATION_REGISTERING ) {
+  if (monitor->registration_status != REGISTRATION_NOT_REGISTERED &&
+      monitor->registration_status != REGISTRATION_REGISTERING)
+    {
 
-	cellmodem_t_identify_network( monitor );
+      cellmodem_t_identify_network (monitor);
 
-    } else {
-        reschedule_open( monitor );
-	/* Check for PIN ????? */
-	// cellmodem_t_get_pin_status( monitor );
-	/*else
-     
-	 */
+    }
+  else
+    {
+      reschedule_open (monitor);
+      /* Check for PIN ????? */
+      // cellmodem_t_get_pin_status( monitor );
+      /*else
+
+       */
     }
 }
+
 /**
  * @brief [cellmodem_t pseudo-member] Callback for network id request
  *
@@ -750,74 +817,94 @@ cellmodem_t_registration_callback(gboolean success, GString *response, void *pvt
  */
 
 static void
-cellmodem_t_identify_callback(gboolean success, GString *response, void *pvt)
+cellmodem_t_identify_callback (gboolean success, GString * response,
+			       void *pvt)
 {
-    cellmodem_t *monitor = (cellmodem_t*)pvt;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
 
-    if ( !success || response==NULL || response->str==NULL ) {
-	/* Error */
-        CELLMODEM_DEBUG(2,"Modem error detected (%p)", pvt);
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Error in modem reply to COPS") );
-        return;
+  if (!success || response == NULL || response->str == NULL)
+    {
+      /* Error */
+      CELLMODEM_DEBUG (2, "Modem error detected (%p)", pvt);
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Error in modem reply to COPS"));
+      return;
     }
 
-    /* +COPS: 0,0,"Provider",2 */
-    if ( strncmp(response->str,"+COPS: ", 7 )==0 ) {
-	gchar *start = response->str + 7;
-	gchar *tok[64];
-	int i=0;
+  /* +COPS: 0,0,"Provider",2 */
+  if (strncmp (response->str, "+COPS: ", 7) == 0)
+    {
+      gchar *start = response->str + 7;
+      gchar *tok[64];
+      int i = 0;
 
-	tok[i++] = strtok( start, ",");
-	while ( ( tok[i++]=strtok(NULL,",")) ) {};
+      tok[i++] = strtok (start, ",");
+      while ((tok[i++] = strtok (NULL, ",")))
+	{
+	};
 
-	CELLMODEM_DEBUG(4,"Network: '%s'\n", tok[2]);
+      CELLMODEM_DEBUG (4, "Network: '%s'\n", tok[2]);
 
-    /* Some modems do not reply with all fields */
+      /* Some modems do not reply with all fields */
 
-	CELLMODEM_DEBUG(4,"Network Type: '%s'\n", tok[3]);
+      CELLMODEM_DEBUG (4, "Network Type: '%s'\n", tok[3]);
 
-	if ( monitor->network )
-	    g_free( monitor->network );
+      if (monitor->network)
+	g_free (monitor->network);
 
-	if (tok[2][0]=='"') {
-	    monitor->network = g_strndup( tok[2]+1, strlen(tok[2])-2 );
-	} else {
-	    monitor->network = g_strdup( tok[2] );
+      if (tok[2][0] == '"')
+	{
+	  monitor->network = g_strndup (tok[2] + 1, strlen (tok[2]) - 2);
+	}
+      else
+	{
+	  monitor->network = g_strdup (tok[2]);
 	}
 
-	if ( monitor->registration_status != REGISTRATION_NOT_REGISTERED )
+      if (monitor->registration_status != REGISTRATION_NOT_REGISTERED)
 	{
-		int type;
+	  int type;
 
-		if ( tok[3] )
-			type = atoi(tok[3]);
-		else
-            type = -1; /* Unknown */
+	  if (tok[3])
+	    type = atoi (tok[3]);
+	  else
+	    type = -1;		/* Unknown */
 
-	    switch (type) {
+	  switch (type)
+	    {
 	    case 0:
-		cellmodem_t_switch_network_status( monitor, REGISTRATION_GPRS );
-		break;
+	      cellmodem_t_switch_network_status (monitor, REGISTRATION_GPRS);
+	      break;
 	    case 2:
-            /* Check for HSDPA/UMTS */
-            if ( monitor->driver->capabilities & MODEM_CAPABILITY_OHCIP ) {
-                cellmodem_t_get_ohcip_status( monitor );
-            } else {
-                cellmodem_t_get_quality( monitor );
-            }
-            return;
+	      /* Check for HSDPA/UMTS */
+	      if (monitor->driver->capabilities & MODEM_CAPABILITY_OHCIP)
+		{
+		  cellmodem_t_get_ohcip_status (monitor);
+		}
+	      else
+		{
+		  cellmodem_t_get_quality (monitor);
+		}
+	      return;
 	    default:
-		cellmodem_t_switch_network_status( monitor, REGISTRATION_UNKNOWN );
+	      cellmodem_t_switch_network_status (monitor,
+						 REGISTRATION_UNKNOWN);
 	    }
 	}
-    } else {
-	cellmodem_t_switch_network_status( monitor, REGISTRATION_NOT_REGISTERED );
+    }
+  else
+    {
+      cellmodem_t_switch_network_status (monitor,
+					 REGISTRATION_NOT_REGISTERED);
 
-        cellmodem_t_switch_to_error_and_restart( monitor, _("Invalid COPS reply from modem") );
-        return;
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Invalid COPS reply from modem"));
+      return;
     }
 
-    cellmodem_t_get_quality( monitor );
+  cellmodem_t_get_quality (monitor);
 }
 
 /**
@@ -833,48 +920,61 @@ cellmodem_t_identify_callback(gboolean success, GString *response, void *pvt)
  */
 
 static void
-cellmodem_t_pin_callback(gboolean success, GString *response, void *pvt)
+cellmodem_t_pin_callback (gboolean success, GString * response, void *pvt)
 {
-    cellmodem_t *monitor = (cellmodem_t*)pvt;
-    gboolean failure = FALSE;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
+  gboolean failure = FALSE;
 
-    if ( !success || response==NULL || response->str==NULL ) {
-	/* Error */
-        CELLMODEM_DEBUG(2,"Modem error detected (%p)", pvt);
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Error in modem reply to CPIN") );
-        return;
+  if (!success || response == NULL || response->str == NULL)
+    {
+      /* Error */
+      CELLMODEM_DEBUG (2, "Modem error detected (%p)", pvt);
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Error in modem reply to CPIN"));
+      return;
     }
 
-    /* +CPIN: SIM PIN */
-    /* +CPIN: READY */
+  /* +CPIN: SIM PIN */
+  /* +CPIN: READY */
 
-    if ( strncmp(response->str,"+CPIN: ", 7 )==0 ) {
-	gchar *start = response->str + 7;
-	CELLMODEM_DEBUG(4, "CPIN: '%s'", start);
-	if ( strncmp( start, "SIM PIN", 7) == 0) {
-	    /* If we can ask for pin, we do */
+  if (strncmp (response->str, "+CPIN: ", 7) == 0)
+    {
+      gchar *start = response->str + 7;
+      CELLMODEM_DEBUG (4, "CPIN: '%s'", start);
+      if (strncmp (start, "SIM PIN", 7) == 0)
+	{
+	  /* If we can ask for pin, we do */
 
-	    cellmodem_t_request_pin( monitor );
-	    return;
+	  cellmodem_t_request_pin (monitor);
+	  return;
 	}
-	if ( strncmp( start, "READY", 5) == 0 )
-    {
-        cellmodem_t_is_registered( monitor );
-        return;
-	} else {
-            failure = TRUE;
+      if (strncmp (start, "READY", 5) == 0)
+	{
+	  cellmodem_t_is_registered (monitor);
+	  return;
+	}
+      else
+	{
+	  failure = TRUE;
 	}
 
-        /* Errors found ?? . */
-    } else {
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Invalid CPIN reply from modem") );
+      /* Errors found ?? . */
+    }
+  else
+    {
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Invalid CPIN reply from modem"));
 
-        reschedule_open( monitor );
+      reschedule_open (monitor);
     }
-    if ( failure )
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Unsupportted CPIN reply from modem") );
-    else
-	reschedule_open( monitor );
+  if (failure)
+    cellmodem_t_switch_to_error_and_restart (monitor,
+					     _
+					     ("Unsupportted CPIN reply from modem"));
+  else
+    reschedule_open (monitor);
 }
 
 /**
@@ -890,41 +990,53 @@ cellmodem_t_pin_callback(gboolean success, GString *response, void *pvt)
  */
 
 static void
-cellmodem_t_ohcip_callback(gboolean success, GString *response, void *pvt)
+cellmodem_t_ohcip_callback (gboolean success, GString * response, void *pvt)
 {
-    cellmodem_t *monitor = (cellmodem_t*)pvt;
-    gboolean failure = FALSE;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
+  gboolean failure = FALSE;
 
-    if ( !success || response==NULL || response->str==NULL ) {
-	/* Error  - ignore */
-	cellmodem_t_switch_network_status( monitor, REGISTRATION_UMTS );
-        goto ohcip_out;
+  if (!success || response == NULL || response->str == NULL)
+    {
+      /* Error  - ignore */
+      cellmodem_t_switch_network_status (monitor, REGISTRATION_UMTS);
+      goto ohcip_out;
     }
 
-    /* +CPIN: SIM PIN */
-    /* +CPIN: READY */
+  /* +CPIN: SIM PIN */
+  /* +CPIN: READY */
 
-    if ( strncmp(response->str,"_OHCIP: ", 8 )==0 ) {
-	gchar *start = response->str + 8;
-	CELLMODEM_DEBUG(4,"OHCIP: '%s'", start);
-	if ( strncmp( start, "1", 1) == 0) {
+  if (strncmp (response->str, "_OHCIP: ", 8) == 0)
+    {
+      gchar *start = response->str + 8;
+      CELLMODEM_DEBUG (4, "OHCIP: '%s'", start);
+      if (strncmp (start, "1", 1) == 0)
+	{
 
-            cellmodem_t_switch_network_status( monitor, REGISTRATION_HSDPA );
-	} else {
-	    cellmodem_t_switch_network_status( monitor, REGISTRATION_UMTS );
+	  cellmodem_t_switch_network_status (monitor, REGISTRATION_HSDPA);
+	}
+      else
+	{
+	  cellmodem_t_switch_network_status (monitor, REGISTRATION_UMTS);
 	}
 
-        /* Errors found ?? . */
-    } else {
-        cellmodem_t_switch_to_error_and_restart( monitor, _("Invalid OHCIP reply from modem") );
-        return;
+      /* Errors found ?? . */
     }
-    if ( failure ) {
-        cellmodem_t_switch_to_error_and_restart( monitor, _("Unsupportted OHCIP reply from modem") );
-        return;
+  else
+    {
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Invalid OHCIP reply from modem"));
+      return;
+    }
+  if (failure)
+    {
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Unsupportted OHCIP reply from modem"));
+      return;
     }
 ohcip_out:
-    cellmodem_t_get_quality( monitor );
+  cellmodem_t_get_quality (monitor);
 }
 
 /**
@@ -941,44 +1053,55 @@ ohcip_out:
 
 #if 0
 static void
-cellmodem_t_cmgf_callback(gboolean success, GString *response, void *pvt)
+cellmodem_t_cmgf_callback (gboolean success, GString * response, void *pvt)
 {
-	cellmodem_t *monitor = (cellmodem_t*)pvt;
-	gboolean failure = FALSE;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
+  gboolean failure = FALSE;
 
-	if ( !success || response==NULL || response->str==NULL ) {
-		// Seems not to support SMS.
-		monitor->no_sms_support = TRUE;
-		return;
-	}
+  if (!success || response == NULL || response->str == NULL)
+    {
+      // Seems not to support SMS.
+      monitor->no_sms_support = TRUE;
+      return;
+    }
 
-	/* +CMGF: 0 */
-	/* +CMGF: 1 */
+  /* +CMGF: 0 */
+  /* +CMGF: 1 */
 
-	if ( strncmp(response->str,"+CMGF: ", 7 )==0 ) {
-		gchar *start = response->str + 7;
-		CELLMODEM_DEBUG(4, "CMGF: '%s'", start);
+  if (strncmp (response->str, "+CMGF: ", 7) == 0)
+    {
+      gchar *start = response->str + 7;
+      CELLMODEM_DEBUG (4, "CMGF: '%s'", start);
 
-		if ( strncmp( start, "1", 1) == 0) {
-			// We need to enter PDU mode.
-            cellmodem_t_switch_to_sms_pdu_mode( monitor );
-		}
-        if ( strncmp( start, "0", 1) == 0) {
-			// Ok, good, we're in PDU mode.
+      if (strncmp (start, "1", 1) == 0)
+	{
+	  // We need to enter PDU mode.
+	  cellmodem_t_switch_to_sms_pdu_mode (monitor);
+	}
+      if (strncmp (start, "0", 1) == 0)
+	{
+	  // Ok, good, we're in PDU mode.
 
-		}
+	}
 
 
-	} else {
-		cellmodem_t_switch_to_error_and_restart( monitor, _("Invalid OHCIP reply from modem") );
-		return;
-	}
-	if ( failure ) {
-		cellmodem_t_switch_to_error_and_restart( monitor, _("Unsupportted OHCIP reply from modem") );
-		return;
-	}
+    }
+  else
+    {
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Invalid OHCIP reply from modem"));
+      return;
+    }
+  if (failure)
+    {
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Unsupportted OHCIP reply from modem"));
+      return;
+    }
 ohcip_out:
-	cellmodem_t_get_quality( monitor );
+  cellmodem_t_get_quality (monitor);
 }
 
 #endif
@@ -996,39 +1119,43 @@ ohcip_out:
 
 #if 0
 static void
-cellmodem_t_set_cmgf_callback(gboolean success, GString *response, void *pvt)
+cellmodem_t_set_cmgf_callback (gboolean success, GString * response,
+			       void *pvt)
 {
-	cellmodem_t *monitor = (cellmodem_t*)pvt;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
 
-	if ( !success || response==NULL || response->str==NULL ) {
-		// Seems not to support SMS, or PDU mode.
-		monitor->no_sms_support = TRUE;
-		return;
-	}
-	//
+  if (!success || response == NULL || response->str == NULL)
+    {
+      // Seems not to support SMS, or PDU mode.
+      monitor->no_sms_support = TRUE;
+      return;
+    }
+  //
 }
 #endif
 
 static void
-cellmodem_t_setpin_callback(gboolean success, GString *response, void *pvt)
+cellmodem_t_setpin_callback (gboolean success, GString * response, void *pvt)
 {
-    cellmodem_t *monitor = (cellmodem_t*)pvt;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
 
-    if ( !success ) {
-	/* Error */
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Cannot send PIN to modem") );
-        return;
+  if (!success)
+    {
+      /* Error */
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _("Cannot send PIN to modem"));
+      return;
     }
 
-    /* TODO: We should recheck if PIN was accepted */
+  /* TODO: We should recheck if PIN was accepted */
 
 
 
-    /* Just try to reopen. */
+  /* Just try to reopen. */
 
-    cellmodem_t_switch_status( monitor, MODEM_CLOSED );
+  cellmodem_t_switch_status (monitor, MODEM_CLOSED);
 
-    reschedule_open( monitor /*, FALSE*/ );
+  reschedule_open (monitor /*, FALSE */ );
 }
 
 
@@ -1045,40 +1172,49 @@ cellmodem_t_setpin_callback(gboolean success, GString *response, void *pvt)
  */
 
 static void
-cellmodem_t_quality_callback(gboolean success, GString *response, void *pvt)
+cellmodem_t_quality_callback (gboolean success, GString * response, void *pvt)
 {
-    cellmodem_t *monitor = (cellmodem_t*)pvt;
+  cellmodem_t *monitor = (cellmodem_t *) pvt;
 
-    if ( !success || response==NULL || response->str==NULL ) {
-	/* Error */
-        CELLMODEM_DEBUG(2,"Modem error detected (%p)", pvt);
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Error in modem reply to CSQ") );
-        return;
+  if (!success || response == NULL || response->str == NULL)
+    {
+      /* Error */
+      CELLMODEM_DEBUG (2, "Modem error detected (%p)", pvt);
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Error in modem reply to CSQ"));
+      return;
     }
 
-    if ( strncmp( response->str ,"+CSQ: ", 6 )==0 ) {
-	gchar *start = response->str + 6;
-	if ( strtok( start, ",") == NULL) {
-	    return;/* FALSE;*/
+  if (strncmp (response->str, "+CSQ: ", 6) == 0)
+    {
+      gchar *start = response->str + 6;
+      if (strtok (start, ",") == NULL)
+	{
+	  return;		/* FALSE; */
 	}
-	strtok ( NULL, "," );
-	CELLMODEM_DEBUG(4,"Qual: '%s'\n", start );
-
-	int i = atoi( start );
-	monitor->signal_strength = i;
-	monitor->quality = (double)i/ (double)monitor->options.max_quality;
-	if (monitor->quality>1.0)
-	    monitor->quality=1.0;
-
-        cellmodem_t_update_monitors( monitor );
-    } else {
-        cellmodem_t_switch_to_error_and_restart( monitor, _("Invalid CSQ reply from modem") );
-        return;
-    }
-    CELLMODEM_DEBUG(3, "Got quality, restarting");
-    /* cellmodem_t_close_modem( monitor, FALSE ); - reschedule will close */
-    cellmodem_t_switch_status( monitor, MODEM_CLOSED );
-    reschedule_open( monitor /*, FALSE*/ );
+      strtok (NULL, ",");
+      CELLMODEM_DEBUG (4, "Qual: '%s'\n", start);
+
+      int i = atoi (start);
+      monitor->signal_strength = i;
+      monitor->quality = (double) i / (double) monitor->options.max_quality;
+      if (monitor->quality > 1.0)
+	monitor->quality = 1.0;
+
+      cellmodem_t_update_monitors (monitor);
+    }
+  else
+    {
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _
+					       ("Invalid CSQ reply from modem"));
+      return;
+    }
+  CELLMODEM_DEBUG (3, "Got quality, restarting");
+  /* cellmodem_t_close_modem( monitor, FALSE ); - reschedule will close */
+  cellmodem_t_switch_status (monitor, MODEM_CLOSED);
+  reschedule_open (monitor /*, FALSE */ );
 }
 
 /**
@@ -1093,10 +1229,11 @@ cellmodem_t_quality_callback(gboolean success, GString *response, void *pvt)
  */
 
 static void
-cellmodem_t_is_registered( cellmodem_t *monitor )
+cellmodem_t_is_registered (cellmodem_t * monitor)
 {
-    cellmodem_t_send_at_command(monitor, &cellmodem_t_registration_callback, "+CREG?", "+CREG:" );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_CREG_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_registration_callback,
+			       "+CREG?", "+CREG:");
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_CREG_RESPONSE);
 }
 
 /**
@@ -1114,10 +1251,11 @@ cellmodem_t_is_registered( cellmodem_t *monitor )
  */
 
 static void
-cellmodem_t_identify_network( cellmodem_t *monitor )
+cellmodem_t_identify_network (cellmodem_t * monitor)
 {
-    cellmodem_t_send_at_command(monitor, &cellmodem_t_identify_callback, "+COPS?", "+COPS:" );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_COPS_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_identify_callback,
+			       "+COPS?", "+COPS:");
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_COPS_RESPONSE);
 
 }
 
@@ -1136,10 +1274,11 @@ cellmodem_t_identify_network( cellmodem_t *monitor )
  */
 
 static void
-cellmodem_t_get_quality( cellmodem_t *monitor )
+cellmodem_t_get_quality (cellmodem_t * monitor)
 {
-    cellmodem_t_send_at_command(monitor, &cellmodem_t_quality_callback, "+CSQ", "+CSQ:" );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_CSQ_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_quality_callback, "+CSQ",
+			       "+CSQ:");
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_CSQ_RESPONSE);
 }
 
 /**
@@ -1157,10 +1296,11 @@ cellmodem_t_get_quality( cellmodem_t *monitor )
  */
 
 static void
-cellmodem_t_get_pin_status( cellmodem_t *monitor )
+cellmodem_t_get_pin_status (cellmodem_t * monitor)
 {
-    cellmodem_t_send_at_command(monitor, &cellmodem_t_pin_callback, "+CPIN?", "+CPIN:" );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_CPIN_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_pin_callback, "+CPIN?",
+			       "+CPIN:");
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_CPIN_RESPONSE);
 
 }
 
@@ -1176,10 +1316,11 @@ cellmodem_t_get_pin_status( cellmodem_t *monitor )
  */
 
 static void
-cellmodem_t_get_ohcip_status( cellmodem_t *monitor )
+cellmodem_t_get_ohcip_status (cellmodem_t * monitor)
 {
-    cellmodem_t_send_at_command(monitor, &cellmodem_t_ohcip_callback, "_OHCIP?","_OHCIP:" );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_OHCIP_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_ohcip_callback,
+			       "_OHCIP?", "_OHCIP:");
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_OHCIP_RESPONSE);
 }
 
 /**
@@ -1194,10 +1335,11 @@ cellmodem_t_get_ohcip_status( cellmodem_t *monitor )
  */
 #if 0
 static void
-cellmodem_t_get_cmgf_status( cellmodem_t *monitor )
+cellmodem_t_get_cmgf_status (cellmodem_t * monitor)
 {
-	cellmodem_t_send_at_command(monitor, &cellmodem_t_cmgf_callback, "+CMGF?","+CMGF: " );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_CMGF_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_cmgf_callback, "+CMGF?",
+			       "+CMGF: ");
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_CMGF_RESPONSE);
 }
 #endif
 
@@ -1214,10 +1356,11 @@ cellmodem_t_get_cmgf_status( cellmodem_t *monitor )
  */
 #if 0
 static void
-cellmodem_t_get_cpms( cellmodem_t *monitor )
+cellmodem_t_get_cpms (cellmodem_t * monitor)
 {
-	cellmodem_t_send_at_command(monitor, &cellmodem_t_cpms_callback, "+CPMS?","+CPMS: " );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_CMGF_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_cpms_callback, "+CPMS?",
+			       "+CPMS: ");
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_CMGF_RESPONSE);
 }
 #endif
 
@@ -1233,10 +1376,11 @@ cellmodem_t_get_cpms( cellmodem_t *monitor )
  */
 #if 0
 static void
-cellmodem_t_get_cmgl_read( cellmodem_t *monitor )
+cellmodem_t_get_cmgl_read (cellmodem_t * monitor)
 {
-	cellmodem_t_send_at_command(monitor, &cellmodem_t_cmgl_callback, "+CPMS?","+CPMS: " );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_CMGL_READ_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_cmgl_callback, "+CPMS?",
+			       "+CPMS: ");
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_CMGL_READ_RESPONSE);
 }
 #endif
 
@@ -1253,27 +1397,33 @@ cellmodem_t_get_cmgl_read( cellmodem_t *monitor )
  */
 #if 0
 static void
-cellmodem_t_set_cmgf( cellmodem_t *monitor )
+cellmodem_t_set_cmgf (cellmodem_t * monitor)
 {
-	cellmodem_t_send_at_command(monitor, &cellmodem_t_set_cmgf_callback, "+CMGF=0", NULL );
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_SET_CMGF_RESPONSE );
+  cellmodem_t_send_at_command (monitor, &cellmodem_t_set_cmgf_callback,
+			       "+CMGF=0", NULL);
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_SET_CMGF_RESPONSE);
 }
 #endif
 
 static void
-cellmodem_t_send_pin( cellmodem_t *monitor, const gchar *pin )
+cellmodem_t_send_pin (cellmodem_t * monitor, const gchar * pin)
 {
-    GString *g = g_string_new("+CPIN=");
-    g_string_append( g, pin );
+  GString *g = g_string_new ("+CPIN=");
+  g_string_append (g, pin);
 
-    if (cellmodem_t_open_modem( monitor ) == TRUE) {
+  if (cellmodem_t_open_modem (monitor) == TRUE)
+    {
 
-	cellmodem_t_send_at_command(monitor, &cellmodem_t_setpin_callback, g->str, NULL );
-	g_string_free( g, TRUE );
+      cellmodem_t_send_at_command (monitor, &cellmodem_t_setpin_callback,
+				   g->str, NULL);
+      g_string_free (g, TRUE);
 
-	cellmodem_t_switch_status( monitor, MODEM_WAIT_PINE_RESPONSE );
-    } else {
-	cellmodem_t_switch_to_error_and_restart( monitor, _("Cannot open modem") );
+      cellmodem_t_switch_status (monitor, MODEM_WAIT_PINE_RESPONSE);
+    }
+  else
+    {
+      cellmodem_t_switch_to_error_and_restart (monitor,
+					       _("Cannot open modem"));
     }
 }
 
@@ -1292,83 +1442,93 @@ cellmodem_t_send_pin( cellmodem_t *monitor, const gchar *pin )
  */
 
 static gboolean
-cellmodem_t_modem_handle_response( cellmodem_t *monitor, char *buffer )
+cellmodem_t_modem_handle_response (cellmodem_t * monitor, char *buffer)
 {
-    char *bstart;
+  char *bstart;
 
-    if ( monitor->resp.reply_callback == NULL ) {
-        CELLMODEM_DEBUG(0, "No callback defined!!!!");
-        return TRUE; /* No registered listener. */
+  if (monitor->resp.reply_callback == NULL)
+    {
+      CELLMODEM_DEBUG (0, "No callback defined!!!!");
+      return TRUE;		/* No registered listener. */
     }
-    if ( monitor->resp.reply_buffer == NULL )
+  if (monitor->resp.reply_buffer == NULL)
     {
-	monitor->resp.reply_buffer = g_string_new( NULL ); /* Initialize to NULL */
+      monitor->resp.reply_buffer = g_string_new (NULL);	/* Initialize to NULL */
     }
 
-    /* Remove trailing \r and \n */
+  /* Remove trailing \r and \n */
 
-    bstart = remove_leading_chars(buffer,"\n\r");
-    remove_trailing_chars(bstart,"\r\n");
+  bstart = remove_leading_chars (buffer, "\n\r");
+  remove_trailing_chars (bstart, "\r\n");
 
-    /* See if it is echo */
+  /* See if it is echo */
 
-    if ( strcmp( monitor->lastcmd , bstart ) == 0 ) {
-	CELLMODEM_DEBUG(7,"Echo detected, skipping");
-	return TRUE;
+  if (strcmp (monitor->lastcmd, bstart) == 0)
+    {
+      CELLMODEM_DEBUG (7, "Echo detected, skipping");
+      return TRUE;
     }
 
-    /* Ignore empty lines */
+  /* Ignore empty lines */
 
-    if ( is_only_spaces( bstart ) ) {
-        CELLMODEM_DEBUG(7,"Only spaces found in reply, skipping");
-	return TRUE;
+  if (is_only_spaces (bstart))
+    {
+      CELLMODEM_DEBUG (7, "Only spaces found in reply, skipping");
+      return TRUE;
     }
 
-    CELLMODEM_DEBUG(5, "Got response: '%s' command '%s'\n", bstart, monitor->lastcmd);
+  CELLMODEM_DEBUG (5, "Got response: '%s' command '%s'\n", bstart,
+		   monitor->lastcmd);
 
-    cellmodem_t_cancel_pending_at_command_timeout( monitor );
+  cellmodem_t_cancel_pending_at_command_timeout (monitor);
 
-    if ( is_AT_error_reply( bstart ) ) {
+  if (is_AT_error_reply (bstart))
+    {
 
-	monitor->resp.reply_callback( FALSE,
-				     monitor->resp.reply_buffer,
-				     monitor->resp.reply_pvt );
+      monitor->resp.reply_callback (FALSE,
+				    monitor->resp.reply_buffer,
+				    monitor->resp.reply_pvt);
 
-        g_string_free( monitor->resp.reply_buffer, TRUE );
-        monitor->resp.reply_buffer = NULL;
+      g_string_free (monitor->resp.reply_buffer, TRUE);
+      monitor->resp.reply_buffer = NULL;
 
-	return TRUE;
+      return TRUE;
     }
-    
-    if ( is_AT_success_reply( bstart ) ) {
-        CELLMODEM_DEBUG(4, "Got AT OK reply");
-	monitor->resp.reply_callback( TRUE,
-		       monitor->resp.reply_buffer,
-		       monitor->resp.reply_pvt );
 
-	g_string_free( monitor->resp.reply_buffer, TRUE );
-        monitor->resp.reply_buffer = NULL;
+  if (is_AT_success_reply (bstart))
+    {
+      CELLMODEM_DEBUG (4, "Got AT OK reply");
+      monitor->resp.reply_callback (TRUE,
+				    monitor->resp.reply_buffer,
+				    monitor->resp.reply_pvt);
+
+      g_string_free (monitor->resp.reply_buffer, TRUE);
+      monitor->resp.reply_buffer = NULL;
 
-	return TRUE;
+      return TRUE;
     }
 
-    /*
+  /*
      Check expectation. If expectation does not match,
      we should add this message to some asynchronous event handling.
-     */
+   */
 
-    if ( monitor->resp.reply_expect ) {
-	if ( strncmp( bstart, monitor->resp.reply_expect, strlen(monitor->resp.reply_expect))!=0) {
-	    CELLMODEM_DEBUG(3, "Ignoring reply from modem: '%s'\n", bstart);
-            return TRUE;
+  if (monitor->resp.reply_expect)
+    {
+      if (strncmp
+	  (bstart, monitor->resp.reply_expect,
+	   strlen (monitor->resp.reply_expect)) != 0)
+	{
+	  CELLMODEM_DEBUG (3, "Ignoring reply from modem: '%s'\n", bstart);
+	  return TRUE;
 	}
     }
 
-    g_string_append( monitor->resp.reply_buffer, bstart );
-    g_string_append( monitor->resp.reply_buffer, "\n" );
+  g_string_append (monitor->resp.reply_buffer, bstart);
+  g_string_append (monitor->resp.reply_buffer, "\n");
 
-    CELLMODEM_DEBUG(6, "Finished handling");
-    return TRUE;
+  CELLMODEM_DEBUG (6, "Finished handling");
+  return TRUE;
 }
 
 
@@ -1393,71 +1553,79 @@ cellmodem_t_modem_handle_response( cellmodem_t *monitor, char *buffer )
 
 
 static gboolean
-cellmodem_t_modem_callback(GIOChannel *chan, GIOCondition c, gpointer data )
+cellmodem_t_modem_callback (GIOChannel * chan, GIOCondition c, gpointer data)
 {
-    cellmodem_t *monitor = (cellmodem_t*)data;
-    /* Data ready */
-    CELLMODEM_DEBUG(9, "Data from modem ready, IO cond %d, data %p", c, data);
-    gsize length;
-    GError *error = NULL;
-    GIOStatus status;
-    gboolean r;
-
-    if ( chan == NULL )
+  cellmodem_t *monitor = (cellmodem_t *) data;
+  /* Data ready */
+  CELLMODEM_DEBUG (9, "Data from modem ready, IO cond %d, data %p", c, data);
+  gsize length;
+  GError *error = NULL;
+  GIOStatus status;
+  gboolean r;
+
+  if (chan == NULL)
     {
-		CELLMODEM_DEBUG(2,"NULL channel!!!");
-        return FALSE;
+      CELLMODEM_DEBUG (2, "NULL channel!!!");
+      return FALSE;
     }
 
-    CELLMODEM_DEBUG(9,"Line buffer size before reading: %d", monitor->line_buffer_size);
+  CELLMODEM_DEBUG (9, "Line buffer size before reading: %d",
+		   monitor->line_buffer_size);
 
 
-    status = g_io_channel_read_chars(
-				     chan,
-				     monitor->line_buffer + (monitor->line_buffer_size),
-				     8192-(monitor->line_buffer_size),
-				     &length,
-				     &error
-				    );
-    if ( status == G_IO_STATUS_AGAIN ) {
-        usleep(10000);
-	return TRUE;
+  status = g_io_channel_read_chars (chan,
+				    monitor->line_buffer +
+				    (monitor->line_buffer_size),
+				    8192 - (monitor->line_buffer_size),
+				    &length, &error);
+  if (status == G_IO_STATUS_AGAIN)
+    {
+      usleep (10000);
+      return TRUE;
     }
 
-    if (status != G_IO_STATUS_NORMAL ) {
-	CELLMODEM_DEBUG(1,"Error reading from modem");
-        cellmodem_t_switch_to_error( monitor, _("Error reading from modem") );
-	cellmodem_t_close_modem( monitor /*, TRUE*/ );
-	return FALSE;
+  if (status != G_IO_STATUS_NORMAL)
+    {
+      CELLMODEM_DEBUG (1, "Error reading from modem");
+      cellmodem_t_switch_to_error (monitor, _("Error reading from modem"));
+      cellmodem_t_close_modem (monitor /*, TRUE */ );
+      return FALSE;
     }
 
 
-    monitor->line_buffer_size+=length;
-    monitor->line_buffer[ monitor->line_buffer_size ] = 0;
-
-    CELLMODEM_DEBUG(9,"Read %d bytes from modem: '%s'", length, monitor->line_buffer);
-    CELLMODEM_DEBUG(9,"Buffer size now %d", monitor->line_buffer_size );
-    char *eol;
-    do {
-	eol = memchr( monitor->line_buffer, '\n', monitor->line_buffer_size);
-	CELLMODEM_DEBUG(9,"EOL: from %p -> %p",monitor->line_buffer, eol);
-	if ( eol!=NULL ) {
-            CELLMODEM_DEBUG(7,"Handling command from modem");
-	    size_t dist = eol-monitor->line_buffer;
-	    gchar * line = g_strndup( monitor->line_buffer, dist+1 );
-	    line[dist+1]=0;
-	    memmove(monitor->line_buffer, eol+1, (monitor->line_buffer_size)-dist-1 );
-	    monitor->line_buffer_size-=dist+1;
-	    CELLMODEM_DEBUG(7,"Calling handle response");
-	    r = cellmodem_t_modem_handle_response( monitor, line );
-	    g_free( line );
-	    if (!r)
-		return r;
-	} else {
-	    CELLMODEM_DEBUG(7,"No newline in modem reply, waiting");
+  monitor->line_buffer_size += length;
+  monitor->line_buffer[monitor->line_buffer_size] = 0;
+
+  CELLMODEM_DEBUG (9, "Read %d bytes from modem: '%s'", length,
+		   monitor->line_buffer);
+  CELLMODEM_DEBUG (9, "Buffer size now %d", monitor->line_buffer_size);
+  char *eol;
+  do
+    {
+      eol = memchr (monitor->line_buffer, '\n', monitor->line_buffer_size);
+      CELLMODEM_DEBUG (9, "EOL: from %p -> %p", monitor->line_buffer, eol);
+      if (eol != NULL)
+	{
+	  CELLMODEM_DEBUG (7, "Handling command from modem");
+	  size_t dist = eol - monitor->line_buffer;
+	  gchar *line = g_strndup (monitor->line_buffer, dist + 1);
+	  line[dist + 1] = 0;
+	  memmove (monitor->line_buffer, eol + 1,
+		   (monitor->line_buffer_size) - dist - 1);
+	  monitor->line_buffer_size -= dist + 1;
+	  CELLMODEM_DEBUG (7, "Calling handle response");
+	  r = cellmodem_t_modem_handle_response (monitor, line);
+	  g_free (line);
+	  if (!r)
+	    return r;
 	}
-    } while (eol);
-    return TRUE;
+      else
+	{
+	  CELLMODEM_DEBUG (7, "No newline in modem reply, waiting");
+	}
+    }
+  while (eol);
+  return TRUE;
 }
 
 /**
@@ -1476,111 +1644,112 @@ cellmodem_t_modem_callback(GIOChannel *chan, GIOCondition c, gpointer data )
  */
 
 static gboolean
-cellmodem_t_send_at_command(cellmodem_t *monitor,
-			    modem_reply_callback_t callback,
-			    const gchar *command,
-			    const gchar *expect)
+cellmodem_t_send_at_command (cellmodem_t * monitor,
+			     modem_reply_callback_t callback,
+			     const gchar * command, const gchar * expect)
 {
 
-    monitor->resp.reply_callback = callback;
-    monitor->resp.reply_pvt = monitor;
-    monitor->resp.reply_expect = expect; /* Constant and static - no need to strdup */
+  monitor->resp.reply_callback = callback;
+  monitor->resp.reply_pvt = monitor;
+  monitor->resp.reply_expect = expect;	/* Constant and static - no need to strdup */
 
-    snprintf(monitor->lastcmd, 128, "AT%s", command );
+  snprintf (monitor->lastcmd, 128, "AT%s", command);
 
-    /* TODO - check if we already have a timeout */
+  /* TODO - check if we already have a timeout */
 
-    if ( monitor->at_timeout_id > 0 )
-        g_source_remove( monitor->at_timeout_id );
+  if (monitor->at_timeout_id > 0)
+    g_source_remove (monitor->at_timeout_id);
 
-    monitor->at_timeout_id =
-	g_timeout_add( 1000,
-		      (GSourceFunc) cellmodem_t_at_command_timeout,
-		      monitor );
+  monitor->at_timeout_id =
+    g_timeout_add (1000,
+		   (GSourceFunc) cellmodem_t_at_command_timeout, monitor);
 
-    if ( monitor->driver->writeln(
-				  monitor->modem_instance,
-				  monitor->lastcmd
-				 ) == FALSE )
+  if (monitor->driver->writeln (monitor->modem_instance,
+				monitor->lastcmd) == FALSE)
     {
-	CELLMODEM_DEBUG(1,"ERROR Command: '%s'\n", monitor->lastcmd );
-        cellmodem_t_switch_to_error( monitor, _("Error writing to modem") );
-        cellmodem_t_close_modem( monitor /*, TRUE*/ );
-        return FALSE;
+      CELLMODEM_DEBUG (1, "ERROR Command: '%s'\n", monitor->lastcmd);
+      cellmodem_t_switch_to_error (monitor, _("Error writing to modem"));
+      cellmodem_t_close_modem (monitor /*, TRUE */ );
+      return FALSE;
     }
 
-    CELLMODEM_DEBUG(7,"Sent command to modem: '%s'\n", monitor->lastcmd);
-    
-    return TRUE;
+  CELLMODEM_DEBUG (7, "Sent command to modem: '%s'\n", monitor->lastcmd);
+
+  return TRUE;
 }
 
 
 static gboolean
-cellmodem_t_at_command_timeout( cellmodem_t *monitor )
+cellmodem_t_at_command_timeout (cellmodem_t * monitor)
 {
-    monitor->at_timeout_id = -1;
-    CELLMODEM_DEBUG(1,"Modem failed to reply");
-    cellmodem_t_switch_to_error_and_restart( monitor, _("Modem did not reply to command") );
-    return FALSE;
+  monitor->at_timeout_id = -1;
+  CELLMODEM_DEBUG (1, "Modem failed to reply");
+  cellmodem_t_switch_to_error_and_restart (monitor,
+					   _
+					   ("Modem did not reply to command"));
+  return FALSE;
 }
 
 static void
-cellmodem_t_cancel_pending_at_command_timeout( cellmodem_t *monitor )
+cellmodem_t_cancel_pending_at_command_timeout (cellmodem_t * monitor)
 {
-    if (monitor->at_timeout_id > 0) {
-        g_source_remove ( monitor->at_timeout_id );
+  if (monitor->at_timeout_id > 0)
+    {
+      g_source_remove (monitor->at_timeout_id);
     }
-    monitor->at_timeout_id = -1;
+  monitor->at_timeout_id = -1;
 }
 
 
 static gboolean
-cellmodem_t_open_modem(cellmodem_t *monitor)
+cellmodem_t_open_modem (cellmodem_t * monitor)
 {
-    if ( NULL == monitor->driver ) {
-	cellmodem_t_switch_to_error( monitor, _("No driver defined") );
-	return FALSE;
+  if (NULL == monitor->driver)
+    {
+      cellmodem_t_switch_to_error (monitor, _("No driver defined"));
+      return FALSE;
     }
 
-    if ( NULL == monitor->modem_instance ) {
-        cellmodem_t_switch_to_error( monitor, _("No modem instance") );
-	return FALSE;
+  if (NULL == monitor->modem_instance)
+    {
+      cellmodem_t_switch_to_error (monitor, _("No modem instance"));
+      return FALSE;
     }
 
-    monitor->driver->set_termios( monitor->modem_instance, 0, 0, monitor->options.speed );
+  monitor->driver->set_termios (monitor->modem_instance, 0, 0,
+				monitor->options.speed);
 
-    if ( monitor->driver->open( monitor->modem_instance,
-			        &monitor->options ) == FALSE )
+  if (monitor->driver->open (monitor->modem_instance,
+			     &monitor->options) == FALSE)
     {
-	return FALSE;
+      return FALSE;
     }
-    /* cellmodem_t_switch_status( monitor, MODEM_IDLE ); */
-    cellmodem_t_reset_buffer( monitor );
+  /* cellmodem_t_switch_status( monitor, MODEM_IDLE ); */
+  cellmodem_t_reset_buffer (monitor);
 
-    monitor->driver->set_reader( monitor->modem_instance,
-				 cellmodem_t_modem_callback,
-				 monitor);
+  monitor->driver->set_reader (monitor->modem_instance,
+			       cellmodem_t_modem_callback, monitor);
 
-    return TRUE;
+  return TRUE;
 }
 
 
 static gboolean
-reschedule_open( cellmodem_t *monitor /*, gboolean failure*/ )
+reschedule_open (cellmodem_t * monitor /*, gboolean failure */ )
 {
-    CELLMODEM_DEBUG(7,"RESCHEDULING OPEN");
-    cellmodem_t_close_modem( monitor /*, failure*/ );
+  CELLMODEM_DEBUG (7, "RESCHEDULING OPEN");
+  cellmodem_t_close_modem (monitor /*, failure */ );
 
-    if ( monitor->info_timeout_id > 0 )
+  if (monitor->info_timeout_id > 0)
     {
-        g_source_remove( monitor->info_timeout_id );
+      g_source_remove (monitor->info_timeout_id);
     }
 
-    monitor->info_timeout_id = g_timeout_add( OPEN_TIMEOUT,
-                                             (GSourceFunc) get_network_info ,
-                                             monitor );
+  monitor->info_timeout_id = g_timeout_add (OPEN_TIMEOUT,
+					    (GSourceFunc) get_network_info,
+					    monitor);
 
-    return FALSE; /* Cancel this timer */
+  return FALSE;			/* Cancel this timer */
 }
 
 
@@ -1589,20 +1758,21 @@ reschedule_open( cellmodem_t *monitor /*, gboolean failure*/ )
  */
 
 static gboolean
-get_network_info( cellmodem_t *monitor )
+get_network_info (cellmodem_t * monitor)
 {
-    CELLMODEM_DEBUG(5, "Getting network info");
-    if ( cellmodem_t_open_modem( monitor ) != FALSE ) {
-        /* Check PIN first. Some modems reply error in registry check */
-        /* cellmodem_t_is_registered( monitor ); */
-        cellmodem_t_get_pin_status( monitor );
-        return FALSE; /* Dont restart timer. */
+  CELLMODEM_DEBUG (5, "Getting network info");
+  if (cellmodem_t_open_modem (monitor) != FALSE)
+    {
+      /* Check PIN first. Some modems reply error in registry check */
+      /* cellmodem_t_is_registered( monitor ); */
+      cellmodem_t_get_pin_status (monitor);
+      return FALSE;		/* Dont restart timer. */
     }
-    CELLMODEM_DEBUG(1,"Cannot open modem");
+  CELLMODEM_DEBUG (1, "Cannot open modem");
 
-    cellmodem_t_switch_to_error_and_restart( monitor, _("Cannot open modem") );
+  cellmodem_t_switch_to_error_and_restart (monitor, _("Cannot open modem"));
 
-    return FALSE;
+  return FALSE;
 }
 
 
@@ -1611,220 +1781,248 @@ get_network_info( cellmodem_t *monitor )
  */
 
 static void
-cellmodem_read_config(XfcePanelPlugin *plugin, cellmodem_t *monitor)
+cellmodem_read_config (XfcePanelPlugin * plugin, cellmodem_t * monitor)
 {
-    char *file;
-    const char *text;
-    XfceRc *rc;
+  char *file;
+  const char *text;
+  XfceRc *rc;
 
-    if (!(file = xfce_panel_plugin_lookup_rc_file (plugin))) {
-	CELLMODEM_DEBUG(1,"No config file found\n");
-	return;
+  if (!(file = xfce_panel_plugin_lookup_rc_file (plugin)))
+    {
+      CELLMODEM_DEBUG (1, "No config file found\n");
+      return;
     }
 
-    rc = xfce_rc_simple_open (file, TRUE);
-    g_free (file);
+  rc = xfce_rc_simple_open (file, TRUE);
+  g_free (file);
 
-    if (!rc) {
-	CELLMODEM_DEBUG(1,"Cannot open config file\n");
+  if (!rc)
+    {
+      CELLMODEM_DEBUG (1, "Cannot open config file\n");
 
-	return;
+      return;
     }
 
-    monitor->options.display_tooltip_info =
-	xfce_rc_read_bool_entry (rc, "display_tooltip_info", FALSE);
+  monitor->options.display_tooltip_info =
+    xfce_rc_read_bool_entry (rc, "display_tooltip_info", FALSE);
 
 
-    if ( NULL != monitor->options.modem_device )
-	    g_free( monitor->options.modem_device );
+  if (NULL != monitor->options.modem_device)
+    g_free (monitor->options.modem_device);
 
-    text =  xfce_rc_read_entry (rc, "modem_device", NULL);
-    if (NULL!=text && *text) {
-	monitor->options.modem_device = g_strdup (text);
-    } else {
+  text = xfce_rc_read_entry (rc, "modem_device", NULL);
+  if (NULL != text && *text)
+    {
+      monitor->options.modem_device = g_strdup (text);
+    }
+  else
+    {
 
-	monitor->options.modem_device = NULL;
+      monitor->options.modem_device = NULL;
     }
 
-    if ( NULL != monitor->options.modem_driver )
-	g_free( monitor->options.modem_driver );
+  if (NULL != monitor->options.modem_driver)
+    g_free (monitor->options.modem_driver);
 
-    text =  xfce_rc_read_entry (rc, "modem_driver", NULL);
-    if (NULL!=text && *text) {
-	monitor->options.modem_driver = g_strdup (text);
-    } else {
-	monitor->options.modem_driver = NULL;
+  text = xfce_rc_read_entry (rc, "modem_driver", NULL);
+  if (NULL != text && *text)
+    {
+      monitor->options.modem_driver = g_strdup (text);
+    }
+  else
+    {
+      monitor->options.modem_driver = NULL;
     }
 
 
-    monitor->options.low_threshold = xfce_rc_read_int_entry( rc, "low_threshold", 40 );
-    monitor->options.critical_threshold = xfce_rc_read_int_entry( rc, "critical_threshold", 20 );
-    monitor->options.max_quality = xfce_rc_read_int_entry( rc, "max_quality", MAX_QUAL );
-    monitor->options.speed = xfce_rc_read_int_entry( rc, "speed", B230400 );
-	monitor->options.check_for_sms = xfce_rc_read_bool_entry (rc, "check_for_sms", FALSE);
-	monitor->options.sms_check_interval = xfce_rc_read_int_entry (rc, "sms_check_interval", 10);
+  monitor->options.low_threshold =
+    xfce_rc_read_int_entry (rc, "low_threshold", 40);
+  monitor->options.critical_threshold =
+    xfce_rc_read_int_entry (rc, "critical_threshold", 20);
+  monitor->options.max_quality =
+    xfce_rc_read_int_entry (rc, "max_quality", MAX_QUAL);
+  monitor->options.speed = xfce_rc_read_int_entry (rc, "speed", B230400);
+  monitor->options.check_for_sms =
+    xfce_rc_read_bool_entry (rc, "check_for_sms", FALSE);
+  monitor->options.sms_check_interval =
+    xfce_rc_read_int_entry (rc, "sms_check_interval", 10);
 
 
-    xfce_rc_close (rc);
+  xfce_rc_close (rc);
 
 }
 
 
 void
-cellmodem_write_config(XfcePanelPlugin *plugin, cellmodem_t *monitor)
+cellmodem_write_config (XfcePanelPlugin * plugin, cellmodem_t * monitor)
 {
-    XfceRc *rc;
-    char *file;
+  XfceRc *rc;
+  char *file;
 
-    CELLMODEM_DEBUG(7, "Saving configuration");
+  CELLMODEM_DEBUG (7, "Saving configuration");
 
-    if (!(file = xfce_panel_plugin_save_location (plugin, TRUE))) {
-        CELLMODEM_DEBUG(1,"Cannot save configuration!");
-	return;
+  if (!(file = xfce_panel_plugin_save_location (plugin, TRUE)))
+    {
+      CELLMODEM_DEBUG (1, "Cannot save configuration!");
+      return;
     }
-    
-    rc = xfce_rc_simple_open (file, FALSE);
-    g_free (file);
 
+  rc = xfce_rc_simple_open (file, FALSE);
+  g_free (file);
 
-    if (!rc) {
-        CELLMODEM_DEBUG(1,"Cannot open configuration file to save!");
-	return;
-    }
-    
-    xfce_rc_write_bool_entry (rc, "display_tooltip_info",
-			      monitor->options.display_tooltip_info);
-
-    xfce_rc_write_entry (rc, "modem_device",
-			 monitor->options.modem_device );
-    xfce_rc_write_entry (rc, "modem_driver",
-			 monitor->options.modem_driver );
 
-    xfce_rc_write_int_entry( rc, "low_threshold", monitor->options.low_threshold );
-    xfce_rc_write_int_entry( rc, "critical_threshold", monitor->options.critical_threshold );
-    xfce_rc_write_int_entry( rc, "max_quality", monitor->options.max_quality );
-    xfce_rc_write_int_entry( rc, "speed", monitor->options.speed );
-    xfce_rc_write_bool_entry( rc, "check_for_sms",monitor->options.check_for_sms );
-    xfce_rc_write_int_entry( rc, "sms_check_interval", monitor->options.sms_check_interval );
+  if (!rc)
+    {
+      CELLMODEM_DEBUG (1, "Cannot open configuration file to save!");
+      return;
+    }
 
-    CELLMODEM_DEBUG(7, "Done saving configuration");
-    xfce_rc_close (rc);
+  xfce_rc_write_bool_entry (rc, "display_tooltip_info",
+			    monitor->options.display_tooltip_info);
+
+  xfce_rc_write_entry (rc, "modem_device", monitor->options.modem_device);
+  xfce_rc_write_entry (rc, "modem_driver", monitor->options.modem_driver);
+
+  xfce_rc_write_int_entry (rc, "low_threshold",
+			   monitor->options.low_threshold);
+  xfce_rc_write_int_entry (rc, "critical_threshold",
+			   monitor->options.critical_threshold);
+  xfce_rc_write_int_entry (rc, "max_quality", monitor->options.max_quality);
+  xfce_rc_write_int_entry (rc, "speed", monitor->options.speed);
+  xfce_rc_write_bool_entry (rc, "check_for_sms",
+			    monitor->options.check_for_sms);
+  xfce_rc_write_int_entry (rc, "sms_check_interval",
+			   monitor->options.sms_check_interval);
+
+  CELLMODEM_DEBUG (7, "Done saving configuration");
+  xfce_rc_close (rc);
 }
 
 
 void
-cellmodem_t_initialize_modem( cellmodem_t *monitor )
+cellmodem_t_initialize_modem (cellmodem_t * monitor)
 {
-    CELLMODEM_DEBUG(3," ---- Initializing modem ---- ");
+  CELLMODEM_DEBUG (3, " ---- Initializing modem ---- ");
 
-    cellmodem_t_switch_to_error( monitor, _("Modem initializing") );
+  cellmodem_t_switch_to_error (monitor, _("Modem initializing"));
 
-    /*
+  /*
      Cancel any pending timers
-     */
+   */
 
-    if (monitor->at_timeout_id > 0) {
-        g_source_remove( monitor->at_timeout_id );
+  if (monitor->at_timeout_id > 0)
+    {
+      g_source_remove (monitor->at_timeout_id);
     }
-    if ( monitor->info_timeout_id > 0 )
+  if (monitor->info_timeout_id > 0)
     {
-        g_source_remove( monitor->info_timeout_id );
+      g_source_remove (monitor->info_timeout_id);
     }
 
-    if ( monitor->options.modem_driver == NULL ) {
-        CELLMODEM_DEBUG(1,"No driver defined, skipping");
-	return;
+  if (monitor->options.modem_driver == NULL)
+    {
+      CELLMODEM_DEBUG (1, "No driver defined, skipping");
+      return;
     }
 
-    /* TODO: Skip if we already have this driver loaded */
+  /* TODO: Skip if we already have this driver loaded */
 
-    if ( monitor->driver != NULL && monitor->modem_instance != NULL ) {
-        CELLMODEM_DEBUG(1,"Closing already created driver/instance");
-	monitor->driver->close( monitor->modem_instance );
-        CELLMODEM_DEBUG(1,"Destroying the modem instance");
-	monitor->driver->destroy( monitor->modem_instance );
-        monitor->modem_instance = NULL;
+  if (monitor->driver != NULL && monitor->modem_instance != NULL)
+    {
+      CELLMODEM_DEBUG (1, "Closing already created driver/instance");
+      monitor->driver->close (monitor->modem_instance);
+      CELLMODEM_DEBUG (1, "Destroying the modem instance");
+      monitor->driver->destroy (monitor->modem_instance);
+      monitor->modem_instance = NULL;
     }
 
-    monitor->driver = NULL;
-    CELLMODEM_DEBUG(7,"Locating driver");
-    monitor->driver = find_driver_by_name( monitor->options.modem_driver );
+  monitor->driver = NULL;
+  CELLMODEM_DEBUG (7, "Locating driver");
+  monitor->driver = find_driver_by_name (monitor->options.modem_driver);
 
-    if (monitor->driver==NULL) {
-	CELLMODEM_DEBUG(0,"Cannot find that driver (%s)!!!", monitor->options.modem_driver);
-	cellmodem_t_switch_to_error( monitor, _("Invalid driver specified") );
-	return;
+  if (monitor->driver == NULL)
+    {
+      CELLMODEM_DEBUG (0, "Cannot find that driver (%s)!!!",
+		       monitor->options.modem_driver);
+      cellmodem_t_switch_to_error (monitor, _("Invalid driver specified"));
+      return;
     }
 
-    CELLMODEM_DEBUG(9,"Modem driver at %p", monitor->driver);
-    monitor->modem_instance =
-	monitor->driver->create();
+  CELLMODEM_DEBUG (9, "Modem driver at %p", monitor->driver);
+  monitor->modem_instance = monitor->driver->create ();
 
-    CELLMODEM_DEBUG(7,"Modem instance created");
+  CELLMODEM_DEBUG (7, "Modem instance created");
 
-    cellmodem_t_switch_status( monitor, MODEM_WAIT_CREG_RESPONSE );
+  cellmodem_t_switch_status (monitor, MODEM_WAIT_CREG_RESPONSE);
 
-    CELLMODEM_DEBUG(6,"Calling get network info");
+  CELLMODEM_DEBUG (6, "Calling get network info");
 
-    get_network_info(monitor);
+  get_network_info (monitor);
 }
 
 static gboolean
-cellmodem_button_event(GtkEventBox *box, GdkEventButton *button, cellmodem_t *monitor)
+cellmodem_button_event (GtkEventBox * box, GdkEventButton * button,
+			cellmodem_t * monitor)
 {
-    if (button->type != GDK_BUTTON_PRESS || button->button != 1) {
-        return FALSE;
+  if (button->type != GDK_BUTTON_PRESS || button->button != 1)
+    {
+      return FALSE;
     }
 
-    if ( monitor->registration_status == REGISTRATION_NEEDS_PIN )
+  if (monitor->registration_status == REGISTRATION_NEEDS_PIN)
     {
-	pin_helper_launch( GTK_WIDGET(monitor->plugin), pin_callback, monitor );
+      pin_helper_launch (GTK_WIDGET (monitor->plugin), pin_callback, monitor);
     }
-    return TRUE;
+  return TRUE;
 }
 
 
 #ifdef DEBUG_ENABLED
 
-int init_logging()
+int
+init_logging ()
 {
-    openlog("cellmodem", LOG_PID, LOG_USER );
-    cellmodem_debug_level = 9;
-    return 0;
+  openlog ("cellmodem", LOG_PID, LOG_USER);
+  cellmodem_debug_level = 9;
+  return 0;
 }
 
 #endif
 /* create the plugin */
 
 static void
-cellmodem_t_construct (XfcePanelPlugin *plugin)
+cellmodem_t_construct (XfcePanelPlugin * plugin)
 {
-    cellmodem_t *monitor;
+  cellmodem_t *monitor;
 
-    xfce_textdomain(GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
+  xfce_textdomain (GETTEXT_PACKAGE, PACKAGE_LOCALE_DIR, "UTF-8");
 
 #ifdef DEBUG_ENABLED
-    init_logging();
+  init_logging ();
 #endif
 
-    CELLMODEM_DEBUG(2,"Creating applet\n");
-    monitor = cellmodem_t_new (plugin);
+  CELLMODEM_DEBUG (2, "Creating applet\n");
+  monitor = cellmodem_t_new (plugin);
 
-    CELLMODEM_DEBUG(8,"Reading config\n");
-    cellmodem_read_config (plugin, monitor);
-    cellmodem_t_initialize_modem( monitor );
+  CELLMODEM_DEBUG (8, "Reading config\n");
+  cellmodem_read_config (plugin, monitor);
+  cellmodem_t_initialize_modem (monitor);
 
-    cellmodem_t_update_monitors( monitor );
+  cellmodem_t_update_monitors (monitor);
 
-    g_signal_connect (plugin, "free-data", G_CALLBACK (cellmodem_t_delete), monitor);
-    g_signal_connect (plugin, "save", G_CALLBACK (cellmodem_write_config), monitor);
-    g_signal_connect (plugin, "size-changed", G_CALLBACK (cellmodem_set_size), monitor);
+  g_signal_connect (plugin, "free-data", G_CALLBACK (cellmodem_t_delete),
+		    monitor);
+  g_signal_connect (plugin, "save", G_CALLBACK (cellmodem_write_config),
+		    monitor);
+  g_signal_connect (plugin, "size-changed", G_CALLBACK (cellmodem_set_size),
+		    monitor);
 
-    xfce_panel_plugin_menu_show_configure (plugin);
+  xfce_panel_plugin_menu_show_configure (plugin);
 
-    g_signal_connect (plugin, "configure-plugin", G_CALLBACK (cellmodem_create_options), monitor);
+  g_signal_connect (plugin, "configure-plugin",
+		    G_CALLBACK (cellmodem_create_options), monitor);
 
-    gtk_container_add(GTK_CONTAINER(plugin), monitor->eventbox);
+  gtk_container_add (GTK_CONTAINER (plugin), monitor->eventbox);
 
 }
 
diff --git a/panel-plugin/cellmodem.h b/panel-plugin/cellmodem.h
index d41152f..8dc552f 100644
--- a/panel-plugin/cellmodem.h
+++ b/panel-plugin/cellmodem.h
@@ -40,7 +40,7 @@
 #ifdef DEBUG_ENABLED
 #include <syslog.h>
 
-extern int init_logging();
+extern int init_logging ();
 extern char cellmodem_logbuf[8192];
 extern int cellmodem_debug_level;
 
@@ -68,92 +68,94 @@ extern int cellmodem_debug_level;
 #define MAX_QUAL 20
 #define BORDER 8
 
-typedef void (*modem_reply_callback_t)( gboolean success, GString *response, void  *pvt);
-
-typedef enum {
-    MODEM_ERROR,
-    MODEM_WAIT_CPIN_RESPONSE,
-    MODEM_WAIT_CREG_RESPONSE,
-    MODEM_WAIT_COPS_RESPONSE,
-    MODEM_WAIT_CSQ_RESPONSE,
-    MODEM_WAIT_REGISTRATION,
-    MODEM_WAIT_PINE_RESPONSE,
-    MODEM_WAIT_OHCIP_RESPONSE,
-    MODEM_WAIT_CMGF_RESPONSE,
-    MODEM_WAIT_SET_CMGF_RESPONSE,
-    MODEM_CLOSED
+typedef void (*modem_reply_callback_t) (gboolean success, GString * response,
+					void *pvt);
+
+typedef enum
+{
+  MODEM_ERROR,
+  MODEM_WAIT_CPIN_RESPONSE,
+  MODEM_WAIT_CREG_RESPONSE,
+  MODEM_WAIT_COPS_RESPONSE,
+  MODEM_WAIT_CSQ_RESPONSE,
+  MODEM_WAIT_REGISTRATION,
+  MODEM_WAIT_PINE_RESPONSE,
+  MODEM_WAIT_OHCIP_RESPONSE,
+  MODEM_WAIT_CMGF_RESPONSE,
+  MODEM_WAIT_SET_CMGF_RESPONSE,
+  MODEM_CLOSED
 } modem_status_t;
 
-typedef enum {
-    REGISTRATION_UNKNOWN,
-    REGISTRATION_NOT_REGISTERED,
-    REGISTRATION_REGISTERING,
-    REGISTRATION_GPRS,
-    REGISTRATION_UMTS,
-    REGISTRATION_HSDPA,
-    REGISTRATION_NEEDS_PIN
+typedef enum
+{
+  REGISTRATION_UNKNOWN,
+  REGISTRATION_NOT_REGISTERED,
+  REGISTRATION_REGISTERING,
+  REGISTRATION_GPRS,
+  REGISTRATION_UMTS,
+  REGISTRATION_HSDPA,
+  REGISTRATION_NEEDS_PIN
 } registration_type_t;
 
 
 typedef struct
 {
-    modem_reply_callback_t reply_callback;
-	void *reply_pvt;
-    const gchar *reply_expect;
-    GString *reply_buffer;
+  modem_reply_callback_t reply_callback;
+  void *reply_pvt;
+  const gchar *reply_expect;
+  GString *reply_buffer;
 } modem_response_data_t;
 
 typedef struct
 {
-    XfcePanelPlugin *plugin;
-    GtkTooltips     *tooltips;
-    GtkWidget       *eventbox;
-    GtkWidget       *box, *gbox;
-    GtkWidget       *qualpbar;
-    led_t           *status_led;
-    led_t           *network_led;
-    /* Colors */
-    GdkColor        red_color, yellow_color, green_color;
-    /* IO Stuff */
-
-    modem_driver_t  *driver;
-    modem_instance_t  *modem_instance;
-    gchar           line_buffer[8192];
-    size_t          line_buffer_size;
-
-    /* User options */
-    cellmodem_options_t options;
-
-    /* Modem stuff */
-    modem_status_t modem_status;
-    registration_type_t registration_status;
-    gfloat quality;
-    gint signal_strength;
-    /* Last command we sent to the modem */
-    gchar *lastcmd;
-    /* Network information */
-    gchar *network;
-    /* Last error we got */
-	gchar *lasterror;
-
-	/* Set to true if modem does not support SMS */
-	gboolean no_sms_support;
-	guint sms_read_messages;
-	guint sms_unread_messages;
-
-    modem_response_data_t resp;
-
-    gint info_timeout_id;
-    gint at_timeout_id;
+  XfcePanelPlugin *plugin;
+  GtkTooltips *tooltips;
+  GtkWidget *eventbox;
+  GtkWidget *box, *gbox;
+  GtkWidget *qualpbar;
+  led_t *status_led;
+  led_t *network_led;
+  /* Colors */
+  GdkColor red_color, yellow_color, green_color;
+  /* IO Stuff */
+
+  modem_driver_t *driver;
+  modem_instance_t *modem_instance;
+  gchar line_buffer[8192];
+  size_t line_buffer_size;
+
+  /* User options */
+  cellmodem_options_t options;
+
+  /* Modem stuff */
+  modem_status_t modem_status;
+  registration_type_t registration_status;
+  gfloat quality;
+  gint signal_strength;
+  /* Last command we sent to the modem */
+  gchar *lastcmd;
+  /* Network information */
+  gchar *network;
+  /* Last error we got */
+  gchar *lasterror;
+
+  /* Set to true if modem does not support SMS */
+  gboolean no_sms_support;
+  guint sms_read_messages;
+  guint sms_unread_messages;
+
+  modem_response_data_t resp;
+
+  gint info_timeout_id;
+  gint at_timeout_id;
 } cellmodem_t;
 
 
 /*
  Prototypes
  */
-void cellmodem_write_config(XfcePanelPlugin *plugin, cellmodem_t *monitor);
-void cellmodem_t_initialize_modem( cellmodem_t *monitor );
+void cellmodem_write_config (XfcePanelPlugin * plugin, cellmodem_t * monitor);
+void cellmodem_t_initialize_modem (cellmodem_t * monitor);
 
 
 #endif
-
diff --git a/panel-plugin/cellmodem_options.h b/panel-plugin/cellmodem_options.h
index ab1ac3a..192ef34 100644
--- a/panel-plugin/cellmodem_options.h
+++ b/panel-plugin/cellmodem_options.h
@@ -24,17 +24,17 @@
 
 typedef struct
 {
-	gboolean  display_tooltip_info;
-	gchar     *modem_device;
-	gchar     *modem_driver;
-	gchar     *ppp_peer;
-	/*    gboolean  ask_for_pin;*/
-	gint      low_threshold;
-	gint      critical_threshold;
-	gint      max_quality;
-	speed_t   speed;
-	gboolean  check_for_sms;
-	guint     sms_check_interval;
+  gboolean display_tooltip_info;
+  gchar *modem_device;
+  gchar *modem_driver;
+  gchar *ppp_peer;
+  /*    gboolean  ask_for_pin; */
+  gint low_threshold;
+  gint critical_threshold;
+  gint max_quality;
+  speed_t speed;
+  gboolean check_for_sms;
+  guint sms_check_interval;
 } cellmodem_options_t;
 
 #endif
diff --git a/panel-plugin/leds.c b/panel-plugin/leds.c
index 2e282d4..a962f6c 100644
--- a/panel-plugin/leds.c
+++ b/panel-plugin/leds.c
@@ -52,117 +52,125 @@ static int led_v_size = 6;
 
 GdkPixbuf *pixleds[NUMBER_OF_LEDS];
 
-static gboolean initialize_leds()
+static gboolean
+initialize_leds ()
 {
-    int i;
+  int i;
 
-    whole_leds = gdk_pixbuf_new_from_xpm_data( (const char**)LED_XPM );
-    if (whole_leds == NULL)
-	return FALSE;
+  whole_leds = gdk_pixbuf_new_from_xpm_data ((const char **) LED_XPM);
+  if (whole_leds == NULL)
+    return FALSE;
 
-    /* cut individual leds. */
+  /* cut individual leds. */
 
-    for (i=0; i<NUMBER_OF_LEDS; i++) {
-	pixleds[i] =
-	    gdk_pixbuf_new_subpixbuf( whole_leds,
-				     i*led_h_size,
-				     0,
-				     led_h_size,
-                                     led_v_size);
+  for (i = 0; i < NUMBER_OF_LEDS; i++)
+    {
+      pixleds[i] =
+	gdk_pixbuf_new_subpixbuf (whole_leds,
+				  i * led_h_size, 0, led_h_size, led_v_size);
     }
 
-    /* Initialize the list */
+  /* Initialize the list */
 
-    flashing_leds = NULL;
+  flashing_leds = NULL;
 
-    leds_initialized = TRUE;
-    return TRUE;
+  leds_initialized = TRUE;
+  return TRUE;
 }
 
-static gboolean do_flash_leds( gpointer data )
+static gboolean
+do_flash_leds (gpointer data)
 {
-    g_slist_foreach( flashing_leds,
-		   (GFunc)led_t_flip_flash,
-                   NULL );
+  g_slist_foreach (flashing_leds, (GFunc) led_t_flip_flash, NULL);
 
-    return TRUE;
+  return TRUE;
 }
 
 
-void led_t_flip_flash( led_t *led, gpointer data )
+void
+led_t_flip_flash (led_t * led, gpointer data)
 {
-    if ( ! led->flashing )
-	return;
+  if (!led->flashing)
+    return;
 
-    led->flash_on = ~(led->flash_on);
+  led->flash_on = ~(led->flash_on);
 
-    if ( led->flash_on ) {
-	gtk_image_set_from_pixbuf( GTK_IMAGE(led->image), pixleds[ (int)led->color ]);
-    } else {
-	gtk_image_set_from_pixbuf( GTK_IMAGE(led->image), pixleds[ LED_OFF ]);
+  if (led->flash_on)
+    {
+      gtk_image_set_from_pixbuf (GTK_IMAGE (led->image),
+				 pixleds[(int) led->color]);
+    }
+  else
+    {
+      gtk_image_set_from_pixbuf (GTK_IMAGE (led->image), pixleds[LED_OFF]);
     }
 }
 
-led_t *led_t_new()
+led_t *
+led_t_new ()
 {
-    led_t *led = g_new0( led_t, 1 );
+  led_t *led = g_new0 (led_t, 1);
 
-    led->image = gtk_image_new();
+  led->image = gtk_image_new ();
 
-    if ( leds_initialized == FALSE )
-        initialize_leds();
+  if (leds_initialized == FALSE)
+    initialize_leds ();
 
-    return led;
+  return led;
 }
 
-void led_t_set_color( led_t *led, led_color_t color )
+void
+led_t_set_color (led_t * led, led_color_t color)
 {
-    led->color = color;
-    gtk_image_set_from_pixbuf( GTK_IMAGE(led->image), pixleds[ (int)color ]);
+  led->color = color;
+  gtk_image_set_from_pixbuf (GTK_IMAGE (led->image), pixleds[(int) color]);
 }
 
 
-void led_t_set_flashing( led_t *led, gboolean flashing )
+void
+led_t_set_flashing (led_t * led, gboolean flashing)
 {
-    if (  (led->flashing ^ flashing ) == 0 )
-	return; /* Already in that state */
+  if ((led->flashing ^ flashing) == 0)
+    return;			/* Already in that state */
 
-    led->flashing = flashing;
+  led->flashing = flashing;
 
-    if ( flashing )
+  if (flashing)
     {
-	/* Add to the list */
+      /* Add to the list */
 
-	flashing_leds = g_slist_append( flashing_leds,
-				       ( gpointer ) led );
+      flashing_leds = g_slist_append (flashing_leds, (gpointer) led);
 
-	if ( flash_timer <= 0 )
+      if (flash_timer <= 0)
 	{
-	    flash_timer = g_timeout_add( 500,
-					(GSourceFunc) do_flash_leds,
-					NULL );
+	  flash_timer = g_timeout_add (500,
+				       (GSourceFunc) do_flash_leds, NULL);
 	}
-    } else {
-	flashing_leds = g_slist_remove( flashing_leds,
-				       ( gconstpointer ) led );
+    }
+  else
+    {
+      flashing_leds = g_slist_remove (flashing_leds, (gconstpointer) led);
 
-	if (g_slist_length( flashing_leds ) == 0) {
-            g_source_remove( flash_timer );
-            flash_timer = -1;
+      if (g_slist_length (flashing_leds) == 0)
+	{
+	  g_source_remove (flash_timer);
+	  flash_timer = -1;
 	}
-	gtk_image_set_from_pixbuf( GTK_IMAGE(led->image), pixleds[ (int)led->color ]);
+      gtk_image_set_from_pixbuf (GTK_IMAGE (led->image),
+				 pixleds[(int) led->color]);
     }
 
 }
 
 
-void  led_t_destroy( led_t *led )
+void
+led_t_destroy (led_t * led)
 {
-    g_object_unref( G_OBJECT( led->image ) );
-    /* Remove from flashing list */
-    if (led->flashing) {
-        led_t_set_flashing( led, FALSE );
+  g_object_unref (G_OBJECT (led->image));
+  /* Remove from flashing list */
+  if (led->flashing)
+    {
+      led_t_set_flashing (led, FALSE);
     }
-    g_free( led );
+  g_free (led);
 }
-
diff --git a/panel-plugin/leds.h b/panel-plugin/leds.h
index ca9af50..d7ef191 100644
--- a/panel-plugin/leds.h
+++ b/panel-plugin/leds.h
@@ -23,28 +23,28 @@
 
 typedef enum
 {
-    LED_OFF = 2,
-    LED_GREEN = 1,
-    LED_RED = 0,
-    LED_YELLOW = 3,
-    LED_BLUE = 4,
+  LED_OFF = 2,
+  LED_GREEN = 1,
+  LED_RED = 0,
+  LED_YELLOW = 3,
+  LED_BLUE = 4,
 } led_color_t;
 
 typedef struct
 {
-    GtkWidget *image;
-    gboolean flashing;
-    led_color_t color;
-    gboolean flash_on;
+  GtkWidget *image;
+  gboolean flashing;
+  led_color_t color;
+  gboolean flash_on;
 } led_t;
 
 
 
-led_t *led_t_new();
-void led_t_set_color( led_t *led, led_color_t color );
-void led_t_set_flashing( led_t *led, gboolean flashing );
-void led_t_destroy( led_t *led );
-void led_t_flip_flash( led_t *led , gpointer data );
+led_t *led_t_new ();
+void led_t_set_color (led_t * led, led_color_t color);
+void led_t_set_flashing (led_t * led, gboolean flashing);
+void led_t_destroy (led_t * led);
+void led_t_flip_flash (led_t * led, gpointer data);
 
 
 
diff --git a/panel-plugin/modem_driver.c b/panel-plugin/modem_driver.c
index fa2f218..afc724e 100644
--- a/panel-plugin/modem_driver.c
+++ b/panel-plugin/modem_driver.c
@@ -35,14 +35,16 @@
  *
  */
 
-modem_driver_t *find_driver_by_name( const gchar *name )
+modem_driver_t *
+find_driver_by_name (const gchar * name)
 {
-    int idx;
-    for (idx=0; drivers[idx]; idx++) {
-	if ( strcmp( name, drivers[idx]->name )==0 )
-            return drivers[idx];
+  int idx;
+  for (idx = 0; drivers[idx]; idx++)
+    {
+      if (strcmp (name, drivers[idx]->name) == 0)
+	return drivers[idx];
     }
-    return NULL;
+  return NULL;
 }
 
 /**
@@ -55,11 +57,12 @@ modem_driver_t *find_driver_by_name( const gchar *name )
  *
  */
 
-modem_driver_t *find_driver_by_index( const int idx )
+modem_driver_t *
+find_driver_by_index (const int idx)
 {
-    /* TODO: Check bounds */
+  /* TODO: Check bounds */
 
-    return drivers[idx];
+  return drivers[idx];
 }
 
 /**
@@ -71,14 +74,16 @@ modem_driver_t *find_driver_by_index( const int idx )
  *
  */
 
-int find_driver_index_by_name( const gchar *name )
+int
+find_driver_index_by_name (const gchar * name)
 {
-    int idx;
-    for (idx=0; drivers[idx]; idx++) {
-	if ( strcmp( name, drivers[idx]->name )==0 )
-            return idx;
+  int idx;
+  for (idx = 0; drivers[idx]; idx++)
+    {
+      if (strcmp (name, drivers[idx]->name) == 0)
+	return idx;
     }
-    return -1;
+  return -1;
 }
 
 /** The driver registry.
@@ -87,10 +92,10 @@ int find_driver_index_by_name( const gchar *name )
 
 
 modem_driver_t *drivers[] = {
-    &modem_driver_generic,
+  &modem_driver_generic,
 #ifdef HAVE_FAKE_MODEM
-    &modem_driver_fake,
-    &modem_driver_nohsdpa,
-    NULL
+  &modem_driver_fake,
+  &modem_driver_nohsdpa,
+  NULL
 #endif
 };
diff --git a/panel-plugin/modem_driver.h b/panel-plugin/modem_driver.h
index f2c13a9..791f8a7 100644
--- a/panel-plugin/modem_driver.h
+++ b/panel-plugin/modem_driver.h
@@ -27,7 +27,7 @@
 #include <glib.h>
 #include "cellmodem_options.h"
 
-typedef void * modem_instance_t;
+typedef void *modem_instance_t;
 
 typedef unsigned long capability_t;
 
@@ -35,27 +35,30 @@ typedef unsigned long capability_t;
 
 typedef struct modem_driver_t
 {
-    const gchar *name;
-    const gchar *description;
+  const gchar *name;
+  const gchar *description;
 
-    capability_t capabilities;
+  capability_t capabilities;
 
-    /* Methods */
+  /* Methods */
 
-    modem_instance_t (*create)( );
-    gboolean (*open)( modem_instance_t instance, cellmodem_options_t *options );
-    gboolean (*writeln)( modem_instance_t instance, const gchar *data );
-    void (*close)( modem_instance_t instance );
-    gboolean (*set_reader)( modem_instance_t instance, GIOFunc reader, gpointer data );
-    gboolean (*set_termios)( modem_instance_t instance, tcflag_t cflag_set, tcflag_t cflag_unset, speed_t speed);
-    void (*destroy)( modem_instance_t instance );
+    modem_instance_t (*create) ();
+    gboolean (*open) (modem_instance_t instance,
+		      cellmodem_options_t * options);
+    gboolean (*writeln) (modem_instance_t instance, const gchar * data);
+  void (*close) (modem_instance_t instance);
+    gboolean (*set_reader) (modem_instance_t instance, GIOFunc reader,
+			    gpointer data);
+    gboolean (*set_termios) (modem_instance_t instance, tcflag_t cflag_set,
+			     tcflag_t cflag_unset, speed_t speed);
+  void (*destroy) (modem_instance_t instance);
 
 } modem_driver_t;
 
 
-modem_driver_t *find_driver_by_name( const gchar *name );
-modem_driver_t *find_driver_by_index( const int idx );
-int find_driver_index_by_name( const gchar *name );
+modem_driver_t *find_driver_by_name (const gchar * name);
+modem_driver_t *find_driver_by_index (const int idx);
+int find_driver_index_by_name (const gchar * name);
 
 extern modem_driver_t *drivers[];
 
diff --git a/panel-plugin/modem_driver_fake.c b/panel-plugin/modem_driver_fake.c
index 4647afb..5987f4a 100644
--- a/panel-plugin/modem_driver_fake.c
+++ b/panel-plugin/modem_driver_fake.c
@@ -18,281 +18,305 @@
 
 #include "modem_driver_fake.h"
 #include "cellmodem.h"
-#include <errno.h> /* Maybe non-portable */
+#include <errno.h>		/* Maybe non-portable */
 #include <sys/time.h>
 
-static guint32 get_current_time()
+static guint32
+get_current_time ()
 {
-    /* we should use g_date_get_julian();*/
-    struct timeval tv;
-    gettimeofday( &tv,NULL );
-    return tv.tv_sec;
+  /* we should use g_date_get_julian(); */
+  struct timeval tv;
+  gettimeofday (&tv, NULL);
+  return tv.tv_sec;
 }
 
-static gboolean send_reply( struct fake_modem_t *modem )
+static gboolean
+send_reply (struct fake_modem_t *modem)
 {
-    gsize written;
-    GError *error = NULL;
-    CELLMODEM_DEBUG(8,"Sending modem reply: %s", modem->reply->str );
-    if ( g_io_channel_write_chars( modem->channel,
-				  modem->reply->str,
-				  strlen(modem->reply->str),
-				  &written,
-				  &error
-				 ) != G_IO_STATUS_NORMAL )
+  gsize written;
+  GError *error = NULL;
+  CELLMODEM_DEBUG (8, "Sending modem reply: %s", modem->reply->str);
+  if (g_io_channel_write_chars (modem->channel,
+				modem->reply->str,
+				strlen (modem->reply->str),
+				&written, &error) != G_IO_STATUS_NORMAL)
     {
-	/* Close channel */
-        CELLMODEM_DEBUG(1,"Error writing response, closing modem channel");
-	g_io_channel_unref( modem->channel );
-        modem->channel = NULL;
-	return FALSE;
+      /* Close channel */
+      CELLMODEM_DEBUG (1, "Error writing response, closing modem channel");
+      g_io_channel_unref (modem->channel);
+      modem->channel = NULL;
+      return FALSE;
     }
 
 
-    g_io_channel_flush( modem->channel, &error );
+  g_io_channel_flush (modem->channel, &error);
 
-    /* TODO - Check also written bytes */
+  /* TODO - Check also written bytes */
 
-    if ( modem->reader != NULL )
-	modem->reader( modem->channel, G_IO_IN, modem->reader_pvt );
+  if (modem->reader != NULL)
+    modem->reader (modem->channel, G_IO_IN, modem->reader_pvt);
 
-    return FALSE;
+  return FALSE;
 }
 
 
-static gboolean queue_reply( struct fake_modem_t *modem )
+static gboolean
+queue_reply (struct fake_modem_t *modem)
 {
-    g_timeout_add(1,
-		  (GSourceFunc)send_reply,
-		  modem
-		 );
-    return TRUE;
+  g_timeout_add (1, (GSourceFunc) send_reply, modem);
+  return TRUE;
 }
 
 
 static void
-reply_ok( struct fake_modem_t *modem, const gchar *string )
+reply_ok (struct fake_modem_t *modem, const gchar * string)
 {
-    g_string_append( modem->reply, string);
-    g_string_append( modem->reply, "\r\nOK\r\n" );
-    queue_reply( modem );
+  g_string_append (modem->reply, string);
+  g_string_append (modem->reply, "\r\nOK\r\n");
+  queue_reply (modem);
 }
 
-static gboolean fake_handle_command( struct fake_modem_t *modem, const char *data )
+static gboolean
+fake_handle_command (struct fake_modem_t *modem, const char *data)
 {
-    const char *cmd;
+  const char *cmd;
 
-    if ( strlen( data ) < 3 ) {
-        CELLMODEM_DEBUG(1,"Short command");
-        return queue_reply(modem);  /* Not AT command, too short */
+  if (strlen (data) < 3)
+    {
+      CELLMODEM_DEBUG (1, "Short command");
+      return queue_reply (modem);	/* Not AT command, too short */
     }
 
-    if ( ! g_str_has_prefix( data, "AT") ) {
-        CELLMODEM_DEBUG(1,"Not AT Command");
-        return queue_reply(modem); /* Not AT command */
+  if (!g_str_has_prefix (data, "AT"))
+    {
+      CELLMODEM_DEBUG (1, "Not AT Command");
+      return queue_reply (modem);	/* Not AT command */
     }
-    cmd = data + 2;
-
-    CELLMODEM_DEBUG(7, "Cmd: %s", cmd );
+  cmd = data + 2;
 
-    /* Add newlines */
+  CELLMODEM_DEBUG (7, "Cmd: %s", cmd);
 
-    g_string_append(modem->reply,"\r\n");
+  /* Add newlines */
 
-    if ( strncmp( cmd, "+CREG?", 6)==0) {
-	CELLMODEM_DEBUG(7, "PIN time: %u, this time %u", modem->pin_time, get_current_time() );
-	if ( modem->valid_pin )
+  g_string_append (modem->reply, "\r\n");
 
-	    if (  get_current_time() > modem->pin_time + REGISTRATION_TIME ) {
-		reply_ok( modem, "+CREG: 0,1" );
-	    } else {
-		reply_ok( modem, "+CREG: 0,2" );
-	    }
+  if (strncmp (cmd, "+CREG?", 6) == 0)
+    {
+      CELLMODEM_DEBUG (7, "PIN time: %u, this time %u", modem->pin_time,
+		       get_current_time ());
+      if (modem->valid_pin)
+
+	if (get_current_time () > modem->pin_time + REGISTRATION_TIME)
+	  {
+	    reply_ok (modem, "+CREG: 0,1");
+	  }
 	else
-            reply_ok( modem, "+CREG: 0,0" );
-        return TRUE;
+	  {
+	    reply_ok (modem, "+CREG: 0,2");
+	  }
+      else
+	reply_ok (modem, "+CREG: 0,0");
+      return TRUE;
     }
-    if ( strncmp( cmd, "+COPS?", 6)==0) {
-	reply_ok( modem,  "+COPS: 0,0,\"Testing network\",2" );
-        return TRUE;
+  if (strncmp (cmd, "+COPS?", 6) == 0)
+    {
+      reply_ok (modem, "+COPS: 0,0,\"Testing network\",2");
+      return TRUE;
     }
 
-    if ( strncmp( cmd, "+CSQ", 4)==0) {
-	reply_ok( modem,  "+CSQ: 15,0" );
-        return TRUE;
+  if (strncmp (cmd, "+CSQ", 4) == 0)
+    {
+      reply_ok (modem, "+CSQ: 15,0");
+      return TRUE;
     }
 
-    if ( strncmp( cmd, "+CPIN?", 6)==0) {
-        if ( modem->valid_pin )
-	    reply_ok( modem,  "+CPIN: READY" );
-	else
-            reply_ok( modem,  "+CPIN: SIM PIN" );
-        return TRUE;
+  if (strncmp (cmd, "+CPIN?", 6) == 0)
+    {
+      if (modem->valid_pin)
+	reply_ok (modem, "+CPIN: READY");
+      else
+	reply_ok (modem, "+CPIN: SIM PIN");
+      return TRUE;
     }
 
-    if ( strncmp( cmd, "+CPIN=", 6)==0) {
-	const char *pin = cmd+6;
-	if (strncmp( pin, "1234", 4)==0) {
-	    if (! modem->valid_pin) {
-		modem->pin_time = get_current_time();
+  if (strncmp (cmd, "+CPIN=", 6) == 0)
+    {
+      const char *pin = cmd + 6;
+      if (strncmp (pin, "1234", 4) == 0)
+	{
+	  if (!modem->valid_pin)
+	    {
+	      modem->pin_time = get_current_time ();
 	    }
-	    modem->valid_pin = TRUE;
-	    g_string_append( modem->reply, "OK\r\n" );
-	    queue_reply( modem );
-	    return TRUE;
-	} else {
-	    /* What to return here? */
-	    g_string_append( modem->reply, "OK\r\n" );
-	    queue_reply( modem );
-            return TRUE;
+	  modem->valid_pin = TRUE;
+	  g_string_append (modem->reply, "OK\r\n");
+	  queue_reply (modem);
+	  return TRUE;
+	}
+      else
+	{
+	  /* What to return here? */
+	  g_string_append (modem->reply, "OK\r\n");
+	  queue_reply (modem);
+	  return TRUE;
 	}
     }
 
-    /* Queue error for now */
-    g_string_append( modem->reply, "ERROR\r\n" );
-    queue_reply( modem );
+  /* Queue error for now */
+  g_string_append (modem->reply, "ERROR\r\n");
+  queue_reply (modem);
 
-    return FALSE;
+  return FALSE;
 }
 
-static gboolean fake_open( modem_instance_t instance, cellmodem_options_t *options  )
+static gboolean
+fake_open (modem_instance_t instance, cellmodem_options_t * options)
 {
-    /* Tricky - we need to set up a pipe
+  /* Tricky - we need to set up a pipe
      otherwise we won't be able to speak
      with the core plugin */
-    struct fake_modem_t *modem = (struct fake_modem_t*)instance;
-    const gchar *tempdir = "/tmp";
-    GString *pipename;
-    GError *error = NULL;
+  struct fake_modem_t *modem = (struct fake_modem_t *) instance;
+  const gchar *tempdir = "/tmp";
+  GString *pipename;
+  GError *error = NULL;
 
-    CELLMODEM_DEBUG(2,"Opening fake modem");
+  CELLMODEM_DEBUG (2, "Opening fake modem");
 
-    pid_t mypid = getpid();
+  pid_t mypid = getpid ();
 
-    pipename = g_string_new( "" );
+  pipename = g_string_new ("");
 
-    g_string_printf( pipename, "%s/fakemodem-%d-pipe", tempdir, mypid );
+  g_string_printf (pipename, "%s/fakemodem-%d-pipe", tempdir, mypid);
 
-    if ( mkfifo( pipename->str, 0600 ) != 0 )
+  if (mkfifo (pipename->str, 0600) != 0)
     {
-        CELLMODEM_DEBUG(1, "Cannot create pipe!!!");
-        g_string_free( pipename, TRUE );
-        return FALSE;
+      CELLMODEM_DEBUG (1, "Cannot create pipe!!!");
+      g_string_free (pipename, TRUE);
+      return FALSE;
     }
 
-    int fd = open( pipename->str, O_RDWR| O_EXCL);
+  int fd = open (pipename->str, O_RDWR | O_EXCL);
 
-    if (fd<0) {
-	/* Unlink fifo */
-        CELLMODEM_DEBUG(1,"Cannot open pipe!!!");
-	unlink(pipename->str);
-	g_string_free( pipename, TRUE );
-	return FALSE;
+  if (fd < 0)
+    {
+      /* Unlink fifo */
+      CELLMODEM_DEBUG (1, "Cannot open pipe!!!");
+      unlink (pipename->str);
+      g_string_free (pipename, TRUE);
+      return FALSE;
     }
 
-    modem->channel = g_io_channel_unix_new( fd );
+  modem->channel = g_io_channel_unix_new (fd);
 
-    if ( modem->channel == NULL )
+  if (modem->channel == NULL)
     {
-        CELLMODEM_DEBUG(1, "Cannot opem modem channel!!!");
-	while (close( fd )<0 && errno==EINTR );
-	unlink( pipename->str );
-	g_string_free( pipename, TRUE );
-	return FALSE;
+      CELLMODEM_DEBUG (1, "Cannot opem modem channel!!!");
+      while (close (fd) < 0 && errno == EINTR);
+      unlink (pipename->str);
+      g_string_free (pipename, TRUE);
+      return FALSE;
     }
-    g_io_channel_set_encoding( modem->channel, NULL, &error );
-    error=NULL;
-    g_io_channel_set_flags( modem->channel, G_IO_FLAG_NONBLOCK, &error );
+  g_io_channel_set_encoding (modem->channel, NULL, &error);
+  error = NULL;
+  g_io_channel_set_flags (modem->channel, G_IO_FLAG_NONBLOCK, &error);
 
-    g_io_channel_set_close_on_unref( modem->channel, TRUE );
+  g_io_channel_set_close_on_unref (modem->channel, TRUE);
 
-    unlink( pipename->str );  /* Not needed any more. The inode will stay there */
-    g_string_free( pipename, TRUE );
+  unlink (pipename->str);	/* Not needed any more. The inode will stay there */
+  g_string_free (pipename, TRUE);
 
-    CELLMODEM_DEBUG(1,"Modem opened (pipe)");
+  CELLMODEM_DEBUG (1, "Modem opened (pipe)");
 
-    return TRUE;
+  return TRUE;
 }
 
-static void fake_close( modem_instance_t instance )
+static void
+fake_close (modem_instance_t instance)
 {
-    struct fake_modem_t *modem = (struct fake_modem_t*)instance;
+  struct fake_modem_t *modem = (struct fake_modem_t *) instance;
 
-    if ( modem == NULL ) {
-        return;
+  if (modem == NULL)
+    {
+      return;
+    }
+  if (modem->channel != NULL)
+    {
+      g_io_channel_unref (modem->channel);
+      modem->channel = NULL;
     }
-    if ( modem->channel != NULL ) {
-	g_io_channel_unref( modem->channel );
-        modem->channel = NULL;
-    } 
 }
 
-static gboolean fake_writeln( modem_instance_t instance, const gchar *data )
+static gboolean
+fake_writeln (modem_instance_t instance, const gchar * data)
 {
-    struct fake_modem_t *modem = (struct fake_modem_t*)instance;
+  struct fake_modem_t *modem = (struct fake_modem_t *) instance;
 
-    /* Free up the string if already allocated */
-    if ( modem->reply != NULL )
+  /* Free up the string if already allocated */
+  if (modem->reply != NULL)
     {
-        g_string_free( modem->reply, TRUE );
+      g_string_free (modem->reply, TRUE);
     }
 
-    if ( data == NULL )
-	return FALSE; /* NULL data, return error */
+  if (data == NULL)
+    return FALSE;		/* NULL data, return error */
 
-    modem->reply = g_string_new( data ); /* For echoing the command */
+  modem->reply = g_string_new (data);	/* For echoing the command */
 
-    CELLMODEM_DEBUG(1,"Got command: %s", data );
+  CELLMODEM_DEBUG (1, "Got command: %s", data);
 
-    return fake_handle_command( instance , data );
+  return fake_handle_command (instance, data);
 
 }
 
 
-static gboolean fake_set_reader( modem_instance_t instance, GIOFunc reader, gpointer data )
+static gboolean
+fake_set_reader (modem_instance_t instance, GIOFunc reader, gpointer data)
 {
-    struct fake_modem_t *modem = (struct fake_modem_t*)instance;
+  struct fake_modem_t *modem = (struct fake_modem_t *) instance;
 
-    modem->reader = reader;
-    modem->reader_pvt = data;
+  modem->reader = reader;
+  modem->reader_pvt = data;
 
-    CELLMODEM_DEBUG(9,"Data set to %p", data );
+  CELLMODEM_DEBUG (9, "Data set to %p", data);
 
-    return TRUE;
+  return TRUE;
 }
 
-static modem_instance_t fake_create( )
+static modem_instance_t
+fake_create ()
 {
-    struct fake_modem_t *modem = g_new( struct fake_modem_t , 1);
-    modem->reply = NULL;
-    modem->reader = NULL;
+  struct fake_modem_t *modem = g_new (struct fake_modem_t, 1);
+  modem->reply = NULL;
+  modem->reader = NULL;
 
-    modem->valid_pin = FALSE;
-    modem->pin_time = 0;
-    return (modem_instance_t)modem;
+  modem->valid_pin = FALSE;
+  modem->pin_time = 0;
+  return (modem_instance_t) modem;
 }
 
-static gboolean fake_set_termios( modem_instance_t instance, tcflag_t cflag_set, tcflag_t cflag_unset, speed_t speed)
+static gboolean
+fake_set_termios (modem_instance_t instance, tcflag_t cflag_set,
+		  tcflag_t cflag_unset, speed_t speed)
 {
-    return TRUE;
+  return TRUE;
 }
 
-static void fake_destroy( modem_instance_t modem )
+static void
+fake_destroy (modem_instance_t modem)
 {
-    g_free( modem );
+  g_free (modem);
 }
 
 
-struct modem_driver_t modem_driver_fake =
-{
-    .name = "Testing Driver",
-    .description = "Simple Driver for Testing Purposes",
-    .capabilities = 0,
-    .open = &fake_open,
-    .close = &fake_close,
-    .writeln = &fake_writeln,
-    .set_reader = &fake_set_reader,
-    .create = &fake_create,
-    .set_termios = &fake_set_termios,
-    .destroy = &fake_destroy
+struct modem_driver_t modem_driver_fake = {
+  .name = "Testing Driver",
+  .description = "Simple Driver for Testing Purposes",
+  .capabilities = 0,
+  .open = &fake_open,
+  .close = &fake_close,
+  .writeln = &fake_writeln,
+  .set_reader = &fake_set_reader,
+  .create = &fake_create,
+  .set_termios = &fake_set_termios,
+  .destroy = &fake_destroy
 };
diff --git a/panel-plugin/modem_driver_fake.h b/panel-plugin/modem_driver_fake.h
index f69253d..65e8ede 100644
--- a/panel-plugin/modem_driver_fake.h
+++ b/panel-plugin/modem_driver_fake.h
@@ -23,15 +23,15 @@
 
 struct fake_modem_t
 {
-    GString *reply;
-    GIOFunc reader;
-    void *reader_pvt;
-    GIOChannel *channel;
-    gboolean valid_pin;
-    guint32 pin_time;
+  GString *reply;
+  GIOFunc reader;
+  void *reader_pvt;
+  GIOChannel *channel;
+  gboolean valid_pin;
+  guint32 pin_time;
 };
 
-#define REGISTRATION_TIME 40 /* 40 seconds registration */
+#define REGISTRATION_TIME 40	/* 40 seconds registration */
 
 extern struct modem_driver_t modem_driver_fake;
 
diff --git a/panel-plugin/modem_driver_generic.c b/panel-plugin/modem_driver_generic.c
index 296fac5..ee085bb 100644
--- a/panel-plugin/modem_driver_generic.c
+++ b/panel-plugin/modem_driver_generic.c
@@ -18,55 +18,59 @@
 
 #include "modem_driver_generic.h"
 #include "cellmodem.h"
-#include <errno.h> /* Maybe non-portable */
+#include <errno.h>		/* Maybe non-portable */
 
 
-static gboolean generic_open( modem_instance_t instance, cellmodem_options_t *options  )
+static gboolean
+generic_open (modem_instance_t instance, cellmodem_options_t * options)
 {
-    struct generic_modem_t *modem = (struct generic_modem_t*)instance;
-    GError *error = NULL;
-    struct termios tio;
-
-    CELLMODEM_DEBUG(6,"Opening modem");
-    if ( options->modem_device == NULL ) {
-        CELLMODEM_DEBUG(1,"Modem device is null, returning");
-	return FALSE;
+  struct generic_modem_t *modem = (struct generic_modem_t *) instance;
+  GError *error = NULL;
+  struct termios tio;
+
+  CELLMODEM_DEBUG (6, "Opening modem");
+  if (options->modem_device == NULL)
+    {
+      CELLMODEM_DEBUG (1, "Modem device is null, returning");
+      return FALSE;
     }
 
-	int fd = open( options->modem_device, O_RDWR|O_EXCL|O_NOCTTY);
+  int fd = open (options->modem_device, O_RDWR | O_EXCL | O_NOCTTY);
 
-    if (fd<0) {
-        CELLMODEM_DEBUG(1,"Cannot open modem!!!");
-	return FALSE;
+  if (fd < 0)
+    {
+      CELLMODEM_DEBUG (1, "Cannot open modem!!!");
+      return FALSE;
     }
 
-    tcgetattr( fd, &tio );
+  tcgetattr (fd, &tio);
 
-    cfmakeraw( &tio );
+  cfmakeraw (&tio);
 
-    tio.c_cflag &= ~(modem->cflag_unset);
-    tio.c_cflag |= (modem->cflag_set | modem->speed);
+  tio.c_cflag &= ~(modem->cflag_unset);
+  tio.c_cflag |= (modem->cflag_set | modem->speed);
 
-    tcsetattr( fd, TCSANOW , &tio);
+  tcsetattr (fd, TCSANOW, &tio);
 
-    modem->channel = g_io_channel_unix_new( fd );
+  modem->channel = g_io_channel_unix_new (fd);
 
-    if ( modem->channel == NULL )
+  if (modem->channel == NULL)
     {
-        CELLMODEM_DEBUG(1,"Cannot opem modem channel!!!");
-	while (close( fd )<0 && errno==EINTR );
-	return FALSE;
+      CELLMODEM_DEBUG (1, "Cannot opem modem channel!!!");
+      while (close (fd) < 0 && errno == EINTR);
+      return FALSE;
     }
-    g_io_channel_set_encoding( modem->channel, NULL, &error );
-    error=NULL;
-    g_io_channel_set_flags( modem->channel, G_IO_FLAG_NONBLOCK, &error );
+  g_io_channel_set_encoding (modem->channel, NULL, &error);
+  error = NULL;
+  g_io_channel_set_flags (modem->channel, G_IO_FLAG_NONBLOCK, &error);
 
-    g_io_channel_set_close_on_unref( modem->channel, TRUE );
+  g_io_channel_set_close_on_unref (modem->channel, TRUE);
 
-    CELLMODEM_DEBUG(6, "Modem successfully opened");
+  CELLMODEM_DEBUG (6, "Modem successfully opened");
 
-    return TRUE;
+  return TRUE;
 }
+
 /*
 static void flush_modem( int fd )
 {
@@ -79,174 +83,188 @@ static void flush_modem( int fd )
     }
 }
 */
-static void generic_close( modem_instance_t instance )
+static void
+generic_close (modem_instance_t instance)
 {
-    struct generic_modem_t *modem = (struct generic_modem_t*)instance;
+  struct generic_modem_t *modem = (struct generic_modem_t *) instance;
 
-    CELLMODEM_DEBUG(6,"Closing modem");
+  CELLMODEM_DEBUG (6, "Closing modem");
 
-    if ( modem == NULL ) {
-	return;
+  if (modem == NULL)
+    {
+      return;
     }
-    if ( modem->channel != NULL ) {
-	if ( modem->reader >= 0 ) {
-	    g_source_remove( modem->reader );
-            modem->reader = -1;
+  if (modem->channel != NULL)
+    {
+      if (modem->reader >= 0)
+	{
+	  g_source_remove (modem->reader);
+	  modem->reader = -1;
 	}
-        CELLMODEM_DEBUG(9, "Closing channel %p", modem->channel );
-	g_io_channel_unref( modem->channel );
-        modem->channel = NULL;
+      CELLMODEM_DEBUG (9, "Closing channel %p", modem->channel);
+      g_io_channel_unref (modem->channel);
+      modem->channel = NULL;
     }
-    CELLMODEM_DEBUG(9,"all done");
+  CELLMODEM_DEBUG (9, "all done");
 }
 
-static gboolean generic_writeln( modem_instance_t instance, const gchar *data )
+static gboolean
+generic_writeln (modem_instance_t instance, const gchar * data)
 {
-    struct generic_modem_t *modem = (struct generic_modem_t*)instance;
-    gsize written, bytes_to_write, bw;
-    GError *error = NULL;
-    GString *g = g_string_new( data );
+  struct generic_modem_t *modem = (struct generic_modem_t *) instance;
+  gsize written, bytes_to_write, bw;
+  GError *error = NULL;
+  GString *g = g_string_new (data);
 
-    GIOStatus status;
+  GIOStatus status;
 
-    if (modem==NULL) {
-	CELLMODEM_DEBUG(1,"Null modem instance!");
-        return FALSE;
+  if (modem == NULL)
+    {
+      CELLMODEM_DEBUG (1, "Null modem instance!");
+      return FALSE;
     }
 
-    if (modem->channel==NULL) {
-	CELLMODEM_DEBUG(1,"Null modem channel!");
-        return FALSE;
+  if (modem->channel == NULL)
+    {
+      CELLMODEM_DEBUG (1, "Null modem channel!");
+      return FALSE;
     }
 
-    g_string_append( g, "\r\n" );
-
-    bytes_to_write = strlen( g->str );
-    written = 0;
-
-    CELLMODEM_DEBUG(8,"Writing command to modem, size %d", bytes_to_write);
-
-    do {
-	status = g_io_channel_write_chars( modem->channel,
-					  g->str + written,
-					  bytes_to_write - written,
-					  &bw,
-					  &error
-					 );
-	CELLMODEM_DEBUG(9,"Write status: %d, written %d", status, bw);
-	if ( status == G_IO_STATUS_AGAIN ) {
-            usleep(10000);
-            error = NULL;
-	} else {
-	    if (status == G_IO_STATUS_NORMAL) {
-		written += bw;
-	    } else {
-                break;
+  g_string_append (g, "\r\n");
+
+  bytes_to_write = strlen (g->str);
+  written = 0;
+
+  CELLMODEM_DEBUG (8, "Writing command to modem, size %d", bytes_to_write);
+
+  do
+    {
+      status = g_io_channel_write_chars (modem->channel,
+					 g->str + written,
+					 bytes_to_write - written,
+					 &bw, &error);
+      CELLMODEM_DEBUG (9, "Write status: %d, written %d", status, bw);
+      if (status == G_IO_STATUS_AGAIN)
+	{
+	  usleep (10000);
+	  error = NULL;
+	}
+      else
+	{
+	  if (status == G_IO_STATUS_NORMAL)
+	    {
+	      written += bw;
+	    }
+	  else
+	    {
+	      break;
 	    }
 	}
 
 
-    } while ( status == G_IO_STATUS_AGAIN || written<bytes_to_write );
+    }
+  while (status == G_IO_STATUS_AGAIN || written < bytes_to_write);
 
-    if ( status != G_IO_STATUS_NORMAL )
+  if (status != G_IO_STATUS_NORMAL)
     {
 
-	/* Close channel */
+      /* Close channel */
 
-	CELLMODEM_DEBUG(1,"Error writing ro modem, closing modem channel");
-	if (error && error->message ) {
-	    CELLMODEM_DEBUG(1,"Error message: '%s'", error->message );
+      CELLMODEM_DEBUG (1, "Error writing ro modem, closing modem channel");
+      if (error && error->message)
+	{
+	  CELLMODEM_DEBUG (1, "Error message: '%s'", error->message);
 	}
 
-        g_string_free( g, TRUE );
-	g_io_channel_unref( modem->channel );
-	modem->channel = NULL;
-	return FALSE;
+      g_string_free (g, TRUE);
+      g_io_channel_unref (modem->channel);
+      modem->channel = NULL;
+      return FALSE;
     }
 
-    g_string_free( g, TRUE );
+  g_string_free (g, TRUE);
 
-    g_io_channel_flush( modem->channel, &error );
+  g_io_channel_flush (modem->channel, &error);
 
-    return TRUE;
+  return TRUE;
 }
 
 
-static gboolean generic_set_reader( modem_instance_t instance, GIOFunc reader, gpointer data )
+static gboolean
+generic_set_reader (modem_instance_t instance, GIOFunc reader, gpointer data)
 {
-    struct generic_modem_t *modem = (struct generic_modem_t*)instance;
+  struct generic_modem_t *modem = (struct generic_modem_t *) instance;
 
-    /*modem->reader = reader;
-    modem->reader_pvt = data;
+  /*modem->reader = reader;
+     modem->reader_pvt = data;
 
-    DEBUG("Data set to %p", data );
-    */
+     DEBUG("Data set to %p", data );
+   */
 
-    if ( modem->reader >= 0)
+  if (modem->reader >= 0)
     {
-        g_source_remove( modem->reader );
+      g_source_remove (modem->reader);
     }
 
-    modem->reader = g_io_add_watch( modem->channel,
-				   G_IO_IN,
-				   reader,
-				   data );
+  modem->reader = g_io_add_watch (modem->channel, G_IO_IN, reader, data);
 
-    return TRUE;
+  return TRUE;
 }
 
-static modem_instance_t generic_create( )
+static modem_instance_t
+generic_create ()
 {
-    struct generic_modem_t *modem = g_new( struct generic_modem_t , 1);
-    modem->reader = -1;
-    modem->channel = NULL;
-
-	modem->cflag_unset = CBAUD | CSIZE | CSTOPB | PARENB | HUPCL;
-	modem->cflag_set =  CS8 | CREAD | CLOCAL | CRTSCTS;
-	modem->speed = B115200;
-	return (modem_instance_t)modem;
+  struct generic_modem_t *modem = g_new (struct generic_modem_t, 1);
+  modem->reader = -1;
+  modem->channel = NULL;
+
+  modem->cflag_unset = CBAUD | CSIZE | CSTOPB | PARENB | HUPCL;
+  modem->cflag_set = CS8 | CREAD | CLOCAL | CRTSCTS;
+  modem->speed = B115200;
+  return (modem_instance_t) modem;
 }
 
-static void generic_destroy( modem_instance_t modem )
+static void
+generic_destroy (modem_instance_t modem)
 {
-    CELLMODEM_DEBUG(8,"Destroying instance %p", modem);
-    g_free( modem );
+  CELLMODEM_DEBUG (8, "Destroying instance %p", modem);
+  g_free (modem);
 }
 
-static gboolean generic_set_termios( modem_instance_t instance, tcflag_t cflag_set, tcflag_t cflag_unset, speed_t speed)
+static gboolean
+generic_set_termios (modem_instance_t instance, tcflag_t cflag_set,
+		     tcflag_t cflag_unset, speed_t speed)
 {
-	struct generic_modem_t *modem =  (struct generic_modem_t*)instance;
-	modem->cflag_set |= cflag_set;
-	modem->cflag_unset |= cflag_unset;
-	modem->speed = speed;
-	return TRUE;
+  struct generic_modem_t *modem = (struct generic_modem_t *) instance;
+  modem->cflag_set |= cflag_set;
+  modem->cflag_unset |= cflag_unset;
+  modem->speed = speed;
+  return TRUE;
 }
 
 
-struct modem_driver_t modem_driver_generic =
-{
-    .name = "Generic Driver",
-    .description = "Generic GPRS/UMTS/HSDPA Driver",
-    .capabilities = MODEM_CAPABILITY_OHCIP,
-    .open = &generic_open,
-    .close = &generic_close,
-    .writeln = &generic_writeln,
-    .set_reader = &generic_set_reader,
-    .create = &generic_create,
-    .set_termios = &generic_set_termios,
-    .destroy = &generic_destroy
+struct modem_driver_t modem_driver_generic = {
+  .name = "Generic Driver",
+  .description = "Generic GPRS/UMTS/HSDPA Driver",
+  .capabilities = MODEM_CAPABILITY_OHCIP,
+  .open = &generic_open,
+  .close = &generic_close,
+  .writeln = &generic_writeln,
+  .set_reader = &generic_set_reader,
+  .create = &generic_create,
+  .set_termios = &generic_set_termios,
+  .destroy = &generic_destroy
 };
 
-struct modem_driver_t modem_driver_nohsdpa =
-{
-    .name = "Generic Driver",
-    .description = "Generic GPRS/UMTS Driver [no HSDPA]",
-    .capabilities = 0,
-    .open = &generic_open,
-    .close = &generic_close,
-    .writeln = &generic_writeln,
-    .set_reader = &generic_set_reader,
-    .create = &generic_create,
-    .set_termios = &generic_set_termios,
-    .destroy = &generic_destroy
+struct modem_driver_t modem_driver_nohsdpa = {
+  .name = "Generic Driver",
+  .description = "Generic GPRS/UMTS Driver [no HSDPA]",
+  .capabilities = 0,
+  .open = &generic_open,
+  .close = &generic_close,
+  .writeln = &generic_writeln,
+  .set_reader = &generic_set_reader,
+  .create = &generic_create,
+  .set_termios = &generic_set_termios,
+  .destroy = &generic_destroy
 };
diff --git a/panel-plugin/modem_driver_generic.h b/panel-plugin/modem_driver_generic.h
index e7ee89c..836a271 100644
--- a/panel-plugin/modem_driver_generic.h
+++ b/panel-plugin/modem_driver_generic.h
@@ -23,11 +23,11 @@
 
 struct generic_modem_t
 {
-    gint reader;
-    GIOChannel *channel;
-	tcflag_t cflag_set;
-	tcflag_t cflag_unset;
-	speed_t speed;
+  gint reader;
+  GIOChannel *channel;
+  tcflag_t cflag_set;
+  tcflag_t cflag_unset;
+  speed_t speed;
 };
 
 extern struct modem_driver_t modem_driver_generic;
diff --git a/panel-plugin/pin_helper.c b/panel-plugin/pin_helper.c
index 9cffe60..8cd2dbf 100644
--- a/panel-plugin/pin_helper.c
+++ b/panel-plugin/pin_helper.c
@@ -19,81 +19,90 @@
 #include "pin_helper.h"
 
 static void
-pin_helper_pin_entry_callback( GtkDialog *dlg, int response, pin_dialog_t *dialog )
+pin_helper_pin_entry_callback (GtkDialog * dlg, int response,
+			       pin_dialog_t * dialog)
 {
-    if ( response == GTK_RESPONSE_ACCEPT ) {
+  if (response == GTK_RESPONSE_ACCEPT)
+    {
 
-	const gchar *pin = gtk_entry_get_text( GTK_ENTRY(dialog->entry) );
+      const gchar *pin = gtk_entry_get_text (GTK_ENTRY (dialog->entry));
 
-	if (!pin || strlen(pin)!=4 )
+      if (!pin || strlen (pin) != 4)
 	{
-	    /* Error. */
-	    xfce_warn(_("Invalid PIN entered. PIN has 4 digits"));
+	  /* Error. */
+	  xfce_warn (_("Invalid PIN entered. PIN has 4 digits"));
 
-            return;
+	  return;
 	}
 
-        /* cellmodem_t_send_pin( dialog->monitor, pin ); */
-        dialog->cb( pin, dialog->pvt );
+      /* cellmodem_t_send_pin( dialog->monitor, pin ); */
+      dialog->cb (pin, dialog->pvt);
 
 
-    } else {
-	/*
-	 now what???????
+    }
+  else
+    {
+      /*
+         now what???????
 
-	 Wait for user to get to preferences again.
+         Wait for user to get to preferences again.
 
-	*/
+       */
 
     }
 
-    gtk_widget_destroy( GTK_WIDGET(dlg) );
-    g_free( dialog );
+  gtk_widget_destroy (GTK_WIDGET (dlg));
+  g_free (dialog);
 }
 
-void pin_helper_launch( GtkWidget *parent, pin_helper_callback cb, void *pvt )
+void
+pin_helper_launch (GtkWidget * parent, pin_helper_callback cb, void *pvt)
 {
-    GtkWidget *vbox;
-    GtkWidget *label;
-    pin_dialog_t *dialog;
+  GtkWidget *vbox;
+  GtkWidget *label;
+  pin_dialog_t *dialog;
 
-    dialog = g_new0( pin_dialog_t, 1 );
+  dialog = g_new0 (pin_dialog_t, 1);
 
-    dialog->pvt = pvt;
-    dialog->cb = cb;
+  dialog->pvt = pvt;
+  dialog->cb = cb;
 
-    dialog->dlg = gtk_dialog_new_with_buttons ( _("Enter PIN"),
-					       GTK_WINDOW( gtk_widget_get_toplevel( parent ) ),
-					       GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
-					       GTK_STOCK_OK,
-					       GTK_RESPONSE_ACCEPT,
-					       GTK_STOCK_CANCEL,
-					       GTK_RESPONSE_REJECT,
-					       NULL
-					      );
+  dialog->dlg = gtk_dialog_new_with_buttons (_("Enter PIN"),
+					     GTK_WINDOW
+					     (gtk_widget_get_toplevel
+					      (parent)),
+					     GTK_DIALOG_MODAL |
+					     GTK_DIALOG_DESTROY_WITH_PARENT,
+					     GTK_STOCK_OK,
+					     GTK_RESPONSE_ACCEPT,
+					     GTK_STOCK_CANCEL,
+					     GTK_RESPONSE_REJECT, NULL);
 
-    vbox = gtk_vbox_new( FALSE, BORDER );
-    gtk_widget_show( vbox );
-    label = gtk_label_new( _("Please enter PIN:") );
-    gtk_widget_show( label );
+  vbox = gtk_vbox_new (FALSE, BORDER);
+  gtk_widget_show (vbox);
+  label = gtk_label_new (_("Please enter PIN:"));
+  gtk_widget_show (label);
 
-    gtk_box_pack_start( GTK_BOX(vbox), label, FALSE, FALSE, 0 );
+  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
 
-    gtk_box_pack_start( GTK_BOX( GTK_DIALOG(dialog->dlg)->vbox ), vbox, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->dlg)->vbox), vbox, FALSE,
+		      FALSE, 0);
 
-    dialog->entry = gtk_entry_new_with_max_length( 4 );
-    gtk_entry_set_visibility( GTK_ENTRY( dialog->entry ), FALSE );
+  dialog->entry = gtk_entry_new_with_max_length (4);
+  gtk_entry_set_visibility (GTK_ENTRY (dialog->entry), FALSE);
 
-    gtk_widget_show( dialog->entry );
+  gtk_widget_show (dialog->entry);
 
-    gtk_box_pack_start( GTK_BOX(vbox), dialog->entry, FALSE, FALSE, 0 );
+  gtk_box_pack_start (GTK_BOX (vbox), dialog->entry, FALSE, FALSE, 0);
 
 
 
-    /* Connect close and response */
+  /* Connect close and response */
 
-    g_signal_connect (dialog->dlg, "close", G_CALLBACK (gtk_widget_destroy), dialog);
-    g_signal_connect (dialog->dlg, "response", G_CALLBACK (pin_helper_pin_entry_callback), dialog);
+  g_signal_connect (dialog->dlg, "close", G_CALLBACK (gtk_widget_destroy),
+		    dialog);
+  g_signal_connect (dialog->dlg, "response",
+		    G_CALLBACK (pin_helper_pin_entry_callback), dialog);
 
-    gtk_widget_show( dialog->dlg );
+  gtk_widget_show (dialog->dlg);
 }
diff --git a/panel-plugin/pin_helper.h b/panel-plugin/pin_helper.h
index 9066fbb..6b949ce 100644
--- a/panel-plugin/pin_helper.h
+++ b/panel-plugin/pin_helper.h
@@ -21,19 +21,20 @@
 
 #include "cellmodem.h"
 
-typedef void (*pin_helper_callback)( const gchar *pin, void *pvt );
+typedef void (*pin_helper_callback) (const gchar * pin, void *pvt);
 
 typedef struct pin_dialog_t
 {
-    GtkWidget *entry;
-    GtkWidget *dlg;
-    pin_helper_callback cb;
-    void *pvt;
+  GtkWidget *entry;
+  GtkWidget *dlg;
+  pin_helper_callback cb;
+  void *pvt;
 } pin_dialog_t;
 
 
 
-void pin_helper_launch( GtkWidget *parent, pin_helper_callback callback, void *pvt );
+void pin_helper_launch (GtkWidget * parent, pin_helper_callback callback,
+			void *pvt);
 
 
 #endif
diff --git a/panel-plugin/preferences.c b/panel-plugin/preferences.c
index ef60754..4273e83 100644
--- a/panel-plugin/preferences.c
+++ b/panel-plugin/preferences.c
@@ -21,132 +21,145 @@
 #include "autodetect.h"
 
 speed_names_t speeds[] = {
-	{ .name = "1200", .speed = B1200 },
-	{ .name = "2400", .speed = B2400 },
-	{ .name = "4800", .speed = B4800 },
-	{ .name = "9600", .speed = B9600 },
-	{ .name = "19200", .speed = B19200 },
-	{ .name = "38400", .speed = B38400 },
-	{ .name = "57600", .speed = B57600 },
-	{ .name = "115200", .speed = B115200 },
-	{ .name = "230400", .speed = B230400 },
-	{ .name = "460800", .speed = B460800 },
-	{ .name = "500000", .speed = B500000 },
-	{ .name = "576000", .speed = B576000 },
-	{ .name = "921600", .speed = B921600 },
-	{ .name = "1000000", .speed = B1000000 },
-	{ .name = "1152000", .speed = B1152000 },
-	{ .name = "1500000", .speed = B1500000 },
-	{ .name = "2000000", .speed = B2000000 },
-	{ .name = "2500000", .speed = B2500000 },
-	{ .name = "3000000", .speed = B3000000 },
-	{ .name = "3500000", .speed = B3500000 },
-	{ .name = "4000000", .speed = B4000000 },
-	{ .name = NULL, .speed = B0 }
+  {.name = "1200",.speed = B1200},
+  {.name = "2400",.speed = B2400},
+  {.name = "4800",.speed = B4800},
+  {.name = "9600",.speed = B9600},
+  {.name = "19200",.speed = B19200},
+  {.name = "38400",.speed = B38400},
+  {.name = "57600",.speed = B57600},
+  {.name = "115200",.speed = B115200},
+  {.name = "230400",.speed = B230400},
+  {.name = "460800",.speed = B460800},
+  {.name = "500000",.speed = B500000},
+  {.name = "576000",.speed = B576000},
+  {.name = "921600",.speed = B921600},
+  {.name = "1000000",.speed = B1000000},
+  {.name = "1152000",.speed = B1152000},
+  {.name = "1500000",.speed = B1500000},
+  {.name = "2000000",.speed = B2000000},
+  {.name = "2500000",.speed = B2500000},
+  {.name = "3000000",.speed = B3000000},
+  {.name = "3500000",.speed = B3500000},
+  {.name = "4000000",.speed = B4000000},
+  {.name = NULL,.speed = B0}
 };
 
 
-static void fill_speeds( GtkWidget *dlg )
+static void
+fill_speeds (GtkWidget * dlg)
 {
-	speed_names_t *iter;
-	for (iter=speeds; iter->name; iter++) {
-		gtk_combo_box_append_text(GTK_COMBO_BOX(dlg), iter->name);
-	}
+  speed_names_t *iter;
+  for (iter = speeds; iter->name; iter++)
+    {
+      gtk_combo_box_append_text (GTK_COMBO_BOX (dlg), iter->name);
+    }
 }
 
 static void
-cellmodem_t_dialog_response( GtkWidget *dlg, int response, cellmodem_t *monitor )
+cellmodem_t_dialog_response (GtkWidget * dlg, int response,
+			     cellmodem_t * monitor)
 {
-    /* Set default driver if none is still defined */
+  /* Set default driver if none is still defined */
 
 
-    CELLMODEM_DEBUG(9,"Got dialog response");
+  CELLMODEM_DEBUG (9, "Got dialog response");
 
 
-    if (monitor->options.modem_driver == NULL) {
-	monitor->options.modem_driver =
-	    g_strdup( find_driver_by_index( 0 )->name );
-	CELLMODEM_DEBUG(9,"Setting driver to default entry ('%s')",
-              monitor->options.modem_driver );
+  if (monitor->options.modem_driver == NULL)
+    {
+      monitor->options.modem_driver =
+	g_strdup (find_driver_by_index (0)->name);
+      CELLMODEM_DEBUG (9, "Setting driver to default entry ('%s')",
+		       monitor->options.modem_driver);
     }
 
-    gtk_widget_destroy (dlg);
-    xfce_panel_plugin_unblock_menu (monitor->plugin);
+  gtk_widget_destroy (dlg);
+  xfce_panel_plugin_unblock_menu (monitor->plugin);
 
-    cellmodem_write_config (monitor->plugin, monitor);
+  cellmodem_write_config (monitor->plugin, monitor);
 
-    /* Reconfigure everything */
+  /* Reconfigure everything */
 
-    cellmodem_t_initialize_modem( monitor );
+  cellmodem_t_initialize_modem (monitor);
 }
 
 
 static void
-update_dialog( cellmodem_dialog_t *dialog )
+update_dialog (cellmodem_dialog_t * dialog)
 {
-    int idx;
-    cellmodem_t *monitor = dialog->monitor;
-	speed_names_t *speediter;
+  int idx;
+  cellmodem_t *monitor = dialog->monitor;
+  speed_names_t *speediter;
 
-    if ( monitor->options.modem_device != NULL )
-	gtk_entry_set_text( GTK_ENTRY(dialog->device_entry),
-			   monitor->options.modem_device);
+  if (monitor->options.modem_device != NULL)
+    gtk_entry_set_text (GTK_ENTRY (dialog->device_entry),
+			monitor->options.modem_device);
 
-    if (monitor->options.modem_driver != NULL) {
-	idx = find_driver_index_by_name( monitor->options.modem_driver );
-    } else {
-	idx=0;
-	/*  monitor->options.modem_driver = find_driver_by_index( idx );*/
+  if (monitor->options.modem_driver != NULL)
+    {
+      idx = find_driver_index_by_name (monitor->options.modem_driver);
+    }
+  else
+    {
+      idx = 0;
+      /*  monitor->options.modem_driver = find_driver_by_index( idx ); */
 
     }
 
-    if (idx<=0)
-	idx=0;
+  if (idx <= 0)
+    idx = 0;
 
-    gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->driver_entry),idx);
+  gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->driver_entry), idx);
 
-	for (idx=0,speediter=speeds; speediter->name; idx++, speediter++) {
-		if ( monitor->options.speed == speediter->speed ) {
-			gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->speed_entry),idx);
-            break;
-		}
-	}
-	if (speediter->name == NULL) {
-		gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->speed_entry),0);
+  for (idx = 0, speediter = speeds; speediter->name; idx++, speediter++)
+    {
+      if (monitor->options.speed == speediter->speed)
+	{
+	  gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->speed_entry), idx);
+	  break;
 	}
+    }
+  if (speediter->name == NULL)
+    {
+      gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->speed_entry), 0);
+    }
 
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->low_entry),
-			      monitor->options.low_threshold);
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->critical_entry),
-			      monitor->options.critical_threshold);
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->maxqual_entry),
-			      monitor->options.max_quality);
-    gtk_spin_button_set_value(GTK_SPIN_BUTTON(dialog->sms_check_interval_entry),
-			      monitor->options.sms_check_interval);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->low_entry),
+			     monitor->options.low_threshold);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->critical_entry),
+			     monitor->options.critical_threshold);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON (dialog->maxqual_entry),
+			     monitor->options.max_quality);
+  gtk_spin_button_set_value (GTK_SPIN_BUTTON
+			     (dialog->sms_check_interval_entry),
+			     monitor->options.sms_check_interval);
 
-	gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(dialog->check_sms_entry),
-								 monitor->options.check_for_sms);
+  gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (dialog->check_sms_entry),
+				monitor->options.check_for_sms);
 
-	if (! monitor->options.check_for_sms ) {
-        gtk_widget_set_sensitive( GTK_WIDGET(dialog->sms_check_interval_entry), FALSE );
-	}
+  if (!monitor->options.check_for_sms)
+    {
+      gtk_widget_set_sensitive (GTK_WIDGET (dialog->sms_check_interval_entry),
+				FALSE);
+    }
 }
 
 
 static void
-cb_device_entry_changed(GtkEntry *entry, cellmodem_dialog_t *dialog)
+cb_device_entry_changed (GtkEntry * entry, cellmodem_dialog_t * dialog)
 {
-    if ( dialog->monitor->options.modem_device != NULL )
-	g_free( dialog->monitor->options.modem_device );
+  if (dialog->monitor->options.modem_device != NULL)
+    g_free (dialog->monitor->options.modem_device);
 
-    dialog->monitor->options.modem_device = NULL;
-            
-    const gchar *text =
-	gtk_entry_get_text( entry );
+  dialog->monitor->options.modem_device = NULL;
 
-    if ( text && strlen( text ) > 0 ) {
-	dialog->monitor->options.modem_device = g_strdup( text );
-	CELLMODEM_DEBUG(9,"Modem device: '%s'", text);
+  const gchar *text = gtk_entry_get_text (entry);
+
+  if (text && strlen (text) > 0)
+    {
+      dialog->monitor->options.modem_device = g_strdup (text);
+      CELLMODEM_DEBUG (9, "Modem device: '%s'", text);
     }
 }
 
@@ -158,218 +171,237 @@ cb_pin_entry_toggled(GtkToggleButton *entry, cellmodem_dialog_t *dialog)
 }
 */
 static void
-cb_driver_entry_changed(GtkComboBox *combo, cellmodem_dialog_t *dialog)
+cb_driver_entry_changed (GtkComboBox * combo, cellmodem_dialog_t * dialog)
 {
-    modem_driver_t *driver;
-    int idx;
+  modem_driver_t *driver;
+  int idx;
 
-    if ( dialog->monitor->options.modem_driver != NULL )
-	g_free( dialog->monitor->options.modem_driver );
+  if (dialog->monitor->options.modem_driver != NULL)
+    g_free (dialog->monitor->options.modem_driver);
 
-    dialog->monitor->options.modem_driver = NULL;
+  dialog->monitor->options.modem_driver = NULL;
 
-    idx = gtk_combo_box_get_active( combo );
+  idx = gtk_combo_box_get_active (combo);
 
 
-    driver = find_driver_by_index( idx );
+  driver = find_driver_by_index (idx);
 
-    if (!driver)
-	return; /* ????? */
+  if (!driver)
+    return;			/* ????? */
 
-    dialog->monitor->options.modem_driver = g_strdup( driver->name );
+  dialog->monitor->options.modem_driver = g_strdup (driver->name);
 }
 
 static void
-cb_speed_entry_changed(GtkComboBox *combo, cellmodem_dialog_t *dialog)
+cb_speed_entry_changed (GtkComboBox * combo, cellmodem_dialog_t * dialog)
 {
-	int idx;
+  int idx;
 
-    idx = gtk_combo_box_get_active( combo );
+  idx = gtk_combo_box_get_active (combo);
 
-    dialog->monitor->options.speed = speeds[idx].speed;
+  dialog->monitor->options.speed = speeds[idx].speed;
 }
 
 
 static void
-cb_maxqual_entry_changed(GtkSpinButton *button, cellmodem_dialog_t *dialog)
+cb_maxqual_entry_changed (GtkSpinButton * button, cellmodem_dialog_t * dialog)
 {
-    dialog->monitor->options.max_quality =
-	gtk_spin_button_get_value_as_int( button );
-    CELLMODEM_DEBUG(9,"Max qual: %d",
-	  dialog->monitor->options.max_quality);
+  dialog->monitor->options.max_quality =
+    gtk_spin_button_get_value_as_int (button);
+  CELLMODEM_DEBUG (9, "Max qual: %d", dialog->monitor->options.max_quality);
 }
 
 static void
-cb_low_entry_changed(GtkSpinButton *button, cellmodem_dialog_t *dialog)
+cb_low_entry_changed (GtkSpinButton * button, cellmodem_dialog_t * dialog)
 {
-    dialog->monitor->options.low_threshold =
-        gtk_spin_button_get_value_as_int( button );
+  dialog->monitor->options.low_threshold =
+    gtk_spin_button_get_value_as_int (button);
 }
 
 static void
-cb_critical_entry_changed(GtkSpinButton *button, cellmodem_dialog_t *dialog)
+cb_critical_entry_changed (GtkSpinButton * button,
+			   cellmodem_dialog_t * dialog)
 {
-    dialog->monitor->options.critical_threshold =
-        gtk_spin_button_get_value_as_int( button );
+  dialog->monitor->options.critical_threshold =
+    gtk_spin_button_get_value_as_int (button);
 }
 
 static void
-cb_sms_check_interval_entry_changed(GtkSpinButton *button, cellmodem_dialog_t *dialog)
+cb_sms_check_interval_entry_changed (GtkSpinButton * button,
+				     cellmodem_dialog_t * dialog)
 {
-    dialog->monitor->options.sms_check_interval =
-        gtk_spin_button_get_value_as_int( button );
+  dialog->monitor->options.sms_check_interval =
+    gtk_spin_button_get_value_as_int (button);
 }
 
 static void
-cb_check_sms_entry_toggled(GtkCheckButton *button, cellmodem_dialog_t *dialog)
+cb_check_sms_entry_toggled (GtkCheckButton * button,
+			    cellmodem_dialog_t * dialog)
 {
-    dialog->monitor->options.check_for_sms = gtk_toggle_button_get_active( GTK_TOGGLE_BUTTON(button) );
-	gtk_widget_set_sensitive( GTK_WIDGET(dialog->sms_check_interval_entry), dialog->monitor->options.check_for_sms );
+  dialog->monitor->options.check_for_sms =
+    gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (button));
+  gtk_widget_set_sensitive (GTK_WIDGET (dialog->sms_check_interval_entry),
+			    dialog->monitor->options.check_for_sms);
 }
 
 static void
-autodetect_dialog_callback( GtkDialog *dlg, int response, cellmodem_dialog_t *dialog )
+autodetect_dialog_callback (GtkDialog * dlg, int response,
+			    cellmodem_dialog_t * dialog)
 {
 
-    if ( response == GTK_RESPONSE_OK ) {
-	/* Fill in device */
+  if (response == GTK_RESPONSE_OK)
+    {
+      /* Fill in device */
 
-        guint a = gtk_combo_box_get_active( GTK_COMBO_BOX(dialog->device_combo) );
+      guint a =
+	gtk_combo_box_get_active (GTK_COMBO_BOX (dialog->device_combo));
 
-        struct known_device *d = g_list_nth_data( dialog->devices, a );
+      struct known_device *d = g_list_nth_data (dialog->devices, a);
 
-	if (d && d->info && d->info->device)
-	    gtk_entry_set_text( GTK_ENTRY(dialog->device_entry), d->info->device );
+      if (d && d->info && d->info->device)
+	gtk_entry_set_text (GTK_ENTRY (dialog->device_entry),
+			    d->info->device);
 
-	/* Set the driver */
+      /* Set the driver */
 
-	int di = find_driver_index_by_name( d->driver );
+      int di = find_driver_index_by_name (d->driver);
 
-	if (di>=0) {
-            gtk_combo_box_set_active( GTK_COMBO_BOX( dialog->driver_entry ), di );
+      if (di >= 0)
+	{
+	  gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->driver_entry), di);
 	}
 
     }
 
-    free_detected_devices( dialog->devices );
-    dialog->devices = NULL;
+  free_detected_devices (dialog->devices);
+  dialog->devices = NULL;
 
-    gtk_widget_destroy( GTK_WIDGET( dialog->autodetect_dialog ) );
+  gtk_widget_destroy (GTK_WIDGET (dialog->autodetect_dialog));
 }
 
 
 static void
-append_device_info( struct known_device *dev, GtkWidget *w )
+append_device_info (struct known_device *dev, GtkWidget * w)
 {
 
-    if (dev == NULL)
-	return;
+  if (dev == NULL)
+    return;
 
-    gtk_combo_box_append_text(GTK_COMBO_BOX(w), dev->description );
+  gtk_combo_box_append_text (GTK_COMBO_BOX (w), dev->description);
 
 }
 
 static void
-cb_autodetect_modem(GtkButton *button, cellmodem_dialog_t *dialog)
+cb_autodetect_modem (GtkButton * button, cellmodem_dialog_t * dialog)
 {
-    GtkWidget *label;
+  GtkWidget *label;
 
-    dialog->device_combo = NULL;
+  dialog->device_combo = NULL;
 
-    CELLMODEM_DEBUG(8,"Getting devices");
+  CELLMODEM_DEBUG (8, "Getting devices");
 
-    dialog->devices = detect_devices();
+  dialog->devices = detect_devices ();
 
-    dialog->autodetect_dialog = gtk_dialog_new();
+  dialog->autodetect_dialog = gtk_dialog_new ();
 
-    gtk_dialog_add_button( GTK_DIALOG( dialog->autodetect_dialog), _("Close"), GTK_RESPONSE_CLOSE);
+  gtk_dialog_add_button (GTK_DIALOG (dialog->autodetect_dialog), _("Close"),
+			 GTK_RESPONSE_CLOSE);
 
-    CELLMODEM_DEBUG(8,"Parsing devices");
+  CELLMODEM_DEBUG (8, "Parsing devices");
 
-    if ( g_list_length( dialog->devices ) == 0 ) {
-	label = gtk_label_new(_("No known device found.") );
-    } else {
-	label = gtk_label_new(_("The following devices were found:") );
-        dialog->device_combo = gtk_combo_box_new_text();
+  if (g_list_length (dialog->devices) == 0)
+    {
+      label = gtk_label_new (_("No known device found."));
+    }
+  else
+    {
+      label = gtk_label_new (_("The following devices were found:"));
+      dialog->device_combo = gtk_combo_box_new_text ();
 
-        g_list_foreach( dialog->devices, (GFunc)&append_device_info, dialog->device_combo );
+      g_list_foreach (dialog->devices, (GFunc) & append_device_info,
+		      dialog->device_combo);
 
-	gtk_combo_box_set_active(GTK_COMBO_BOX( dialog->device_combo ),0);
+      gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->device_combo), 0);
 
-	gtk_dialog_add_button( GTK_DIALOG( dialog->autodetect_dialog), _("Use this device"), GTK_RESPONSE_OK);
+      gtk_dialog_add_button (GTK_DIALOG (dialog->autodetect_dialog),
+			     _("Use this device"), GTK_RESPONSE_OK);
 
-	gtk_widget_show( dialog->device_combo );
+      gtk_widget_show (dialog->device_combo);
     }
 
 
-    gtk_widget_show( label );
+  gtk_widget_show (label);
 
 
 
-    gtk_box_pack_start( GTK_BOX( GTK_DIALOG(dialog->autodetect_dialog)->vbox ), label, FALSE, FALSE, 0);
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog->autodetect_dialog)->vbox),
+		      label, FALSE, FALSE, 0);
 
-    if (dialog->device_combo)
-	gtk_box_pack_start( GTK_BOX( GTK_DIALOG(dialog->autodetect_dialog)->vbox ), dialog->device_combo, FALSE, FALSE, 0);
+  if (dialog->device_combo)
+    gtk_box_pack_start (GTK_BOX
+			(GTK_DIALOG (dialog->autodetect_dialog)->vbox),
+			dialog->device_combo, FALSE, FALSE, 0);
 
-    gtk_window_set_modal( GTK_WINDOW( dialog->autodetect_dialog ), TRUE );
+  gtk_window_set_modal (GTK_WINDOW (dialog->autodetect_dialog), TRUE);
 
-    gtk_window_set_default_size( GTK_WINDOW( dialog->autodetect_dialog ), 300, 100 );
+  gtk_window_set_default_size (GTK_WINDOW (dialog->autodetect_dialog), 300,
+			       100);
 
-    g_signal_connect (dialog->autodetect_dialog, "response", G_CALLBACK (autodetect_dialog_callback), dialog);
+  g_signal_connect (dialog->autodetect_dialog, "response",
+		    G_CALLBACK (autodetect_dialog_callback), dialog);
 
 
-    gtk_widget_show( dialog->autodetect_dialog );
+  gtk_widget_show (dialog->autodetect_dialog);
 }
 
 void
-cellmodem_create_options(XfcePanelPlugin *plugin, cellmodem_t *monitor)
+cellmodem_create_options (XfcePanelPlugin * plugin, cellmodem_t * monitor)
 {
-    GtkWidget *dlg;
-    GtkWidget *header;
-    GtkWidget *vbox;
+  GtkWidget *dlg;
+  GtkWidget *header;
+  GtkWidget *vbox;
 /*    GtkWidget *vbox2;*/
-    GtkSizeGroup *sizegr;
-    GtkWidget *hbox;
-    GtkWidget *label;
+  GtkSizeGroup *sizegr;
+  GtkWidget *hbox;
+  GtkWidget *label;
 
-    cellmodem_dialog_t *dialog;
+  cellmodem_dialog_t *dialog;
 
-    dialog = g_new0(cellmodem_dialog_t, 1);
+  dialog = g_new0 (cellmodem_dialog_t, 1);
 
-    dialog->monitor = monitor;
+  dialog->monitor = monitor;
 
-    xfce_panel_plugin_block_menu (plugin);
-    
-    dlg = gtk_dialog_new_with_buttons (_("Configure Cell Modem Monitor"),
-                GTK_WINDOW (gtk_widget_get_toplevel (GTK_WIDGET (plugin))),
-                GTK_DIALOG_DESTROY_WITH_PARENT |
-                GTK_DIALOG_NO_SEPARATOR,
-                GTK_STOCK_CLOSE, GTK_RESPONSE_OK,
-                NULL);
-    
-    g_signal_connect (dlg, "response", G_CALLBACK (cellmodem_t_dialog_response),
-                      monitor);
+  xfce_panel_plugin_block_menu (plugin);
 
+  dlg = gtk_dialog_new_with_buttons (_("Configure Cell Modem Monitor"),
+				     GTK_WINDOW (gtk_widget_get_toplevel
+						 (GTK_WIDGET (plugin))),
+				     GTK_DIALOG_DESTROY_WITH_PARENT |
+				     GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CLOSE,
+				     GTK_RESPONSE_OK, NULL);
 
-    /* The header - this was most copied from other sources*/
+  g_signal_connect (dlg, "response", G_CALLBACK (cellmodem_t_dialog_response),
+		    monitor);
 
-    header = xfce_create_header (NULL, _("Cellular Modem Monitor"));
-    gtk_widget_set_size_request (GTK_BIN (header)->child, -1, 32);
-    gtk_container_set_border_width (GTK_CONTAINER (header), BORDER - 2);
-    gtk_widget_show (header);
-    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), header,
-                        FALSE, TRUE, 0);
 
-    /* Our own Vbox, so we can have a border */
+  /* The header - this was most copied from other sources */
 
-    vbox = gtk_vbox_new(FALSE, BORDER);
-    gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER - 2);
-    gtk_widget_show(vbox);
-    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox,
-                        TRUE, TRUE, 0);
+  header = xfce_create_header (NULL, _("Cellular Modem Monitor"));
+  gtk_widget_set_size_request (GTK_BIN (header)->child, -1, 32);
+  gtk_container_set_border_width (GTK_CONTAINER (header), BORDER - 2);
+  gtk_widget_show (header);
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), header,
+		      FALSE, TRUE, 0);
 
-    /* Saw this nice one in other plugin */
-    sizegr = gtk_size_group_new(GTK_SIZE_GROUP_HORIZONTAL);
+  /* Our own Vbox, so we can have a border */
+
+  vbox = gtk_vbox_new (FALSE, BORDER);
+  gtk_container_set_border_width (GTK_CONTAINER (vbox), BORDER - 2);
+  gtk_widget_show (vbox);
+  gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dlg)->vbox), vbox, TRUE, TRUE, 0);
+
+  /* Saw this nice one in other plugin */
+  sizegr = gtk_size_group_new (GTK_SIZE_GROUP_HORIZONTAL);
 
 #define MAKEHBOX( name ) \
     name = gtk_hbox_new(FALSE, BORDER); \
@@ -383,116 +415,132 @@ cellmodem_create_options(XfcePanelPlugin *plugin, cellmodem_t *monitor)
     gtk_widget_show( name )
 
 
-    MAKEHBOX( hbox );
-    MAKELABEL( label, _("Modem driver:") );
-    gtk_box_pack_start( GTK_BOX(hbox), label, 0, FALSE, FALSE );
-    /* Create a combo with the drivers */
+  MAKEHBOX (hbox);
+  MAKELABEL (label, _("Modem driver:"));
+  gtk_box_pack_start (GTK_BOX (hbox), label, 0, FALSE, FALSE);
+  /* Create a combo with the drivers */
 
-    dialog->driver_entry = gtk_combo_box_new_text();
+  dialog->driver_entry = gtk_combo_box_new_text ();
 
 
-    int idx;
+  int idx;
 
-    for (idx=0; drivers[idx]; idx++)
+  for (idx = 0; drivers[idx]; idx++)
     {
-	gtk_combo_box_append_text(GTK_COMBO_BOX(dialog->driver_entry), drivers[idx]->description);
+      gtk_combo_box_append_text (GTK_COMBO_BOX (dialog->driver_entry),
+				 drivers[idx]->description);
     }
 
-    gtk_combo_box_set_active(GTK_COMBO_BOX(dialog->driver_entry),0);
+  gtk_combo_box_set_active (GTK_COMBO_BOX (dialog->driver_entry), 0);
+
+  gtk_box_pack_start (GTK_BOX (hbox), dialog->driver_entry, 0, FALSE, FALSE);
+  gtk_widget_show (dialog->driver_entry);
 
-    gtk_box_pack_start( GTK_BOX(hbox), dialog->driver_entry, 0, FALSE, FALSE );
-    gtk_widget_show( dialog->driver_entry );
+  g_signal_connect (dialog->driver_entry, "changed",
+		    G_CALLBACK (cb_driver_entry_changed), dialog);
 
-    g_signal_connect(dialog->driver_entry, "changed", G_CALLBACK(cb_driver_entry_changed), dialog);
+  MAKEHBOX (hbox);
+  MAKELABEL (label, _("Modem speed:"));
+  gtk_box_pack_start (GTK_BOX (hbox), label, 0, FALSE, FALSE);
 
-	MAKEHBOX( hbox );
-    MAKELABEL( label, _("Modem speed:") );
-    gtk_box_pack_start( GTK_BOX(hbox), label, 0, FALSE, FALSE );
+  dialog->speed_entry = gtk_combo_box_new_text ();
 
-	dialog->speed_entry = gtk_combo_box_new_text();
+  fill_speeds (dialog->speed_entry);
 
-    fill_speeds( dialog->speed_entry );
+  gtk_box_pack_start (GTK_BOX (hbox), dialog->speed_entry, 0, FALSE, FALSE);
+  gtk_widget_show (dialog->speed_entry);
 
-    gtk_box_pack_start( GTK_BOX(hbox), dialog->speed_entry, 0, FALSE, FALSE );
-	gtk_widget_show( dialog->speed_entry );
+  g_signal_connect (dialog->speed_entry, "changed",
+		    G_CALLBACK (cb_speed_entry_changed), dialog);
 
-    g_signal_connect(dialog->speed_entry, "changed", G_CALLBACK(cb_speed_entry_changed), dialog);
+  MAKEHBOX (hbox);
+  MAKELABEL (label, _("Modem device:"));
 
-    MAKEHBOX( hbox );
-    MAKELABEL( label, _("Modem device:") );
+  gtk_box_pack_start (GTK_BOX (hbox), label, 0, FALSE, FALSE);
 
-    gtk_box_pack_start( GTK_BOX(hbox), label, 0, FALSE, FALSE );
-   
-    dialog->device_entry = gtk_entry_new();
-    gtk_widget_show(dialog->device_entry);
-    gtk_box_pack_start(GTK_BOX(hbox), dialog->device_entry, FALSE, FALSE, 0);
+  dialog->device_entry = gtk_entry_new ();
+  gtk_widget_show (dialog->device_entry);
+  gtk_box_pack_start (GTK_BOX (hbox), dialog->device_entry, FALSE, FALSE, 0);
 
-    g_signal_connect(dialog->device_entry, "changed", G_CALLBACK(cb_device_entry_changed), dialog);
+  g_signal_connect (dialog->device_entry, "changed",
+		    G_CALLBACK (cb_device_entry_changed), dialog);
 
 
-    MAKEHBOX( hbox );
-    GtkWidget *autodetect_button = gtk_button_new_with_label(_("Autodetect modem..."));
+  MAKEHBOX (hbox);
+  GtkWidget *autodetect_button =
+    gtk_button_new_with_label (_("Autodetect modem..."));
 
-    gtk_widget_show(autodetect_button);
-    gtk_box_pack_start(GTK_BOX(hbox), autodetect_button, FALSE, FALSE, 0);
-    g_signal_connect(autodetect_button, "clicked", G_CALLBACK(cb_autodetect_modem), dialog);
+  gtk_widget_show (autodetect_button);
+  gtk_box_pack_start (GTK_BOX (hbox), autodetect_button, FALSE, FALSE, 0);
+  g_signal_connect (autodetect_button, "clicked",
+		    G_CALLBACK (cb_autodetect_modem), dialog);
 
 
 
 
-    MAKEHBOX( hbox );
-    MAKELABEL( label, _("Maximum quality:") );
-    gtk_box_pack_start( GTK_BOX(hbox), label, 0, FALSE, FALSE );
+  MAKEHBOX (hbox);
+  MAKELABEL (label, _("Maximum quality:"));
+  gtk_box_pack_start (GTK_BOX (hbox), label, 0, FALSE, FALSE);
 
-    dialog->maxqual_entry = gtk_spin_button_new_with_range(1, 100, 1);
-    gtk_widget_show(dialog->maxqual_entry);
-    gtk_box_pack_start(GTK_BOX(hbox), dialog->maxqual_entry, FALSE, FALSE, 0);
+  dialog->maxqual_entry = gtk_spin_button_new_with_range (1, 100, 1);
+  gtk_widget_show (dialog->maxqual_entry);
+  gtk_box_pack_start (GTK_BOX (hbox), dialog->maxqual_entry, FALSE, FALSE, 0);
 
-    g_signal_connect(dialog->maxqual_entry, "value-changed", G_CALLBACK(cb_maxqual_entry_changed), dialog);
+  g_signal_connect (dialog->maxqual_entry, "value-changed",
+		    G_CALLBACK (cb_maxqual_entry_changed), dialog);
 
 
-    MAKEHBOX( hbox );
-    MAKELABEL( label, _("Low quality percentage:") );
-    gtk_box_pack_start( GTK_BOX(hbox), label, 0, FALSE, FALSE );
+  MAKEHBOX (hbox);
+  MAKELABEL (label, _("Low quality percentage:"));
+  gtk_box_pack_start (GTK_BOX (hbox), label, 0, FALSE, FALSE);
 
-    dialog->low_entry = gtk_spin_button_new_with_range(1, 100, 1);
-    gtk_widget_show(dialog->low_entry);
-    gtk_box_pack_start(GTK_BOX(hbox), dialog->low_entry, FALSE, FALSE, 0);
+  dialog->low_entry = gtk_spin_button_new_with_range (1, 100, 1);
+  gtk_widget_show (dialog->low_entry);
+  gtk_box_pack_start (GTK_BOX (hbox), dialog->low_entry, FALSE, FALSE, 0);
 
-    g_signal_connect(dialog->low_entry, "value-changed", G_CALLBACK(cb_low_entry_changed), dialog);
+  g_signal_connect (dialog->low_entry, "value-changed",
+		    G_CALLBACK (cb_low_entry_changed), dialog);
 
-    MAKEHBOX( hbox );
-    MAKELABEL( label, _("Critical quality percentage:") );
-    gtk_box_pack_start( GTK_BOX(hbox), label, 0, FALSE, FALSE );
+  MAKEHBOX (hbox);
+  MAKELABEL (label, _("Critical quality percentage:"));
+  gtk_box_pack_start (GTK_BOX (hbox), label, 0, FALSE, FALSE);
 
-    dialog->critical_entry = gtk_spin_button_new_with_range(1, 100, 1);
-    gtk_widget_show(dialog->critical_entry);
-    gtk_box_pack_start(GTK_BOX(hbox), dialog->critical_entry, FALSE, FALSE, 0);
+  dialog->critical_entry = gtk_spin_button_new_with_range (1, 100, 1);
+  gtk_widget_show (dialog->critical_entry);
+  gtk_box_pack_start (GTK_BOX (hbox), dialog->critical_entry, FALSE, FALSE,
+		      0);
 
-    g_signal_connect(dialog->critical_entry, "value-changed", G_CALLBACK(cb_critical_entry_changed), dialog);
+  g_signal_connect (dialog->critical_entry, "value-changed",
+		    G_CALLBACK (cb_critical_entry_changed), dialog);
 
 
-    /* Toggle buttons. */
+  /* Toggle buttons. */
 
-    MAKEHBOX( hbox );
+  MAKEHBOX (hbox);
 
-	dialog->check_sms_entry = gtk_check_button_new_with_mnemonic( _("Check for SMS every") );
-	dialog->sms_check_interval_entry = gtk_spin_button_new_with_range( 0, 100,1 );
-	label = gtk_label_new(_("minutes"));
+  dialog->check_sms_entry =
+    gtk_check_button_new_with_mnemonic (_("Check for SMS every"));
+  dialog->sms_check_interval_entry =
+    gtk_spin_button_new_with_range (0, 100, 1);
+  label = gtk_label_new (_("minutes"));
 
-	gtk_box_pack_start( GTK_BOX(hbox), dialog->check_sms_entry, 0, FALSE, FALSE );
-	gtk_box_pack_start( GTK_BOX(hbox), dialog->sms_check_interval_entry, 0, FALSE, FALSE );
-    gtk_box_pack_start( GTK_BOX(hbox), label, 0, FALSE, FALSE );
-	gtk_widget_show( dialog->check_sms_entry );
-	gtk_widget_show( dialog->sms_check_interval_entry );
-    gtk_widget_show( label );
+  gtk_box_pack_start (GTK_BOX (hbox), dialog->check_sms_entry, 0, FALSE,
+		      FALSE);
+  gtk_box_pack_start (GTK_BOX (hbox), dialog->sms_check_interval_entry, 0,
+		      FALSE, FALSE);
+  gtk_box_pack_start (GTK_BOX (hbox), label, 0, FALSE, FALSE);
+  gtk_widget_show (dialog->check_sms_entry);
+  gtk_widget_show (dialog->sms_check_interval_entry);
+  gtk_widget_show (label);
 
-    g_signal_connect(dialog->check_sms_entry, "toggled", G_CALLBACK(cb_check_sms_entry_toggled), dialog);
-    g_signal_connect(dialog->sms_check_interval_entry, "value-changed", G_CALLBACK(cb_sms_check_interval_entry_changed), dialog);
+  g_signal_connect (dialog->check_sms_entry, "toggled",
+		    G_CALLBACK (cb_check_sms_entry_toggled), dialog);
+  g_signal_connect (dialog->sms_check_interval_entry, "value-changed",
+		    G_CALLBACK (cb_sms_check_interval_entry_changed), dialog);
 
 
-    update_dialog( dialog );
+  update_dialog (dialog);
 
 
-    gtk_widget_show( dlg );
+  gtk_widget_show (dlg);
 }
diff --git a/panel-plugin/preferences.h b/panel-plugin/preferences.h
index e8fb41c..89f14f0 100644
--- a/panel-plugin/preferences.h
+++ b/panel-plugin/preferences.h
@@ -24,29 +24,29 @@
 
 typedef struct
 {
-    GtkWidget *device_entry;
-    GtkWidget *driver_entry;
-    GtkWidget *low_entry;
-    GtkWidget *critical_entry;
-    GtkWidget *maxqual_entry;
-    GtkWidget *autodetect_dialog;
-    GtkWidget *device_combo;
-	GtkWidget *speed_entry;
-	GtkWidget *check_sms_entry;
-	GtkWidget *sms_check_interval_entry;
-	cellmodem_t *monitor;
-
-	GList *devices;
+  GtkWidget *device_entry;
+  GtkWidget *driver_entry;
+  GtkWidget *low_entry;
+  GtkWidget *critical_entry;
+  GtkWidget *maxqual_entry;
+  GtkWidget *autodetect_dialog;
+  GtkWidget *device_combo;
+  GtkWidget *speed_entry;
+  GtkWidget *check_sms_entry;
+  GtkWidget *sms_check_interval_entry;
+  cellmodem_t *monitor;
+
+  GList *devices;
 
 } cellmodem_dialog_t;
 
 typedef struct
 {
-	const char *name;
-    speed_t speed;
+  const char *name;
+  speed_t speed;
 } speed_names_t;
 
 void
-cellmodem_create_options(XfcePanelPlugin *plugin, cellmodem_t *monitor);
+cellmodem_create_options (XfcePanelPlugin * plugin, cellmodem_t * monitor);
 
 #endif



More information about the Xfce4-commits mailing list