Adding a tray icon.
This commit is contained in:
@@ -876,3 +876,51 @@ void rkt_webview_exit_done(int done)
|
||||
ERROR0("rkt_webview_exit_done called with 'false', i.e. this library did not have a cleanup call\n");
|
||||
}
|
||||
}
|
||||
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
// Tray specific functions
|
||||
/////////////////////////////////////////////////////////////////////
|
||||
|
||||
rktwebview_t rkt_webview_tray_create(const char *icon_file,
|
||||
const char *tooltip)
|
||||
{
|
||||
RKT_WEBVIEW_INIT;
|
||||
FAIL_WV
|
||||
|
||||
JSON j;
|
||||
j["icon"] = icon_file;
|
||||
j["tooltip"] = tooltip;
|
||||
|
||||
handler->command_queue->enqueue(CMD_CREATE_TRAY, j.dump());
|
||||
|
||||
int result;
|
||||
std::string json_result;
|
||||
while (!handler->command_result_queue->dequeue(result, json_result, MAX_WAIT_RESULT)) {
|
||||
if (handler->alive_error) {
|
||||
return result_t::failed;
|
||||
}
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
result_t rkt_webview_tray_set_icon(rktwebview_t tray, const char *icon_file)
|
||||
{
|
||||
CMDRES(CMD_TRAY_SET_ICON, tray, "icon", icon_file)
|
||||
}
|
||||
|
||||
result_t rkt_webview_tray_set_tooltip(rktwebview_t tray, const char *tooltip)
|
||||
{
|
||||
CMDRES(CMD_TRAY_SET_TOOLTIP, tray, "tooltip", tooltip)
|
||||
}
|
||||
|
||||
result_t rkt_webview_tray_show_message(rktwebview_t tray, const char *title, const char *message)
|
||||
{
|
||||
CMDRES2(CMD_TRAY_SHOW_MESSAGE, tray, "title", title, "message", message)
|
||||
}
|
||||
|
||||
result_t rkt_webview_tray_set_menu(rktwebview_t tray, const char *menu_json)
|
||||
{
|
||||
CMDRES(CMD_TRAY_SET_MENU, tray, "menu", menu_json)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user