GoClient

Name

GoClient -- access the GoData databases

Synopsis


#include <go-client.h>


struct      GoClient;

void        go_client_register_player       (GoClient *self,
                                             GoPlayer *player);
void        go_client_unregister_player     (GoClient *self,
                                             GoPlayer *player);
int         go_client_player_count          (GoClient *self);
GoPlayer*   go_client_player                (GoClient *self,
                                             int i);
void        go_client_foreach_player        (GoClient *self,
                                             GoClientPlayerFunc f,
                                             void *data);
void        go_client_sort_players          (GoClient *self,
                                             GoComparePlayersFunc compare_players_fn,
                                             gpointer client_data);

void        go_client_register_game         (GoClient *self,
                                             GoGame *game);
void        go_client_unregister_game       (GoClient *self,
                                             GoGame *game);
int         go_client_game_count            (GoClient *self);
GoGame*     go_client_game                  (GoClient *self,
                                             int i);
void        go_client_foreach_game          (GoClient *self,
                                             GoClientGameFunc f,
                                             void *data);

void        go_client_redisplay             (GoClient *self,
                                             gboolean games,
                                             gboolean players);
void        go_client_make_game_visible     (GoClient *self,
                                             GoGame *g);
void        go_client_print_player          (GoClient *self,
                                             GoPlayer *player,
                                             int i,
                                             int n);
void        go_client_print_game            (GoClient *self,
                                             GoGame *game,
                                             int i,
                                             int n);
void        go_client_select_game           (GoClient *self,
                                             GoGame *g,
                                             int i);

void        (*GoClientGameFunc)             (GoClient *c,
                                             GoGame *g,
                                             int i,
                                             int n,
                                             gpointer client_data);
void        (*GoClientPlayerFunc)           (GoClient *c,
                                             GoPlayer *p,
                                             int i,
                                             int n,
                                             gpointer client_data);
int         (*GoComparePlayersFunc)         (const GoPlayer *a,
                                             const GoPlayer *b,
                                             void *client_data);

Object Hierarchy


  GtkObject
   +----GoClient

Description

Objects derived from this type may be used to access the data of a GoData object.

This is an abstract base class of which no objects may be instantiated. Derived classes, which use the GoClient infrastructure, are GoPlayerList and GoGameList.

Details

struct GoClient

struct GoClient {
	GoData * data;
};


go_client_register_player ()

void        go_client_register_player       (GoClient *self,
                                             GoPlayer *player);

A virtual method to register a player with the Client. This is called exactly once for each player by the underlying GoData object. If your subclass overrides this method, it must "chain up" the call.

This function is called by the GoData object the view is connected to. There is no need to call it yourself.

self : a GoClient object
player : a GoPlayer object


go_client_unregister_player ()

void        go_client_unregister_player     (GoClient *self,
                                             GoPlayer *player);

A virtual method to unregister a player from the Client. This is called once for each removed player by the underlying GoData object. If your subclass overrides this method, it must "chain up" the call.

This function is called by the GoData object the view is connected to. There is no need to call it yourself.

self : a GoClient object
player : a GoPlayer object


go_client_player_count ()

int         go_client_player_count          (GoClient *self);

Determine the number of players in self.

self : a GoClient object
Returns : the number of players.


go_client_player ()

GoPlayer*   go_client_player                (GoClient *self,
                                             int i);

Get player data from the database.

self : a GoClient object
i : the player index
Returns : player number i.


go_client_foreach_player ()

void        go_client_foreach_player        (GoClient *self,
                                             GoClientPlayerFunc f,
                                             void *data);

Calls function f for each of the client's players in turn, using data as the client_data argument.

self : a GoClient object
f : the function to iterate over the players
data : an additional argument for f


go_client_sort_players ()

void        go_client_sort_players          (GoClient *self,
                                             GoComparePlayersFunc compare_players_fn,
                                             gpointer client_data);

Sort the list of players displayed by self. The order for the client self is independent of the sort order for any other client.

The function redisplay() is called internally to display the new player list.

self : a GoClient object
compare_players_fn : the comparison function
client_data : additional data for compare_players_fn


go_client_register_game ()

void        go_client_register_game         (GoClient *self,
                                             GoGame *game);

