Found in "gnokii-working" directory, some November-patches version
[gnokii.git] / xgnokii / xgnokii.c
index 233ebd6..05cc9fd 100644 (file)
@@ -1,11 +1,58 @@
 /*
 
+  $Id$
+  
   X G N O K I I
 
   A Linux/Unix GUI for Nokia mobile phones.
+  Copyright (C) 1999 Pavel Janík ml., Hugh Blemings
+  & Ján Derfiòák <ja@mail.upjs.sk>.
 
   Released under the terms of the GNU GPL, see file COPYING for more details.
 
+  $Log$
+  Revision 1.1.1.4  2002/04/03 00:08:26  short
+  Found in "gnokii-working" directory, some November-patches version
+
+  Revision 1.38  2001/09/14 13:14:03  pkot
+  Xgnokii WM fixes (Martin Lucina)
+
+  Revision 1.37  2001/06/27 23:52:52  pkot
+  7110/6210 updates (Marian Jancar)
+
+  Revision 1.36  2001/06/20 21:27:36  pkot
+  IrDA patch (Marian Jancar)
+
+  Revision 1.35  2001/05/24 20:47:30  chris
+  More updating of 7110 code and some of xgnokii_lowlevel changed over.
+
+  Revision 1.34  2001/03/23 08:24:56  ja
+  New preview for 6210 in xgnokii's logos module.
+
+  Revision 1.33  2001/03/19 23:43:47  pkot
+  Solaris/BSD '#if defined' cleanup
+
+  Revision 1.32  2001/03/13 01:21:39  pkot
+  *BSD updates (Bert Driehuis)
+
+  Revision 1.31  2001/03/05 10:42:02  ja
+  Pavel Machek's vcard and finegrained indicators patch.
+
+  Revision 1.30  2001/01/29 15:22:20  machek
+  Use integer as bitfield instead of struct of int:1.
+
+  Be able to read phonebook saved in gnokii format from xgnokii.
+
+  Revision 1.29  2001/01/15 21:10:20  ja
+  Better status reporting in xgnokii, fixed phone capabilities detection in xgnokii.
+
+  Revision 1.28  2000/12/20 11:49:25  ja
+  Bringing back to life smsd. It was broken after last Pawel update.
+
+  Revision 1.27  2000/12/19 16:18:21  pkot
+  configure script updates and added shared function for configfile reading
+
+  
 */
 
 #include <stdlib.h>  /* for getenv */
@@ -33,7 +80,9 @@
 #include "misc.h"
 #include "gsm-common.h"
 #include "gsm-api.h"
-#include "files/cfgreader.h"
+#include "fbus-6110.h"
+#include "fbus-3810.h"
+#include "cfgreader.h"
 #include "xgnokii.h"
 #include "xgnokii_common.h"
 #include "xgnokii_lowlevel.h"
 #include "xgnokii_xkeyb.h"
 #include "xgnokii_calendar.h"
 #include "xgnokii_logos.h"
-#include "xgnokii_xring.h"
 #include "xgnokii_cfg.h"
 #include "xgnokii_data.h"
-#include "newmodules/n6110.h"
 
 #include "xpm/logo.xpm"
 #include "xpm/background.xpm"
@@ -105,15 +152,11 @@ gint max_phonebook_sim_number_length;
 
 /* Local variables */
 static char *DefaultXGnokiiDir = XGNOKIIDIR;
-static char *DefaultXGnokiiDocsDir = XGNOKIIDOCSDIR;
 static bool SMSSettingsInitialized = FALSE;
 static bool CallersGroupsInitialized = FALSE;
-static bool SMSFoldersInitialized = FALSE;
 static gint hiddenCallDialog;
 static guint splashRemoveHandler;
 
