diff --git a/gtk3/main.c b/gtk3/main.c index 4b820f5..7f2896e 100644 --- a/gtk3/main.c +++ b/gtk3/main.c @@ -2091,7 +2091,7 @@ bool on_change_model(GtkWidget *widget, gpointer user_data) { } else if (!GB_is_inited(&gb)) { gui_data.cli_options.model = -1; - config.emulation.model = g_strdup(model_str); + config.emulation.model = model_str; return false; } @@ -2112,8 +2112,7 @@ bool on_change_model(GtkWidget *widget, gpointer user_data) { // Reset the CLI model override gui_data.cli_options.model = -1; - g_free(config.emulation.model); - config.emulation.model = g_strdup(model_str); + config.emulation.model = model_str; reset(); break; diff --git a/gtk3/settings.c b/gtk3/settings.c index 639a1cc..2c7f923 100644 --- a/gtk3/settings.c +++ b/gtk3/settings.c @@ -169,7 +169,14 @@ int load_settings(GApplication *app, GDateTime **modification_date) { g_autoptr(GFile) file = g_file_new_for_path(settings_file_path); g_autoptr(GFileInfo) file_info = g_file_query_info(file, "time::*", G_FILE_QUERY_INFO_NONE, NULL, NULL); - *modification_date = g_file_info_get_modification_date_time(file_info); + + #if GLIB_CHECK_VERSION(2,62,0) + *modification_date = g_file_info_get_modification_date_time(file_info); + #else + GTimeVal tv; + g_file_info_get_modification_time(file_info, &tv); + *modification_date = g_date_time_new_from_timeval_utc(&tv); + #endif if (!g_key_file_load_from_file(key_file, settings_file_path, G_KEY_FILE_KEEP_COMMENTS | G_KEY_FILE_KEEP_TRANSLATIONS, &error)) { if (error->domain == G_FILE_ERROR) { @@ -198,7 +205,14 @@ void save_settings(GtkWindow *main_window, GDateTime *saved_modification_date) { g_autoptr(GFile) file = g_file_new_for_path(settings_file_path); g_autoptr(GFileInfo) file_info = g_file_query_info(file, "time::*", G_FILE_QUERY_INFO_NONE, NULL, NULL); - GDateTime *modification_date = g_file_info_get_modification_date_time(file_info); + + #if GLIB_CHECK_VERSION(2,62,0) + GDateTime *modification_date = g_file_info_get_modification_date_time(file_info); + #else + GTimeVal tv; + g_file_info_get_modification_time(file_info, &tv); + GDateTime *modification_date = g_date_time_new_from_timeval_utc(&tv); + #endif if (!g_date_time_equal(saved_modification_date, modification_date)) { GtkMessageDialog *dialog = GTK_MESSAGE_DIALOG(gtk_message_dialog_new(