Hey,

This looks good.  (Holy C++ style (which isn't a bad thing).  I think
the event handling is good and it'll allow for us to more easily speed
things up.

A few questions: Are the 'defines' in the events.h file standard
gnutella codes or did we/you just make them up?  

Also, at some point you should write a little thing that describes how
the main functionality works, something like:


Case 1: Starting a new search.  The info is entered in the gui.  The gui
uses the API functions to create a new event in the API event queue. 
The core then....

Case 2: Changing a config setting....



etc.  That would probably save us all some time and help new folks get
up to speed.  I find I spend a lot of time on projects figuring out how
stuff fits together mechanically by having to dig through the code, even
if the code is structured well, a few paragraphs of explaination can
save hours of digging.

Emile


On Sat, 2003-10-25 at 12:55, Jeroen Asselman wrote:
> Hi,
> 
> Apparently my first mail got lost. So I hereby resend it:
> 
> I hereby send a very rough (incomplete) API as I see how the
> gnutella-lib API should look like.
> 
> For the configuration perhaps something like:
> 
> 
> #define CONFIG_S_NAME "GTK_GNUTELLA_LIB_CONFIG"
> #define CONFIG_S_NAME_LENGTH 23
> 
> typedef struct config_s config_t;
> struct config_s {
>     char    config_s_name[CONFIG_S_NAME_LENGTH];
>     char    *config_name;        /**< Name. eg: Downloads.Timeout.Retry
> */
>     char    *config_hint;        /**< Hint. eg: When to retry a download
> that timed out */
> 
>     int        type;                /**< Boolean, nummeric, float?, 
> string, enum */
>     int        num_value;            /**< Assigned value. eg: 1800 */
>     int        num_value_default;    /**< Default value if not set. eg: 
> 600 */
>     int        num_min;            /**< Minimum value, or -1 if not a 
> range. eg: 0 */
>     int        num_max;            /**< Maximum value, or num_min if no 
> maximum. eg: 0 */
> 
>     char    *str_value;            /**< string: Assigned value. eg:
> ~/tmp */
>     char    *str_value_default;    /**< string: Default value. eg: ~ */
> 
>     char    **enum_values;       
> 
>     int        ID;                    /**< ID for translation. Must be 
> unique for every config entry. */
> };
> 
> /**
>  * Get first setting from config file.
>  *
>  * Gets the first setting from the configuration data. If you want to 
> retreive
>  * all config items you can use gnut_config_get_items_first() and then
> use
>  * gnut_config_get_item_next(gnut_config_t *) to travel thru the list of
> all
>  * configuration items.
>  *
>  * @return pointer to the config item. If the pointer is NULL there are
> no
>  * configuration items.
>  */
> gnut_config_t    *gnut_config_get_item_first();
> 
> /**
>  * Get next setting from config file.
>  *
>  * Gets the next setting from the configuration data relative to
> *config.
>  * If you want to retreive all config items you can use 
> gnut_config_get_items_first()
>  * and then use gnut_config_get_item_next(gnut_config_t *) to travel 
> thru the list of
>  * all configuration items.
>  *
>  * @param config is a pointer to the current configuration item.
>  * @return pointer to the next configuration item relative to config. If
> the pointer
>  * is NULL there are no next configuration items.
>  */
> gnut_config_t    *gnut_config_get_item_next(gnut_config_t *config);
> 
> /**
>  * Get previous setting from config file.
>  *
>  * Gets the previous setting from the configuration data relative to 
> *config.
>  * You can use this function to travel thru the list of configuration
> items.
>  *
>  * @param config is a pointer to the current configuration item.
>  * @return pointer to the previous configuration item relative to 
> config. If the
>  * pointer is NULL there are no next configuration items.
>  */
> gnut_config_t    *gnut_config_get_item_prev(gnut_config_t *config);
> 
> /**
>  * Get the last setting from config file.
>  *
>  * Gets the last setting from the configuration data.
>  *
>  * @return pointer to the last config item. If the pointer is NULL there
> are no
>  * configuration items.
>  */
> gnut_config_t    *gnut_config_get_item_last();
> 
> /**
>  * Find a configuration setting with a given name.
>  *
>  * @param config_name contains the name to locate.
>  * @return a pointer to the configuration item with the given name. 
> Returns NULL
>  * if the configuration items is not found.
>  */
> gnut_config_t    *gnut_config_find_with_name(char *config_name);
>        
> char    *gnut_config_get_name(gnut_tconfig *config);
> char    *gnut_config_get_hint(gnut_tconfig *config);
> int         gnut_config_get_type(gnut_tconfig *config);
> int         gnut_config_get_id(gnut_tconfig *config);
> 
> int         gnut_config_get_num_value(gnut_tconfig *config);
> int         gnut_config_get_num_value_default(gnut_tconfig *config);
> int         gnut_config_get_num_min(gnut_tconfig *config);
> int         gnut_config_get_num_max(gnut_tconfig *config);
> 
> char    *gnut_config_get_str_value(gnut_tconfig *config);
> char    *gnut_config_get_str_value_default(gnut_tconfig *config);
> 
> char    *gnut_config_get_enum_value(gnut_tconfig *config);
> int         gnut_config_get_enum_values(gnut_tconfig *config);
> 
> int         gnut_config_get_version(gnut_tconfig *config);
> 
> gnut_config_t    *gnut_config_set_name(char *name);
> void             gnut_config_set_hint(gnut_config_t *config, char
> *hint);
> void             gnut_config_set_type(gnut_config_t *config, int type);
> 
> void             gnut_config_set_num_value(gnut_config_t *config, int 
> value);
> void             gnut_config_set_num_value_default(gnut_config_t 
> *config, int value);
> void             gnut_config_set_name_min(gnut_config_t *config, int
> min);
> void             gnut_config_set_name_max(gnut_config_t *config, int
> max);
> 
> void             gnut_config_set_str_value(gnut_config_t *config, char 
> *value);
> void             gnut_config_set_str_value_default(gnut_config_t 
> *config, char *hint);
> 
> void             gnut_config_add_enum_value(gnut_config_t *config, char 
> *value);
> void             gnut_config_rem_enum_value(gnut_config_t *config, char 
> *value);
> 
> 
> The events are defined as in the attached files events.c and events.h.
-- 
Computer Troubleshooting, New Computer Advice, Virus Clean-up,
Hardware/Software Installs, Web Design, Linux Installations:  Attune
Consulting can help.  
http://www.attuneconsulting.com 
[EMAIL PROTECTED]



-------------------------------------------------------
This SF.net email is sponsored by: The SF.net Donation Program.
Do you like what SourceForge.net is doing for the Open
Source Community?  Make a contribution, and help us add new
features and functionality. Click here: http://sourceforge.net/donate/
_______________________________________________
Gtk-gnutella-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/gtk-gnutella-devel

Reply via email to