Compare commits

..

3 Commits

Author SHA1 Message Date
247ea6977f Merge branch 'master' into newfile 2017-07-09 19:56:20 +02:00
eeb9d87cc3 Correct integer type used for times
Some functions used guint instead of gint64. This commit corrects them all.
2017-07-09 19:56:01 +02:00
756e8fa4fd Fix memory leak in mainWindow_checkDate (Resolves #4) 2017-07-09 19:48:23 +02:00

View File

@ -61,7 +61,7 @@ static gboolean mainWindow_list_entry_visible(GtkTreeModel *model,
gboolean search_matched = 0; gboolean search_matched = 0;
GDateTime *datetime; GDateTime *datetime;
guint time; gint64 time;
if (mainWindow->filterSettings.hide_all) if (mainWindow->filterSettings.hide_all)
return FALSE; return FALSE;
@ -134,8 +134,8 @@ static gint mainWindow_sort_date_compare_func(GtkTreeModel *model,
{ {
GDateTime *datetime1; GDateTime *datetime1;
GDateTime *datetime2; GDateTime *datetime2;
guint time1; gint64 time1;
guint time2; gint64 time2;
gtk_tree_model_get(model, a, COL_TIMESTAMP, &datetime1, -1); gtk_tree_model_get(model, a, COL_TIMESTAMP, &datetime1, -1);
gtk_tree_model_get(model, b, COL_TIMESTAMP, &datetime2, -1); gtk_tree_model_get(model, b, COL_TIMESTAMP, &datetime2, -1);
@ -886,14 +886,17 @@ void mainWindow_checkDate(GtkWidget *widget, gint event, gpointer user_data)
{ {
struct mainWindow *mainWindow = (struct mainWindow *)user_data; struct mainWindow *mainWindow = (struct mainWindow *)user_data;
GDateTime *datetime; GDateTime *datetime;
gchar *temp;
datetime = mdiary_get_date_from_string((char *)gtk_entry_get_text(GTK_ENTRY(widget))); datetime = mdiary_get_date_from_string((char *)gtk_entry_get_text(GTK_ENTRY(widget)));
if (!datetime) { if (!datetime) {
datetime = g_date_time_new_from_unix_local(widget == mainWindow->dateStart datetime = g_date_time_new_from_unix_local(widget == mainWindow->dateStart
? mainWindow->filterSettings.time_start ? mainWindow->filterSettings.time_start
: mainWindow->filterSettings.time_end); : mainWindow->filterSettings.time_end);
temp = g_date_time_format(datetime, "%Y-%m-%d");
gtk_entry_set_text(GTK_ENTRY(widget), gtk_entry_set_text(GTK_ENTRY(widget),
g_date_time_format(datetime, "%Y-%m-%d")); temp);
g_free(temp);
} }
g_date_time_unref(datetime); g_date_time_unref(datetime);
} }