+
+ // Setup the preferences filename string. Default is the
+ // *nix systems one (/home/$USER/.xestiacal/preferences)
+
+ prefFilename = GetUserPrefDir();
+
+ preferences = new XCALPreferences(prefFilename);
+
+ // Setup the General Tab.
+
+ bool saveWindowPos = preferences->GetBoolData(wxT("SaveWindowPosition"));
+ bool hideLocalABs = preferences->GetBoolData(wxT("HideLocalCalendars"));
+
+ if (saveWindowPos == TRUE){
+
+ chkSaveWindowPosition->SetValue(TRUE);
+
+ }
+
+ if (hideLocalABs == TRUE){
+
+ chkHideLocal->SetValue(TRUE);
+
+ }
+
+ // Setup the Themes tab.
+
+ wxListItem themecol0;
+
+ themecol0.SetId(0);
+ themecol0.SetWidth(250);
+ themecol0.SetText(_("Theme"));
+ lstThemes->InsertColumn(0,themecol0);
+
+ // Setup the Accounts tab.
+
+ ReloadAccounts();
+
+}
+
+frmPreferences::~frmPreferences(){
+
+ // Destory the preferences window.
+
+ delete accImgList;
+ accImgList = NULL;
+
+}
+
+void frmPreferences::ReloadAccounts(){
+
+ // Reload the accounts in the accounts list.
+
+ if (firstLoad == FALSE){
+ delete preferences;
+ preferences = NULL;
+ preferences = new XCALPreferences(prefFilename);
+ } else {
+ firstLoad = FALSE;
+ }
+
+ wxListItem accountscol0, accountscol1, accountscol2, accountscol3;
+
+ lstAccounts->ClearAll();
+
+ accountscol0.SetId(0);
+ accountscol0.SetWidth(24);
+ lstAccounts->InsertColumn(0,accountscol0);
+ lstAccounts->SetImageList(accImgList, wxIMAGE_LIST_SMALL);
+
+ accountscol1.SetId(1);
+ accountscol1.SetText(_("Name"));
+ accountscol1.SetWidth(224);
+ lstAccounts->InsertColumn(1,accountscol1);
+
+ accountscol2.SetId(2);
+ accountscol2.SetText(_("Type"));
+ accountscol2.SetWidth(96);
+ lstAccounts->InsertColumn(2,accountscol2);
+
+ wxString accType;
+
+ for (int i = 0; i < preferences->accounts.GetCount() ; i++){
+
+ wxListItem col0;
+ col0.SetId(i);
+
+ /* if (preferences->accounts.GetAccountType(i) == wxT("CalDAV")){
+
+ col0.SetImage(AccountNetID);
+
+ } else */
+
+ if (preferences->accounts.GetAccountType(i) == wxT("Local")){
+
+ col0.SetImage(accountID);
+
+ } else {
+
+ col0.SetImage(accountUnsupportedID);
+
+ }
+
+ long itemindex = lstAccounts->InsertItem( col0 );
+
+ lstAccounts->SetItem(itemindex, 1, preferences->accounts.GetAccountName(i));
+ lstAccounts->SetItem(itemindex, 2, preferences->accounts.GetAccountType(i));
+ lstAccounts->SetItemData(itemindex, i);
+
+ }
+