XXX network select

This commit is contained in:
Tom Stellard 2021-01-14 12:19:53 -08:00
parent 91fbd1b590
commit b423e16a7b
7 changed files with 315 additions and 6 deletions

View File

@ -311,7 +311,7 @@ main_init_variables(void)
window.file_chooser = window.contract =
window.menu_player = window.user_management =
window.mmatches = window.bets = window.splash =
window.training_camp = NULL;
window.network_select = window.training_camp = NULL;
users = g_array_new(FALSE, FALSE, sizeof(User));
transfer_list = g_array_new(FALSE, FALSE, sizeof(Transfer));

View File

@ -217,6 +217,12 @@ on_button_splash_new_game_clicked (GtkButton *button,
stat0 = STATUS_TEAM_SELECTION;
}
G_MODULE_EXPORT void
on_button_splash_new_network_game_clicked (GtkButton *button,
gpointer user_data)
{
window_show_network_select(user_data);
}
G_MODULE_EXPORT void
on_button_splash_load_game_clicked (GtkButton *button,
@ -397,3 +403,23 @@ on_button_news_close_clicked (GtkButton *button,
{
window_destroy(&window.news);
}
G_MODULE_EXPORT void
on_button_network_select_ok_clicked(GtkButton *button,
Bygfoot *bygfoot)
{
GtkEntry *entry_server = GTK_ENTRY(lookup_widget(window.network_select, "server_name"));
const gchar *server = gtk_entry_get_text(entry_server);
GtkEntry *entry_port = GTK_ENTRY(lookup_widget(window.network_select, "server_port"));
const gchar *port = gtk_entry_get_text(entry_port);
window_destroy(&window.network_select);
window_show_startup(bygfoot);
stat0 = STATUS_TEAM_SELECTION;
}
G_MODULE_EXPORT void
on_button_network_select_cancel_clicked(GtkButton *button,
Bygfoot *bygfoot)
{
window_destroy(&window.network_select);
}

View File

@ -55,6 +55,7 @@ create_window_splash (Bygfoot *bygfoot)
GTK_HOOKUP_OBJECT (window_splash, builder, "button_splash_hint_back");
GTK_HOOKUP_OBJECT (window_splash, builder, "button_splash_hint_next");
GTK_HOOKUP_OBJECT (window_splash, builder, "hbox3");
GTK_HOOKUP_OBJECT (window_splash, builder, "button_splash_new_network_game");
/* free memory used by GtkBuilder object */
g_object_unref (G_OBJECT (builder));
@ -102,3 +103,21 @@ create_window_news (void)
return window_news;
}
GtkWidget*
create_window_network_select (Bygfoot *bygfoot)
{
GtkWidget *window_network_select;
GtkBuilder *builder;
builder = load_ui_with_userdata(file_find_support_file("bygfoot_misc3.glade", TRUE),
bygfoot);
window_network_select = GTK_WIDGET (gtk_builder_get_object (builder, "window_network_select"));
gtk_widget_show (window_network_select);
/* Store pointers to all widgets, for use by lookup_widget(). */
GTK_HOOKUP_OBJECT (window_network_select, builder, "button_network_select_ok");
/* free memory used by GtkBuilder object */
g_object_unref (G_OBJECT (builder));
return window_network_select;
}

View File

@ -8,3 +8,4 @@ GtkWidget* create_window_bets (void);
GtkWidget* create_window_splash (Bygfoot *bygfoot);
GtkWidget* create_window_alr (void);
GtkWidget* create_window_news (void);
GtkWidget* create_window_network_select (Bygfoot *bygfoot);

View File

@ -73,6 +73,12 @@ window_show_splash(Bygfoot *bygfoot)
window_splash_show_hint();
}
void
window_show_network_select(Bygfoot *bygfoot)
{
window_create_with_userdata(WINDOW_NETWORK_SELECT, bygfoot);
}
/** Show the hint determined by the hint counter in the splash window. */
void
window_splash_show_hint(void)
@ -988,6 +994,13 @@ window_create_with_userdata(gint window_type, Bygfoot *bygfoot)
window.splash = create_window_splash(bygfoot);
wind = window.splash;
break;
case WINDOW_NETWORK_SELECT:
if(window.network_select != NULL)
debug_print_message("window_create: called on already existing window\n");
else
window.network_select = create_window_network_select(bygfoot);
wind = window.network_select;
break;
case WINDOW_TRAINING_CAMP:
if(window.training_camp != NULL)
debug_print_message("window_create: called on already existing window\n");

