]> git.meshlink.io Git - catta/blobdiff - examples/glib-integration.c
get rid of a lot of old svn cruft
[catta] / examples / glib-integration.c
index fa68693ada43bc5d57e7d2ca6ff8729f40ac43a3..d2a2457999b006e2d9936f89125d352a3bf11b84 100644 (file)
@@ -1,24 +1,26 @@
-/* $Id$ */
-
 /***
   This file is part of avahi.
+
   avahi is free software; you can redistribute it and/or modify it
   under the terms of the GNU Lesser General Public License as
   published by the Free Software Foundation; either version 2.1 of the
   License, or (at your option) any later version.
+
   avahi 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 Lesser General
   Public License for more details.
+
   You should have received a copy of the GNU Lesser General Public
   License along with avahi; if not, write to the Free Software
   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
   USA.
 ***/
 
+#ifdef HAVE_CONFIG_H
+#include <config.h>
+#endif
+
 #include <glib.h>
 
 #include <avahi-client/client.h>
@@ -29,7 +31,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!");
 }
@@ -41,7 +43,7 @@ avahi_timeout_event_glib (void *userdata)
     GMainLoop *loop = userdata;
 
     g_message ("GLIB API Timeout reached, quitting main loop!");
-    
+
     /* Quit the application */
     g_main_loop_quit (loop);
 
@@ -50,16 +52,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);
@@ -67,7 +69,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;
@@ -104,6 +106,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 */
@@ -116,7 +119,7 @@ main (int argc, char *argv[])
 
         goto fail;
     }
-   
+
     /* Make a call to get the version string from the daemon */
     version = avahi_client_get_version_string (client);
 
@@ -127,7 +130,7 @@ main (int argc, char *argv[])
 
         goto fail;
     }
-        
+
     g_message ("Avahi Server Version: %s", version);
 
     /* Start the GLIB Main Loop */