[gupnp] Drop main-context property.
- From: Jens Georg <jensgeorg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gupnp] Drop main-context property.
- Date: Sat, 30 Jul 2011 10:57:38 +0000 (UTC)
commit 831395e0c8b295d4bb24aa96d68012f6e3ecb7cc
Author: Jens Georg <mail jensge org>
Date: Mon Jun 27 23:10:45 2011 +0200
Drop main-context property.
Use g_main_context_get_thread_default()
https://bugzilla.gnome.org/show_bug.cgi?id=654990
configure.ac | 2 +-
libgupnp/gupnp-context-manager.c | 30 +++++++++++++++-----
libgupnp/gupnp-context.c | 13 ++++++---
libgupnp/gupnp-linux-context-manager.c | 17 +----------
libgupnp/gupnp-network-manager.c | 45 +------------------------------
libgupnp/gupnp-network-manager.h | 2 +-
libgupnp/gupnp-service-proxy.c | 42 ++++++-----------------------
libgupnp/gupnp-service.c | 15 +++-------
libgupnp/gupnp-unix-context-manager.c | 11 +-------
tests/test-browsing.c | 2 +-
tests/test-introspection.c | 2 +-
tests/test-proxy.c | 2 +-
tests/test-server.c | 2 +-
13 files changed, 56 insertions(+), 129 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 2df48df..ca55d11 100644
--- a/configure.ac
+++ b/configure.ac
@@ -46,7 +46,7 @@ esac
PKG_CHECK_MODULES(LIBGUPNP, glib-2.0 >= 2.24.0 \
gio-2.0 \
gmodule-2.0 \
- gssdp-1.0 >= 0.11.0 \
+ gssdp-1.0 >= 0.11.2 \
libsoup-2.4 >= 2.28.2 \
libxml-2.0 \
$UUID)
diff --git a/libgupnp/gupnp-context-manager.c b/libgupnp/gupnp-context-manager.c
index e7d4817..aae1b33 100644
--- a/libgupnp/gupnp-context-manager.c
+++ b/libgupnp/gupnp-context-manager.c
@@ -49,8 +49,6 @@ G_DEFINE_TYPE (GUPnPContextManager,
G_TYPE_OBJECT);
struct _GUPnPContextManagerPrivate {
- GMainContext *main_context;
-
guint port;
GUPnPContextManager *impl;
@@ -166,7 +164,11 @@ gupnp_context_manager_set_property (GObject *object,
priv->port = g_value_get_uint (value);
break;
case PROP_MAIN_CONTEXT:
- priv->main_context = g_value_get_pointer (value);
+ if (g_value_get_pointer (value) != NULL)
+ g_warning ("GUPnPContextManager:main-context is "
+ "deprecated. Use "
+ "g_main_context_push_thread_default()"
+ "instead.");
break;
case PROP_CONTEXT_MANAGER:
priv->impl = g_value_get_object (value);
@@ -204,7 +206,11 @@ gupnp_context_manager_get_property (GObject *object,
g_value_set_uint (value, manager->priv->port);
break;
case PROP_MAIN_CONTEXT:
- g_value_set_pointer (value, manager->priv->main_context);
+ g_warning ("GUPnPContextManager:main-context is deprecated. "
+ "Use g_main_context_push_thread_default()"
+ "instead.");
+ g_value_set_pointer (value,
+ g_main_context_get_thread_default ());
break;
case PROP_CONTEXT_MANAGER:
g_value_set_object (value, manager->priv->impl);
@@ -259,6 +265,9 @@ gupnp_context_manager_class_init (GUPnPContextManagerClass *klass)
*
* The #GMainContext to pass to created #GUPnPContext objects. Set to
* NULL to use the default.
+ *
+ * Deprecated: 0.17.2: Use g_main_context_push_thread_default()
+ * instead.
**/
g_object_class_install_property
(object_class,
@@ -353,7 +362,9 @@ gupnp_context_manager_class_init (GUPnPContextManagerClass *klass)
/**
* gupnp_context_manager_new:
- * @main_context: (allow-none): GMainContext to pass to created GUPnPContext objects.
+ * @main_context: (allow-none): Deprecated: 0.17.2: %NULL. If you want to use
+ * a different main context use
+ * g_main_context_push_thread_default() instead.
* @port: Port to create contexts for, or 0 if you don't care what port is used.
*
* Create a new #GUPnPContextManager.
@@ -368,10 +379,15 @@ gupnp_context_manager_new (GMainContext *main_context,
GUPnPContextManager *impl;
GType impl_type = G_TYPE_INVALID;
+ if (main_context)
+ g_warning ("gupnp_context_manager_new::main_context is"
+ " deprecated. Use "
+ " g_main_context_push_thread_default() instead");
+
#ifdef USE_NETWORK_MANAGER
#include "gupnp-network-manager.h"
- if (gupnp_network_manager_is_available (main_context))
+ if (gupnp_network_manager_is_available ())
impl_type = GUPNP_TYPE_NETWORK_MANAGER;
#elif USE_NETLINK
#include "gupnp-linux-context-manager.h"
@@ -382,12 +398,10 @@ gupnp_context_manager_new (GMainContext *main_context,
impl_type = GUPNP_TYPE_UNIX_CONTEXT_MANAGER;
impl = g_object_new (impl_type,
- "main-context", main_context,
"port", port,
NULL);
manager = g_object_new (GUPNP_TYPE_CONTEXT_MANAGER,
- "main-context", main_context,
"port", port,
"context-manager", impl,
NULL);
diff --git a/libgupnp/gupnp-context.c b/libgupnp/gupnp-context.c
index d1fff37..8b79f69 100644
--- a/libgupnp/gupnp-context.c
+++ b/libgupnp/gupnp-context.c
@@ -162,7 +162,7 @@ gupnp_context_initable_init (GInitable *initable,
(SOUP_SESSION_IDLE_TIMEOUT,
60,
SOUP_SESSION_ASYNC_CONTEXT,
- gssdp_client_get_main_context (GSSDP_CLIENT (context)),
+ g_main_context_get_thread_default (),
NULL);
user_agent = g_strdup_printf ("%s GUPnP/" VERSION " DLNADOC/1.50",
@@ -475,7 +475,7 @@ gupnp_context_get_server (GUPnPContext *context)
(SOUP_SERVER_PORT,
context->priv->port,
SOUP_SERVER_ASYNC_CONTEXT,
- gssdp_client_get_main_context (GSSDP_CLIENT (context)),
+ g_main_context_get_thread_default (),
SOUP_SERVER_INTERFACE,
addr,
NULL);
@@ -522,7 +522,8 @@ _gupnp_context_get_server_url (GUPnPContext *context)
/**
* gupnp_context_new:
- * @main_context: A #GMainContext, or %NULL to use the default one
+ * @main_context: Deprecated: 0.17.2: Always set to %NULL. If you want to use
+ * a different context, use g_main_context_push_thread_default().
* @interface: The network interface to use, or %NULL to auto-detect.
* @port: Port to run on, or 0 if you don't care what port is used.
* @error: A location to store a #GError, or %NULL
@@ -538,10 +539,14 @@ gupnp_context_new (GMainContext *main_context,
guint port,
GError **error)
{
+ if (main_context)
+ g_warning ("gupnp_context_new::main_context is deprecated."
+ " Use g_main_context_push_thread_default()"
+ " instead");
+
return g_initable_new (GUPNP_TYPE_CONTEXT,
NULL,
error,
- "main-context", main_context,
"interface", interface,
"port", port,
NULL);
diff --git a/libgupnp/gupnp-linux-context-manager.c b/libgupnp/gupnp-linux-context-manager.c
index 4b39595..dce036e 100644
--- a/libgupnp/gupnp-linux-context-manager.c
+++ b/libgupnp/gupnp-linux-context-manager.c
@@ -145,7 +145,6 @@ network_device_update_essid (NetworkInterface *device)
static void
network_device_create_context (NetworkInterface *device)
{
- GMainContext *main_context;
guint port;
GError *error = NULL;
@@ -163,7 +162,6 @@ network_device_create_context (NetworkInterface *device)
device->flags &= ~NETWORK_INTERFACE_PRECONFIGURED;
g_object_get (device->manager,
- "main-context", &main_context,
"port", &port,
NULL);
@@ -171,7 +169,6 @@ network_device_create_context (NetworkInterface *device)
device->context = g_initable_new (GUPNP_TYPE_CONTEXT,
NULL,
&error,
- "main-context", main_context,
"interface", device->name,
"network", device->essid,
"port", port,
@@ -347,18 +344,13 @@ on_bootstrap (GUPnPLinuxContextManager *self)
return TRUE;
} else {
- GMainContext *main_context;
-
self->priv->netlink_socket_source = g_socket_create_source
(self->priv->netlink_socket,
G_IO_IN | G_IO_PRI,
NULL);
- g_object_get (self,
- "main-context", &main_context,
- NULL);
g_source_attach (self->priv->netlink_socket_source,
- main_context);
+ g_main_context_get_thread_default ());
g_source_set_callback (self->priv->netlink_socket_source,
(GSourceFunc)
@@ -642,14 +634,9 @@ gupnp_linux_context_manager_constructed (GObject *object)
GObjectClass *parent_class;
GUPnPLinuxContextManager *self;
GError *error = NULL;
- GMainContext *main_context;
self = GUPNP_LINUX_CONTEXT_MANAGER (object);
- g_object_get (self,
- "main-context", &main_context,
- NULL);
-
if (!create_ioctl_socket (self, &error))
goto cleanup;
@@ -659,7 +646,7 @@ gupnp_linux_context_manager_constructed (GObject *object)
self->priv->bootstrap_source =
g_idle_source_new ();
g_source_attach (self->priv->bootstrap_source,
- main_context);
+ g_main_context_get_thread_default ());
g_source_set_callback (self->priv->bootstrap_source,
(GSourceFunc) on_bootstrap,
self,
diff --git a/libgupnp/gupnp-network-manager.c b/libgupnp/gupnp-network-manager.c
index 4fdb3af..9b4c728 100644
--- a/libgupnp/gupnp-network-manager.c
+++ b/libgupnp/gupnp-network-manager.c
@@ -158,21 +158,18 @@ create_loopback_context (gpointer data)
{
GUPnPNetworkManager *manager = (GUPnPNetworkManager *) data;
GUPnPContext *context;
- GMainContext *main_context;
guint port;
GError *error = NULL;
manager->priv->idle_context_creation_src = NULL;
g_object_get (manager,
- "main-context", &main_context,
"port", &port,
NULL);
context = g_initable_new (GUPNP_TYPE_CONTEXT,
NULL,
&error,
- "main-context", main_context,
"interface", LOOPBACK_IFACE,
"port", port,
NULL);
@@ -195,7 +192,6 @@ static void
create_context_for_device (NMDevice *nm_device)
{
GError *error = NULL;
- GMainContext *main_context;
guint port;
GVariant *value;
char *iface;
@@ -274,20 +270,6 @@ ap_proxy_new_cb (GObject *source_object,
create_context_for_device (nm_device);
}
-static GMainContext *
-push_thread_main_context (GUPnPNetworkManager *manager)
-{
- GMainContext *main_context;
-
- g_object_get (manager,
- "main-context", &main_context,
- NULL);
-
- g_main_context_push_thread_default (main_context);
-
- return main_context;
-}
-
static void
on_wifi_device_activated (NMDevice *nm_device)
{
@@ -310,9 +292,6 @@ on_wifi_device_activated (NMDevice *nm_device)
if (G_UNLIKELY (ap_path == NULL))
create_context_for_device (nm_device);
else {
- GMainContext *main_context;
-
- main_context = push_thread_main_context (nm_device->manager);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
@@ -322,7 +301,6 @@ on_wifi_device_activated (NMDevice *nm_device)
nm_device->manager->priv->cancellable,
ap_proxy_new_cb,
nm_device);
- g_main_context_pop_thread_default (main_context);
}
g_variant_unref (value);
@@ -467,9 +445,6 @@ device_proxy_new_cb (GObject *source_object,
if (type == NM_DEVICE_TYPE_WIFI) {
const char *path;
- GMainContext *main_context;
-
- main_context = push_thread_main_context (manager);
path = g_dbus_proxy_get_object_path (nm_device->proxy);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
@@ -481,7 +456,6 @@ device_proxy_new_cb (GObject *source_object,
manager->priv->cancellable,
wifi_proxy_new_cb,
nm_device);
- g_main_context_pop_thread_default (main_context);
} else
use_new_device (manager, nm_device);
}
@@ -511,14 +485,12 @@ on_manager_signal (GDBusProxy *proxy,
if (g_strcmp0 (signal_name, "DeviceAdded") == 0) {
char *device_path = NULL;
- GMainContext *main_context;
g_variant_get_child (parameters, 0, "o", &device_path);
if (G_UNLIKELY (device_path == NULL))
return;
- main_context = push_thread_main_context (manager);
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
NULL,
@@ -528,7 +500,6 @@ on_manager_signal (GDBusProxy *proxy,
manager->priv->cancellable,
device_proxy_new_cb,
manager);
- g_main_context_pop_thread_default (main_context);
g_free (device_path);
} else if (g_strcmp0 (signal_name, "DeviceRemoved") == 0) {
GList *device_node;
@@ -570,7 +541,6 @@ get_devices_cb (GObject *source_object,
GVariantIter *device_iter;
char* device_path;
GError *error = NULL;
- GMainContext *main_context;
manager = GUPNP_NETWORK_MANAGER (user_data);
@@ -587,7 +557,6 @@ get_devices_cb (GObject *source_object,
}
g_variant_get_child (ret, 0, "ao", &device_iter);
- main_context = push_thread_main_context (manager);
while (g_variant_iter_loop (device_iter, "o", &device_path))
g_dbus_proxy_new_for_bus (G_BUS_TYPE_SYSTEM,
G_DBUS_PROXY_FLAGS_NONE,
@@ -598,7 +567,6 @@ get_devices_cb (GObject *source_object,
manager->priv->cancellable,
device_proxy_new_cb,
user_data);
- g_main_context_pop_thread_default (main_context);
g_variant_iter_free (device_iter);
g_variant_unref (ret);
@@ -607,18 +575,12 @@ get_devices_cb (GObject *source_object,
static void
schedule_loopback_context_creation (GUPnPNetworkManager *manager)
{
- GMainContext *main_context;
-
- g_object_get (manager,
- "main-context", &main_context,
- NULL);
-
/* Create contexts in mainloop so that is happens after user has hooked
* to the "context-available" signal.
*/
manager->priv->idle_context_creation_src = g_idle_source_new ();
g_source_attach (manager->priv->idle_context_creation_src,
- main_context);
+ g_main_context_get_thread_default ());
g_source_set_callback (manager->priv->idle_context_creation_src,
create_loopback_context,
manager,
@@ -630,7 +592,6 @@ static void
init_network_manager (GUPnPNetworkManager *manager)
{
GUPnPNetworkManagerPrivate *priv;
- GMainContext *main_context;
GError *error;
priv = manager->priv;
@@ -659,7 +620,6 @@ init_network_manager (GUPnPNetworkManager *manager)
manager);
- main_context = push_thread_main_context (manager);
g_dbus_proxy_call (priv->manager_proxy,
"GetDevices",
NULL,
@@ -668,7 +628,6 @@ init_network_manager (GUPnPNetworkManager *manager)
priv->cancellable,
get_devices_cb,
manager);
- g_main_context_pop_thread_default (main_context);
}
static void
@@ -754,7 +713,7 @@ gupnp_network_manager_class_init (GUPnPNetworkManagerClass *klass)
}
gboolean
-gupnp_network_manager_is_available (GMainContext *main_context)
+gupnp_network_manager_is_available ()
{
GDBusProxy *dbus_proxy;
GVariant *ret_values;
diff --git a/libgupnp/gupnp-network-manager.h b/libgupnp/gupnp-network-manager.h
index 0ba9774..f4aea35 100644
--- a/libgupnp/gupnp-network-manager.h
+++ b/libgupnp/gupnp-network-manager.h
@@ -70,7 +70,7 @@ typedef struct {
} GUPnPNetworkManagerClass;
gboolean
-gupnp_network_manager_is_available (GMainContext *main_context);
+gupnp_network_manager_is_available ();
G_END_DECLS
diff --git a/libgupnp/gupnp-service-proxy.c b/libgupnp/gupnp-service-proxy.c
index ff4f260..87555e9 100644
--- a/libgupnp/gupnp-service-proxy.c
+++ b/libgupnp/gupnp-service-proxy.c
@@ -430,17 +430,14 @@ gupnp_service_proxy_send_action_valist (GUPnPServiceProxy *proxy,
GError **error,
va_list var_args)
{
- GUPnPContext *context;
- GMainContext *main_context;
GMainLoop *main_loop;
GUPnPServiceProxyAction *handle;
g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
g_return_val_if_fail (action, FALSE);
- context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (proxy));
- main_context = gssdp_client_get_main_context (GSSDP_CLIENT (context));
- main_loop = g_main_loop_new (main_context, TRUE);
+ main_loop = g_main_loop_new (g_main_context_get_thread_default (),
+ TRUE);
handle = gupnp_service_proxy_begin_action_valist (proxy,
action,
@@ -485,17 +482,14 @@ gupnp_service_proxy_send_action_hash (GUPnPServiceProxy *proxy,
GHashTable *in_hash,
GHashTable *out_hash)
{
- GUPnPContext *context;
- GMainContext *main_context;
GMainLoop *main_loop;
GUPnPServiceProxyAction *handle;
g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
g_return_val_if_fail (action, FALSE);
- context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (proxy));
- main_context = gssdp_client_get_main_context (GSSDP_CLIENT (context));
- main_loop = g_main_loop_new (main_context, TRUE);
+ main_loop = g_main_loop_new (g_main_context_get_thread_default (),
+ TRUE);
handle = gupnp_service_proxy_begin_action_hash (proxy,
action,
@@ -554,17 +548,14 @@ gupnp_service_proxy_send_action_list (GUPnPServiceProxy *proxy,
GList *out_types,
GList **out_values)
{
- GUPnPContext *context;
- GMainContext *main_context;
GMainLoop *main_loop;
GUPnPServiceProxyAction *handle;
g_return_val_if_fail (GUPNP_IS_SERVICE_PROXY (proxy), FALSE);
g_return_val_if_fail (action, FALSE);
- context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (proxy));
- main_context = gssdp_client_get_main_context (GSSDP_CLIENT (context));
- main_loop = g_main_loop_new (main_context, TRUE);
+ main_loop = g_main_loop_new (g_main_context_get_thread_default (),
+ TRUE);
handle = gupnp_service_proxy_begin_action_list (proxy,
action,
@@ -1813,19 +1804,12 @@ server_handler (SoupServer *soup_server,
proxy->priv->pending_notifies =
g_list_append (proxy->priv->pending_notifies, emit_notify_data);
if (!proxy->priv->notify_idle_src) {
- GUPnPContext *context;
- GMainContext *main_context;
-
- context = gupnp_service_info_get_context
- (GUPNP_SERVICE_INFO (proxy));
- main_context = gssdp_client_get_main_context
- (GSSDP_CLIENT (context));
-
proxy->priv->notify_idle_src = g_idle_source_new();
g_source_set_callback (proxy->priv->notify_idle_src,
emit_notifications,
proxy, NULL);
- g_source_attach (proxy->priv->notify_idle_src, main_context);
+ g_source_attach (proxy->priv->notify_idle_src,
+ g_main_context_get_thread_default ());
g_source_unref (proxy->priv->notify_idle_src);
}
@@ -1962,14 +1946,6 @@ subscribe_got_response (SoupSession *session,
}
if (strncmp (hdr, "Second-", strlen ("Second-")) == 0) {
- GUPnPContext *context;
- GMainContext *main_context;
-
- context = gupnp_service_info_get_context
- (GUPNP_SERVICE_INFO (proxy));
- main_context = gssdp_client_get_main_context
- (GSSDP_CLIENT (context));
-
/* We have a finite timeout */
timeout = atoi (hdr + strlen ("Second-"));
@@ -1993,7 +1969,7 @@ subscribe_got_response (SoupSession *session,
subscription_expire,
proxy, NULL);
g_source_attach (proxy->priv->subscription_timeout_src,
- main_context);
+ g_main_context_get_thread_default ());
g_source_unref (proxy->priv->subscription_timeout_src);
}
diff --git a/libgupnp/gupnp-service.c b/libgupnp/gupnp-service.c
index 90de9db..7d44ed5 100644
--- a/libgupnp/gupnp-service.c
+++ b/libgupnp/gupnp-service.c
@@ -107,9 +107,6 @@ static SoupSession *
gupnp_service_get_session (GUPnPService *service)
{
if (! service->priv->session) {
- GUPnPContext *context =
- gupnp_service_info_get_context (GUPNP_SERVICE_INFO (service));
-
/* Create a dedicated session for this service to
* ensure that notifications are sent in the proper
* order. The session from GUPnPContext may use
@@ -118,7 +115,7 @@ gupnp_service_get_session (GUPnPService *service)
service->priv->session = soup_session_async_new_with_options
(SOUP_SESSION_IDLE_TIMEOUT, 60,
SOUP_SESSION_ASYNC_CONTEXT,
- gssdp_client_get_main_context (GSSDP_CLIENT (context)),
+ g_main_context_get_thread_default (),
SOUP_SESSION_MAX_CONNS_PER_HOST, 1,
NULL);
@@ -1145,7 +1142,6 @@ subscribe (GUPnPService *service,
SubscriptionData *data;
char *start, *end, *uri;
GUPnPContext *context;
- GMainContext *main_context;
data = g_slice_new0 (SubscriptionData);
@@ -1188,8 +1184,8 @@ subscribe (GUPnPService *service,
NULL);
context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (service));
- main_context = gssdp_client_get_main_context (GSSDP_CLIENT (context));
- g_source_attach (data->timeout_src, main_context);
+ g_source_attach (data->timeout_src,
+ g_main_context_get_thread_default ());
g_source_unref (data->timeout_src);
@@ -1212,7 +1208,6 @@ resubscribe (GUPnPService *service,
{
SubscriptionData *data;
GUPnPContext *context;
- GMainContext *main_context;
data = g_hash_table_lookup (service->priv->subscriptions, sid);
if (!data) {
@@ -1234,8 +1229,8 @@ resubscribe (GUPnPService *service,
NULL);
context = gupnp_service_info_get_context (GUPNP_SERVICE_INFO (service));
- main_context = gssdp_client_get_main_context (GSSDP_CLIENT (context));
- g_source_attach (data->timeout_src, main_context);
+ g_source_attach (data->timeout_src,
+ g_main_context_get_thread_default ());
g_source_unref (data->timeout_src);
diff --git a/libgupnp/gupnp-unix-context-manager.c b/libgupnp/gupnp-unix-context-manager.c
index 0f5260d..835773e 100644
--- a/libgupnp/gupnp-unix-context-manager.c
+++ b/libgupnp/gupnp-unix-context-manager.c
@@ -64,13 +64,11 @@ create_and_signal_context (GUPnPUnixContextManager *manager,
const char *interface)
{
GUPnPContext *context;
- GMainContext *main_context;
guint port;
GError *error;
g_object_get (manager,
- "main-context", &main_context,
"port", &port,
NULL);
@@ -78,7 +76,6 @@ create_and_signal_context (GUPnPUnixContextManager *manager,
context = g_initable_new (GUPNP_TYPE_CONTEXT,
NULL,
&error,
- "main-context", main_context,
"interface", interface,
"port", port,
NULL);
@@ -173,20 +170,14 @@ destroy_contexts (GUPnPUnixContextManager *manager)
static void
schedule_contexts_creation (GUPnPUnixContextManager *manager)
{
- GMainContext *main_context;
-
manager->priv->idle_context_creation_src = NULL;
- g_object_get (manager,
- "main-context", &main_context,
- NULL);
-
/* Create contexts in mainloop so that is happens after user has hooked
* to the "context-available" signal.
*/
manager->priv->idle_context_creation_src = g_idle_source_new ();
g_source_attach (manager->priv->idle_context_creation_src,
- main_context);
+ g_main_context_get_thread_default ());
g_source_set_callback (manager->priv->idle_context_creation_src,
create_contexts,
manager,
diff --git a/tests/test-browsing.c b/tests/test-browsing.c
index a35d1a8..2d27fc2 100644
--- a/tests/test-browsing.c
+++ b/tests/test-browsing.c
@@ -102,7 +102,7 @@ main (int argc, char **argv)
setlocale (LC_ALL, "");
error = NULL;
- context = gupnp_context_new (NULL, NULL, 0, &error);
+ context = g_initable_new (GUPNP_TYPE_CONTEXT, NULL, &error, NULL);
if (error) {
g_printerr ("Error creating the GUPnP context: %s\n",
error->message);
diff --git a/tests/test-introspection.c b/tests/test-introspection.c
index 7fee447..e02b262 100644
--- a/tests/test-introspection.c
+++ b/tests/test-introspection.c
@@ -257,7 +257,7 @@ main (int argc, char **argv)
g_type_init ();
error = NULL;
- context = gupnp_context_new (NULL, NULL, 0, &error);
+ context = g_initable_new (GUPNP_TYPE_CONTEXT, NULL, &error, NULL);
if (error) {
g_printerr ("Error creating the GUPnP context: %s\n",
error->message);
diff --git a/tests/test-proxy.c b/tests/test-proxy.c
index f4f04cf..f465f3a 100644
--- a/tests/test-proxy.c
+++ b/tests/test-proxy.c
@@ -158,7 +158,7 @@ main (int argc, char **argv)
setlocale (LC_ALL, "");
error = NULL;
- context = gupnp_context_new (NULL, NULL, 0, &error);
+ context = g_initable_new (GUPNP_TYPE_CONTEXT, NULL, &error, NULL);
if (error) {
g_printerr ("Error creating the GUPnP context: %s\n",
error->message);
diff --git a/tests/test-server.c b/tests/test-server.c
index edf0709..9eb96a2 100644
--- a/tests/test-server.c
+++ b/tests/test-server.c
@@ -75,7 +75,7 @@ main (int argc, char **argv)
setlocale (LC_ALL, "");
error = NULL;
- context = gupnp_context_new (NULL, NULL, 0, &error);
+ context = g_initable_new (GUPNP_TYPE_CONTEXT, NULL, &error, NULL);
if (error) {
g_printerr ("Error creating the GUPnP context: %s\n",
error->message);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]