diff options
author | Rodrigo Moya <rodrigo@ximian.com> | 2002-08-16 20:56:14 +0800 |
---|---|---|
committer | Rodrigo Moya <rodrigo@src.gnome.org> | 2002-08-16 20:56:14 +0800 |
commit | f245eb32c54f5f98e79643338f192abea871f2cf (patch) | |
tree | a9017040ec0bb4aff911c53780d824b30f9cc24d /calendar/cal-client | |
parent | 83c35905a8146b88be28545604ec96c4358270d2 (diff) | |
download | gsoc2013-evolution-f245eb32c54f5f98e79643338f192abea871f2cf.tar gsoc2013-evolution-f245eb32c54f5f98e79643338f192abea871f2cf.tar.gz gsoc2013-evolution-f245eb32c54f5f98e79643338f192abea871f2cf.tar.bz2 gsoc2013-evolution-f245eb32c54f5f98e79643338f192abea871f2cf.tar.lz gsoc2013-evolution-f245eb32c54f5f98e79643338f192abea871f2cf.tar.xz gsoc2013-evolution-f245eb32c54f5f98e79643338f192abea871f2cf.tar.zst gsoc2013-evolution-f245eb32c54f5f98e79643338f192abea871f2cf.zip |
added internal EComponentListener object, to listen for the activated Cal.
2002-08-16 Rodrigo Moya <rodrigo@ximian.com>
* cal-client/cal-client.[ch]: added internal EComponentListener
object, to listen for the activated Cal.
(cal_client_class_init): added "backend_died" signal.
(cal_client_destroy): clean up component listener.
(backend_died_cb): new callback for getting signals from the
EComponentListener.
(cal_opened_cb): setup component listener.
* cal-client/Makefile.am: added libetuil to needed LIBS.
* gui/gnome-cal.c (backend_died_cb): new callback.
(gnome_calendar_construct): connect to "backend_died" signal
on all CalClient's we create.
svn path=/trunk/; revision=17787
Diffstat (limited to 'calendar/cal-client')
-rw-r--r-- | calendar/cal-client/Makefile.am | 1 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.c | 38 | ||||
-rw-r--r-- | calendar/cal-client/cal-client.h | 2 |
3 files changed, 41 insertions, 0 deletions
diff --git a/calendar/cal-client/Makefile.am b/calendar/cal-client/Makefile.am index de4b85e51f..c1ede1e84f 100644 --- a/calendar/cal-client/Makefile.am +++ b/calendar/cal-client/Makefile.am @@ -77,6 +77,7 @@ client_test_INCLUDES = \ client_test_LDADD = \ $(EVOLUTION_CALENDAR_LIBS) \ + $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/calendar/cal-util/libcal-util.la \ $(top_builddir)/libversit/libversit.a \ $(top_builddir)/libical/src/libical/libical-evolution.la \ diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index 992f0bf157..b46dc3a215 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -29,6 +29,7 @@ #include <bonobo-conf/bonobo-config-database.h> #include <libgnome/gnome-util.h> +#include "e-util/e-component-listener.h" #include "cal-client-types.h" #include "cal-client.h" #include "cal-listener.h" @@ -69,6 +70,9 @@ struct _CalClientPrivate { /* The default timezone to use to resolve DATE and floating DATE-TIME values. */ icaltimezone *default_zone; + + /* The component listener to keep track of the lifetime of backends */ + EComponentListener *comp_listener; }; @@ -81,6 +85,7 @@ enum { OBJ_REMOVED, CATEGORIES_CHANGED, FORGET_PASSWORD, + BACKEND_DIED, LAST_SIGNAL }; @@ -196,6 +201,13 @@ cal_client_class_init (CalClientClass *class) gtk_marshal_NONE__STRING, GTK_TYPE_NONE, 1, GTK_TYPE_STRING); + cal_client_signals[BACKEND_DIED] = + gtk_signal_new ("backend_died", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (CalClientClass, backend_died), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); gtk_object_class_add_signals (object_class, cal_client_signals, LAST_SIGNAL); @@ -204,6 +216,7 @@ cal_client_class_init (CalClientClass *class) class->obj_removed = NULL; class->categories_changed = NULL; class->forget_password = NULL; + class->backend_died = NULL; object_class->destroy = cal_client_destroy; } @@ -223,6 +236,7 @@ cal_client_init (CalClient *client) priv->timezones = g_hash_table_new (g_str_hash, g_str_equal); priv->w_client = NULL; priv->default_zone = icaltimezone_get_utc_timezone (); + priv->comp_listener = NULL; } /* Gets rid of the factories that a client knows about */ @@ -332,6 +346,12 @@ cal_client_destroy (GtkObject *object) priv->listener = NULL; } + if (priv->comp_listener) { + gtk_signal_disconnect_by_data (GTK_OBJECT (priv->comp_listener), client); + gtk_object_unref (GTK_OBJECT (priv->comp_listener)); + priv->comp_listener = NULL; + } + priv->w_client = NULL; destroy_factories (client); destroy_cal (client); @@ -356,6 +376,19 @@ cal_client_destroy (GtkObject *object) +static void +backend_died_cb (EComponentListener *cl, gpointer user_data) +{ + CalClientPrivate *priv; + CalClient *client = (CalClient *) user_data; + + g_return_if_fail (IS_CAL_CLIENT (client)); + + priv = client->priv; + priv->load_state = CAL_CLIENT_LOAD_NOT_LOADED; + gtk_signal_emit (GTK_OBJECT (client), cal_client_signals[BACKEND_DIED]); +} + /* Signal handlers for the listener's signals */ /* Handle the cal_opened notification from the listener */ static void @@ -394,6 +427,11 @@ cal_opened_cb (CalListener *listener, priv->load_state = CAL_CLIENT_LOAD_LOADED; client_status = CAL_CLIENT_OPEN_SUCCESS; + + /* setup component listener */ + priv->comp_listener = e_component_listener_new (priv->cal, 0); + gtk_signal_connect (GTK_OBJECT (priv->comp_listener), "component_died", + GTK_SIGNAL_FUNC (backend_died_cb), client); goto out; case GNOME_Evolution_Calendar_Listener_ERROR: diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index 68bef1e96c..de5e19ffdf 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -110,6 +110,8 @@ struct _CalClientClass { void (* categories_changed) (CalClient *client, GPtrArray *categories); void (* forget_password) (CalClient *client, const char *key); + + void (* backend_died) (CalClient *client); }; typedef gchar * (* CalClientAuthFunc) (CalClient *client, |