Crossfire Client, Branch  R11627
Defines | Functions | Variables
config.c File Reference

Covers configuration issues. More...

#include <gtk/gtk.h>
#include <glade/glade.h>
#include <ctype.h>
#include "client.h"
#include "main.h"
#include "image.h"
#include "gtk2proto.h"
#include <dirent.h>
Include dependency graph for config.c:

Go to the source code of this file.

Defines

#define IS_DIFFERENT(TYPE)   (want_config[TYPE] != use_config[TYPE])

Functions

void config_init (GtkWidget *window_root)
 Set up the configuration popup dialog using libglade and the XML layout file loaded from main.c and connect various signals associated with this dialog.
static void fill_combobox_from_datadir (GtkWidget *combobox, char *active, uint64 want_none, char *subdir, int(*scandir_filter)())
 Load a control with entries created from a directory that has files suited to a particular function.
void load_defaults (void)
 This function processes the user saved settings file and establishes the configuration of the client.
void load_theme (int reload)
 Loads the theme stored away in the theme value above.
void load_window_positions (GtkWidget *window_root)
 Retrieves saved window positions saved with the Client | Save Window Position menu item.
void on_config_button_apply_clicked (GtkButton *button, gpointer user_data)
 Defines the behavior invoked when the configuration dialog apply button is pressed.
void on_config_button_close_clicked (GtkButton *button, gpointer user_data)
 Defines the behavior invoked when the configuration dialog close button is pressed.
void on_config_button_save_clicked (GtkButton *button, gpointer user_data)
 Defines the behavior invoked when the configuration dialog save button is pressed.
void on_configure_activate (GtkMenuItem *menuitem, gpointer user_data)
 Defines the behavior invoked when the configuration dialog is activated.
void on_save_window_position_activate (GtkMenuItem *menuitem, gpointer user_data)
 Handles saving of the window positions when the Client | Save Window Position menu item is activated.
static void read_config_window (void)
 This is basically the opposite of setup_config_window() above - instead of setting the display state appropriately, we read the display state and update the want_config values.
void save_defaults (void)
 This function saves user settings chosen using the configuration popup dialog.
void save_winpos (void)
 Handles saving of the window positions when the Client | Save Window Position menu item is executed.
static int scandir_glade_filter (const struct dirent *d)
 This function is used by scandir below to get only the directory entries needed.
static int scandir_theme_filter (const struct dirent *d)
 This function is used by scandir below to get only the directory entries needed.
static void setup_config_window (void)

Variables

GtkWidget * config_button_cache
GtkWidget * config_button_download
GtkWidget * config_button_echo
GtkWidget * config_button_fasttcp
GtkWidget * config_button_fog
GtkWidget * config_button_foodbeep
GtkWidget * config_button_grad_color
GtkWidget * config_button_smoothing
GtkWidget * config_button_sound
GtkWidget * config_combobox_displaymode
GtkWidget * config_combobox_faceset
GtkWidget * config_combobox_glade
GtkWidget * config_combobox_lighting
GtkWidget * config_combobox_theme
GtkWidget * config_spinbutton_cwindow
GtkWidget * config_spinbutton_iconscale
GtkWidget * config_spinbutton_mapheight
GtkWidget * config_spinbutton_mapscale
GtkWidget * config_spinbutton_mapwidth
GtkWidget * config_window
static const char *const display_modes [] = {"Pixmap", "SDL", "OpenGL"}
static char * gladedir = "glade-gtk2"
const char *const rcsid_gtk2_config_c = "$Id: config.c 11627 2009-04-04 16:55:25Z lalo $"
static char * theme = "Standard"
static char * themedir = "themes"

Detailed Description

Covers configuration issues.

Definition in file config.c.


Define Documentation

#define IS_DIFFERENT (   TYPE)    (want_config[TYPE] != use_config[TYPE])

Definition at line 784 of file config.c.

Referenced by read_config_window().


Function Documentation

void config_init ( GtkWidget *  window_root)

Set up the configuration popup dialog using libglade and the XML layout file loaded from main.c and connect various signals associated with this dialog.

Definition at line 407 of file config.c.

References dialog_xml, has_init, on_config_button_apply_clicked(), on_config_button_close_clicked(), and on_config_button_save_clicked().

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

static void fill_combobox_from_datadir ( GtkWidget *  combobox,
char *  active,
uint64  want_none,
char *  subdir,
int(*)()  scandir_filter 
) [static]

Load a control with entries created from a directory that has files suited to a particular function.

IE. themes, and UI layout files.

This sees what themes or layouts are in the directory and puts them in the pulldown menu for the selection box. The presumption is made that these files won't change during run time, so we only need to do this once.

Parameters:
comboboxa glade combobox widget to be filled with filenames.
activea pointer to a string that is the active combobox item.
want_none1 if a "None" entry is added to the filename list; 0 if not.
subdirthe subdirectory that contains filenames to add to the combobox list.
scandir_filtera pointer to a function that is called by scandir() to filter filenames to add to the combobox. The function returns 1 if the filename is valid for addition to the combobox list.

Definition at line 565 of file config.c.

References LOG(), LOG_DEBUG, LOG_ERROR, and MAX_BUF.

Referenced by setup_config_window().

Here is the call graph for this function:

Here is the caller graph for this function:

void load_defaults ( void  )
void load_theme ( int  reload)

Loads the theme stored away in the theme value above.

