diff options
author | David Robillard <d@drobilla.net> | 2011-02-22 07:57:23 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-02-22 07:57:23 +0000 |
commit | 3d3ae423b30e61c624b737a306d4fa66a9af411e (patch) | |
tree | 807193125ae2d97ebb073c69701b8583c8afe93f /src/uis.c | |
parent | 292f32b8932227e010f059de00a7df7c3b3b2a8d (diff) | |
download | suil-3d3ae423b30e61c624b737a306d4fa66a9af411e.tar.gz suil-3d3ae423b30e61c624b737a306d4fa66a9af411e.tar.bz2 suil-3d3ae423b30e61c624b737a306d4fa66a9af411e.zip |
Initial UI instance implementation.
git-svn-id: http://svn.drobilla.net/lad/trunk/suil@3010 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/uis.c')
-rw-r--r-- | src/uis.c | 45 |
1 files changed, 45 insertions, 0 deletions
@@ -15,4 +15,49 @@ * along with this program. If not, see <http://www.gnu.org/licenses/>. */ +#define _XOPEN_SOURCE 500 + +#include <string.h> + #include "suil_internal.h" + +SUIL_API +SuilUIs +suil_uis_new(const char* plugin_uri) +{ + SuilUIs uis = (SuilUIs)malloc(sizeof(struct _SuilUIs)); + uis->plugin_uri = strdup(plugin_uri); + uis->uis = malloc(sizeof(SuilUI)); + uis->uis[0] = (SuilUI)NULL; + uis->n_uis = 0; + return uis; +} + +SUIL_API +void +suil_uis_free(SuilUIs uis) +{ + free(uis->plugin_uri); + free(uis); +} + +SUIL_API +void +suil_uis_add(SuilUIs uis, + const char* uri, + const char* type_uri, + const char* bundle_path, + const char* binary_path) +{ + SuilUI ui = (SuilUI)malloc(sizeof(struct _SuilUI)); + ui->uri = strdup(uri); + ui->type_uri = strdup(type_uri); + ui->bundle_path = strdup(bundle_path); + ui->binary_path = strdup(binary_path); + + ++uis->n_uis; + uis->uis = realloc(uis->uis, sizeof(SuilUI) * (uis->n_uis + 1)); + assert(uis->uis[uis->n_uis - 1] == NULL); + uis->uis[uis->n_uis - 1] = ui; + uis->uis[uis->n_uis] = NULL; +} |