View File

@ -58,7 +58,8 @@ enum Windows
WINDOW_END,
WINDOW_TRAINING_CAMP,
WINDOW_NEWS,
WINDOW_ALR
WINDOW_ALR,
WINDOW_NETWORK_SELECT
};
void
@ -140,4 +141,7 @@ window_show_alr(void);
void
window_show_constants(void);
void
window_show_network_select(Bygfoot *bygfoot);
#endif

View File

@ -456,6 +456,55 @@
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_splash_new_network_game">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<signal name="clicked" handler="on_button_splash_new_network_game_clicked"/>
<child>
<object class="GtkAlignment" id="alignment_new_network">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkHBox" id="hbox_new_network">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage" id="image_new_network">
<property name="visible">True</property>
<property name="stock">gtk-new</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label_new_network">
<property name="visible">True</property>
<property name="label" translatable="yes">Start _new network game</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_splash_load_game">
<property name="visible">True</property>
@ -493,7 +542,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
</object>
@ -504,7 +553,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
<property name="position">2</property>
</packing>
</child>
<child>
@ -555,7 +604,7 @@
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
<property name="position">3</property>
</packing>
</child>
<child>
@ -570,7 +619,7 @@
<signal name="clicked" handler="on_button_splash_quit_clicked"/>
</object>
<packing>
<property name="position">3</property>
<property name="position">4</property>
</packing>
</child>
</object>
@ -616,6 +665,203 @@
</object>
</child>
</object>
<object class="GtkWindow" id="window_network_select">
<property name="border_width">5</property>
<property name="modal">True</property>
<property name="window_position">center</property>
<signal name="delete_event" handler="on_window_network_select_delete_event"/>
<child>
<object class="GtkVBox" id="vbox_network0">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">10</property>
<child>
<object class="GtkLabel" id="label_main">
<property name="visible">True</property>
<property name="wrap">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkHBox" id="hbox_network0">
<property name="visible">True</property>
<child>
<object class="GtkVBox" id="vbox_network1">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label_1">
<property name="visible">True</property>
<property name="label" translatable="yes">Server Name:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="server_name">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox16">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<child>
<object class="GtkLabel" id="label_2">
<property name="visible">True</property>
<property name="label" translatable="yes">Server Port:</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkEntry" id="server_port">
<property name="visible">True</property>
<property name="can_focus">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="position">1</property>
</packing>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkHSeparator" id="hseparator10">
<property name="height_request">10</property>
<property name="visible">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
<child>
<object class="GtkVBox" id="vbox29">
<property name="visible">True</property>
<property name="orientation">vertical</property>
<property name="spacing">3</property>
<child>
<object class="GtkButton" id="button_network_select_ok">
<property name="label">gtk-ok</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="use_stock">True</property>
<signal name="clicked" handler="on_button_network_select_ok_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_digits_alr">
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<signal name="clicked" handler="on_button_digits_alr_clicked"/>
<child>
<object class="GtkAlignment" id="alignment16">
<property name="visible">True</property>
<property name="xscale">0</property>
<property name="yscale">0</property>
<child>
<object class="GtkHBox" id="hbox38">
<property name="visible">True</property>
<property name="spacing">2</property>
<child>
<object class="GtkImage" id="image23">
<property name="visible">True</property>
<property name="stock">gtk-jump-to</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">0</property>
</packing>
</child>
<child>
<object class="GtkLabel" id="label63">
<property name="visible">True</property>
<property name="label" translatable="yes">Confirm &amp; schedule repayment</property>
<property name="use_underline">True</property>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
</object>
</child>
</object>
</child>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">1</property>
</packing>
</child>
<child>
<object class="GtkButton" id="button_network_select_cancel">
<property name="label">gtk-cancel</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
<property name="tooltip_text" translatable="yes">Esc</property>
<property name="use_stock">True</property>
<accelerator key="Escape" signal="clicked"/>
<signal name="clicked" handler="on_button_network_select_cancel_clicked"/>
</object>
<packing>
<property name="expand">False</property>
<property name="fill">False</property>
<property name="position">2</property>
</packing>
</child>
</object>
<packing>
<property name="fill">False</property>
<property name="position">3</property>
</packing>
</child>
</object>
</child>
</object>
<object class="GtkWindow" id="window_alr">
<property name="title" translatable="yes">Automatic loan repayment</property>
<property name="modal">True</property>