Replace start_batch() and end_batch() calls with refresh_all_sidebars() to clear up the intent of the code.

This commit is contained in:
slamm%netscape.com 2000-04-26 14:19:26 +00:00
Родитель 5a1e4419d4
Коммит 7e59d49aac
1 изменённых файлов: 11 добавлений и 18 удалений

Просмотреть файл

@ -374,8 +374,6 @@ function Save()
// Without this, the dialog tries to update as it is being destroyed. // Without this, the dialog tries to update as it is being destroyed.
current_panels.setAttribute('ref', 'rdf:null'); current_panels.setAttribute('ref', 'rdf:null');
start_batch(sidebarObj.datasource, sidebarObj.resource);
// Create a "container" wrapper around the current panels to // Create a "container" wrapper around the current panels to
// manipulate the RDF:Seq more easily. // manipulate the RDF:Seq more easily.
var container = Components.classes["component://netscape/rdf/container"].createInstance(); var container = Components.classes["component://netscape/rdf/container"].createInstance();
@ -407,7 +405,7 @@ function Save()
container); container);
} }
end_batch(sidebarObj.datasource, sidebarObj.resource); refresh_all_sidebars();
// Write the modified panels out. // Write the modified panels out.
sidebarObj.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush(); sidebarObj.datasource.QueryInterface(Components.interfaces.nsIRDFRemoteDataSource).Flush();
@ -431,20 +429,15 @@ function has_targets(datasource, resource) {
return arcs.HasMoreElements(); return arcs.HasMoreElements();
} }
// Mark the beginning of a batch by asserting inbatch="true" // Use an assertion to pass a "refresh" event to all the sidebars.
// into the datasource. The observer in sidebarOverlay.js uses // They use observers to watch for this assertion (in sidebarOverlay.js).
// this to remember the panel selection. function refresh_all_sidebars() {
function start_batch(datasource, resource) { sidebarObj.datasource.Assert(RDF.GetResource(sidebarObj.resource),
datasource.Assert(RDF.GetResource(resource), RDF.GetResource(NC + "refresh"),
RDF.GetResource(NC + "inbatch"),
RDF.GetLiteral("true"), RDF.GetLiteral("true"),
true); true);
} sidebarObj.datasource.Unassert(RDF.GetResource(sidebarObj.resource),
RDF.GetResource(NC + "refresh"),
// Mark the end of a batch by unasserting 'inbatch' on the datasource.
function end_batch(datasource, resource) {
datasource.Unassert(RDF.GetResource(resource),
RDF.GetResource(NC + "inbatch"),
RDF.GetLiteral("true")); RDF.GetLiteral("true"));
} }