| Anonymous | Login | Signup for a new account | 10-09-09 07:03 CEST |
| Main | My View | View Issues | Change Log | Roadmap | Docs |
| Relationship Graph | [ View Issue ] [ Dependency Graph ] | |||
|
|
||||
|
||||
| Viewing Issue Simple Details | |||||
| ID | Category | Severity | Reproducibility | Date Submitted | Last Update |
| 0000019 | feature | N/A | 04-03-19 19:31 | 06-04-06 23:35 | |
| Reporter | tru | View Status | public | ||
| Assigned To | |||||
| Priority | normal | Resolution | open | ||
| Status | confirmed | ||||
| Summary | 0000019: configuration language | ||||
| Description | We should have some kind of language to describe configuration values. | ||||
| Additional Information |
Some code. typedef enum { /* Normal string, any string could be whatever argument should be NULL */ XMMS_CONFIG_TYPE_STRING, /* Normal int argument should be NULL */ XMMS_CONFIG_TYPE_INT, /* Could be a string in the list argument should be a GList* with possible values.*/ XMMS_CONFIG_TYPE_STRING_LIST, /* Could be a INT in the list argument should be a GList* with int values (GINT_TO_POINTER)*/ XMMS_CONFIG_TYPE_INT_LIST, /* Could be any int between the numbers argument should be a string like "0-100" */ XMMS_CONFIG_TYPE_INT_RANGE, /* A file path argument should be a glob string like "*mp3" */ XMMS_CONFIG_TYPE_PATH_FILE, /* A directory path argument should be NULL */ XMMS_CONFIG_TYPE_PATH_DIR, /* A hostname or IP argument should be NULL */ XMMS_CONFIG_TYPE_HOST, } xmms_config_types_t; gboolean xmms_config_value_set_info (xmms_config_value_t *, xmms_config_types_t, void *argument, gchar *documentation); /* Example 1: a normal string */ xmms_config_value_set_info (val, XMMS_CONFIG_TYPE_STRING, NULL, "This string will format the HTTP request"); /* Example 2: a list of different strings */ GList *outputs = NULL; outputs = g_list_append (outputs, "oss"); outputs = g_list_append (outputs, "also"); xmms_config_value_set_info (val, XMMS_CONFIG_TYPE_STRING_LIST, (void *) outputs, "Selects a output-plugin to use."); /* Example 3: a group */ xmms_config_value_group_t *group; group = xmms_config_value_group_new (config, "Core parameters"); xmms_config_value_group_add (group, value1); xmms_config_value_group_add (group, value2); /* clientside */ xmmsc_result_t *res; res = xmmsc_config_info_get (connection); ... x_list_t *apan = xmmsc_result_get_config_info (res); for (n = apan; n; n = x_list_next (n)) { xmmsc_config_info_t *info = n->data; switch (info->type) { case XMMS_CONFIG_TYPE_STRING_LIST: { x_list_t *strs = info->list; /* Not real GTK code */ GtkWidget *selection = gtk_selection_new ("korv"); for (l = strs; l; l = x_list_next (l)) { gtk_selection_add_value (l->data); if (g_strcacecmp (l->data, info->current_value.str) == 0) { gtk_selection_select (l->data); } } gtk_widget_show (selection); } break; case XMMS_CONFIG_TYPE_INT_RANGE: ... break; } } |
||||
| Mantis 1.1.6[^] Copyright © 2000 - 2008 Mantis Group |