aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/calendar-offline-handler.c
diff options
context:
space:
mode:
authorJP Rosevear <jpr@ximian.com>2001-09-26 14:40:50 +0800
committerJP Rosevear <jpr@src.gnome.org>2001-09-26 14:40:50 +0800
commit943c0e6e2393607a1adf380db102cc2bad61ff52 (patch)
treec8bcf65617509c8c40e74fcbd82ff956c9584026 /calendar/gui/calendar-offline-handler.c
parent225b147233ea335927385c2f867218b6abfb3994 (diff)
downloadgsoc2013-evolution-943c0e6e2393607a1adf380db102cc2bad61ff52.tar.gz
gsoc2013-evolution-943c0e6e2393607a1adf380db102cc2bad61ff52.tar.zst
gsoc2013-evolution-943c0e6e2393607a1adf380db102cc2bad61ff52.zip
new proto
2001-09-26 JP Rosevear <jpr@ximian.com> * pcs/cal.h: new proto * pcs/cal.c (impl_Cal_set_mode): implement set mode method (cal_class_init): set setMode function in epv (cal_notify_mode): notify listener of mode change * pcs/cal-factory.c (add_uri): deal with UriType renaming * pcs/cal-backend.h: add new virtual methods and protos * pcs/cal-backend.c (cal_backend_class_init): init new virtual methods to null (cal_backend_set_mode): sets mode (cal_backend_get_mode): gets mode * pcs/cal-backend-file.c (cal_backend_file_class_init): overide get_mode and set_mode methods (cal_backend_file_get_mode): return mode (notify_mode): have listeners notified of the set mode call (cal_backend_file_set_mode): set the mode by indicating not supported * cal-client/cal-listener.h: update proto * cal-client/cal-listener.c (impl_notifyCalSetMode): implement set mode callback (cal_listener_construct): take set mode callback (cal_listener_new): ditto * cal-client/cal-client.h: update protos, add signal proto * cal-client/cal-client.c (cal_client_class_init): add cal_set_mode signal (cal_set_mode_cb): handle set mode callback from listener (cal_client_open_calendar): pass additional param to cal_listener_new (cal_client_set_mode): wrapper to set the calendar mode * idl/evolution-calendar.idl: make UriType into CalMode, add SetModeStatus enum and notifyCalSetMode method to the listener * gui/calendar-offline-handler.c (create_connection_list): fetch the uri list ourselves (impl_prepareForOffline): reflect param change of create_connect_list (update_offline): ditto (backend_cal_set_mode): set mode call back (backend_cal_opened): cal opened call back, set mode to local (impl_goOffline): reflect UriType renaming * cal-util/cal-util.h: rename UriType to CalMode svn path=/trunk/; revision=13142
Diffstat (limited to 'calendar/gui/calendar-offline-handler.c')
-rw-r--r--calendar/gui/calendar-offline-handler.c35
1 files changed, 25 insertions, 10 deletions
diff --git a/calendar/gui/calendar-offline-handler.c b/calendar/gui/calendar-offline-handler.c
index e57ba042ee..e804bc8040 100644
--- a/calendar/gui/calendar-offline-handler.c
+++ b/calendar/gui/calendar-offline-handler.c
@@ -28,6 +28,7 @@
#endif
#include <gtk/gtkmain.h>
+#include <gtk/gtksignal.h>
#include <bonobo/bonobo-exception.h>
#include <libgnomevfs/gnome-vfs-types.h>
#include <libgnomevfs/gnome-vfs-uri.h>
@@ -64,9 +65,15 @@ add_connection (gpointer data, gpointer user_data)
}
static GNOME_Evolution_ConnectionList *
-create_connection_list (GList *uris)
+create_connection_list (CalendarOfflineHandler *offline_handler)
{
+ CalendarOfflineHandlerPrivate *priv;
GNOME_Evolution_ConnectionList *list;
+ GList *uris;
+
+ priv = offline_handler->priv;
+
+ uris = cal_client_uri_list (priv->client, CAL_MODE_REMOTE);
list = GNOME_Evolution_ConnectionList__alloc ();
list->_length = 0;
@@ -99,14 +106,11 @@ impl_prepareForOffline (PortableServer_Servant servant,
{
CalendarOfflineHandler *offline_handler;
CalendarOfflineHandlerPrivate *priv;
- GList *uris;
offline_handler = CALENDAR_OFFLINE_HANDLER (bonobo_object_from_servant (servant));
priv = offline_handler->priv;
- uris = cal_client_uri_list (priv->client, CALURI_TYPE_REMOTE);
-
- *active_connection_list = create_connection_list (uris);
+ *active_connection_list = create_connection_list (offline_handler);
}
static void
@@ -118,8 +122,7 @@ update_offline (CalendarOfflineHandler *offline_handler)
priv = offline_handler->priv;
-#if 0
- connection_list = create_connection_list ();
+ connection_list = create_connection_list (offline_handler);
CORBA_exception_init (&ev);
@@ -130,9 +133,16 @@ update_offline (CalendarOfflineHandler *offline_handler)
g_warning ("Error updating offline progress");
CORBA_exception_free (&ev);
-#endif
}
-
+
+static void
+backend_cal_set_mode (CalClient *client, CalClientSetModeStatus status, CalMode mode, gpointer data)
+{
+ CalendarOfflineHandler *offline_handler = data;
+
+ update_offline (offline_handler);
+}
+
static void
backend_cal_opened (CalClient *client, CalClientOpenStatus status, gpointer data)
{
@@ -143,6 +153,11 @@ backend_cal_opened (CalClient *client, CalClientOpenStatus status, gpointer data
gtk_object_unref (GTK_OBJECT (client));
return;
}
+
+ cal_client_set_mode (client, CAL_MODE_LOCAL);
+
+ gtk_signal_connect (GTK_OBJECT (client), "cal_mode_set",
+ backend_cal_set_mode, offline_handler);
}
static void
@@ -180,7 +195,7 @@ impl_goOffline (PortableServer_Servant servant,
/* To update the status */
priv->listener_interface = CORBA_Object_duplicate (progress_listener, ev);
- uris = cal_client_uri_list (priv->client, CALURI_TYPE_REMOTE);
+ uris = cal_client_uri_list (priv->client, CAL_MODE_REMOTE);
g_list_foreach (uris, backend_go_offline, offline_handler);
}