the theme string is loaded/saved into the config file, and can also be changed by the user in the config menu.

Parameters:
reloadIf true, user has changed theme after initial startup. In this mode, we need to call the routines that store away private theme data. When program is starting up, this is false, because all the widgets haven't been realized yet, and the initialize routines will get the theme data at that time.

Definition at line 116 of file config.c.

References Player_Struct::below, cpl, draw_lists(), draw_message_window(), draw_stats(), info_get_styles(), item_struct::inv_updated, inventory_get_styles(), LOG(), LOG_ERROR, MAX_BUF, Player_Struct::ob, spell_get_styles(), stats_get_styles(), TRUE, and update_spell_information().

Referenced by main(), and read_config_window().

Here is the call graph for this function:

Here is the caller graph for this function:

void load_window_positions ( GtkWidget *  window_root)

Retrieves saved window positions saved with the Client | Save Window Position menu item.

Parameters:
window_rootThe client's main window.

Definition at line 1064 of file config.c.

References draw_info(), LOG(), LOG_ERROR, LOG_INFO, MAX_BUF, NDI_RED, and window_xml_file.

Referenced by main().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_config_button_apply_clicked ( GtkButton *  button,
gpointer  user_data 
)

Defines the behavior invoked when the configuration dialog apply button is pressed.

Parameters:
button
user_data

Definition at line 941 of file config.c.

References read_config_window().

Referenced by config_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_config_button_close_clicked ( GtkButton *  button,
gpointer  user_data 
)

Defines the behavior invoked when the configuration dialog close button is pressed.

Parameters:
button
user_data

Definition at line 955 of file config.c.

Referenced by config_init().

Here is the caller graph for this function:

void on_config_button_save_clicked ( GtkButton *  button,
gpointer  user_data 
)

Defines the behavior invoked when the configuration dialog save button is pressed.

Parameters:
button
user_data

Definition at line 926 of file config.c.

References read_config_window(), and save_defaults().

Referenced by config_init().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_configure_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Defines the behavior invoked when the configuration dialog is activated.

Parameters:
menuitem
user_data

Definition at line 968 of file config.c.

References setup_config_window().

Referenced by enable_menu_items().

Here is the call graph for this function:

Here is the caller graph for this function:

void on_save_window_position_activate ( GtkMenuItem *  menuitem,
gpointer  user_data 
)

Handles saving of the window positions when the Client | Save Window Position menu item is activated.

Parameters:
menuitem
user_data

Definition at line 1048 of file config.c.

References save_winpos().

Referenced by enable_menu_items().

Here is the call graph for this function:

Here is the caller graph for this function:

static void read_config_window ( void  ) [static]
void save_defaults ( void  )

This function saves user settings chosen using the configuration popup dialog.

Definition at line 365 of file config.c.

References config_names, CONFIG_NUMS, draw_info(), face_info, LOG(), LOG_ERROR, make_path_to_file(), MAX_BUF, NDI_BLUE, server, want_config, Face_Information_struct::want_faceset, and window_xml_file.

Here is the call graph for this function:

void save_winpos ( void  )

Handles saving of the window positions when the Client | Save Window Position menu item is executed.

All hpaned and vpaned widget settings have the information required, and the code automatically works for Glade XML layouts that follow the glade-2's default widget naming convention.

Definition at line 981 of file config.c.

References draw_info(), get_window_coord(), MAX_BUF, NDI_BLUE, NDI_RED, window_root, and window_xml_file.

Here is the call graph for this function:

static int scandir_glade_filter ( const struct dirent *  d) [static]

This function is used by scandir below to get only the directory entries needed.

In the case of glade files, skip all files that do not end with ".glade" and the default glade XML file that defines auxilliary dialogs.

Parameters:
dthe dirent entry from scandir.

function returns 1 if the file is a valid glade XML file name, 0 for files that are not.

Definition at line 517 of file config.c.

References DIALOG_XML_FILENAME, and MAX_BUF.

Referenced by setup_config_window().

Here is the caller graph for this function:

static int scandir_theme_filter ( const struct dirent *  d) [static]

This function is used by scandir below to get only the directory entries needed.

In the case of themes, simply skip dot files.

Parameters:
dthe dirent entry from scandir.

function returns 1 if the file is a valid theme file name, 0 for files that are not.

Definition at line 500 of file config.c.

Referenced by setup_config_window().

Here is the caller graph for this function:

static void setup_config_window ( void  ) [static]

Variable Documentation

GtkWidget * config_button_cache

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

GtkWidget * config_button_echo

Definition at line 88 of file config.c.

GtkWidget * config_button_fasttcp

Definition at line 88 of file config.c.

GtkWidget * config_button_fog

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

GtkWidget * config_button_sound

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

GtkWidget * config_combobox_glade

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

GtkWidget * config_combobox_theme

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

Definition at line 88 of file config.c.

GtkWidget* config_window

Definition at line 88 of file config.c.

const char* const display_modes[] = {"Pixmap", "SDL", "OpenGL"} [static]

Definition at line 103 of file config.c.

char* gladedir = "glade-gtk2" [static]

Definition at line 101 of file config.c.

const char* const rcsid_gtk2_config_c = "$Id: config.c 11627 2009-04-04 16:55:25Z lalo $"

Definition at line 1 of file config.c.

char* theme = "Standard" [static]

Definition at line 99 of file config.c.

char* themedir = "themes" [static]

Definition at line 100 of file config.c.