aboutsummaryrefslogtreecommitdiffstats
path: root/e-util/e-gtk-utils.c
diff options
context:
space:
mode:
authorEttore Perazzoli <ettore@src.gnome.org>2002-12-20 06:11:01 +0800
committerEttore Perazzoli <ettore@src.gnome.org>2002-12-20 06:11:01 +0800
commit128eba1c6da5ee673d401094e7c7bb6b46961c8a (patch)
treeb692d73a7b1ad4176077fe31b8bacfb71cd717ad /e-util/e-gtk-utils.c
parent482cf3700a1d1df629cc5d8c09a2f2490b3fcd77 (diff)
downloadgsoc2013-evolution-128eba1c6da5ee673d401094e7c7bb6b46961c8a.tar.gz
gsoc2013-evolution-128eba1c6da5ee673d401094e7c7bb6b46961c8a.tar.zst
gsoc2013-evolution-128eba1c6da5ee673d401094e7c7bb6b46961c8a.zip
(e_signal_connect_while_alive): New.
(e_signal_connect_full_while_alive): Renamed from e_gtk_signal_connect_full_while_alive(). svn path=/trunk/; revision=19171
Diffstat (limited to 'e-util/e-gtk-utils.c')
-rw-r--r--e-util/e-gtk-utils.c50
1 files changed, 34 insertions, 16 deletions
diff --git a/e-util/e-gtk-utils.c b/e-util/e-gtk-utils.c
index ed233be3f5..161a74ae45 100644
--- a/e-util/e-gtk-utils.c
+++ b/e-util/e-gtk-utils.c
@@ -36,6 +36,24 @@
#include "e-gtk-utils.h"
+void
+e_signal_connect_while_alive (void *instance,
+ const char *name,
+ GCallback callback,
+ void *callback_data,
+ void *alive_instance)
+{
+ GClosure *closure;
+
+ g_return_if_fail (GTK_IS_OBJECT (instance));
+
+ closure = g_cclosure_new (callback, callback_data, NULL);
+ g_object_watch_closure (alive_instance, closure);
+ g_signal_connect_closure_by_id (instance, g_signal_lookup (name, G_OBJECT_TYPE (object)), 0,
+ closure, FALSE);
+}
+
+
/* (Cut and pasted from Gtk.) */
typedef struct DisconnectInfo {
@@ -79,36 +97,36 @@ alive_disconnecter (GtkObject *object,
* params like `gtk_signal_connect_full()'.
**/
void
-e_gtk_signal_connect_full_while_alive (GtkObject *object,
- const char *name,
- GtkSignalFunc func,
- GtkCallbackMarshal marshal,
- void *data,
- GtkDestroyNotify destroy_func,
- gboolean object_signal,
- gboolean after,
- GtkObject *alive_object)
+e_signal_connect_full_while_alive (void *instance,
+ const char *name,
+ GtkSignalFunc func,
+ GtkCallbackMarshal marshal,
+ void *data,
+ GtkDestroyNotify destroy_func,
+ gboolean object_signal,
+ gboolean after,
+ void *alive_instance)
{
DisconnectInfo *info;
- g_return_if_fail (GTK_IS_OBJECT (object));
+ g_return_if_fail (GTK_IS_OBJECT (instance));
g_return_if_fail (name != NULL);
g_return_if_fail (func != NULL);
- g_return_if_fail (GTK_IS_OBJECT (alive_object));
+ g_return_if_fail (GTK_IS_OBJECT (alive_instance));
info = g_new (DisconnectInfo, 1);
- info->signal_handler = gtk_signal_connect_full (object, name,
+ info->signal_handler = gtk_signal_connect_full (instance, name,
func, marshal, data,
destroy_func,
- object_signal, after);
+ instance_signal, after);
- info->object1 = object;
- info->disconnect_handler1 = gtk_signal_connect (object, "destroy",
+ info->object1 = instance;
+ info->disconnect_handler1 = gtk_signal_connect (instance, "destroy",
GTK_SIGNAL_FUNC (alive_disconnecter), info);
info->object2 = alive_object;
- info->disconnect_handler2 = gtk_signal_connect (alive_object, "destroy",
+ info->disconnect_handler2 = gtk_signal_connect (alive_instance, "destroy",
GTK_SIGNAL_FUNC (alive_disconnecter), info);
}