|
Lines 106-111
Link Here
|
| 106 |
g_type_class_add_private (this_class, sizeof (DocumentTilePrivate)); |
106 |
g_type_class_add_private (this_class, sizeof (DocumentTilePrivate)); |
| 107 |
} |
107 |
} |
| 108 |
|
108 |
|
|
|
109 |
static char* |
| 110 |
date_to_fuzzy (GDate *date) |
| 111 |
{ |
| 112 |
char buf[15]; |
| 113 |
time_t ttime; |
| 114 |
GTime today_time; |
| 115 |
GDate *today; |
| 116 |
|
| 117 |
time (&ttime); |
| 118 |
today_time = (GTime)ttime; |
| 119 |
|
| 120 |
today = g_date_new (); |
| 121 |
g_date_set_time (today, today_time); |
| 122 |
|
| 123 |
if (date->day == today->day && date->month == today->month && date->year == today->year) |
| 124 |
return g_strdup (_("Today")); |
| 125 |
else if (date->day == (today->day - 1) && date->month == today->month && date->year == today->year) |
| 126 |
return g_strdup (_("Yesterday")); |
| 127 |
else if (date->year == today->year) |
| 128 |
g_date_strftime (buf, 15, "%b %d", date); |
| 129 |
else |
| 130 |
g_date_strftime (buf, 15, "%b %d, %Y", date); |
| 131 |
|
| 132 |
return g_strdup (buf); |
| 133 |
} |
| 134 |
|
| 135 |
|
| 109 |
GtkWidget * |
136 |
GtkWidget * |
| 110 |
document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified) |
137 |
document_tile_new (const gchar *in_uri, const gchar *mime_type, time_t modified) |
| 111 |
{ |
138 |
{ |
|
Lines 147-156
Link Here
|
| 147 |
|
174 |
|
| 148 |
time_stamp = g_date_new (); |
175 |
time_stamp = g_date_new (); |
| 149 |
g_date_set_time (time_stamp, modified); |
176 |
g_date_set_time (time_stamp, modified); |
| 150 |
|
177 |
time_str = date_to_fuzzy (time_stamp); |
| 151 |
time_str = g_new0 (gchar, 256); |
|
|
| 152 |
|
| 153 |
g_date_strftime (time_str, 256, _("Edited %m/%d/%Y"), time_stamp); |
| 154 |
g_date_free (time_stamp); |
178 |
g_date_free (time_stamp); |
| 155 |
|
179 |
|
| 156 |
subheader = create_subheader (time_str); |
180 |
subheader = create_subheader (time_str); |