Feature #46 ยป 0018-gtk4x-modpack-installer-Turn-NULLs-to-nullptrs.patch
tools/fcmp/mpgui_gtk5.c | ||
---|---|---|
struct fcmp_params fcmp = {
|
||
.list_url = MODPACK_LIST_URL,
|
||
.inst_prefix = NULL,
|
||
.autoinstall = NULL
|
||
.inst_prefix = nullptr,
|
||
.autoinstall = nullptr
|
||
};
|
||
static GtkApplication *fcmp_app;
|
||
... | ... | |
static void quit_dialog_response(GObject *dialog, GAsyncResult *result,
|
||
gpointer data)
|
||
{
|
||
int button = gtk_alert_dialog_choose_finish(GTK_ALERT_DIALOG(dialog), result, NULL);
|
||
int button = gtk_alert_dialog_choose_finish(GTK_ALERT_DIALOG(dialog),
|
||
result, nullptr);
|
||
if (button == 0) {
|
||
modinst_quit();
|
||
}
|
||
quit_dialog = NULL;
|
||
quit_dialog = nullptr;
|
||
}
|
||
/**********************************************************************//**
|
||
... | ... | |
if (downloading || TRUE) {
|
||
/* Download in progress. Confirm quit from user. */
|
||
if (quit_dialog == NULL) {
|
||
const char *buttons[] = { _("Quit"), _("Cancel"), NULL };
|
||
if (quit_dialog == nullptr) {
|
||
const char *buttons[] = { _("Quit"), _("Cancel"), nullptr };
|
||
quit_dialog = gtk_alert_dialog_new(_("Modpack installation in progress.\n"
|
||
"Are you sure you want to quit?"));
|
||
... | ... | |
gtk_alert_dialog_set_buttons(GTK_ALERT_DIALOG(quit_dialog), buttons);
|
||
gtk_alert_dialog_choose(GTK_ALERT_DIALOG(quit_dialog),
|
||
GTK_WINDOW(toplevel), NULL,
|
||
quit_dialog_response, NULL);
|
||
GTK_WINDOW(toplevel), nullptr,
|
||
quit_dialog_response, nullptr);
|
||
}
|
||
} else {
|
||
... | ... | |
new_inst = mpdb_installed_version(name_str, type);
|
||
if (new_inst == NULL) {
|
||
if (new_inst == nullptr) {
|
||
new_inst = _("Not installed");
|
||
}
|
||
... | ... | |
**************************************************************************/
|
||
static void versionlist_update_dl_thread(void)
|
||
{
|
||
g_idle_add(versionlist_update_main_thread, NULL);
|
||
g_idle_add(versionlist_update_main_thread, nullptr);
|
||
}
|
||
/**********************************************************************//**
|
||
... | ... | |
errmsg = download_modpack(data, &fcmp, msg_dl_thread, pbar_dl_thread);
|
||
if (errmsg == NULL) {
|
||
if (errmsg == nullptr) {
|
||
msg_dl_thread(_("Ready"));
|
||
} else {
|
||
msg_dl_thread(errmsg);
|
||
... | ... | |
downloading = FALSE;
|
||
return NULL;
|
||
return nullptr;
|
||
}
|
||
/**********************************************************************//**
|
||
... | ... | |
strcpy(URLbuf, URL);
|
||
downloader = g_thread_new("Downloader", download_thread, URLbuf);
|
||
if (downloader == NULL) {
|
||
if (downloader == nullptr) {
|
||
gtk_label_set_text(GTK_LABEL(statusbar),
|
||
_("Failed to start downloader"));
|
||
free(URLbuf);
|
||
... | ... | |
if (!gtk_tree_view_get_tooltip_context(tree_view, x, y,
|
||
keyboard_tip,
|
||
&model, NULL, &iter)) {
|
||
&model, nullptr, &iter)) {
|
||
return FALSE;
|
||
}
|
||
... | ... | |
ML_NOTES, ¬es,
|
||
-1);
|
||
if (notes != NULL) {
|
||
if (notes != nullptr) {
|
||
gtk_tooltip_set_markup(tooltip, notes);
|
||
return TRUE;
|
||
... | ... | |
type_str = _("?");
|
||
}
|
||
if (license != NULL) {
|
||
if (license != nullptr) {
|
||
lic_str = license;
|
||
} else {
|
||
/* TRANS: License of modpack is not known */
|
||
... | ... | |
}
|
||
inst_str = mpdb_installed_version(name, type);
|
||
if (inst_str == NULL) {
|
||
if (inst_str == nullptr) {
|
||
inst_str = _("Not installed");
|
||
}
|
||
... | ... | |
rev_ver = fc_git_revision();
|
||
if (rev_ver == NULL) {
|
||
if (rev_ver == nullptr) {
|
||
fc_snprintf(verbuf, sizeof(verbuf), "%s%s", word_version(), VERSION_STRING);
|
||
} else {
|
||
fc_snprintf(verbuf, sizeof(verbuf), _("%s%s\ncommit: %s"),
|
||
... | ... | |
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(main_list),
|
||
ML_COL_NAME,
|
||
_("Name"), renderer, "text", 0,
|
||
NULL);
|
||
nullptr);
|
||
renderer = gtk_cell_renderer_text_new();
|
||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(main_list),
|
||
ML_COL_VER,
|
||
_("Version"), renderer, "text", 1,
|
||
NULL);
|
||
nullptr);
|
||
renderer = gtk_cell_renderer_text_new();
|
||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(main_list),
|
||
ML_COL_INST,
|
||
_("Installed"), renderer, "text", 2,
|
||
NULL);
|
||
nullptr);
|
||
renderer = gtk_cell_renderer_text_new();
|
||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(main_list),
|
||
ML_COL_TYPE,
|
||
Q_("?modpack:Type"),
|
||
renderer, "text", 3,
|
||
NULL);
|
||
nullptr);
|
||
renderer = gtk_cell_renderer_text_new();
|
||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(main_list),
|
||
ML_COL_SUBTYPE,
|
||
_("Subtype"),
|
||
renderer, "text", 4,
|
||
NULL);
|
||
nullptr);
|
||
renderer = gtk_cell_renderer_text_new();
|
||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(main_list),
|
||
ML_COL_LIC,
|
||
/* TRANS: noun */
|
||
_("License"), renderer, "text", 5,
|
||
NULL);
|
||
nullptr);
|
||
renderer = gtk_cell_renderer_text_new();
|
||
gtk_tree_view_insert_column_with_attributes(GTK_TREE_VIEW(main_list),
|
||
ML_COL_URL,
|
||
_("URL"), renderer, "text", 6,
|
||
NULL);
|
||
nullptr);
|
||
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(main_list));
|
||
g_signal_connect(selection, "changed", G_CALLBACK(select_from_list), NULL);
|
||
g_signal_connect(selection, "changed", G_CALLBACK(select_from_list), nullptr);
|
||
install_button = gtk_button_new();
|
||
gtk_button_set_label(GTK_BUTTON(install_button), _("Install modpack"));
|
||
... | ... | |
gtk_entry_buffer_set_text(gtk_entry_get_buffer(GTK_ENTRY(URL_input)),
|
||
DEFAULT_URL_START, -1);
|
||
g_signal_connect(URL_input, "activate",
|
||
G_CALLBACK(URL_return), NULL);
|
||
G_CALLBACK(URL_return), nullptr);
|
||
g_signal_connect(install_button, "clicked",
|
||
G_CALLBACK(install_clicked), URL_input);
|
||
... | ... | |
errmsg = download_modpack_list(&fcmp, setup_modpack_list, msg_callback);
|
||
gtk_tree_view_set_model(GTK_TREE_VIEW(main_list), GTK_TREE_MODEL(main_store));
|
||
g_object_set(main_list, "has-tooltip", TRUE, NULL);
|
||
g_object_set(main_list, "has-tooltip", TRUE, nullptr);
|
||
g_signal_connect(main_list, "query-tooltip",
|
||
G_CALLBACK(query_main_list_tooltip_cb), NULL);
|
||
G_CALLBACK(query_main_list_tooltip_cb), nullptr);
|
||
g_object_unref(main_store);
|
||
if (errmsg != NULL) {
|
||
if (errmsg != nullptr) {
|
||
gtk_label_set_text(GTK_LABEL(statusbar), errmsg);
|
||
}
|
||
}
|
||
... | ... | |
**************************************************************************/
|
||
static void activate_gui(GtkApplication *app, gpointer data)
|
||
{
|
||
quit_dialog = NULL;
|
||
quit_dialog = nullptr;
|
||
toplevel = gtk_application_window_new(app);
|
||
... | ... | |
* errors loading the icon. */
|
||
GError *err;
|
||
(void) gtk_window_set_icon_from_file(GTK_WINDOW(toplevel), MPICON_PATH,
|
||
&err);
|
||
(void) gtk_window_set_icon_from_file(GTK_WINDOW(toplevel),
|
||
MPICON_PATH, &err);
|
||
}
|
||
#endif /* FREECIV_MSWINDOWS */
|
||
#endif /* 0 */
|
||
g_signal_connect(toplevel, "close_request",
|
||
G_CALLBACK(quit_dialog_callback), NULL);
|
||
G_CALLBACK(quit_dialog_callback), nullptr);
|
||
modinst_setup_widgets();
|
||
gtk_widget_set_visible(toplevel, TRUE);
|
||
if (fcmp.autoinstall != NULL) {
|
||
if (fcmp.autoinstall != nullptr) {
|
||
gui_download_modpack(fcmp.autoinstall);
|
||
}
|
||
}
|
||
... | ... | |
load_install_info_lists(&fcmp);
|
||
if (gtk_init_check()) {
|
||
fcmp_app = gtk_application_new(NULL, 0);
|
||
g_signal_connect(fcmp_app, "activate", G_CALLBACK(activate_gui), NULL);
|
||
g_application_run(G_APPLICATION(fcmp_app), 0, NULL);
|
||
fcmp_app = gtk_application_new(nullptr, 0);
|
||
g_signal_connect(fcmp_app, "activate",
|
||
G_CALLBACK(activate_gui), nullptr);
|
||
g_application_run(G_APPLICATION(fcmp_app), 0, nullptr);
|
||
g_object_unref(fcmp_app);
|
||
} else {
|