-GSM_SMSFolders folders;
-
 static struct CallDialog {
   GtkWidget *dialog;
   GtkWidget *label;
@@ -130,7 +173,7 @@ typedef struct {
   GtkWidget *model;
   GtkWidget *init;
   GtkWidget *bindir;
-  GtkWidget *serial, *infrared, *mbus;
+  GtkWidget *serial, *infrared, *irda;
 } ConnectionWidgets;
 
 typedef struct {
@@ -145,7 +188,6 @@ typedef struct {
 typedef struct {
   GtkWidget *set;
   GtkWidget *number;
-  GtkWidget *defaultrecipient;
   GtkWidget *format;
   GtkWidget *validity;
   GSM_MessageCenter smsSetting[MAX_SMS_CENTER];
@@ -181,21 +223,11 @@ static GSM_MessageCenter tempMessageSettings;
 
 static inline void Help1 (GtkWidget *w, gpointer data)
 {
-  gchar *indx = g_strdup_printf ("/%s/gnokii/xgnokii/main/index.htm", xgnokiiConfig.locale);
+  gchar *indx = g_strdup_printf ("/help/%s/index.html", xgnokiiConfig.locale);
   Help (w, indx);
   g_free (indx);
 }
 
-void GUI_InitSMSFoldersInf (void)
-{
-  if (SMSFoldersInitialized)
-    return;
-
-  GSM->GetSMSFolders(&folders);
-  
-  SMSFoldersInitialized = TRUE;
-  GUIEventSend (GUI_EVENT_SMS_FOLDERS_CHANGED);
-}
 
 void GUI_InitCallerGroupsInf (void)
 {
@@ -217,7 +249,7 @@ void GUI_InitCallerGroupsInf (void)
   xgnokiiConfig.callerGroups[4] = g_strndup( _("Other"), MAX_CALLER_GROUP_LENGTH);
   xgnokiiConfig.callerGroups[5] = g_strndup( _("No group"), MAX_CALLER_GROUP_LENGTH);
 
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
     for (i = 0; i < 5; i++)
     {
       cg = (D_CallerGroup *) g_malloc (sizeof (D_CallerGroup));
@@ -254,6 +286,7 @@ static inline void DrawBackground (GtkWidget *data)
                   261, 96);
 }
 
+
 int network_levels[] = {
   152, 69, 11, 3,
   138, 69, 11, 3,
@@ -290,6 +323,7 @@ int battery_levels[] = {
   92, 69, 11, 6
 };
 
+
 static inline void DrawBattery (GtkWidget *data, int batterylevel)
 {
   int i;
@@ -311,6 +345,7 @@ static inline void DrawBattery (GtkWidget *data, int batterylevel)
   }
 }
 
+
 static inline void DrawSMS (GtkWidget *data)
 {
   gdk_draw_pixmap (Pixmap,
@@ -332,11 +367,12 @@ static inline void DrawAlarm (GtkWidget *data)
                   9, 9);
 }
 
+
 static inline void DrawText (GtkWidget *data, int at, char *text)
 {
   static GdkFont *Font;
 
-  Font = gdk_font_load ("-misc-fixed-medium-r-*-*-*-90-*-*-*-*-*-*");
+  Font = gdk_font_load ("-misc-fixed-medium-r-*-*-*-90-*-*-*-*-iso8859-*");
   gdk_draw_string (Pixmap,
                   Font,
                   GTK_WIDGET(data)->style->fg_gc[GTK_STATE_NORMAL],
@@ -400,7 +436,7 @@ static gint Update (gpointer data)
   static gchar timeBuf[10];
   static gchar *anonym = "anonymous";
   static struct tm stm;
-  static gint smsNumber = 0;
+  static gint smsUsed = 0;
   static gint callTimerStart = 0;
   gint callTimer = 0;
   time_t t;
@@ -409,20 +445,22 @@ static gint Update (gpointer data)
 
 
   /* The number of SMS messages before second */
-  static int smsold=0;
+  static int smsUnRead=0;
 
   /* The number of second for we should display "Short Message Received" message */
   static int smsreceived=-1;
 
   DrawBackground (data);
 
-  DrawNetwork(data, phoneMonitor.rfLevel);
+  DrawNetwork (data, phoneMonitor.rfLevel);
 
-  DrawBattery(data, phoneMonitor.batteryLevel);
+  if (phoneMonitor.powerSource == GPS_ACDC)
+    phoneMonitor.batteryLevel = ((gint) phoneMonitor.batteryLevel + 25) % 125;
+  DrawBattery (data, phoneMonitor.batteryLevel);
 
   if (phoneMonitor.alarm)
     DrawAlarm (data);
-
+    
   if (phoneMonitor.working)
     DrawText (data, 25, phoneMonitor.working);
 
@@ -431,15 +469,15 @@ static gint Update (gpointer data)
   {
     DrawSMS (data);
 
-    if (phoneMonitor.sms.unRead > smsold && smsold != -1)
+    if (phoneMonitor.sms.unRead > smsUnRead && smsUnRead != -1)
       smsreceived = 10;  /* The message "Short Message Received" is displayed for 10s */
   }
-  if (smsNumber != phoneMonitor.sms.number)
+  if (smsUsed != phoneMonitor.sms.used)
     GUIEventSend (GUI_EVENT_SMS_NUMBER_CHANGED);
 
-  smsold = phoneMonitor.sms.unRead;
+  smsUnRead = phoneMonitor.sms.unRead;
 
-  smsNumber = phoneMonitor.sms.number;
+  smsUsed = phoneMonitor.sms.used;
 
   pthread_mutex_unlock (&smsMutex);
 
@@ -533,7 +571,7 @@ static void ParseSMSCenters (void)
 
   for (i = 0; i < xgnokiiConfig.smsSets; i++)
   {
-    gchar *row[5];
+    gchar *row[4];
     if (*(configDialogData.sms.smsSetting[i].Name) == '\0')
       row[0] = g_strdup_printf (_("Set %d"), i + 1);
     else
@@ -608,11 +646,9 @@ static void ParseSMSCenters (void)
         break;
     }
 
-    row[4] = g_strdup (configDialogData.sms.smsSetting[i].DefaultRecipient);
-    
     gtk_clist_append( GTK_CLIST (SMSClist), row); 
 
-    for (j = 0; j < 5; j++)
+    for (j = 0; j < 4; j++)
       g_free (row[j]);
   }
 
@@ -702,14 +738,13 @@ void GUI_ShowOptions (void)
 
   gtk_entry_set_text (GTK_ENTRY (configDialogData.connection.bindir), xgnokiiConfig.bindir);
 
-  if (!strcmp(xgnokiiConfig.connection, "fbus"))
+  if(!strcmp(xgnokiiConfig.connection, "serial")) {
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.connection.serial), TRUE);
-
-  if (!strcmp(xgnokiiConfig.connection, "infrared"))
+  } else   if(!strcmp(xgnokiiConfig.connection, "infrared")) {
     gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.connection.infrared), TRUE);
-
-  if (!strcmp(xgnokiiConfig.connection, "mbus"))
-    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.connection.mbus), TRUE);
+  } else {
+    gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.connection.irda), TRUE);
+  }
 
   /* Phone */
   gtk_entry_set_text (GTK_ENTRY (configDialogData.phone.model), phoneMonitor.phone.model);
