Freeciv-3.2
Loading...
Searching...
No Matches
Data Structures | Macros | Functions | Variables
citizensinfo.c File Reference
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gtk/gtk.h>
#include <gdk/gdkkeysyms.h>
#include "citizens.h"
#include "city.h"
#include "nation.h"
#include "player.h"
#include "gui_stuff.h"
#include "plrdlg.h"
#include "citizensinfo.h"
#include "speclist.h"

Go to the source code of this file.

Data Structures

struct  citizens_column
 
struct  citizens_dialog
 

Macros

#define CITIZENS_DLG_COL_STYLE   (0 + num_citizens_cols)
 
#define CITIZENS_DLG_COL_WEIGHT   (1 + num_citizens_cols)
 
#define CITIZENS_DLG_COL_ID   (2 + num_citizens_cols)
 
#define SPECLIST_TAG   dialog
 
#define SPECLIST_TYPE   struct citizens_dialog
 
#define dialog_list_iterate(dialoglist, pdialog)    TYPED_LIST_ITERATE(struct citizens_dialog, dialoglist, pdialog)
 
#define dialog_list_iterate_end   LIST_ITERATE_END
 

Functions

static struct citizens_dialogcitizens_dialog_get (const struct city *pcity)
 
static struct citizens_dialogcitizens_dialog_create (const struct city *pcity)
 
static GtkTreeStorecitizens_dialog_store_new (void)
 
static int citizens_dialog_default_sort_column (void)
 
static void citizens_dialog_row (GtkTreeStore *store, GtkTreeIter *it, const struct city *pcity, const struct player_slot *pslot)
 
static const charcol_nation (const struct city *pcity, const struct player_slot *pslot)
 
static const charcol_citizens (const struct city *pcity, const struct player_slot *pslot)
 
void citizens_dialog_init (void)
 
void citizens_dialog_done (void)
 
void citizens_dialog_refresh (const struct city *pcity)
 
void citizens_dialog_close (const struct city *pcity)
 
GtkWidgetcitizens_dialog_display (const struct city *pcity)
 

Variables

static struct citizens_column citizens_cols []
 
static const int num_citizens_cols = ARRAY_SIZE(citizens_cols)
 
static struct dialog_list * dialog_list
 

Macro Definition Documentation

◆ CITIZENS_DLG_COL_ID

#define CITIZENS_DLG_COL_ID   (2 + num_citizens_cols)

Definition at line 71 of file citizensinfo.c.

◆ CITIZENS_DLG_COL_STYLE

#define CITIZENS_DLG_COL_STYLE   (0 + num_citizens_cols)

Definition at line 69 of file citizensinfo.c.

◆ CITIZENS_DLG_COL_WEIGHT

#define CITIZENS_DLG_COL_WEIGHT   (1 + num_citizens_cols)

Definition at line 70 of file citizensinfo.c.

◆ dialog_list_iterate

#define dialog_list_iterate (   dialoglist,
  pdialog 
)     TYPED_LIST_ITERATE(struct citizens_dialog, dialoglist, pdialog)

Definition at line 88 of file citizensinfo.c.

◆ dialog_list_iterate_end

#define dialog_list_iterate_end   LIST_ITERATE_END

Definition at line 90 of file citizensinfo.c.

◆ SPECLIST_TAG

#define SPECLIST_TAG   dialog

Definition at line 84 of file citizensinfo.c.

◆ SPECLIST_TYPE

#define SPECLIST_TYPE   struct citizens_dialog

Definition at line 85 of file citizensinfo.c.

Function Documentation

◆ citizens_dialog_close()

void citizens_dialog_close ( const struct city pcity)

Close citizens dialog of one city

Definition at line 366 of file citizensinfo.c.

Referenced by city_destroy_callback(), and switch_city_callback().

◆ citizens_dialog_create()

static struct citizens_dialog * citizens_dialog_create ( const struct city pcity)
static

Create citizens dialog

Definition at line 172 of file citizensinfo.c.

Referenced by citizens_dialog_display().

◆ citizens_dialog_default_sort_column()

static int citizens_dialog_default_sort_column ( void  )
static

Returns column to sort by by default

Definition at line 163 of file citizensinfo.c.

Referenced by citizens_dialog_create().

◆ citizens_dialog_display()

GtkWidget * citizens_dialog_display ( const struct city pcity)

Make citizen dialog of the city visible.

Definition at line 385 of file citizensinfo.c.

Referenced by create_and_append_happiness_page(), and switch_city_callback().

◆ citizens_dialog_done()

void citizens_dialog_done ( void  )

Free resources allocated for citizens dialog

Definition at line 277 of file citizensinfo.c.

Referenced by ui_main().

◆ citizens_dialog_get()

static struct citizens_dialog * citizens_dialog_get ( const struct city pcity)
static

Get citizen dialog of the given city

Definition at line 285 of file citizensinfo.c.

Referenced by citizens_dialog_close(), citizens_dialog_display(), and citizens_dialog_refresh().

◆ citizens_dialog_init()

void citizens_dialog_init ( void  )

Initialize citizens dialog

Definition at line 269 of file citizensinfo.c.

Referenced by activate_gui(), and ui_main().

◆ citizens_dialog_refresh()

void citizens_dialog_refresh ( const struct city pcity)

Refresh citizen dialog of the given city

Definition at line 299 of file citizensinfo.c.

Referenced by citizens_dialog_create(), citizens_dialog_display(), and real_city_dialog_refresh().

◆ citizens_dialog_row()

static void citizens_dialog_row ( GtkTreeStore store,
GtkTreeIter it,
const struct city pcity,
const struct player_slot pslot 
)
static

Fills the citizens list with the data for 'pslot' at the row given by 'it'.

Definition at line 319 of file citizensinfo.c.

Referenced by citizens_dialog_refresh().

◆ citizens_dialog_store_new()

static GtkTreeStore * citizens_dialog_store_new ( void  )
static

Create a citizens dialog store.

FIXME: copy of players_dialog_store_new();

Definition at line 127 of file citizensinfo.c.

Referenced by citizens_dialog_create().

◆ col_citizens()

static const char * col_citizens ( const struct city pcity,
const struct player_slot pslot 
)
static

The number of citizens for the player in the city.

Definition at line 106 of file citizensinfo.c.

◆ col_nation()

static const char * col_nation ( const struct city pcity,
const struct player_slot pslot 
)
static

The name of the player's nation for the plrdlg.

Definition at line 97 of file citizensinfo.c.

Variable Documentation

◆ citizens_cols

struct citizens_column citizens_cols[]
static
Initial value:
= {
{TRUE, COL_RIGHT_TEXT, N_("#"), col_citizens, "citizens"},
{TRUE, COL_FLAG, N_("Flag"), NULL, "flag"},
{TRUE, COL_TEXT, N_("Nation"), col_nation, "nation"}
}
char * incite_cost
Definition comments.c:75
#define N_(String)
Definition fcintl.h:69
static const char * col_citizens(const struct city *pcity, const struct player_slot *pslot)
static const char * col_nation(const struct city *pcity, const struct player_slot *pslot)
@ COL_TEXT
Definition unitselect.c:50
@ COL_FLAG
@ COL_RIGHT_TEXT
#define TRUE
Definition support.h:46

Referenced by citizens_dialog_create(), citizens_dialog_row(), and citizens_dialog_store_new().

◆ dialog_list

struct dialog_list* dialog_list
static

◆ num_citizens_cols

const int num_citizens_cols = ARRAY_SIZE(citizens_cols)
static