Crossfire Client, Branch  R11627
Enumerations | Functions | Variables
metaserver.c File Reference

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>
Include dependency graph for metaserver.c:

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

Detailed Description

Supports the client's metaserver dialog used to connect to available servers.

Definition in file metaserver.c.


Enumeration Type Documentation

anonymous enum
Enumerator:
LIST_HOSTNAME 
LIST_IPADDR 
LIST_IDLETIME 
LIST_PLAYERS 
LIST_VERSION 
LIST_COMMENT 

Definition at line 51 of file metaserver.c.


Function Documentation

void get_metaserver ( void  )
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.

Parameters:
nameThe DNS name of a server to connect to.
ipAn 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
selection
model
path
path_currently_selected
userdata
Returns:
TRUE

Definition at line 66 of file metaserver.c.

References metaserver_button, metaserver_entry, and TRUE.

Referenced by get_metaserver().

Here is the caller graph for this function:

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.

Parameters:
button
user_data

Definition at line 388 of file metaserver.c.

Referenced by get_metaserver().

Here is the caller graph for this function:

void on_metaserver_select_clicked ( GtkButton *  button,
gpointer  user_data 
)

Establish a connection with the server when pressing the connect button.

Parameters:
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().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_metaserver_text_entry_activate ( GtkEntry *  entry,
gpointer  user_data 
)

This callback handles the user entering text into the metaserver freeform entry box.

Parameters:
entry
user_data

Definition at line 370 of file metaserver.c.

References metaserver_connect_to().

Referenced by get_metaserver().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters:
widget
event
user_data
Returns:
FALSE

Definition at line 408 of file metaserver.c.

References FALSE, metaserver_button, metaserver_selection, and TRUE.

Referenced by get_metaserver().

Here is the caller graph for this function:

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.

Parameters:
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().

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

GtkWidget * metaserver_button [static]
GtkWidget * metaserver_entry [static]
GtkTreeSelection* metaserver_selection [static]
GtkWidget * metaserver_status [static]
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().