From 48ff93b64492c08d82e8452cb6b0e94b8582eb3e Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Mon, 28 Aug 2000 23:27:51 +0000 Subject: New function. We need this from code that dynamically updates from a 2000-08-28 Federico Mena Quintero * cal-client/cal-client.c (cal_client_is_loaded): New function. We need this from code that dynamically updates from a client and could not have connected to the "cal_loaded" signal right after the client was created. * gui/calendar-model.c (load_objects): Do not try to load the objects if the client has not been loaded yet. (cal_loaded_cb): Check the status value. * gui/calendar-model.h (CalendarModel): Declare the private structure here so that gdb will give me love. * pcs/cal-factory.h (CalFactory): Likewise. * pcs/cal.h (Cal): Likewise. * cal-client/cal-listener.h (CalListener): Likewise. * cal-client/cal-client.h (CalClient): Likewise. * pcs/cal-backend.h (CalBackend): This no longer has a private structure, so remove it. * cal-util/Makefile.am (libcal_util_la_SOURCES): Removed the vCalendar and old iCalendar cruft. (libcal_utilinclude_HEADERS): Likewise. Removed the obsolete iCalendar test program. svn path=/trunk/; revision=5091 --- calendar/ChangeLog | 30 ++++++++++++++++++++++++++++++ calendar/cal-client/cal-client.c | 25 +++++++++++++++++++++++-- calendar/cal-client/cal-client.h | 6 +++++- calendar/cal-client/cal-listener.c | 4 ++-- calendar/cal-client/cal-listener.h | 4 +++- calendar/cal-util/Makefile.am | 26 +------------------------- calendar/cal-util/cal-util.c | 1 - calendar/gui/calendar-model.c | 12 +++++++++--- calendar/gui/calendar-model.h | 4 +++- calendar/pcs/cal-backend.h | 3 --- calendar/pcs/cal-factory.c | 4 ++-- calendar/pcs/cal-factory.h | 4 +++- calendar/pcs/cal.c | 4 ++-- calendar/pcs/cal.h | 4 +++- 14 files changed, 86 insertions(+), 45 deletions(-) (limited to 'calendar') diff --git a/calendar/ChangeLog b/calendar/ChangeLog index a339ade968..bdca5bf6f2 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,33 @@ +2000-08-28 Federico Mena Quintero + + * cal-client/cal-client.c (cal_client_is_loaded): New function. + We need this from code that dynamically updates from a client and + could not have connected to the "cal_loaded" signal right after + the client was created. + + * gui/calendar-model.c (load_objects): Do not try to load the + objects if the client has not been loaded yet. + (cal_loaded_cb): Check the status value. + + * gui/calendar-model.h (CalendarModel): Declare the private + structure here so that gdb will give me love. + + * pcs/cal-factory.h (CalFactory): Likewise. + + * pcs/cal.h (Cal): Likewise. + + * cal-client/cal-listener.h (CalListener): Likewise. + + * cal-client/cal-client.h (CalClient): Likewise. + + * pcs/cal-backend.h (CalBackend): This no longer has a private + structure, so remove it. + + * cal-util/Makefile.am (libcal_util_la_SOURCES): Removed the + vCalendar and old iCalendar cruft. + (libcal_utilinclude_HEADERS): Likewise. + Removed the obsolete iCalendar test program. + 2000-08-28 JP Rosevear * cal-util/timeutil.h: We no longer need time_from_icaltimetype diff --git a/calendar/cal-client/cal-client.c b/calendar/cal-client/cal-client.c index b038c26752..d48a11a7f0 100644 --- a/calendar/cal-client/cal-client.c +++ b/calendar/cal-client/cal-client.c @@ -42,7 +42,7 @@ typedef enum { } LoadState; /* Private part of the CalClient structure */ -typedef struct { +struct _CalClientPrivate { /* Load state to avoid multiple loads */ LoadState load_state; @@ -54,7 +54,7 @@ typedef struct { /* The calendar client interface object we are contacting */ Evolution_Calendar_Cal cal; -} CalClientPrivate; +}; @@ -548,6 +548,27 @@ cal_client_create_calendar (CalClient *client, const char *str_uri) return load_or_create (client, str_uri, FALSE); } +/** + * cal_client_is_loaded: + * @client: A calendar client. + * + * Queries whether a calendar client has been loaded successfully. + * + * Return value: TRUE if the client has been loaded, FALSE if it has not or if + * the loading process is not finished yet. + **/ +gboolean +cal_client_is_loaded (CalClient *client) +{ + CalClientPrivate *priv; + + g_return_val_if_fail (client != NULL, FALSE); + g_return_val_if_fail (IS_CAL_CLIENT (client), FALSE); + + priv = client->priv; + return (priv->load_state == LOAD_STATE_LOADED); +} + /* Converts our representation of a calendar component type into its CORBA representation */ static Evolution_Calendar_CalObjType corba_obj_type (CalObjType type) diff --git a/calendar/cal-client/cal-client.h b/calendar/cal-client/cal-client.h index 24cc170350..6747c7488e 100644 --- a/calendar/cal-client/cal-client.h +++ b/calendar/cal-client/cal-client.h @@ -40,6 +40,8 @@ BEGIN_GNOME_DECLS typedef struct _CalClient CalClient; typedef struct _CalClientClass CalClientClass; +typedef struct _CalClientPrivate CalClientPrivate; + /* Load status for the cal_loaded signal */ typedef enum { CAL_CLIENT_LOAD_SUCCESS, @@ -59,7 +61,7 @@ struct _CalClient { GtkObject object; /* Private data */ - gpointer priv; + CalClientPrivate *priv; }; struct _CalClientClass { @@ -82,6 +84,8 @@ CalClient *cal_client_new (void); gboolean cal_client_load_calendar (CalClient *client, const char *str_uri); gboolean cal_client_create_calendar (CalClient *client, const char *str_uri); +gboolean cal_client_is_loaded (CalClient *client); + int cal_client_get_n_objects (CalClient *client, CalObjType type); CalClientGetStatus cal_client_get_object (CalClient *client, diff --git a/calendar/cal-client/cal-listener.c b/calendar/cal-client/cal-listener.c index d9a028b20d..c5626fee9d 100644 --- a/calendar/cal-client/cal-listener.c +++ b/calendar/cal-client/cal-listener.c @@ -26,10 +26,10 @@ /* Private part of the CalListener structure */ -typedef struct { +struct _CalListenerPrivate { /* The calendar this listener refers to */ Evolution_Calendar_Cal cal; -} CalListenerPrivate; +}; diff --git a/calendar/cal-client/cal-listener.h b/calendar/cal-client/cal-listener.h index 171da0d5c3..b4eda6c2d6 100644 --- a/calendar/cal-client/cal-listener.h +++ b/calendar/cal-client/cal-listener.h @@ -40,11 +40,13 @@ BEGIN_GNOME_DECLS typedef struct _CalListener CalListener; typedef struct _CalListenerClass CalListenerClass; +typedef struct _CalListenerPrivate CalListenerPrivate; + struct _CalListener { BonoboObject object; /* Private data */ - gpointer priv; + CalListenerPrivate *priv; }; struct _CalListenerClass { diff --git a/calendar/cal-util/Makefile.am b/calendar/cal-util/Makefile.am index 2c95bcaec5..d589e7d26b 100644 --- a/calendar/cal-util/Makefile.am +++ b/calendar/cal-util/Makefile.am @@ -1,5 +1,4 @@ -noinst_PROGRAMS = icalendar-test -#noinst_PROGRAMS = test-recur icalendar-test +#noinst_PROGRAMS = test-recur INCLUDES = \ -DGNOMELOCALEDIR=\""$(datadir)/locale"\" \ @@ -23,11 +22,6 @@ libcal_util_la_SOURCES = \ cal-component.c \ cal-recur.c \ cal-util.c \ - calobj.c \ - icalendar.c \ - icalendar.h \ - icalendar-save.c \ - icalendar-save.h \ timeutil.c libcal_utilincludedir = $(includedir)/evolution/cal-util @@ -36,7 +30,6 @@ libcal_utilinclude_HEADERS = \ cal-component.h \ cal-recur.h \ cal-util.h \ - calobj.h \ timeutil.h # @@ -46,23 +39,6 @@ noinst_LTLIBRARIES = libcal-util-static.la libcal_util_static_la_SOURCES = $(libcal_util_la_SOURCES) libcal_util_static_la_LDFLAGS = --all-static - -# -# test program -# - -icalendar_test_SOURCES = \ - icalendar-test.c \ - icalendar.c \ - icalendar-save.c - -icalendar_test_LDADD = \ - $(EXTRA_GNOME_LIBS) \ - $(top_builddir)/libversit/libversit.la \ - $(top_builddir)/libical/src/libical/libical.a - -# $(top_builddir)/calendar/cal-util/libcal-util.la \ - #test_recur_SOURCES = \ # test-recur.c # diff --git a/calendar/cal-util/cal-util.c b/calendar/cal-util/cal-util.c index 40c4fe5bfe..092fd79889 100644 --- a/calendar/cal-util/cal-util.c +++ b/calendar/cal-util/cal-util.c @@ -22,7 +22,6 @@ #include #include #include "cal-util.h" -#include "libversit/vcc.h" diff --git a/calendar/gui/calendar-model.c b/calendar/gui/calendar-model.c index 135f770863..8a6eae5445 100644 --- a/calendar/gui/calendar-model.c +++ b/calendar/gui/calendar-model.c @@ -39,7 +39,7 @@ /* Private part of the ECalendarModel structure */ -typedef struct { +struct _CalendarModelPrivate { /* Calendar client we are using */ CalClient *client; @@ -54,7 +54,7 @@ typedef struct { /* HACK: so that ETable can do its stupid append_row() thing */ guint appending_row : 1; -} CalendarModelPrivate; +}; @@ -1443,7 +1443,10 @@ cal_loaded_cb (CalClient *client, g_return_if_fail (IS_CALENDAR_MODEL (model)); e_table_model_pre_change (E_TABLE_MODEL (model)); - load_objects (model); + + if (status == CAL_CLIENT_LOAD_SUCCESS) + load_objects (model); + e_table_model_changed (E_TABLE_MODEL (model)); } @@ -1620,6 +1623,9 @@ load_objects (CalendarModel *model) priv = model->priv; + if (!cal_client_is_loaded (priv->client)) + return; + uids = cal_client_get_uids (priv->client, priv->type); for (l = uids; l; l = l->next) { diff --git a/calendar/gui/calendar-model.h b/calendar/gui/calendar-model.h index d1481a4ece..aeb50b45e6 100644 --- a/calendar/gui/calendar-model.h +++ b/calendar/gui/calendar-model.h @@ -40,11 +40,13 @@ BEGIN_GNOME_DECLS typedef struct _CalendarModel CalendarModel; typedef struct _CalendarModelClass CalendarModelClass; +typedef struct _CalendarModelPrivate CalendarModelPrivate; + struct _CalendarModel { ETableModel model; /* Private data */ - gpointer priv; + CalendarModelPrivate *priv; }; struct _CalendarModelClass { diff --git a/calendar/pcs/cal-backend.h b/calendar/pcs/cal-backend.h index e1122f4d1c..cfc4cb8a99 100644 --- a/calendar/pcs/cal-backend.h +++ b/calendar/pcs/cal-backend.h @@ -49,9 +49,6 @@ typedef enum { struct _CalBackend { GtkObject object; - - /* Private data */ - gpointer priv; }; struct _CalBackendClass { diff --git a/calendar/pcs/cal-factory.c b/calendar/pcs/cal-factory.c index ab19ccb8b3..a89f2fe9f4 100644 --- a/calendar/pcs/cal-factory.c +++ b/calendar/pcs/cal-factory.c @@ -31,13 +31,13 @@ /* Private part of the CalFactory structure */ -typedef struct { +struct _CalFactoryPrivate { /* Hash table from URI method strings to GtkType * for backend class types */ GHashTable *methods; /* Hash table from GnomeVFSURI structures to CalBackend objects */ GHashTable *backends; -} CalFactoryPrivate; +}; diff --git a/calendar/pcs/cal-factory.h b/calendar/pcs/cal-factory.h index f96ba4ba92..9405a05ef8 100644 --- a/calendar/pcs/cal-factory.h +++ b/calendar/pcs/cal-factory.h @@ -41,11 +41,13 @@ BEGIN_GNOME_DECLS typedef struct _CalFactory CalFactory; typedef struct _CalFactoryClass CalFactoryClass; +typedef struct _CalFactoryPrivate CalFactoryPrivate; + struct _CalFactory { BonoboObject object; /* Private data */ - gpointer priv; + CalFactoryPrivate *priv; }; struct _CalFactoryClass { diff --git a/calendar/pcs/cal.c b/calendar/pcs/cal.c index fdb7682e7c..64eb29b023 100644 --- a/calendar/pcs/cal.c +++ b/calendar/pcs/cal.c @@ -26,13 +26,13 @@ /* Private part of the Cal structure */ -typedef struct { +struct _CalPrivate { /* Our backend */ CalBackend *backend; /* Listener on the client we notify */ Evolution_Calendar_Listener listener; -} CalPrivate; +}; diff --git a/calendar/pcs/cal.h b/calendar/pcs/cal.h index a11cedebbb..2b17278573 100644 --- a/calendar/pcs/cal.h +++ b/calendar/pcs/cal.h @@ -37,11 +37,13 @@ BEGIN_GNOME_DECLS #define IS_CAL(obj) (GTK_CHECK_TYPE ((obj), CAL_TYPE)) #define IS_CAL_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CAL_TYPE)) +typedef struct _CalPrivate CalPrivate; + struct _Cal { BonoboObject object; /* Private data */ - gpointer priv; + CalPrivate *priv; }; struct _CalClass { -- cgit