Crossfire Client, Branch
R11627
|
Supports the client's metaserver dialog used to connect to available servers. More...
#include <gtk/gtk.h>
#include <glade/glade.h>
#include "client.h"
#include "image.h"
#include "gtk2proto.h"
#include "metaserver.h"
#include "main.h"
#include <pthread.h>
Go to the source code of this file.
Enumerations | |
enum | { LIST_HOSTNAME, LIST_IPADDR, LIST_IDLETIME, LIST_PLAYERS, LIST_VERSION, LIST_COMMENT } |
Functions | |
void | get_metaserver (void) |
Constructs the metaserver dialog and handles metaserver selection. | |
static void | metaserver_connect_to (const char *name, const char *ip) |
Establish a connection to a server when the server name was entered. | |
gboolean | metaserver_selection_func (GtkTreeSelection *selection, GtkTreeModel *model, GtkTreePath *path, gboolean path_currently_selected, gpointer userdata) |
Enables the connect button and clears the server entry box when a server is navigated to or otherwise selected. | |
void | on_button_metaserver_quit_pressed (GtkButton *button, gpointer user_data) |
Quits the client application if the quit button is pressed. | |
void | on_metaserver_select_clicked (GtkButton *button, gpointer user_data) |
Establish a connection with the server when pressing the connect button. | |
void | on_metaserver_text_entry_activate (GtkEntry *entry, gpointer user_data) |
This callback handles the user entering text into the metaserver freeform entry box. | |
gboolean | on_metaserver_text_entry_key_press_event (GtkWidget *widget, GdkEventKey *event, gpointer user_data) |
Activate the connect button and unselect servers if keys are pressed to enter a server name. | |
void | on_treeview_metaserver_row_activated (GtkTreeView *treeview, GtkTreePath *path, GtkTreeViewColumn *column, gpointer user_data) |
Selects and attempts a connection to a server if the player activates one of the server entries. | |
Variables | |
static GtkWidget * | metaserver_button |
static GtkWidget * | metaserver_entry |
static GtkTreeSelection * | metaserver_selection |
static GtkWidget * | metaserver_status |
static GtkWidget * | metaserver_window |
const char *const | rcsid_gtk2_metaserver_c = "$Id: metaserver.c 9201 2008-06-01 17:32:45Z anmaster $" |
static GtkListStore * | store_metaserver |
static GtkWidget * | treeview_metaserver |
Supports the client's metaserver dialog used to connect to available servers.
Definition in file metaserver.c.
anonymous enum |
Definition at line 51 of file metaserver.c.
void get_metaserver | ( | void | ) |
Constructs the metaserver dialog and handles metaserver selection.
Definition at line 82 of file metaserver.c.
References cached_servers_ip, cached_servers_name, cached_servers_num, check_server_version(), cpl, dialog_xml, draw_map(), enable_menu_items(), FALSE, has_init, Player_Struct::input_state, LIST_COMMENT, LIST_HOSTNAME, LIST_IDLETIME, LIST_IPADDR, LIST_PLAYERS, LIST_VERSION, meta_numservers, meta_servers, meta_sort(), metaserver_button, metaserver_check_status(), metaserver_entry, Metaserver_Select, metaserver_selection, metaserver_selection_func(), metaserver_status, metaserver_window, ms2_info_mutex, on_button_metaserver_quit_pressed(), on_metaserver_select_clicked(), on_metaserver_text_entry_activate(), on_metaserver_text_entry_key_press_event(), on_treeview_metaserver_row_activated(), on_window_destroy_event(), server, store_metaserver, treeview_metaserver, TRUE, and window_root.
static void metaserver_connect_to | ( | const char * | name, |
const char * | ip | ||
) | [static] |
Establish a connection to a server when the server name was entered.
Either a DNS name or IP address may be specified, but if both are supplied, use the IP address.
name | The DNS name of a server to connect to. |
ip | An IP address of a server to connect to. |
Definition at line 308 of file metaserver.c.
References CONFIG_PORT, cpl, csocket, ClientSocket::fd, init_connection(), Player_Struct::input_state, metaserver_status, Playing, and use_config.
Referenced by on_metaserver_text_entry_activate(), and on_treeview_metaserver_row_activated().
gboolean metaserver_selection_func | ( | GtkTreeSelection * | selection, |
GtkTreeModel * | model, | ||
GtkTreePath * | path, | ||
gboolean | path_currently_selected, | ||
gpointer | userdata | ||
) |
Enables the connect button and clears the server entry box when a server is navigated to or otherwise selected.
selection | |
model | |
path | |
path_currently_selected | |
userdata |
Definition at line 66 of file metaserver.c.
References metaserver_button, metaserver_entry, and TRUE.
Referenced by get_metaserver().
void on_button_metaserver_quit_pressed | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
Quits the client application if the quit button is pressed.
This is also used to quit the client if the button's accelerator is pressed.
button | |
user_data |
Definition at line 388 of file metaserver.c.
Referenced by get_metaserver().
void on_metaserver_select_clicked | ( | GtkButton * | button, |
gpointer | user_data | ||
) |
Establish a connection with the server when pressing the connect button.
button | |
user_data |
Definition at line 257 of file metaserver.c.
References CONFIG_PORT, cpl, csocket, FALSE, ClientSocket::fd, init_connection(), Player_Struct::input_state, LIST_HOSTNAME, LIST_IPADDR, metaserver_button, metaserver_entry, metaserver_selection, metaserver_status, name, Playing, and use_config.
Referenced by get_metaserver().
void on_metaserver_text_entry_activate | ( | GtkEntry * | entry, |
gpointer | user_data | ||
) |
This callback handles the user entering text into the metaserver freeform entry box.
entry | |
user_data |
Definition at line 370 of file metaserver.c.
References metaserver_connect_to().
Referenced by get_metaserver().
gboolean on_metaserver_text_entry_key_press_event | ( | GtkWidget * | widget, |
GdkEventKey * | event, | ||
gpointer | user_data | ||
) |
Activate the connect button and unselect servers if keys are pressed to enter a server name.
widget | |
event | |
user_data |
Definition at line 408 of file metaserver.c.
References FALSE, metaserver_button, metaserver_selection, and TRUE.
Referenced by get_metaserver().
void on_treeview_metaserver_row_activated | ( | GtkTreeView * | treeview, |
GtkTreePath * | path, | ||
GtkTreeViewColumn * | column, | ||
gpointer | user_data | ||
) |
Selects and attempts a connection to a server if the player activates one of the server entries.
treeview | |
path | |
column | |
user_data |
Definition at line 346 of file metaserver.c.
References LIST_HOSTNAME, LIST_IPADDR, metaserver_connect_to(), and name.
Referenced by get_metaserver().
GtkWidget * metaserver_button [static] |
Definition at line 46 of file metaserver.c.
Referenced by get_metaserver(), metaserver_selection_func(), on_metaserver_select_clicked(), and on_metaserver_text_entry_key_press_event().
GtkWidget * metaserver_entry [static] |
Definition at line 46 of file metaserver.c.
Referenced by get_metaserver(), metaserver_selection_func(), and on_metaserver_select_clicked().
GtkTreeSelection* metaserver_selection [static] |
Definition at line 49 of file metaserver.c.
Referenced by get_metaserver(), on_metaserver_select_clicked(), and on_metaserver_text_entry_key_press_event().
GtkWidget * metaserver_status [static] |
Definition at line 46 of file metaserver.c.
Referenced by get_metaserver(), metaserver_connect_to(), and on_metaserver_select_clicked().
GtkWidget* metaserver_window [static] |
Definition at line 46 of file metaserver.c.
Referenced by get_metaserver().
const char* const rcsid_gtk2_metaserver_c = "$Id: metaserver.c 9201 2008-06-01 17:32:45Z anmaster $" |
Definition at line 1 of file metaserver.c.
GtkListStore* store_metaserver [static] |
Definition at line 48 of file metaserver.c.
Referenced by get_metaserver().
GtkWidget * treeview_metaserver [static] |
Definition at line 46 of file metaserver.c.
Referenced by get_metaserver().