112
113
static gboolean unity_files_place_utils_get_icon_for_uri_async_co (UnityFilesPlaceUtilsGetIconForUriAsyncData* data);
113
114
gint unity_files_place_utils_cmp_file_info_by_mtime (GFileInfo* info1, GFileInfo* info2);
114
115
char* unity_files_place_utils_get_month_name (GDateMonth month);
115
guint unity_files_place_utils_get_time_group (ZeitgeistEvent* event, DeeModel* groups_model);
116
char* unity_files_place_utils_get_day_name (GDateWeekday weekday);
117
guint unity_files_place_utils_get_time_group (ZeitgeistEvent* event, DeeModel* groups_model, char** comment);
116
118
GType unity_files_place_group_get_type (void) G_GNUC_CONST;
117
119
static void _g_slist_free_g_object_unref (GSList* self);
118
120
static void unity_files_place_utils_list_dir_data_free (gpointer _data);
354
356
case G_DATE_BAD_MONTH:
356
result = g_strdup ("Invalid Month");
358
result = g_strdup (_ ("Invalid Month"));
359
361
case G_DATE_JANUARY:
361
result = g_strdup ("January");
363
result = g_strdup (_ ("January"));
364
366
case G_DATE_FEBRUARY:
366
result = g_strdup ("February");
368
result = g_strdup (_ ("February"));
369
371
case G_DATE_MARCH:
371
result = g_strdup ("March");
373
result = g_strdup (_ ("March"));
374
376
case G_DATE_APRIL:
376
result = g_strdup ("April");
378
result = g_strdup (_ ("April"));
381
result = g_strdup ("May");
383
result = g_strdup (_ ("May"));
384
386
case G_DATE_JUNE:
386
result = g_strdup ("June");
388
result = g_strdup (_ ("June"));
389
391
case G_DATE_JULY:
391
result = g_strdup ("July");
393
result = g_strdup (_ ("July"));
394
396
case G_DATE_AUGUST:
396
result = g_strdup ("August");
398
result = g_strdup (_ ("August"));
399
401
case G_DATE_SEPTEMBER:
401
result = g_strdup ("September");
403
result = g_strdup (_ ("September"));
404
406
case G_DATE_OCTOBER:
406
result = g_strdup ("October");
408
result = g_strdup (_ ("October"));
409
411
case G_DATE_NOVEMBER:
411
result = g_strdup ("November");
413
result = g_strdup (_ ("November"));
414
416
case G_DATE_DECEMBER:
416
result = g_strdup ("December");
418
result = g_strdup (_ ("December"));
425
guint unity_files_place_utils_get_time_group (ZeitgeistEvent* event, DeeModel* groups_model) {
427
char* unity_files_place_utils_get_day_name (GDateWeekday weekday) {
432
result = g_strdup (_ ("Monday"));
437
result = g_strdup (_ ("Tuesday"));
440
case G_DATE_WEDNESDAY:
442
result = g_strdup (_ ("Wednesday"));
445
case G_DATE_THURSDAY:
447
result = g_strdup (_ ("Thursday"));
452
result = g_strdup (_ ("Friday"));
455
case G_DATE_SATURDAY:
457
result = g_strdup (_ ("Saturday"));
462
result = g_strdup (_ ("Sunday"));
467
result = g_strdup ("Internal Error");
474
guint unity_files_place_utils_get_time_group (ZeitgeistEvent* event, DeeModel* groups_model, char** comment) {
426
475
guint result = 0U;
430
484
GDate date = {0};
485
GDate datethen = {0};
431
488
g_return_val_if_fail (event != NULL, 0U);
432
489
g_return_val_if_fail (groups_model != NULL, 0U);
490
if (comment != NULL) {
433
493
t = zeitgeist_event_get_timestamp (event);
434
494
now = zeitgeist_timestamp_for_now ();
496
g_debug ("utils.vala:169: %s", _tmp3_ = g_strconcat ("DELTA: ", _tmp0_ = g_strdup_printf ("%" G_GINT64_FORMAT, now), " - ", _tmp1_ = g_strdup_printf ("%" G_GINT64_FORMAT, t), " = ", _tmp2_ = g_strdup_printf ("%" G_GINT64_FORMAT, delta), NULL));
435
501
limit = zeitgeist_timestamp_prev_midnight (now);
504
hour = ZEITGEIST_TIMESTAMP_HOUR;
505
if (delta > (hour * 7)) {
507
*comment = (_tmp4_ = g_strdup (_ ("Earlier today")), _g_free0 (*comment), _tmp4_);
509
if (delta > (hour * 6)) {
511
*comment = (_tmp5_ = g_strdup (_ ("Five hours ago")), _g_free0 (*comment), _tmp5_);
513
if (delta > (hour * 5)) {
515
*comment = (_tmp6_ = g_strdup (_ ("Four hours ago")), _g_free0 (*comment), _tmp6_);
517
if (delta > (hour * 4)) {
519
*comment = (_tmp7_ = g_strdup (_ ("Three hours ago")), _g_free0 (*comment), _tmp7_);
521
if (delta > (hour * 3)) {
523
*comment = (_tmp8_ = g_strdup (_ ("Two hours ago")), _g_free0 (*comment), _tmp8_);
525
if (delta > (hour * 2)) {
527
*comment = (_tmp9_ = g_strdup (_ ("1 hour ago")), _g_free0 (*comment), _tmp9_);
530
*comment = (_tmp10_ = g_strdup (_ ("Past hour")), _g_free0 (*comment), _tmp10_);
437
537
result = (guint) UNITY_FILES_PLACE_GROUP_TODAY;
440
540
if (t > (limit - ZEITGEIST_TIMESTAMP_DAY)) {
542
*comment = (_tmp11_ = g_strdup (_ ("Yesterday")), _g_free0 (*comment), _tmp11_);
441
543
result = (guint) UNITY_FILES_PLACE_GROUP_YESTERDAY;
445
547
memset (&date, 0, sizeof (GDate));
446
548
zeitgeist_timestamp_to_date (now, &date);
447
549
limit = limit - ((g_date_get_weekday (&date) - 1) * ZEITGEIST_TIMESTAMP_DAY);
550
memset (&datethen, 0, sizeof (GDate));
551
zeitgeist_timestamp_to_date (t, &datethen);
552
*comment = (_tmp12_ = unity_files_place_utils_get_day_name (g_date_get_weekday (&datethen)), _g_free0 (*comment), _tmp12_);
449
554
result = (guint) UNITY_FILES_PLACE_GROUP_THIS_WEEK;
457
562
g_date_set_day (&date, (GDateDay) 1);
458
563
limit = zeitgeist_timestamp_from_date (&date);
566
days = g_date_days_between (&datethen, &date);
567
if (days < (7 * 3)) {
569
*comment = (_tmp13_ = g_strdup (_ ("Three weeks ago")), _g_free0 (*comment), _tmp13_);
571
if (days < (7 * 4)) {
573
*comment = (_tmp14_ = g_strdup (_ ("A month ago")), _g_free0 (*comment), _tmp14_);
460
576
result = (guint) UNITY_FILES_PLACE_GROUP_THIS_MONTH;
579
*comment = (_tmp15_ = unity_files_place_utils_get_month_name (g_date_get_month (&datethen)), _g_free0 (*comment), _tmp15_);
463
580
g_date_subtract_months (&date, (guint) 1);
464
581
limit = zeitgeist_timestamp_from_date (&date);
465
582
if (t > (now - ((6 * 30) * ZEITGEIST_TIMESTAMP_DAY))) {
655
772
if (!gee_collection_contains ((GeeCollection*) valid_uris, uri)) {
656
773
dee_model_remove (model, row);
658
g_debug ("utils.vala:230: Removed: %s", uri);
775
g_debug ("utils.vala:303: Removed: %s", uri);
661
778
_g_object_unref0 (_row_it);
663
780
if (n_removed > 0) {
664
g_debug ("utils.vala:235: Removed %u rows from result set", n_removed);
781
g_debug ("utils.vala:308: Removed %u rows from result set", n_removed);
667
784
_g_object_unref0 (model);