aboutsummaryrefslogtreecommitdiffstats
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
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
-rw-r--r--e-util/ChangeLog6
-rw-r--r--e-util/e-gtk-utils.c50
-rw-r--r--e-util/e-gtk-utils.h24
3 files changed, 55 insertions, 25 deletions
diff --git a/e-util/ChangeLog b/e-util/ChangeLog
index 696ccd2bf2..20d2b13a30 100644
--- a/e-util/ChangeLog
+++ b/e-util/ChangeLog
@@ -1,3 +1,9 @@
+2002-12-19 Ettore Perazzoli <ettore@ximian.com>
+
+ * e-gtk-utils.c (e_signal_connect_while_alive): New.
+ (e_signal_connect_full_while_alive): Renamed from
+ e_gtk_signal_connect_full_while_alive().
+
2002-12-16 Jeffrey Stedfast <fejj@ximian.com>
* e-html-utils.[c,h]: Removed. Back to the fiery depths of hell
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);
}
diff --git a/e-util/e-gtk-utils.h b/e-util/e-gtk-utils.h
index 3eae136152..19d208ffec 100644
--- a/e-util/e-gtk-utils.h
+++ b/e-util/e-gtk-utils.h
@@ -26,15 +26,21 @@
#include <gtk/gtkobject.h>
#include <gtk/gtkradiobutton.h>
-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);
+void e_signal_connect_while_alive (void *object,
+ const char *name,
+ GCallback callback,
+ void *data,
+ void *alive_instance);
+
+void 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);
void e_make_widget_backing_stored (GtkWidget *widget);