A virtual method to register a game with the Client. This is called exactly once for each game by the underlying GoData object. If your subclass overrides this method, it must "chain up" the call.

This function is called by the GoData object the view is connected to. There is no need to call it yourself.

self : a GoClient object
game : a GoGame object


go_client_unregister_game ()

void        go_client_unregister_game       (GoClient *self,
                                             GoGame *game);

A virtual method to unregister a game from the Client. This is called once for each removed game by the underlying GoData object. If your subclass overrides this method, it must "chain up" the call.

This function is called by the GoData object the view is connected to. There is no need to call it yourself.

self : a GoClient object
game : a GoGame object


go_client_game_count ()

int         go_client_game_count            (GoClient *self);

Determine the number of games in self.

self : a GoClient object
Returns : the number of games.


go_client_game ()

GoGame*     go_client_game                  (GoClient *self,
                                             int i);

Get game data from the database.

self : a GoClient object
i : the game index
Returns : game number i.


go_client_foreach_game ()

void        go_client_foreach_game          (GoClient *self,
                                             GoClientGameFunc f,
                                             void *data);

Calls function f for each of the client's games in turn, using data as the client_data argument.

self : a GoClient object
f : the function to iterate over the games
data : an additional argument for f


go_client_redisplay ()

void        go_client_redisplay             (GoClient *self,
                                             gboolean games,
                                             gboolean players);

Redisplay all the data of the client. This must be called every time the database is changed. You may do a whole batch of changes at once (e.g. loading several players and games from a file) and call redisplay afterwards. games must be set to TRUE, if there are any changes to the list of games. players must be set, if there are any changes to the list of players.

This function works by calling the print_player() and print_game() functions.

self : a GoClient object
games : TRUE if a game has changed
players : TRUE if a player has changed


go_client_make_game_visible ()

void        go_client_make_game_visible     (GoClient *self,
                                             GoGame *g);

Call select_game() for the game g.

self : a GoClient object
g : a GoGame object


go_client_print_player ()

void        go_client_print_player          (GoClient *self,
                                             GoPlayer *player,
                                             int i,
                                             int n);

Print a player into a GoClient object. This is called foreach player everytime there is a change in the player list. If the playerlist is empty, this function is called as print_player(self, NULL, -1, 0). Subclasses should clear the display in this case.

This is a pure virtual class method of the GoClient class. Subclasses should override this in order to be notified of changes in the player list. There should be no need to call this function manually.

self : a GoClient object
player : a GoPlayer object to print
i : the position of the player to print
n : the total number of players


go_client_print_game ()

void        go_client_print_game            (GoClient *self,
                                             GoGame *game,
                                             int i,
                                             int n);

Print a game into a GoClient object. This is called foreach game everytime there is a change in the game list. If the gamelist is empty, this function is called as print_game(self, NULL, -1, 0). Subclasses should clear the display in this case.

This is a pure virtual class method of the GoClient class. Subclasses should override this in order to be notified of changes in the game list. There should be no need to call this function manually.

self : a GoClient object
game : a GoGame object to print
i : the position of the game to print
n : the total number of games


go_client_select_game ()

void        go_client_select_game           (GoClient *self,
                                             GoGame *g,
                                             int i);

Select game number i from the GoClient object and try to make it visible on the screen. This is a pure virtual class method of the GoClient class. Subclasses should override this in order to be notified of changes in the game list. There should be no need to call this function manually.

self : a GoClient object
g : a GoGame object
i : the index of g


GoClientGameFunc ()

void        (*GoClientGameFunc)             (GoClient *c,
                                             GoGame *g,
                                             int i,
                                             int n,
                                             gpointer client_data);

c : 
g : 
i : 
n : 
client_data : 


GoClientPlayerFunc ()

void        (*GoClientPlayerFunc)           (GoClient *c,
                                             GoPlayer *p,
                                             int i,
                                             int n,
                                             gpointer client_data);

c : 
p : 
i : 
n : 
client_data : 


GoComparePlayersFunc ()

int         (*GoComparePlayersFunc)         (const GoPlayer *a,
                                             const GoPlayer *b,
                                             void *client_data);

a : 
b : 
client_data : 
Returns : 

See Also

GoData