grim/guifications3

1f195d42369a
closing this since most of it will happen on default since libgds now exists ;)
/*
* Guifications - The end-all, be-all notification framework
* Copyright (C) 2003-2009 Gary Kramlich <grim@reaperworld.com>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
#ifdef HAVE_CONFIG_H
# include <config.h>
#endif /* HAVE_CONFIG_H */
#include <gflib/gf_lib.h>
#include <gflib/gf_intl.h>
#include <libsoup/soup.h>
#include "guifications-daemon-web-handlers.h"
/******************************************************************************
* Globals
*****************************************************************************/
static GfClientConnection *connection = NULL;
static SoupServer *server = NULL;
/******************************************************************************
* Plugin Stuff
*****************************************************************************/
G_MODULE_EXPORT gboolean
gf_native_plugin_load(GfNativePlugin *plugin) {
#ifdef ENABLE_NLS
bindtextdomain(GETTEXT_PACKAGE, LOCALEDIR);
# ifdef HAVE_BIND_TEXTDOMAIN_CODESET
bind_textdomain_codeset(GETTEXT_PACKAGE, "UTF-8");
# endif /* HAVE_BIND_TEXTDOMAIN_CODESET */
#endif /* ENABLE_NLS */
/* check if gthreads initialized, if not, initialize it */
if(!g_thread_supported())
g_thread_init(NULL);
/* we'll assume we're getting a local connection and not do a whole lot
* of error checking... Well, for now anyways...
*/
connection = gf_connection_manager_get_default();
gf_client_connection_connect(GF_CLIENT_CONNECTION(connection), NULL);
/* load the default gplate config */
gplate_config_load_default();
/* create the server */
server = soup_server_new(SOUP_SERVER_PORT, 1028,
SOUP_SERVER_ASYNC_CONTEXT, g_main_context_default(),
NULL);
/* add the default handlers */
gfd_web_handlers_add_default(connection, server);
/* start the server */
soup_server_run_async(server);
/* done loading */
return TRUE;
}
G_MODULE_EXPORT gboolean
gf_native_plugin_unload(GfNativePlugin *plugin) {
soup_server_quit(server);
g_object_unref(G_OBJECT(server));
g_object_unref(G_OBJECT(connection));
connection = NULL;
return TRUE;
}
static GfPluginInfo info = {
GF_NATIVE_PLUGIN_ABI_VERSION,
PACKAGE_NAME,
PACKAGE_VERSION,
N_("Web Interface for Guifications"),
N_("This is a daemon plugin for monitoring via a web browser"),
"Gary Kramlich <grim@reaperworld.com>",
"http://www.guifications.org/",
};
G_MODULE_EXPORT GfPluginInfo *
gf_native_plugin_query(GfPlugin *plugin) {
return &info;
}