[yast-commit] r40698 - in /trunk/ntp-client/src: NtpClient.ycp ntp-client_proposal.ycp
Author: kmachalkova Date: Mon Sep 3 13:50:56 2007 New Revision: 40698 URL: http://svn.opensuse.org/viewcvs/yast?rev=40698&view=rev Log: Fixed adding new NTP servers when calling ntp-client from outside (e.g. timezone) - do not re-read the configuration if it has been already read Modified: trunk/ntp-client/src/NtpClient.ycp trunk/ntp-client/src/ntp-client_proposal.ycp Modified: trunk/ntp-client/src/NtpClient.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/NtpClient.ycp?rev=40698&r1=40697&r2=40698&view=diff ============================================================================== --- trunk/ntp-client/src/NtpClient.ycp (original) +++ trunk/ntp-client/src/NtpClient.ycp Mon Sep 3 13:50:56 2007 @@ -124,7 +124,7 @@ global boolean simple_dialog = false; -global boolean already_proposed = false; +global boolean config_has_been_read = false; /** * Abort function @@ -297,7 +297,7 @@ return false; } - already_proposed = true; + config_has_been_read = true; list<map<string, any> > value = conf["value"]:[]; integer index = -1; ntp_records = maplist (map<string, any> m, value, ``{ @@ -394,6 +394,9 @@ */ global define boolean Read() ``{ + if (config_has_been_read) + return true; + /* NtpClient read dialog caption */ string caption = _("Initializing NTP Client Configuration"); Modified: trunk/ntp-client/src/ntp-client_proposal.ycp URL: http://svn.opensuse.org/viewcvs/yast/trunk/ntp-client/src/ntp-client_proposal.ycp?rev=40698&r1=40697&r2=40698&view=diff ============================================================================== --- trunk/ntp-client/src/ntp-client_proposal.ycp (original) +++ trunk/ntp-client/src/ntp-client_proposal.ycp Mon Sep 3 13:50:56 2007 @@ -34,7 +34,7 @@ void ProposeSomething() { list ntp_items = []; - if( NtpClient::already_proposed || NtpClient::ProcessNtpConf() ) + if( NtpClient::config_has_been_read || NtpClient::ProcessNtpConf() ) { ntp_items = maplist(string server, NtpClient::GetUsedNtpServers(),{ return `item(`id(server), server); @@ -45,7 +45,7 @@ string cc = param["country"]:NtpClient::GetCurrentLanguageCode(); y2milestone("Nothing found in /etc/ntp.conf, proposing current language-based NTP server list"); ntp_items = NtpClient::GetNtpServersByCountry( cc, true ); - NtpClient::already_proposed = true; + NtpClient::config_has_been_read = true; } UI::ChangeWidget(`id(`ntp_address), `Items, ntp_items); @@ -53,8 +53,18 @@ void AddSingleServer( string server ) { - NtpClient::selected_record["address"] = server; - NtpClient::selected_record["type"] = "server"; + + integer idx = NtpClient::findSyncRecord("server", server); + + // -1 means adding new server + if (idx == -1) + { + NtpClient::selected_record["address"] = server; + NtpClient::selected_record["type"] = "server"; + } + else + NtpClient::selectSyncRecord(idx); + NtpClient::storeSyncRecord(); } -- To unsubscribe, e-mail: yast-commit+unsubscribe@opensuse.org For additional commands, e-mail: yast-commit+help@opensuse.org
participants (1)
-
kmachalkova@svn.opensuse.org