~ubuntu-branches/ubuntu/lucid/beagle/lucid

« back to all changes in this revision

Viewing changes to beagled/EvolutionMailQueryable/EvolutionMailQueryable.cs

  • Committer: Bazaar Package Importer
  • Author(s): Stefan Ebner
  • Date: 2008-05-04 00:31:32 UTC
  • mfrom: (1.1.21 upstream)
  • Revision ID: james.westby@ubuntu.com-20080504003132-2tkm5o8moo5952ri
Tags: 0.3.7-2ubuntu1
 * Merge from Debian unstable. (LP: #225746) Remaining Ubuntu changes:
  - debian/control:
    + Rename ice{weasel,dove}-beagle to {mozilla,thunderbird}-beagle and
      and update the dependencies accordingly.
    + Change Maintainer to Ubuntu Mono Team.
  - debian/rules:
    + Install the mozilla-beagle and thunderbird-beagle extensions.
  - ice{dove,weasel}.dirs:
    + Renamed to {mozilla,thunderbird}-beagle.dirs.
    + Fixed paths to point to usr/lib/{firefox,thunderbird}

Show diffs side-by-side

added added

removed removed

Lines of Context:
170
170
 
171
171
                internal void AddGenerator (EvolutionMailIndexableGenerator generator, bool inotify_event)
172
172
                {
173
 
                        running_generators.Add (generator);
 
173
                        lock (running_generators)
 
174
                                running_generators.Add (generator);
174
175
 
175
176
                        if (! inotify_event)
176
177
                                IsIndexing = true;
178
179
 
179
180
                internal void RemoveGenerator (EvolutionMailIndexableGenerator generator)
180
181
                {
181
 
                        running_generators.Remove (generator);
 
182
                        lock (running_generators) {
 
183
                                running_generators.Remove (generator);
182
184
 
183
 
                        if (running_generators.Count == 0)
184
 
                                IsIndexing = false;
 
185
                                if (running_generators.Count == 0)
 
186
                                        IsIndexing = false;
 
187
                        }
185
188
                }
186
189
 
187
190
                protected override int ProgressPercent {
188
191
                        get {
189
 
                                if (running_generators.Count == 0)
190
 
                                        return -1;
191
 
 
192
 
                                // An embarrassingly unscientific attempt at getting progress
193
 
                                // information from the mail backend as a whole.  Unfortunately
194
 
                                // the IMAP and mbox backends don't have a common unit of
195
 
                                // measurement (IMAP has number of messages, mbox number of
196
 
                                // bytes), so we can't get anything really accurate.
197
 
                                double total_percent = 0;
198
 
 
199
 
                                foreach (EvolutionMailIndexableGenerator generator in running_generators)
200
 
                                        total_percent += generator.ProgressPercent;
201
 
 
202
 
                                return (int) (total_percent / running_generators.Count);
 
192
                                lock (running_generators) {
 
193
                                        if (running_generators.Count == 0)
 
194
                                                return -1;
 
195
 
 
196
                                        // An embarrassingly unscientific attempt at getting progress
 
197
                                        // information from the mail backend as a whole.  Unfortunately
 
198
                                        // the IMAP and mbox backends don't have a common unit of
 
199
                                        // measurement (IMAP has number of messages, mbox number of
 
200
                                        // bytes), so we can't get anything really accurate.
 
201
                                        double total_percent = 0;
 
202
 
 
203
                                        foreach (EvolutionMailIndexableGenerator generator in running_generators)
 
204
                                                total_percent += generator.ProgressPercent;
 
205
 
 
206
                                        return (int) (total_percent / running_generators.Count);
 
207
                                }
203
208
                        }
204
209
                }
205
210