From 58f91c51b739e55676b732cb4b4eefa7ba16a40b Mon Sep 17 00:00:00 2001 From: "Leandro A. F. Pereira" Date: Mon, 10 Aug 2009 15:20:46 -0300 Subject: Forgot to commit changes to callbacks.[ch] :) --- hardinfo2/callbacks.c | 24 ++++++++++++++++++++++++ hardinfo2/callbacks.h | 1 + 2 files changed, 25 insertions(+) (limited to 'hardinfo2') diff --git a/hardinfo2/callbacks.c b/hardinfo2/callbacks.c index 1d27b5f7..3b77bd33 100644 --- a/hardinfo2/callbacks.c +++ b/hardinfo2/callbacks.c @@ -27,6 +27,7 @@ #include "report.h" #include "syncmanager.h" #include "help-viewer.h" +#include "xmlrpc-server.h" #include "config.h" @@ -72,6 +73,29 @@ void cb_connect_host(GtkAction * action) g_free(name); } +static gboolean server_start_helper(gpointer server_loop) +{ + GMainLoop *loop = (GMainLoop *)server_loop; + + xmlrpc_server_start(loop); + + return FALSE; +} + +void cb_act_as_server() +{ + gboolean accepting; + static GMainLoop *server_loop = NULL; + + accepting = shell_action_get_active("ActAsServerAction"); + if (accepting) { + server_loop = g_main_loop_new(NULL, FALSE); + g_idle_add(server_start_helper, server_loop); + } else { + g_main_loop_quit(server_loop); + } +} + void cb_local_computer() { Shell *shell = shell_get_main_shell(); diff --git a/hardinfo2/callbacks.h b/hardinfo2/callbacks.h index 9f145554..8cb29a87 100644 --- a/hardinfo2/callbacks.h +++ b/hardinfo2/callbacks.h @@ -39,5 +39,6 @@ void cb_connect_to(); void cb_manage_hosts(); void cb_connect_host(GtkAction * action); void cb_local_computer(); +void cb_act_as_server(); #endif /* __CALLBACKS_H__ */ -- cgit v1.2.3