summaryrefslogtreecommitdiff
path: root/server/thumb-server.c
diff options
context:
space:
mode:
Diffstat (limited to 'server/thumb-server.c')
-rwxr-xr-xserver/thumb-server.c22
1 files changed, 4 insertions, 18 deletions
diff --git a/server/thumb-server.c b/server/thumb-server.c
index 3541d44..750f782 100755
--- a/server/thumb-server.c
+++ b/server/thumb-server.c
@@ -37,9 +37,7 @@ static GMainLoop *g_thumb_server_mainloop;
int main(void)
{
int sockfd = -1;
- GSource *source = NULL;
GIOChannel *channel = NULL;
- GMainContext *context = NULL;
if (ms_cynara_initialize() != MS_MEDIA_ERR_NONE) {
thumb_err("Cynara initialization failed");
@@ -52,32 +50,20 @@ int main(void)
return -1;
}
- g_thumb_server_mainloop = g_main_loop_new(context, FALSE);
- context = g_main_loop_get_context(g_thumb_server_mainloop);
+ g_thumb_server_mainloop = g_main_loop_new(NULL, FALSE);
/* Create new channel to watch tcp socket */
channel = g_io_channel_unix_new(sockfd);
- source = g_io_create_watch(channel, G_IO_IN);
-
- /* Set callback to be called when socket is readable */
- g_source_set_callback(source, (GSourceFunc)_thumb_server_read_socket, (gpointer)g_thumb_server_mainloop, NULL);
- g_source_attach(source, context);
+ g_io_add_watch(channel, G_IO_IN, _thumb_server_read_socket, g_thumb_server_mainloop);
+ g_io_channel_unref(channel);
- GSource *source_evas_init = NULL;
- source_evas_init = g_idle_source_new();
- g_source_set_callback(source_evas_init, _thumb_daemon_start_jobs, NULL, NULL);
- g_source_attach(source_evas_init, context);
+ g_idle_add(_thumb_daemon_start_jobs, NULL);
thumb_info("Thumbnail server is running");
g_main_loop_run(g_thumb_server_mainloop);
thumb_info("Thumbnail server is shutting down");
- g_io_channel_shutdown(channel, FALSE, NULL);
- g_io_channel_unref(channel);
- /*close socket*/
close(sockfd);
-
- g_main_loop_quit(g_thumb_server_mainloop);
g_main_loop_unref(g_thumb_server_mainloop);
ms_cynara_finish();