@@ -746,7 +781,7 @@ void GUI_ShowOptions (void)
   else
   {
     xgnokiiConfig.alarmSupported = TRUE;
-    if (alarm->time.IsSet)
+    if (alarm->time.AlarmEnabled)
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.alarm.alarmSwitch), TRUE);
     else
       gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (configDialogData.alarm.alarmSwitch), FALSE);
@@ -756,7 +791,7 @@ void GUI_ShowOptions (void)
   g_free (alarm);  
 
   /* SMS */
-  if (GetModelFeature(FN_SMS)!=0)
+  if (phoneMonitor.supported & PM_SMS)
   {
     gtk_widget_show (sms_option_frame);
     GUI_InitSMSSettings ();
@@ -766,7 +801,7 @@ void GUI_ShowOptions (void)
 
 
   /* BUSINESS CARD */
-  if (GetModelFeature(FN_SMS)!=0)
+  if (phoneMonitor.supported & PM_SMS)
   {
     gtk_widget_show (user_option_frame);
 
@@ -792,7 +827,7 @@ void GUI_ShowOptions (void)
 
 
   /* Groups */
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
   {
     gtk_widget_show (cg_names_option_frame);
     GUI_InitCallerGroupsInf ();
@@ -803,7 +838,7 @@ void GUI_ShowOptions (void)
     gtk_widget_hide (cg_names_option_frame);
 
   /* Mail */
-  if (GetModelFeature(FN_SMS)!=0)
+  if (phoneMonitor.supported & PM_SMS)
   {
     gtk_widget_show (mail_option_frame);
     gtk_entry_set_text (GTK_ENTRY (configDialogData.mailbox),
@@ -816,9 +851,6 @@ void GUI_ShowOptions (void)
   gtk_entry_set_text (GTK_ENTRY (configDialogData.help),
                       xgnokiiConfig.helpviewer);
 
-  if (GetModelFeature(FN_SMSCDEFAULT)!=0) {} else
-    gtk_clist_set_column_visibility (GTK_CLIST (SMSClist), 4, (GetModelFeature(FN_SMSCDEFAULT)!=0));
-
   optionsDialogIsOpened = TRUE;
   gtk_widget_show (OptionsDialog);
 }
@@ -844,10 +876,6 @@ static void MainExit (void)
   e->data = NULL;
   GUI_InsertEvent (e);
   pthread_join (monitor_th, NULL); 
-
-  //need to correctly close connection
-  GSM->Terminate();
-
   gtk_main_quit();
 }
 
@@ -856,37 +884,37 @@ static void ShowMenu (GdkEventButton *event)
 {
   GdkEventButton *bevent = (GdkEventButton *) event;
 
-  if (GetModelFeature(FN_KEYPRESS)!=0)
+  if (phoneMonitor.supported & PM_KEYBOARD)
     gtk_widget_show (xkeyb_menu_item);
   else
     gtk_widget_hide (xkeyb_menu_item);
 
-  if (GetModelFeature(FN_NETMONITOR)!=0)
+  if (phoneMonitor.supported & PM_NETMONITOR)
     gtk_widget_show (netmon_menu_item);
   else
     gtk_widget_hide (netmon_menu_item);
 
-  if (GetModelFeature(FN_SMS)!=0)
+  if (phoneMonitor.supported & PM_SMS)
     gtk_widget_show (sms_menu_item);
   else
     gtk_widget_hide (sms_menu_item);
 
-  if (GetModelFeature(FN_CALENDAR)!=0)
+  if (phoneMonitor.supported & PM_CALENDAR)
     gtk_widget_show (calendar_menu_item);
   else
     gtk_widget_hide (calendar_menu_item);
 
-  if (GetModelFeature(FN_DTMF)!=0)
+  if (phoneMonitor.supported & PM_DTMF)
     gtk_widget_show (dtmf_menu_item);
   else
     gtk_widget_hide (dtmf_menu_item);
 
-  if (GetModelFeature(FN_SPEEDDIAL)!=0)
+  if (phoneMonitor.supported & PM_SPEEDDIAL)
     gtk_widget_show (speedDial_menu_item);
   else
     gtk_widget_hide (speedDial_menu_item);
   
-  if (GetModelFeature(FN_DATACALLS)!=0)
+  if (phoneMonitor.supported & PM_DATA)
     gtk_widget_show (data_menu_item);
   else
     gtk_widget_hide (data_menu_item);
@@ -920,7 +948,7 @@ static gint ButtonPressEvent (GtkWidget *widget, GdkEventButton *event)
     else if (event->x >= 190 && event->x <= 210 &&
              event->y >=  70 && event->y <= 85)
     {
-      if (GetModelFeature(FN_SMS)==0)
+      if (!phoneMonitor.supported & PM_SMS)
         phoneMonitor.working = _("SMS not supported!");
       else
         GUI_ShowSMS ();
@@ -928,7 +956,7 @@ static gint ButtonPressEvent (GtkWidget *widget, GdkEventButton *event)
     else if (event->x >= 235 && event->x <= 248 &&
              event->y >=  27 && event->y <= 75) 
     {
-      if (GetModelFeature(FN_CALENDAR)==0)
+      if (!phoneMonitor.supported & PM_CALENDAR)
         phoneMonitor.working = _("Calendar not supported!");
       else
         GUI_ShowCalendar ();
@@ -979,7 +1007,7 @@ static void OptionsApplyCallback (GtkWidget *widget, gpointer data )
   }
 
   /* SMS */
-  if (GetModelFeature(FN_SMS)!=0)    
+  if (phoneMonitor.supported & PM_SMS)         
   {
     for (i = 0; i < xgnokiiConfig.smsSets; i++)
       xgnokiiConfig.smsSetting[i] = configDialogData.sms.smsSetting[i];
@@ -987,7 +1015,7 @@ static void OptionsApplyCallback (GtkWidget *widget, gpointer data )
   }
 
   /* BUSINESS CARD */
-  if (GetModelFeature(FN_SMS)!=0)
+  if (phoneMonitor.supported & PM_SMS)
   {
     g_free(xgnokiiConfig.user.name);
     xgnokiiConfig.user.name = g_strdup (gtk_entry_get_text(GTK_ENTRY (configDialogData.user.name)));
@@ -1006,7 +1034,7 @@ static void OptionsApplyCallback (GtkWidget *widget, gpointer data )
   }
 
   /* GROUPS */
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
   {
     for ( i = 0; i < 6; i++)
     {
@@ -1020,7 +1048,7 @@ static void OptionsApplyCallback (GtkWidget *widget, gpointer data )
   }
 
   /* Mail */
-  if (GetModelFeature(FN_SMS)!=0)
+  if (phoneMonitor.supported & PM_SMS)         
   {
     g_free(xgnokiiConfig.mailbox);
     xgnokiiConfig.mailbox = g_strdup (gtk_entry_get_text(GTK_ENTRY (configDialogData.mailbox)));
@@ -1052,7 +1080,7 @@ static void OptionsSaveCallback (GtkWidget *widget, gpointer data )
     GUI_InsertEvent (e);
   }
 
-  if (GetModelFeature(FN_CALLERGROUPS)!=0)
+  if (phoneMonitor.supported & PM_CALLERGROUP)
   {
     cg = (D_CallerGroup *) g_malloc (sizeof (D_CallerGroup));
     cg->number = 0;
@@ -1150,13 +1178,7 @@ static GtkWidget *CreateMenu (void)
   gtk_signal_connect_object (GTK_OBJECT (logos_menu_item), "activate",
                              GTK_SIGNAL_FUNC (GUI_ShowLogosWindow), NULL);
   gtk_widget_show(logos_menu_item);
-
-  logos_menu_item = gtk_menu_item_new_with_label (_("Ringtones"));
-  gtk_menu_append (GTK_MENU (menu), logos_menu_item);
-  gtk_signal_connect_object (GTK_OBJECT (logos_menu_item), "activate",
-                             GTK_SIGNAL_FUNC (GUI_ShowRingtonesWindow), NULL);
-  gtk_widget_show(logos_menu_item);  
-
+  
   dtmf_menu_item = gtk_menu_item_new_with_label (_("DTMF"));
   gtk_menu_append (GTK_MENU (menu), dtmf_menu_item);
   gtk_signal_connect_object (GTK_OBJECT (dtmf_menu_item), "activate",
@@ -1216,7 +1238,7 @@ static GtkWidget *CreateAboutDialog (void)
 {
   GtkWidget *dialog;
   GtkWidget *button, *hbox, *label;
-  gchar buf[200];
+  gchar buf[2000];
 
   dialog = gtk_dialog_new ();
   gtk_window_set_title (GTK_WINDOW (dialog), _("About"));
@@ -1236,8 +1258,12 @@ static GtkWidget *CreateAboutDialog (void)
   gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), hbox);
   gtk_widget_show (hbox);
 
-  g_snprintf (buf, 200, _("xgnokii version: %s\ngnokii version: %s\n\n\
-Copyright (C) 1999 Pavel Janík ml.,\nHugh Blemings & Jan Derfinak\n"), XVERSION, VERSION);
+  g_snprintf (buf, 2000, _("xgnokii version: %s\ngnokii version: %s\n\n\
+Copyright (C) 1999,2000 Pavel Janík ml.,\nHugh Blemings, Jan Derfinak and others\n\
+xgnokii is free software, covered by the GNU General Public License, and you are\n\
+welcome to change it and/or distribute copies of it under certain conditions.\n\
+There is absolutely no waranty for xgnokii. See GPL for details.\n"),
+              XVERSION, VERSION);
   label = gtk_label_new ((gchar *) buf);
   gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
   gtk_widget_show (label);
@@ -1363,13 +1389,6 @@ static void OkEditSMSSetDialog (GtkWidget *w, gpointer data)
   configDialogData.sms.smsSetting[GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Number[GSM_MAX_SMS_CENTER_LENGTH]
     = '\0';
 
-  strncpy(configDialogData.sms.smsSetting
-          [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].DefaultRecipient,
-          gtk_entry_get_text(GTK_ENTRY (configDialogData.sms.defaultrecipient)),
-          GSM_MAX_RECIPIENT_LENGTH);
-  configDialogData.sms.smsSetting[GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].DefaultRecipient[GSM_MAX_RECIPIENT_LENGTH]
-    = '\0';
-
   configDialogData.sms.smsSetting[GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Format
     = tempMessageSettings.Format;
 
@@ -1396,7 +1415,7 @@ static inline void EditSMSSetDialogClick (GtkWidget        *clist,
 static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data)
 {
   static GtkWidget *dialog = NULL;
-  GtkWidget *button, *label, *label2, *hbox, *hbox2, *menu, *item;
+  GtkWidget *button, *label, *hbox, *menu, *item;
 
   if (GTK_CLIST (SMSClist)->selection == NULL)
     return;
@@ -1453,25 +1472,10 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data)
     gtk_box_pack_end(GTK_BOX(hbox), configDialogData.sms.number, FALSE, FALSE, 2);
     gtk_widget_show (configDialogData.sms.number);
 
-    hbox2 = gtk_hbox_new (FALSE, 0);
-    gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox2, FALSE, FALSE, 9);
-    if (GetModelFeature(FN_SMSCDEFAULT)!=0) 
-      gtk_widget_show (hbox2);
-
-    label2 = gtk_label_new (_("Default recipient:"));
-    gtk_box_pack_start(GTK_BOX(hbox2), label2, FALSE, FALSE, 2);
-    if (GetModelFeature(FN_SMSCDEFAULT)!=0) 
-      gtk_widget_show (label2);
-
-    configDialogData.sms.defaultrecipient = gtk_entry_new_with_max_length(GSM_MAX_RECIPIENT_LENGTH - 1);
-    gtk_widget_set_usize (configDialogData.sms.defaultrecipient, 110, 22);
-    gtk_box_pack_end(GTK_BOX(hbox2), configDialogData.sms.defaultrecipient, FALSE, FALSE, 2);
-    if (GetModelFeature(FN_SMSCDEFAULT)!=0) 
-      gtk_widget_show (configDialogData.sms.defaultrecipient);
-
     hbox = gtk_hbox_new (FALSE, 0);
     gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), hbox, FALSE, FALSE, 9);
     gtk_widget_show (hbox);
+
     label = gtk_label_new (_("Sending Format:"));
     gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
     gtk_widget_show (label);
@@ -1579,10 +1583,6 @@ static void ShowEditSMSSetDialog (GtkWidget *w, gpointer data)
                       configDialogData.sms.smsSetting
                       [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Number);
 
-  gtk_entry_set_text (GTK_ENTRY (configDialogData.sms.defaultrecipient),
-                      configDialogData.sms.smsSetting
-                      [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].DefaultRecipient);
-
   switch (configDialogData.sms.smsSetting
           [GPOINTER_TO_INT(GTK_CLIST (SMSClist)->selection->data)].Format)
   {
@@ -1665,7 +1665,7 @@ static GtkWidget *CreateOptionsDialog (void)
   GtkWidget *button, *hbox, *vbox, *label, *notebook, *frame, *clistScrolledWindow;
   register gint i;
   GtkAdjustment *adj;
-  gchar *titles[5] = { _("Set's name"), _("Center number"), _("Format"), _("Validity"), _("Default recipient")};
+  gchar *titles[4] = { _("Set's name"), _("Center number"), _("Format"), _("Validity")};
 
   dialog = gtk_dialog_new ();
   gtk_window_set_title (GTK_WINDOW (dialog), _("Options"));
@@ -1779,22 +1779,22 @@ static GtkWidget *CreateOptionsDialog (void)
   gtk_widget_show (hbox);
 
   label = gtk_label_new (_("Connection:"));
-  gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 3);
+  gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 2);
   gtk_widget_show (label);
 
   configDialogData.connection.infrared = gtk_radio_button_new_with_label (NULL, _("infrared"));
   gtk_box_pack_end (GTK_BOX (hbox), configDialogData.connection.infrared, TRUE, FALSE, 2);
   gtk_widget_show (configDialogData.connection.infrared);
-
+  
   configDialogData.connection.serial = gtk_radio_button_new_with_label ( 
-            gtk_radio_button_group (GTK_RADIO_BUTTON (configDialogData.connection.infrared)), _("fbus"));
+            gtk_radio_button_group (GTK_RADIO_BUTTON (configDialogData.connection.infrared)), _("serial"));
   gtk_box_pack_end (GTK_BOX (hbox), configDialogData.connection.serial, TRUE, FALSE, 2);
   gtk_widget_show (configDialogData.connection.serial);
-
-  configDialogData.connection.mbus = gtk_radio_button_new_with_label ( 
-            gtk_radio_button_group (GTK_RADIO_BUTTON (configDialogData.connection.serial)), _("mbus"));
-  gtk_box_pack_end (GTK_BOX (hbox), configDialogData.connection.mbus, TRUE, FALSE, 2);
-  gtk_widget_show (configDialogData.connection.mbus);
+  
+  configDialogData.connection.irda = gtk_radio_button_new_with_label ( 
+            gtk_radio_button_group (GTK_RADIO_BUTTON (configDialogData.connection.infrared)), _("irda"));
+  gtk_box_pack_end (GTK_BOX (hbox), configDialogData.connection.irda, TRUE, FALSE, 2);
+  gtk_widget_show (configDialogData.connection.irda);
 
   /***  Phone notebook  ***/
   frame = gtk_frame_new (_("Phone information"));
@@ -1871,7 +1871,7 @@ static GtkWidget *CreateOptionsDialog (void)
   gtk_container_add (GTK_CONTAINER (vbox), hbox);
   gtk_widget_show (hbox);
 
-  label = gtk_label_new ("Names length:");
+  label = gtk_label_new (_("Names length:"));
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
   gtk_widget_show (label);
 
@@ -1879,7 +1879,7 @@ static GtkWidget *CreateOptionsDialog (void)
   gtk_container_add (GTK_CONTAINER (vbox), hbox);
   gtk_widget_show (hbox);
 
-  label = gtk_label_new ("SIM:");
+  label = gtk_label_new (_("SIM:"));
   gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 2);
   gtk_widget_show (label);
 
@@ -1897,7 +1897,7 @@ static GtkWidget *CreateOptionsDialog (void)
   gtk_box_pack_end (GTK_BOX (hbox), configDialogData.phone.phoneNameLen, FALSE, FALSE, 2);
   gtk_widget_show (configDialogData.phone.phoneNameLen);
 
-  label = gtk_label_new ("Phone:");
+  label = gtk_label_new (_("Phone:"));
   gtk_box_pack_end (GTK_BOX (hbox), label, FALSE, FALSE, 2);
   gtk_widget_show (label);
 
@@ -1950,7 +1950,7 @@ static GtkWidget *CreateOptionsDialog (void)
   label = gtk_label_new (_("SMS"));
   gtk_notebook_append_page (GTK_NOTEBOOK (notebook), sms_option_frame, label);
 
-  SMSClist = gtk_clist_new_with_titles (5, titles);
+  SMSClist = gtk_clist_new_with_titles (4, titles);
   gtk_clist_set_shadow_type (GTK_CLIST (SMSClist), GTK_SHADOW_OUT);
   gtk_clist_column_titles_passive (GTK_CLIST (SMSClist));
   gtk_clist_set_auto_sort (GTK_CLIST (SMSClist), FALSE);
@@ -1959,7 +1959,6 @@ static GtkWidget *CreateOptionsDialog (void)
   gtk_clist_set_column_width (GTK_CLIST (SMSClist), 1, 115);
   gtk_clist_set_column_width (GTK_CLIST (SMSClist), 2, 40);
   gtk_clist_set_column_width (GTK_CLIST (SMSClist), 3, 55);
-  gtk_clist_set_column_width (GTK_CLIST (SMSClist), 4, 100);
 //  gtk_clist_set_column_justification (GTK_CLIST (SMSClist), 1, GTK_JUSTIFY_RIGHT);
 
   clistScrolledWindow = gtk_scrolled_window_new (NULL, NULL);
@@ -1970,7 +1969,6 @@ static GtkWidget *CreateOptionsDialog (void)
                       TRUE, TRUE, 10);
 
   gtk_widget_show (SMSClist);
-
   gtk_widget_show (clistScrolledWindow);
 
   hbox = gtk_hbox_new (FALSE, 0);
@@ -2286,6 +2284,8 @@ static void TopLevelWindow (void)
   struct sigaction act;
 
   GUI_MainWindow = gtk_window_new (GTK_WINDOW_TOPLEVEL);
+  gtk_window_set_wmclass (GTK_WINDOW (GUI_MainWindow), "MainWindow", "Xgnokii");
+/*  gtk_window_set_decorated (GTK_WINDOW (GUI_MainWindow), GTK_FALSE); */
   gtk_widget_realize (GUI_MainWindow);
 
   BackgroundPixmap = gdk_pixmap_create_from_xpm_d (GUI_MainWindow->window, &mask, &GUI_MainWindow->style->white, (gchar **) XPM_background);
@@ -2341,7 +2341,6 @@ static void TopLevelWindow (void)
   GUI_CreateCalendarWindow ();
   GUI_CreateLogosWindow ();
   GUI_CreateDataWindow();
-  GUI_CreateRingtonesWindow ();
   CreateErrorDialog (&errorDialog, GUI_MainWindow);
   CreateInfoDialog (&infoDialog, GUI_MainWindow);
   CreateInCallDialog ();
@@ -2351,7 +2350,7 @@ static void TopLevelWindow (void)
   act.sa_flags = SA_NOCLDSTOP;
   sigaction (SIGCHLD, &act, NULL);
 
-#if defined(__svr4__) || defined(__FreeBSD__)
+#if __unices__
   act.sa_handler = SIG_IGN;
   sigemptyset (&(act.sa_mask));
   sigaction (SIGALRM, &act, NULL);
@@ -2416,33 +2415,45 @@ static gint RemoveSplash (GtkWidget *Win)
 
 static void ReadConfig (void)
 {
-  /* Read config file */
-  if (CFG_ReadConfig(&xgnokiiConfig.model, &xgnokiiConfig.port,
-                 &xgnokiiConfig.initlength, &xgnokiiConfig.connection,
-                &xgnokiiConfig.bindir, &xgnokiiConfig.synchronizetime,false) < 0) {
-    exit(-1);
-  }
-  
-#ifndef WIN32
+#ifdef WIN32
+  xgnokiiConfig.locale = "";
+#else
   if ((xgnokiiConfig.locale = getenv ("LC_ALL")) == NULL)
     if ((xgnokiiConfig.locale = getenv ("LC_MESSAGES")) == NULL)
       if ((xgnokiiConfig.locale = getenv ("LANG")) == NULL)
         xgnokiiConfig.locale = "POSIX";
 #endif
-
+  if (readconfig(&xgnokiiConfig.model, &xgnokiiConfig.port,
+           &xgnokiiConfig.initlength, &xgnokiiConfig.connection,
+           &xgnokiiConfig.bindir) < 0)
+  {
+    exit(-1);
+  }
+  
   GUI_ReadXConfig();
   max_phonebook_name_length = atoi (xgnokiiConfig.maxPhoneLen);
   max_phonebook_sim_name_length = atoi (xgnokiiConfig.maxSIMLen);
   
 #ifndef WIN32
   xgnokiiConfig.xgnokiidir = DefaultXGnokiiDir;
-  xgnokiiConfig.xgnokiidocsdir = DefaultXGnokiiDocsDir;
+
+#if 0
+  if (strstr(FB38_Information.Models, xgnokiiConfig.model) != NULL)
+  {
+    max_phonebook_number_length = 30;
+    max_phonebook_sim_number_length = 30;
+  }
+  else 
+#endif
 #endif
-  if (CheckModel (N6110_Information, xgnokiiConfig.model, CurrentConnectionType)) {
-    max_phonebook_number_length = N6110_MAX_PHONEBOOK_NUMBER_LENGTH;
-    max_phonebook_sim_number_length = N6110_MAX_PHONEBOOK_NUMBER_LENGTH;
+#if 0
+  if (strstr(FB61_Information.Models, xgnokiiConfig.model) != NULL)
+  {
+    max_phonebook_number_length = FB61_MAX_PHONEBOOK_NUMBER_LENGTH;
+    max_phonebook_sim_number_length = FB61_MAX_PHONEBOOK_NUMBER_LENGTH;
   }
   else
+#endif
   {
     max_phonebook_number_length = max_phonebook_sim_number_length = GSM_MAX_PHONEBOOK_NUMBER_LENGTH;
   }
@@ -2477,5 +2488,5 @@ int main (int argc, char *argv[])
 
   gtk_main ();
 
-  return(0);
+  return (0);
 }