X-Git-Url: http://git.meshlink.io/?a=blobdiff_plain;f=examples%2Fglib-integration.c;h=ab53687693f173d8213f7a3e2c3d97f98aae2f72;hb=920f7683e43247699251569168704c70898d923d;hp=89571282c0b9685a275690218ab4b7edb3059298;hpb=2be556032ed87b7627a135174339c5e5a0e8fc44;p=catta diff --git a/examples/glib-integration.c b/examples/glib-integration.c index 8957128..ab53687 100644 --- a/examples/glib-integration.c +++ b/examples/glib-integration.c @@ -33,7 +33,7 @@ /* Callback for Avahi API Timeout Event */ static void -avahi_timeout_event (AvahiTimeout *timeout, void *userdata) +avahi_timeout_event (AVAHI_GCC_UNUSED AvahiTimeout *timeout, AVAHI_GCC_UNUSED void *userdata) { g_message ("Avahi API Timeout reached!"); } @@ -54,16 +54,16 @@ avahi_timeout_event_glib (void *userdata) /* Callback for state changes on the Client */ static void -avahi_client_callback (AvahiClient *client, AvahiClientState state, void *userdata) +avahi_client_callback (AVAHI_GCC_UNUSED AvahiClient *client, AvahiClientState state, void *userdata) { GMainLoop *loop = userdata; g_message ("Avahi Client State Change: %d", state); - if (state == AVAHI_CLIENT_DISCONNECTED) + if (state == AVAHI_CLIENT_FAILURE) { /* We we're disconnected from the Daemon */ - g_message ("Disconnected from the Avahi Daemon"); + g_message ("Disconnected from the Avahi Daemon: %s", avahi_strerror(avahi_client_errno(client))); /* Quit the application */ g_main_loop_quit (loop); @@ -71,7 +71,7 @@ avahi_client_callback (AvahiClient *client, AvahiClientState state, void *userda } int -main (int argc, char *argv[]) +main (AVAHI_GCC_UNUSED int argc, AVAHI_GCC_UNUSED char *argv[]) { GMainLoop *loop = NULL; const AvahiPoll *poll_api; @@ -108,6 +108,7 @@ main (int argc, char *argv[]) /* Create a new AvahiClient instance */ client = avahi_client_new (poll_api, /* AvahiPoll object from above */ + 0, avahi_client_callback, /* Callback function for Client state changes */ loop, /* User data */ &error); /* Error return */