aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-03-22 21:09:11 +0800
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2010-04-09 19:06:30 +0800
commit3d0a7fef9d5a82348eb75ca94319aa1326b4f392 (patch)
tree7188ca3eababb5d6bb766413e677e4ac13a980b4
parent4a007b35a3aa479fdd937137efccc6a3607fe1f9 (diff)
downloadgsoc2013-empathy-3d0a7fef9d5a82348eb75ca94319aa1326b4f392.tar
gsoc2013-empathy-3d0a7fef9d5a82348eb75ca94319aa1326b4f392.tar.gz
gsoc2013-empathy-3d0a7fef9d5a82348eb75ca94319aa1326b4f392.tar.bz2
gsoc2013-empathy-3d0a7fef9d5a82348eb75ca94319aa1326b4f392.tar.lz
gsoc2013-empathy-3d0a7fef9d5a82348eb75ca94319aa1326b4f392.tar.xz
gsoc2013-empathy-3d0a7fef9d5a82348eb75ca94319aa1326b4f392.tar.zst
gsoc2013-empathy-3d0a7fef9d5a82348eb75ca94319aa1326b4f392.zip
remove empathy_signal_connect_weak (#613583)
-rw-r--r--libempathy/empathy-utils.c86
-rw-r--r--libempathy/empathy-utils.h5
2 files changed, 0 insertions, 91 deletions
diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c
index cb6716bee..1c2d95b09 100644
--- a/libempathy/empathy-utils.c
+++ b/libempathy/empathy-utils.c
@@ -453,92 +453,6 @@ empathy_protocol_name_to_display_name (const gchar *proto_name)
return NULL;
}
-typedef struct {
- GObject *instance;
- GObject *user_data;
- gulong handler_id;
-} WeakHandlerCtx;
-
-static WeakHandlerCtx *
-whc_new (GObject *instance,
- GObject *user_data)
-{
- WeakHandlerCtx *ctx = g_slice_new0 (WeakHandlerCtx);
-
- ctx->instance = instance;
- ctx->user_data = user_data;
-
- return ctx;
-}
-
-static void
-whc_free (WeakHandlerCtx *ctx)
-{
- g_slice_free (WeakHandlerCtx, ctx);
-}
-
-static void user_data_destroyed_cb (gpointer, GObject *);
-
-static void
-instance_destroyed_cb (gpointer ctx_,
- GObject *where_the_instance_was)
-{
- WeakHandlerCtx *ctx = ctx_;
-
- DEBUG ("instance for %p destroyed; cleaning up", ctx);
-
- /* No need to disconnect the signal here, the instance has gone away. */
- g_object_weak_unref (ctx->user_data, user_data_destroyed_cb, ctx);
- whc_free (ctx);
-}
-
-static void
-user_data_destroyed_cb (gpointer ctx_,
- GObject *where_the_user_data_was)
-{
- WeakHandlerCtx *ctx = ctx_;
-
- DEBUG ("user_data for %p destroyed; disconnecting", ctx);
-
- g_signal_handler_disconnect (ctx->instance, ctx->handler_id);
- g_object_weak_unref (ctx->instance, instance_destroyed_cb, ctx);
- whc_free (ctx);
-}
-
-/* This function is copied from telepathy-gabble: util.c */
-/**
- * empathy_signal_connect_weak:
- * @instance: the instance to connect to.
- * @detailed_signal: a string of the form "signal-name::detail".
- * @c_handler: the GCallback to connect.
- * @user_data: an object to pass as data to c_handler calls.
- *
- * Connects a #GCallback function to a signal for a particular object, as if
- * with g_signal_connect(). Additionally, arranges for the signal handler to be
- * disconnected if @user_data is destroyed.
- *
- * This is intended to be a convenient way for objects to use themselves as
- * user_data for callbacks without having to explicitly disconnect all the
- * handlers in their finalizers.
- */
-void
-empathy_signal_connect_weak (gpointer instance,
- const gchar *detailed_signal,
- GCallback c_handler,
- GObject *user_data)
-{
- GObject *instance_obj = G_OBJECT (instance);
- WeakHandlerCtx *ctx = whc_new (instance_obj, user_data);
-
- DEBUG ("connecting to %p:%s with context %p", instance, detailed_signal, ctx);
-
- ctx->handler_id = g_signal_connect (instance, detailed_signal, c_handler,
- user_data);
-
- g_object_weak_ref (instance_obj, instance_destroyed_cb, ctx);
- g_object_weak_ref (user_data, user_data_destroyed_cb, ctx);
-}
-
/* Note: this function depends on the account manager having its core feature
* prepared. */
TpAccount *
diff --git a/libempathy/empathy-utils.h b/libempathy/empathy-utils.h
index 0ab905282..272b66fd8 100644
--- a/libempathy/empathy-utils.h
+++ b/libempathy/empathy-utils.h
@@ -82,11 +82,6 @@ const gchar *empathy_protocol_name_to_display_name (const gchar *proto_name);
#define EMPATHY_ARRAY_TYPE_OBJECT (empathy_type_dbus_ao ())
GType empathy_type_dbus_ao (void);
-void empathy_signal_connect_weak (gpointer instance,
- const gchar *detailed_signal,
- GCallback c_handler,
- GObject *user_data);
-
TpAccount * empathy_get_account_for_connection (TpConnection *connection);
gboolean empathy_account_manager_get_accounts_connected (gboolean *connecting);