[seahorse] Fixes for glib 2.31.x deprecations



commit 39e8f2dbaf67c616cf05411233cf85afa97cb7e8
Author: Stef Walter <stefw collabora co uk>
Date:   Thu Dec 8 20:05:48 2011 +0100

    Fixes for glib 2.31.x deprecations
    
     * Remove use of g_atexit()
     * Fix for warning for missing varargs sentinel

 libseahorse/seahorse-passphrase.c |    2 +-
 libseahorse/seahorse-util.c       |   51 -------------------------------------
 libseahorse/seahorse-util.h       |    5 ---
 pgp/seahorse-discovery.c          |   17 +++++++++++-
 4 files changed, 17 insertions(+), 58 deletions(-)
---
diff --git a/libseahorse/seahorse-passphrase.c b/libseahorse/seahorse-passphrase.c
index 965ff3b..abd87fe 100644
--- a/libseahorse/seahorse-passphrase.c
+++ b/libseahorse/seahorse-passphrase.c
@@ -181,7 +181,7 @@ seahorse_passphrase_prompt_show (const gchar *title,
 	if (!prompt)
 		prompt = _("Password:");
 
-	widget = gtk_dialog_new_with_buttons (title, NULL, GTK_DIALOG_MODAL, NULL);
+	widget = gtk_dialog_new_with_buttons (title, NULL, GTK_DIALOG_MODAL, NULL, NULL);
 	gtk_window_set_icon_name (GTK_WINDOW (widget), GTK_STOCK_DIALOG_AUTHENTICATION);
 	dialog = GTK_DIALOG (widget);
 
diff --git a/libseahorse/seahorse-util.c b/libseahorse/seahorse-util.c
index ee9b3a6..88d2af1 100644
--- a/libseahorse/seahorse-util.c
+++ b/libseahorse/seahorse-util.c
@@ -34,11 +34,6 @@
 #include <gio/gio.h>
 #include <glib/gstdio.h>
 
-#ifdef WITH_SHARING
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
-#endif 
-
 #include <sys/wait.h>
 #include <sys/stat.h>
 #include <unistd.h>
@@ -915,49 +910,3 @@ seahorse_util_parse_version (const char *version)
 	g_strfreev(tokens);
 	return ret;
 }
-
-/* -----------------------------------------------------------------------------
- * DNS-SD Stuff 
- */
-
-#ifdef WITH_SHARING
-
-/* 
- * We have this stuff here because it needs to:
- *  - Be usable from libseahorse and anything within libseahorse
- *  - Be initialized properly only once per process. 
- */
-
-#include <avahi-glib/glib-watch.h>
-#include <avahi-glib/glib-malloc.h>
-
-static AvahiGLibPoll *avahi_poll = NULL;
-
-static void
-free_avahi ()
-{
-    if (avahi_poll)
-        avahi_glib_poll_free (avahi_poll);
-    avahi_poll = NULL;
-}
-
-const AvahiPoll*
-seahorse_util_dns_sd_get_poll (void)
-{
-    if (!avahi_poll) {
-        
-        avahi_set_allocator (avahi_glib_allocator ());
-        
-        avahi_poll = avahi_glib_poll_new (NULL, G_PRIORITY_DEFAULT);
-        if (!avahi_poll) {
-            g_warning ("couldn't initialize avahi glib poll integration");
-            return NULL;
-        }
-        
-        g_atexit (free_avahi);
-    }
-    
-    return avahi_glib_poll_get (avahi_poll);
-}
-
-#endif
diff --git a/libseahorse/seahorse-util.h b/libseahorse/seahorse-util.h
index cdcf04f..9310c8d 100644
--- a/libseahorse/seahorse-util.h
+++ b/libseahorse/seahorse-util.h
@@ -31,11 +31,6 @@
 #include <gtk/gtk.h>
 #include <time.h>
 
-#ifdef WITH_SHARING
-#include <avahi-client/client.h>
-const AvahiPoll* seahorse_util_dns_sd_get_poll (void);
-#endif
-
 typedef guint64 SeahorseVersion;
 
 #define SEAHORSE_BAD_FILENAME_CHARS  "/\\<>|:?;"
diff --git a/pgp/seahorse-discovery.c b/pgp/seahorse-discovery.c
index 3985eb5..06192bb 100644
--- a/pgp/seahorse-discovery.c
+++ b/pgp/seahorse-discovery.c
@@ -29,6 +29,8 @@
 #include <avahi-client/client.h>
 #include <avahi-client/lookup.h>
 #include <avahi-common/error.h>
+#include <avahi-glib/glib-watch.h>
+#include <avahi-glib/glib-malloc.h>
 #endif /* WITH_SHARING */
 
 #include "seahorse-util.h"
@@ -57,6 +59,7 @@ struct _SeahorseDiscoveryPriv {
 #ifdef WITH_SHARING
 	AvahiClient *client;
 	AvahiServiceBrowser *browser;
+	AvahiGLibPoll *poll;
 #else
 	char no_use;
 #endif
@@ -94,6 +97,10 @@ disconnect (SeahorseDiscovery *self)
 	if (self->priv->client)
 		avahi_client_free (self->priv->client);
 	self->priv->client = NULL;
+
+	if (self->priv->poll)
+	        avahi_glib_poll_free (self->priv->poll);
+	self->priv->poll = NULL;
 }
 
 /**
@@ -281,7 +288,15 @@ seahorse_discovery_init (SeahorseDiscovery *self)
 #ifdef WITH_SHARING
 	{
 		int aerr;
-		self->priv->client = avahi_client_new (seahorse_util_dns_sd_get_poll (),
+		avahi_set_allocator (avahi_glib_allocator ());
+
+		self->priv->poll = avahi_glib_poll_new (NULL, G_PRIORITY_DEFAULT);
+		if (!self->priv->poll) {
+			g_warning ("couldn't initialize avahi glib poll integration");
+			return;
+		}
+
+		self->priv->client = avahi_client_new (avahi_glib_poll_get (self->priv->poll),
 		                                       0, client_callback, self, &aerr);
 		if (!self->priv->client) {
 			g_message ("DNS-SD initialization failed: %s", avahi_strerror (aerr));



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]