Project

Profile

Help

HostedRedmine.com has moved to the Planio platform. All logins and passwords remained the same. All users will be able to login and use Redmine just as before. *Read more...*

Feature #892340 ยป 0024-gtk3x-Rearrange-to-work-without-gtk_main.patch

Marko Lindqvist, 2020-10-22 03:39 PM

View differences:

client/gui-gtk-4.0/gui_main.c
bool socket_writable);
static void print_usage(void);
static void activate_gui(GtkApplication* app, gpointer data);
static void parse_options(int argc, char **argv);
static gboolean toplevel_key_press_handler(GtkWidget *w, GdkEvent *ev, gpointer data);
static gboolean toplevel_key_release_handler(GtkWidget *w, GdkEventKey *ev, gpointer data);
......
**************************************************************************/
void ui_main(int argc, char **argv)
{
PangoFontDescription *toplevel_font_name;
guint sig;
GtkApplication *app;
parse_options(argc, argv);
......
gtk_init();
dlg_tab_provider_prepare();
gui_up = TRUE;
app = gtk_application_new(NULL, 0);
g_signal_connect(app, "activate", G_CALLBACK(activate_gui), NULL);
g_application_run(G_APPLICATION(app), 0, NULL);
gui_up = FALSE;
destroy_server_scans();
free_mapcanvas_and_overview();
spaceship_dialog_done();
intel_dialog_done();
citizens_dialog_done();
luaconsole_dialog_done();
happiness_dialog_done();
diplomacy_dialog_done();
cma_fe_done();
free_unit_table();
editgui_free();
gtk_widget_destroy(toplevel_tabs);
message_buffer = NULL; /* Result of destruction of everything */
tileset_free_tiles(tileset);
}
toplevel = gtk_window_new(GTK_WINDOW_TOPLEVEL);
/**********************************************************************//**
Run the gui
**************************************************************************/
static void activate_gui(GtkApplication *app, gpointer data)
{
PangoFontDescription *toplevel_font_name;
guint sig;
toplevel = gtk_application_window_new(app);
if (vmode.width > 0 && vmode.height > 0) {
gtk_window_resize(GTK_WINDOW(toplevel), vmode.width, vmode.height);
}
......
gtk_widget_set_name(toplevel, "Freeciv");
root_window = gtk_widget_get_surface(toplevel);
dlg_tab_provider_prepare();
if (gui_options.first_boot) {
adjust_default_options();
/* We're using fresh defaults for this version of this client,
......
/* assumes client_state is set */
timer_id = g_timeout_add(TIMER_INTERVAL, timer_callback, NULL);
gui_up = TRUE;
gtk_main();
gui_up = FALSE;
destroy_server_scans();
free_mapcanvas_and_overview();
spaceship_dialog_done();
intel_dialog_done();
citizens_dialog_done();
luaconsole_dialog_done();
happiness_dialog_done();
diplomacy_dialog_done();
cma_fe_done();
free_unit_table();
editgui_free();
gtk_widget_destroy(toplevel_tabs);
message_buffer = NULL; /* Result of destruction of everything */
tileset_free_tiles(tileset);
}
/**********************************************************************//**
    (1-1/1)