Menu

API

API (2)
Lachu

Below I described libgreattao API

void tao_initialize_set_insecure_tags(int argc, char **argv)

It will checks each string pointed by argv array with size pointed by argc for matching to string given by module/shell/networking. If matched, it will asks for password. Application must be protected against debugging. I do not known how to protect debugging in good fashion, but setting suid/guid bits are bad idea, because libgreattao can work in GUI and GTK+/Qt backends are sensitive about these bits.
This function must be called before tao_initialize.

void *tao_new_window(const char *class)

It creates new window of specific classes. Windows classes file of given class will be processed, creating widget not associated to any template. Also templates not associated to any template will be added to list of window templates. Pointer to new window will be returned. The pointer is void type, because:

  1. Application shouldn't access to window properties directly
  2. Returned value and type depend on mode application is run(acctually there's only normal and shell mode; network mode will be implemented in future)

void *tao_add_handler(void *window, const char *epath, void (*callback)(void *, void*), void *data)

It searches for templates matched to given epath and process it in normal mode. This call additionally add domain_path structure in normal mode or action structure in shell mode to window, so future call to function needs window and epath will operate on this domain_path or action structure. In normal mode matched templates will be processed, creating widgets and attaching new templates to window.

void tao_initialize(const char *program_name, const char *program_help, int argc, char **argv)

It initializes libgreattao. This function must be called once application starts. Initialization process can bet

  • Waiting to client connection
  • Connect to server
  • Initialize backend, such like console, Gtk+, QT

void tao_handle_events(void)

It runs event iteration. Due to limitations of QT backend and libgreattao you should call this function in main thread and execution of main thread should be in this function, when calling any libgereattao function in different thread.

int tao_open_file(const char *path, int flags, int mode)

Open file with given path and return file descriptor for file with given path.

int tao_open_file(const char *path, int flags, int mode)

Open file with given path and return file descriptor for file with given path. It opens file remotly, when libgreattao application works in network mode.

void tao_close_file(int fd)

Close given fd and sends file related to given fd over network.

char *tao_get_requested_program_version(void);

Retruns string given as program API/GUI version in command line.

char *tao_get_string(void *window_, char *epath, int *error);

Returns string related to given window and path(for example value provided by user). Error pointer tells if there error occurred.

void tao_set_license_notice_and_text(const char *notice, const char *text);

Allows to set license text and notice. Actually this function are related only to shell working in interactive mode

void tao_add_image_to_icon_set(struct tao_icon_set *is, struct tao_image *im);

Adds icon to icon set. In connection with tao_set_helper you can order libgreattao with iconset contains icon with size between minimum and maximum.

void tao_delete_handlers(void *window_, const char *path);

Delete elements with given path for given window_. If path ends with '/' then all children elements will be removed without parent. If path ends with other character than '/', then all children elements and element with given path will be removed.

void tao_set_alternative_design(char *path);

Set path to application depended window class. If there's no matching path for given path, then window classes from alternative path will been used.

void tao_change_weight(void *window_, char *epath, int new_weight);

Change importance of elements in given path. While calling this function, libgreattao will recalculate window content.

void *tao_add_timer(int miliseconds, void (*callback)(void*), void *data);

Create timer and launch it. Return pointer to special structure contains timer data. Timers are invoked in tao loop.

void tao_remove_timer(void *timer);

Removes given timer.

void tao_set_modal(void *parent_, const char *spath, void *child_, char type);

Set given child_ as modal window with given parent_.

void tao_set_exit_callback(int (*callback)(void*));

Callback function will be called, when application exits.

void tao_display_windows(int count, void ** windows)

Function created for displaying simple windows, like messages. It starts message loop and exits from it, when all given window in windows array are closed. Backend are informed that windows are working in ghost mode, which means window doesn't need interaction. Some backends, like console, will automatically close windows after displaying it, so you can wrote simple program similar to ls, which only prints results in console backend and show window in graphical mode.


MongoDB Logo MongoDB