configuration.c File Reference

#include
#include
#include
#include
#include "configuration.h"
#include "nntpgrab_internal.h"

Data Structures

struct   _config_server_details
struct   Configuration
struct   ConfigurationClass

Typedefs

typedef struct ConfigurationClass  ConfigurationClass
typedef struct
_config_server_details 
ConfigServerDetails

Enumerations

enum   { CONFIG_CHANGED_SIGNAL, LAST_SIGNAL }

Functions

Configuration configuration_get_object (void)
GType  configuration_get_type (void)
Configuration configuration_new (char **errmsg, char **warnings)
void  configuration_destroy (Configuration *obj)
GList *  configuration_get_avail_servers (Configuration *obj)
  Retrieve a list of all the available usenet servers.
void  configuration_free_avail_servers (Configuration *obj, GList *servers)
  Frees the list returned by configuration_get_avail_servers().
ConfigServer configuration_get_server_info (Configuration *obj, const char *servername)
  Retrieve information about a specific usenet server.
gboolean  configuration_add_server (Configuration *obj, ConfigServer new_server, char **errmsg)
  Add a new server to the list of known usenet servers.
gboolean  configuration_del_server (Configuration *obj, const char *servername, char **errmsg)
  Delete the settings from the specified servername from the list of known usenet servers.
gboolean  configuration_edit_server (Configuration *obj, const char *servername, ConfigServer new_server, char **errmsg)
  Change the settings from the specified servername in the list of known usenet servers.
ConfigOpts  configuration_get_opts (Configuration *obj)
  Retrieves the configuration options.
void  configuration_set_opts (Configuration *obj, ConfigOpts opts)
  Set the configuration options.
ConfigGroupInfo  configuration_get_newsgroup_info (Configuration *obj, const char *servername, const char *newsgroup)
  Get the details concerning the given server and newsgroup.
void  configuration_set_newsgroup_info (Configuration *obj, const char *servername, const char *newsgroup, ConfigGroupInfo info)
  Set the details concerning the given server and newsgroup.
gboolean  configuration_load (Configuration *obj, char **errmsg)
  Load all settings from a local file on the harddrive.
gboolean  configuration_save (Configuration *obj, char **errmsg)
  Save all settings to a local file on the harddrive.

Typedef Documentation

typedef struct _config_server_details ConfigServerDetails

typedef struct ConfigurationClass ConfigurationClass


Enumeration Type Documentation

anonymous enum

Enumerator:
CONFIG_CHANGED_SIGNAL 
LAST_SIGNAL 


Function Documentation

gboolean configuration_add_server ( Configuration obj,
ConfigServer  new_server,
char **  errmsg  
)

Add a new server to the list of known usenet servers.

Parameters:
obj  The configuration object
new_server  The structure containing the settings of the new server
errmsg  If an error occurs, an error message will be set in this variable
Returns:
TRUE on success, FALSE on error (errmsg will be set)

gboolean configuration_del_server ( Configuration obj,
const char *  servername,
char **  errmsg  
)

Delete the settings from the specified servername from the list of known usenet servers.

Parameters:
obj  The configuration object
servername  The name of the server whose settings need to be removed
errmsg  If an error occurs, an error message will be set in this variable
Returns:
TRUE on success, FALSE on error (errmsg will be set)

void configuration_destroy ( Configuration obj  ) 

gboolean configuration_edit_server ( Configuration obj,
const char *  servername,
ConfigServer  new_server,
char **  errmsg  
)

Change the settings from the specified servername in the list of known usenet servers.

Parameters:
obj  The configuration object
servername  The name of the server whose settings need to be changed
new_server  The new settings of the server which need to be saved
errmsg  If an error occurs, an error message will be set in this variable
Returns:
TRUE on success, FALSE on error (errmsg will be set)

void configuration_free_avail_servers ( Configuration obj,
GList *  servers  
)

Frees the list returned by configuration_get_avail_servers().

Parameters:
obj  The configuration object
servers  A GList* containing g_malloc'ed char* strings with servernames

GList* configuration_get_avail_servers ( Configuration obj  ) 

Retrieve a list of all the available usenet servers.

Parameters:
obj  The configuration object
Returns:
a GList* containing g_malloc'ed char* strings with servernames

ConfigGroupInfo configuration_get_newsgroup_info ( Configuration obj,
const char *  servername,
const char *  newsgroup  
)

Get the details concerning the given server and newsgroup.

Parameters:
obj  The configuration object
servername  The name of the server
newsgroup  The name of the newsgroup
Returns:
Structure containing the details

Configuration* configuration_get_object ( void   ) 

ConfigOpts configuration_get_opts ( Configuration obj  ) 

Retrieves the configuration options.

Parameters:
obj  The configuration object
Returns:
A structure containing configuration data

ConfigServer* configuration_get_server_info ( Configuration obj,
const char *  servername  
)

Retrieve information about a specific usenet server.

Parameters:
obj  The Configuration object
servername  The name of the usenet server whose info should be lookup up
Returns:
A g_slice_new'ed ConfigServer structure containing the requested info or NULL when the servername could not be found

GType configuration_get_type ( void   ) 

gboolean configuration_load ( Configuration obj,
char **  errmsg  
)

Load all settings from a local file on the harddrive.

Parameters:
obj  The configuration object
errmsg  A pointer to a char* to save a possible error message
Returns:
TRUE on success, FALSE on failure (errmsg will be set and needs to be g_free'd after use)

Configuration* configuration_new ( char **  errmsg,
char **  warnings  
)

gboolean configuration_save ( Configuration obj,
char **  errmsg  
)

Save all settings to a local file on the harddrive.

Parameters:
obj  The configuration object
errmsg  A pointer to a char* to save a possible error message
Returns:
TRUE on success, FALSE on failure (errmsg will be set and needs to be g_free'd after use)

void configuration_set_newsgroup_info ( Configuration obj,
const char *  servername,
const char *  newsgroup,
ConfigGroupInfo  info  
)

Set the details concerning the given server and newsgroup.

Parameters:
obj  The configuration object
servername  The name of the server
newsgroup  The name of the newsgroup
info  Structure containing the details

void configuration_set_opts ( Configuration obj,
ConfigOpts  opts  
)

Set the configuration options.

Parameters:
obj  The configuration object
opts  A structure containing configuration data


Generated on Thu May 21 21:25:05 2009 for NNTPGrab by  1.5.4