[GTK3] Fix compilation on GLib pre 2.62
This commit is contained in:
parent
45e62a2f26
commit
7e9ebde585
@ -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;
|
||||
|
@ -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);
|
||||
|
||||
#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);
|
||||
|
||||
#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(
|
||||
|
Loading…
Reference in New Issue
Block a user