#ifndef C8_TILES_H
#define C8_TILES_H
#include <gio/gio.h>
#include <stdbool.h>
/*
* The shell's live tiles, org.cont8nuum.Tiles1 (documented in
* c8-protocols): what a program sending a tile needs, and what one that
* the shell runs to keep a tile fresh (a provider) has to watch for.
*/
#define C8_TILES_NAME "org.cont8nuum.Tiles"
#define C8_TILES_PATH "/org/cont8nuum/Tiles"
#define C8_TILES_IFACE "org.cont8nuum.Tiles1"
/* The session bus, connected once; NULL without one */
GDBusConnection *c8_tiles_bus(void);
/* Calls a method without waiting for the answer; takes params */
void c8_tiles_call(const char *method, GVariant *params);
struct c8_tile_provider {
const char *tile_id;
/* Leave: the shell is starting a fresh provider for the tile, has
* been gone a minute (logged out; a new one starts its own), or
* SIGTERM/SIGINT came */
void (*quit)(void *data);
bool quit_unpinned; // also when the tile is unpinned
/* A shell owns the name, the first or a new one, which may have
* lost what was sent. May be NULL. */
void (*shell)(void *data);
/* Start showing or not, asked for whenever a shell appears. May be
* NULL. */
void (*visible)(bool visible, void *data);
/* The tile was clicked (a tile without a command). May be NULL. */
void (*activated)(void *data);
/* The shell left the bus; `shell` runs if one comes back. May be
* NULL. */
void (*gone)(void *data);
/* The minute without a shell only counts once one was there: for a
* provider that may be started before the shell is */
bool wait_for_shell;
};
/* Starts watching; provider must stay (a static) */
void c8_tile_provider_watch(const struct c8_tile_provider *provider,
void *data);
#endif