~mhr3/unity-lens-files/fix-921665

« back to all changes in this revision

Viewing changes to src/utils.vala

  • Committer: Neil Jagdish Patel
  • Date: 2011-08-07 09:01:34 UTC
  • mfrom: (172.1.5 unity-lens-files.lens)
  • Revision ID: neil.patel@canonical.com-20110807090134-9vpqjyf35nq8ryr7
[merge] Place => Lens

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
using Gee;
23
23
using Dee;
24
24
 
25
 
namespace Unity.FilesPlace.Utils {
 
25
namespace Unity.FilesLens.Utils {
26
26
 
27
27
    const string icon_attribs = FILE_ATTRIBUTE_PREVIEW_ICON + "," +
28
28
                                FILE_ATTRIBUTE_STANDARD_ICON + "," +
160
160
        }
161
161
    }
162
162
    
 
163
#if 0
163
164
    /* Calculate the time group of the event returning the group id
164
165
     * of the group @event belongs to. It may be necessary for this method
165
166
     * to add a row to @groups_model if the group is one of the variadic
260
261
      else
261
262
        return Group.LAST_YEAR;
262
263
    }
263
 
  
 
264
#endif
264
265
  
265
266
    /**
266
267
     * Asynchrnously list the contents of a directory given by a path,
327
328
  
328
329
  /* Returns true iff new_search is a query that simply restricts the
329
330
   * result set of old_query */
330
 
  public bool check_is_filter_search (PlaceSearch new_search, PlaceSearch? old_search)
 
331
  public bool check_is_filter_search (LensSearch new_search, LensSearch? old_search)
331
332
  {
332
333
    bool is_filter_search = false;      
333
334
    if (old_search != null)
334
335
      {
335
 
        string previous_search_string = old_search.get_search_string();
 
336
        string previous_search_string = old_search.search_string;
336
337
        if (previous_search_string != null && previous_search_string != "")
337
 
          is_filter_search = new_search.get_search_string().has_prefix (
 
338
          is_filter_search = new_search.search_string.has_prefix (
338
339
                                                      previous_search_string);
339
340
      }
340
341
    
357
358
  
358
359
  /* Sloppy and null-safe equality checking. null == "" and strings
359
360
   * are stripped of whitespace before comparison */
360
 
  private bool search_has_really_changed (PlaceSearch? old_search,
361
 
                                          PlaceSearch? new_search)
 
361
  private bool search_has_really_changed (LensSearch? old_search,
 
362
                                          LensSearch? new_search)
362
363
  {
363
364
    if (old_search == null && new_search == null)
364
365
      return false;
367
368
   
368
369
    if (old_search == null)
369
370
      {
370
 
        s1 = new_search.get_search_string ();
 
371
        s1 = new_search.search_string;
371
372
        if (s1 == null || s1.strip() == "")
372
373
          return false;
373
374
        else
375
376
      }
376
377
    else if (new_search == null)
377
378
      {
378
 
        s2 = old_search.get_search_string ();
 
379
        s2 = old_search.search_string;
379
380
        if (s2 == null || s2.strip() == "")
380
381
          return false;
381
382
        else
383
384
      }
384
385
    else
385
386
      {
386
 
        s1 = new_search.get_search_string ();
387
 
        s2 = old_search.get_search_string ();
 
387
        s1 = new_search.search_string;
 
388
        s2 = old_search.search_string;
388
389
        if (s1 == null)
389
390
          {
390
391
            if (s2 == null || s2.strip() == "")