~unity-team/unity-lens-files/results-view-fixes

« back to all changes in this revision

Viewing changes to src/utils.vala

  • Committer: Mikkel Kamstrup Erlandsen
  • Date: 2010-08-26 11:01:58 UTC
  • mfrom: (79.1.2 MASTER)
  • Revision ID: mikkel.kamstrup@gmail.com-20100826110158-0y16ewy0uudfzh7u
Sync with trunk.

Fix some reversed logic in Utils.get_time_group() when figuring out how many hours ago we opened some doc

Show diffs side-by-side

added added

removed removed

Lines of Context:
164
164
      
165
165
      var t = event.get_timestamp ();
166
166
      var now = Timestamp.now ();
 
167
      var delta = now - t;
 
168
      
 
169
      debug (@"DELTA: $now - $t = $delta");
167
170
      
168
171
      /* Set limit to the previous midnight */
169
172
      var limit = Timestamp.prev_midnight (now);
170
173
      if (t > limit)
171
174
        {
172
175
          /* Fuzzy hour match */
173
 
          var hour = 60 * 60;
 
176
          var hour = Timestamp.HOUR;
174
177
 
175
 
          if (t > hour)
176
 
            comment = _("Past hour");
177
 
          else if (t > hour * 2)
 
178
          if (delta > hour * 7)
 
179
            comment = _("Earlier today");
 
180
          else if (delta > hour * 6)
 
181
            comment = _("Five hours ago");
 
182
          else if (delta > hour * 5)
 
183
            comment = _("Four hours ago");
 
184
          else if (delta > hour * 4)
 
185
            comment = _("Three hours ago");
 
186
          else if (delta > hour * 3)
 
187
            comment = _("Two hours ago");
 
188
          else if (delta > hour * 2)
178
189
            comment = _("1 hour ago");
179
 
          else if (t > hour * 3)
180
 
            comment = _("Two hours ago");
181
 
          else if (t > hour * 4)
182
 
            comment = _("Three hours ago");
183
 
          else if (t > hour * 5)
184
 
            comment = _("Four hours ago");
185
 
          else if (t > hour * 6)
186
 
            comment = _("Five hours ago");
187
190
          else
188
 
            comment = _("Earlier today");
189
 
            
 
191
            comment = _("Past hour");
 
192
          
190
193
          return Group.TODAY;
191
194
        }
192
195
      else if (t > limit - Zeitgeist.Timestamp.DAY)