From: Enlightenment S. <no-...@en...> - 2010-05-09 18:45:11
|
Log: Make timestamps a fixed reference instead of relative. Relative is nicer, but unless it kept updating, they loose their purpose (imagine seeing "1 minute ago" for five minutes in a row, makes little sense, right?). Author: rui Date: 2010-05-09 11:45:03 -0700 (Sun, 09 May 2010) New Revision: 48721 Modified: trunk/elmdentica/src/elmdentica.c Modified: trunk/elmdentica/src/elmdentica.c =================================================================== --- trunk/elmdentica/src/elmdentica.c 2010-05-09 18:32:36 UTC (rev 48720) +++ trunk/elmdentica/src/elmdentica.c 2010-05-09 18:45:03 UTC (rev 48721) @@ -834,9 +834,9 @@ ub_Bubble * ubBubble = calloc(1, sizeof(ub_Bubble)); Evas_Object *message=NULL, *bubble=NULL, *icon=NULL; - time_t now,status_time,time_delta; - char *tmp=NULL; - char * file_path=NULL, *home=NULL, *timestr = NULL; + struct tm *date_tm; + char *tmp=NULL, datestr[19]; + char * file_path=NULL, *home=NULL; /* In this query handler, these are the current fields: argv[0] == id INTEGER @@ -861,40 +861,13 @@ evas_object_size_hint_weight_set(bubble, 1, 0); evas_object_size_hint_align_set(bubble, -1, -1); - // make a simplified time display - now = time(NULL); - status_time=date; - time_delta=now-status_time; - if(time_delta < 0) time_delta=0; elm_bubble_label_set(bubble, name); - if(time_delta < 60) { - res = asprintf(×tr, _("%d s ago..."), (int)time_delta); - if(res != -1) - elm_bubble_info_set(bubble, timestr); - } else if(time_delta < 3600) { - res = asprintf(×tr, _("± %d min ago..."), (int)time_delta/60); - if(res != -1) - elm_bubble_info_set(bubble, timestr); - } else if(time_delta < 86400) { - if(time_delta < 7200) - elm_bubble_info_set(bubble, _("> 1 h ago...")); - else { - res = asprintf(×tr, _("± %d hs ago..."), (int)time_delta/3600); - if(res != -1) - elm_bubble_info_set(bubble, timestr); - } - } else if(time_delta < 604800) { - if(time_delta < 172800) - elm_bubble_info_set(bubble, _("> a day ago...")); - else { - res = asprintf(×tr, _("± %d days ago..."), (int)time_delta/86400); - if(res != -1) - elm_bubble_info_set(bubble, timestr); - } - } else - elm_bubble_info_set(bubble, _("a long ago...")); - if(res != -1 && timestr) free(timestr); + date_tm = gmtime((time_t*)&date); + if(date_tm != NULL) { + strftime(datestr, sizeof(datestr), "%F %R", date_tm); + elm_bubble_info_set(bubble, datestr); + } icon = elm_icon_add(win); @@ -912,8 +885,6 @@ } message = elm_anchorblock_add(win); - evas_object_size_hint_weight_set(message, 1, 1); - evas_object_size_hint_align_set(message, -1, -1); res = asprintf(&status_message, "%s", argv[5]); if(res == -1) { @@ -956,13 +927,9 @@ evas_object_event_callback_add(message, EVAS_CALLBACK_MOUSE_DOWN, on_bubble_mouse_down, bubble); evas_object_event_callback_add(message, EVAS_CALLBACK_MOUSE_UP, on_bubble_mouse_up, bubble); } - evas_object_show(message); elm_bubble_content_set(bubble, message); - //evas_object_event_callback_add(bubble, EVAS_CALLBACK_MOUSE_DOWN, on_bubble_mouse_down, bubble); - //evas_object_event_callback_add(bubble, EVAS_CALLBACK_MOUSE_UP, on_bubble_mouse_up, bubble); - evas_object_show(bubble); elm_box_pack_end(status_list, bubble); |