Initial highly-stubbed guac_client_init().
This commit is contained in:
parent
b3bf7bd700
commit
897010cd23
@ -48,8 +48,8 @@ noinst_HEADERS = \
|
|||||||
include/client.h \
|
include/client.h \
|
||||||
include/guac_handlers.h
|
include/guac_handlers.h
|
||||||
|
|
||||||
libguac_client_spice_la_CFLAGS = -Werror -Wall -pedantic -Iinclude @SPICE_CLIENT_GLIB_CFLAGS@
|
libguac_client_spice_la_CFLAGS = -Werror -Wall -pedantic -Iinclude @SPICE_CLIENT_GLIB_CFLAGS@ @GLIB_CFLAGS@
|
||||||
libguac_client_spice_la_LIBADD = @SPICE_CLIENT_GLIB_LIBS@
|
libguac_client_spice_la_LIBADD = @SPICE_CLIENT_GLIB_LIBS@ @GLIB_LIBS@
|
||||||
libguac_client_spice_la_LDFLAGS = -version-info 0:0:0
|
libguac_client_spice_la_LDFLAGS = -version-info 0:0:0
|
||||||
|
|
||||||
EXTRA_DIST = LICENSE
|
EXTRA_DIST = LICENSE
|
||||||
|
@ -48,6 +48,7 @@ AC_CHECK_LIB([guac], [guac_client_plugin_open],, AC_MSG_ERROR("libguac must be i
|
|||||||
AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions"))
|
AC_CHECK_LIB([cairo], [cairo_create],, AC_MSG_ERROR("cairo is required for drawing instructions"))
|
||||||
AC_CHECK_LIB([pthread], [pthread_create])
|
AC_CHECK_LIB([pthread], [pthread_create])
|
||||||
PKG_CHECK_MODULES([SPICE_CLIENT_GLIB], [spice-client-glib-2.0])
|
PKG_CHECK_MODULES([SPICE_CLIENT_GLIB], [spice-client-glib-2.0])
|
||||||
|
PKG_CHECK_MODULES([GLIB], [glib-2.0])
|
||||||
|
|
||||||
# Checks for header files.
|
# Checks for header files.
|
||||||
AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h])
|
AC_CHECK_HEADERS([guacamole/client.h guacamole/guacio.h guacamole/protocol.h])
|
||||||
|
@ -36,17 +36,23 @@
|
|||||||
* ***** END LICENSE BLOCK ***** */
|
* ***** END LICENSE BLOCK ***** */
|
||||||
|
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
#include <stdbool.h>
|
||||||
|
|
||||||
#include <guacamole/client.h>
|
#include <guacamole/client.h>
|
||||||
|
#include <spice-session.h>
|
||||||
|
|
||||||
#include "guac_handlers.h"
|
#include "guac_handlers.h"
|
||||||
|
|
||||||
/* Client plugin arguments */
|
/* Client plugin arguments */
|
||||||
const char* GUAC_CLIENT_ARGS[] = {
|
const char* GUAC_CLIENT_ARGS[] = {
|
||||||
|
"hostname",
|
||||||
|
"port",
|
||||||
NULL
|
NULL
|
||||||
};
|
};
|
||||||
|
|
||||||
enum __SPICE_ARGS_IDX {
|
enum __SPICE_ARGS_IDX {
|
||||||
|
SPICE_ARGS_HOSTNAME,
|
||||||
|
SPICE_ARGS_PORT,
|
||||||
SPICE_ARGS_COUNT
|
SPICE_ARGS_COUNT
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -54,11 +60,36 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
|||||||
|
|
||||||
/* STUB */
|
/* STUB */
|
||||||
|
|
||||||
|
GMainLoop* mainloop;
|
||||||
|
SpiceSession* session;
|
||||||
|
|
||||||
if (argc != SPICE_ARGS_COUNT) {
|
if (argc != SPICE_ARGS_COUNT) {
|
||||||
guac_client_log_error(client, "Wrong number of arguments");
|
guac_client_log_error(client, "Wrong number of arguments");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Init GLIB */
|
||||||
|
guac_client_log_info(client, "Init GLIB-2.0...");
|
||||||
|
g_type_init();
|
||||||
|
mainloop = g_main_loop_new(NULL, false);
|
||||||
|
|
||||||
|
/* Create session */
|
||||||
|
guac_client_log_info(client, "Creating SPICE session...");
|
||||||
|
|
||||||
|
session = spice_session_new();
|
||||||
|
|
||||||
|
/* Init session parameters */
|
||||||
|
guac_client_log_info(client, "Setting parameters...");
|
||||||
|
g_object_set(session, "host", argv[SPICE_ARGS_HOSTNAME], NULL);
|
||||||
|
g_object_set(session, "port", argv[SPICE_ARGS_PORT], NULL);
|
||||||
|
|
||||||
|
/* Connect */
|
||||||
|
guac_client_log_info(client, "Connecting...");
|
||||||
|
if (!spice_session_connect(session)) {
|
||||||
|
guac_client_log_error(client, "SPICE connection failed");
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
/* Set handlers */
|
/* Set handlers */
|
||||||
client->handle_messages = spice_guac_client_handle_messages;
|
client->handle_messages = spice_guac_client_handle_messages;
|
||||||
client->clipboard_handler = spice_guac_client_clipboard_handler;
|
client->clipboard_handler = spice_guac_client_clipboard_handler;
|
||||||
@ -67,6 +98,7 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
|
|||||||
client->size_handler = spice_guac_client_size_handler;
|
client->size_handler = spice_guac_client_size_handler;
|
||||||
client->free_handler = spice_guac_client_free_handler;
|
client->free_handler = spice_guac_client_free_handler;
|
||||||
|
|
||||||
|
g_main_loop_run(mainloop);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user