Crossfire Client, Trunk  R18666
Functions | Variables
/home/leaf/crossfire/client/trunk/gtk-v2/src/main.c File Reference
#include <gtk/gtk.h>
#include <glade/glade.h>
#include <stdio.h>
#include <errno.h>
#include <signal.h>
#include "client.h"
#include "main.h"
#include "image.h"
#include "gtk2proto.h"
#include "script.h"
#include "metaserver.h"
#include "mapdata.h"
Include dependency graph for main.c:

Go to the source code of this file.

Functions

int do_timeout (void)
void client_tick (uint32 tick)
void cleanup_connection (void)
void on_window_destroy_event (GtkObject *object, gpointer user_data)
void do_network (void)
void event_loop (void)
int parse_args (int argc, char **argv)
void error_dialog (char *description, char *information)
void my_log_handler (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
int main (int argc, char *argv[])
void get_window_coord (GtkWidget *win, int *x, int *y, int *wx, int *wy, int *w, int *h)

Variables

const char *const rcsid_gtk2_main_c = "$Id: main.c 14240 2011-01-12 06:31:21Z mwedel $"
GtkWidget * window_root
GtkWidget * magic_map
GladeXML * dialog_xml
GladeXML * window_xml
const char *const colorname [NUM_COLORS]
const char *const usercolorname [NUM_COLORS]
char dialog_xml_file [MAX_BUF] = DIALOG_XML_FILENAME
char dialog_xml_path [MAX_BUF] = ""
char window_xml_file [MAX_BUF] = WINDOW_XML_FILENAME
char window_xml_path [MAX_BUF] = ""
GdkColor root_color [NUM_COLORS]
struct timeval timeout
int maxfd
gint csocket_fd = 0
int time_map_redraw

Detailed Description

Implements client startup functions. Command-line parameters are parsed and handled. Libglade XML layout files are loaded. Windows and dialogs are initialized. The server connection is managed. The main.c file originally was generated by glade-2, but is now manually maintained.

Definition in file main.c.


Function Documentation

void cleanup_connection ( void  )

Called from disconnect command - that closes the socket - we just need to do the gtk cleanup.

Definition at line 167 of file main.c.

void client_tick ( uint32  tick)

X11 client doesn't care about this

Definition at line 139 of file main.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void do_network ( void  )

main loop iteration related stuff

Definition at line 193 of file main.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int do_timeout ( void  )

Map, spell, and inventory maintenance.

Returns:
TRUE

Definition at line 125 of file main.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void error_dialog ( char *  description,
char *  information 
)

Display an error message dialog. The dialog contains a multi-line, bolded heading that includes the client version information, an error description, and information relevant to the error condition.

Parameters:
descriptionA C-string, displayed in bold text, that describes the type of the error condition.
informationA C-string, displayed in normal text, that provides additional information about the error condition.

Definition at line 647 of file main.c.

Here is the caller graph for this function:

void event_loop ( void  )

Event loop iteration stuff

Definition at line 251 of file main.c.

Here is the call graph for this function:

Here is the caller graph for this function:

void get_window_coord ( GtkWidget *  win,
int *  x,
int *  y,
int *  wx,
int *  wy,
int *  w,
int *  h 
)

Gets the coordinates of a specified window.

Parameters:
winPass in a GtkWidget pointer to get its coordinates.
xParent-relative window x coordinate
yParent-relative window y coordinate
wx?
wy?
wWindow width
hWindow height

Definition at line 928 of file main.c.

Here is the caller graph for this function:

int main ( int  argc,
char *  argv[] 
)

The client entry point.

Parameters:
argc
argv
Returns:

Definition at line 686 of file main.c.

Here is the call graph for this function:

void my_log_handler ( const gchar *  log_domain,
GLogLevelFlags  log_level,
const gchar *  message,
gpointer  user_data 
)

This goes with the g_log_set_handler below in main(). I leave it here since it may be useful - basically, it can prove handy to try and track down error messages like:

file gtklabel.c: line 1845: assertion `GTK_IS_LABEL (label)' failed

In the debugger, you can set a breakpoint in this function, and then see the stacktrace on what is trying to access a widget that isn't set or otherwise having issues.

Definition at line 674 of file main.c.

Here is the caller graph for this function:

void on_window_destroy_event ( GtkObject *  object,
gpointer  user_data 
)

Handles client shutdown.

Definition at line 179 of file main.c.

Here is the call graph for this function:

Here is the caller graph for this function:

int parse_args ( int  argc,
char **  argv 
)

parse_args: Parses command line options, and does variable initialization.

Parameters:
argc
argv
Returns:
Returns 0 on success, nonzero on failure.

Definition at line 366 of file main.c.

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

const char* const colorname[NUM_COLORS]
Initial value:
 {
"Black",                
"White",                
"Navy",                 
"Red",                  
"Orange",               
"DodgerBlue",           
"DarkOrange2",          
"SeaGreen",             
"DarkSeaGreen",         
"Grey50",               
"Sienna",               
"Gold",                 
"Khaki"                 
}

Definition at line 60 of file main.c.

gint csocket_fd = 0

Definition at line 107 of file main.c.

GladeXML* dialog_xml

Definition at line 57 of file main.c.

Definition at line 96 of file main.c.

Dialog layout file with path.

Definition at line 97 of file main.c.

GtkWidget * magic_map

main.c - drawing area for the magic map

Definition at line 56 of file main.c.

int maxfd

Definition at line 68 of file client.c.

const char* const rcsid_gtk2_main_c = "$Id: main.c 14240 2011-01-12 06:31:21Z mwedel $"

Definition at line 1 of file main.c.

Definition at line 104 of file main.c.

Definition at line 79 of file map.c.

struct timeval timeout

Definition at line 105 of file main.c.

const char* const usercolorname[NUM_COLORS]
Initial value:
 {
"black",                
"white",                
"darkblue",             
"red",                  
"orange",               
"lightblue",            
"darkorange",           
"green",                
"darkgreen",            
"grey",                 
"brown",                
"yellow",               
"tan"                   
}

Definition at line 80 of file main.c.

GtkWidget* window_root

In main.c

Definition at line 56 of file main.c.

GladeXML * window_xml

Definition at line 57 of file main.c.

The file name of the window layout in use by the client. The base name, without dot extention, is re-used when saving the window positions.

Definition at line 98 of file main.c.

Window layout file with path.

Definition at line 103 of file main.c.