下载地址:https://www.spice-space.org/download/gtk/spice-gtk-0.35.tar.bz2
或者gitlab,https://gitlab.com/spice
spice-client官方的代码便是spice-gtk。
spice-gtk的源码里面,tools路径下面有个spicy.c的文件,这个就是官方的gtk客户端。当然,virt-viewer或者ovirt之类的软件,自己也在基于libspice-clinet基础上自己实现了适配自己程序的spice客户端。
下面就spicy.c的源码做个简要分析。
那就从main函数入手:
int main(int argc, char *argv[])
{
GError *error = NULL;
GOptionContext *context;
spice_connection *conn;
gchar *conf_file, *conf;
char *host = NULL, *port = NULL, *tls_port = NULL, *unix_path = NULL;
keyfile = g_key_file_new();
int mode = S_IRWXU;
conf_file = g_build_filename(g_get_user_config_dir(), "spicy", NULL);
if (g_mkdir_with_parents(conf_file, mode) == -1)
SPICE_DEBUG("failed to create config directory");
g_free(conf_file);
conf_file = g_build_filename(g_