diff options
author | James Booth <boothj5@gmail.com> | 2016-02-14 22:28:55 +0000 |
---|---|---|
committer | James Booth <boothj5@gmail.com> | 2016-02-14 22:28:55 +0000 |
commit | 41fe8c22b1f8c1cf666d42052cd73d59e40a2ed2 (patch) | |
tree | 3b53c1fbc2e5dc8c6daccf7fe7bb9f27d1c9d05a /src/ui/window.c | |
parent | f887a35c0cd550a3c635630da2bd83bb7400b957 (diff) | |
download | profani-tty-41fe8c22b1f8c1cf666d42052cd73d59e40a2ed2.tar.gz |
Added C plugin code from plugins branch
Diffstat (limited to 'src/ui/window.c')
-rw-r--r-- | src/ui/window.c | 34 |
1 files changed, 31 insertions, 3 deletions
diff --git a/src/ui/window.c b/src/ui/window.c index 66fcc334..50719d44 100644 --- a/src/ui/window.c +++ b/src/ui/window.c @@ -32,7 +32,7 @@ * */ -#include "config.h" +#include "prof_config.h" #include <stdlib.h> #include <string.h> @@ -41,9 +41,9 @@ #include <wchar.h> #include <glib.h> -#ifdef HAVE_NCURSESW_NCURSES_H +#ifdef PROF_HAVE_NCURSESW_NCURSES_H #include <ncursesw/ncurses.h> -#elif HAVE_NCURSES_H +#elif PROF_HAVE_NCURSES_H #include <ncurses.h> #endif @@ -237,6 +237,20 @@ win_create_xmlconsole(void) return &new_win->window; } +ProfWin* +win_create_plugin(const char *const tag) +{ + ProfPluginWin *new_win = malloc(sizeof(ProfPluginWin)); + new_win->super.type = WIN_PLUGIN; + new_win->super.layout = _win_create_simple_layout(); + + new_win->tag = strdup(tag); + + new_win->memcheck = PROFPLUGINWIN_MEMCHECK; + + return &new_win->super; +} + char* win_get_title(ProfWin *window) { @@ -287,6 +301,11 @@ win_get_title(ProfWin *window) if (window->type == WIN_XML) { return strdup(XML_WIN_TITLE); } + if (window->type == WIN_PLUGIN) { + ProfPluginWin *pluginwin = (ProfPluginWin*) window; + assert(pluginwin->memcheck == PROFPLUGINWIN_MEMCHECK); + return strdup(pluginwin->tag); + } return NULL; } @@ -327,6 +346,15 @@ win_get_string(ProfWin *window) ProfXMLWin *xmlwin = (ProfXMLWin*)window; return xmlwin_get_string(xmlwin); } + case WIN_PLUGIN: + { + ProfPluginWin *pluginwin = (ProfPluginWin*)window; + GString *gstring = g_string_new(""); + g_string_append_printf(gstring, "%s plugin", pluginwin->tag); + char *res = gstring->str; + g_string_free(gstring, FALSE); + return res; + } default: return NULL; } |