aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/conduits/todo/todo-conduit.c
diff options
context:
space:
mode:
Diffstat (limited to 'calendar/conduits/todo/todo-conduit.c')
-rw-r--r--calendar/conduits/todo/todo-conduit.c67
1 files changed, 52 insertions, 15 deletions
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c
index 18819b9b70..7f834921ca 100644
--- a/calendar/conduits/todo/todo-conduit.c
+++ b/calendar/conduits/todo/todo-conduit.c
@@ -23,6 +23,9 @@
#include <config.h>
+#include <liboaf/liboaf.h>
+#include <bonobo.h>
+#include <bonobo-conf/bonobo-config-database.h>
#include <cal-client/cal-client-types.h>
#include <cal-client/cal-client.h>
#include <cal-util/timeutil.h>
@@ -38,7 +41,6 @@
#include <e-pilot-map.h>
#include <e-pilot-settings.h>
#include <e-pilot-util.h>
-#include <e-config-listener.h>
GnomePilotConduit * conduit_get_gpilot_conduit (guint32);
void conduit_destroy_gpilot_conduit (GnomePilotConduit*);
@@ -84,7 +86,7 @@ struct _EToDoLocalRecord {
static void
todoconduit_destroy_record (EToDoLocalRecord *local)
{
- g_object_unref (local->comp);
+ gtk_object_unref (GTK_OBJECT (local->comp));
free_ToDo (local->todo);
g_free (local->todo);
g_free (local);
@@ -305,7 +307,7 @@ e_todo_context_destroy (EToDoConduitContext *ctxt)
e_todo_gui_destroy (ctxt->gui);
if (ctxt->client != NULL)
- g_object_unref (ctxt->client);
+ gtk_object_unref (GTK_OBJECT (ctxt->client));
if (ctxt->default_comp != NULL)
gtk_object_unref (GTK_OBJECT (ctxt->default_comp));
@@ -415,8 +417,8 @@ start_calendar_server (EToDoConduitContext *ctxt)
ctxt->client = cal_client_new ();
- g_signal_connect (ctxt->client, "cal_opened",
- G_CALLBACK (start_calendar_server_cb), &success);
+ gtk_signal_connect (GTK_OBJECT (ctxt->client), "cal_opened",
+ start_calendar_server_cb, &success);
if (!cal_client_open_default_tasks (ctxt->client, FALSE))
return -1;
@@ -447,14 +449,24 @@ get_timezone (CalClient *client, const char *tzid)
static icaltimezone *
get_default_timezone (void)
{
- EConfigListener *listener;
+ Bonobo_ConfigDatabase db;
icaltimezone *timezone = NULL;
char *location;
+ CORBA_Environment ev;
- listener = e_config_listener_new ();
+ CORBA_exception_init (&ev);
+
+ db = bonobo_get_object ("wombat:", "Bonobo/ConfigDatabase", &ev);
+
+ if (BONOBO_EX (&ev) || db == CORBA_OBJECT_NIL) {
+ CORBA_exception_free (&ev);
+ return NULL;
+ }
+
+ CORBA_exception_free (&ev);
- location = e_config_listener_get_string_with_default (listener,
- "/apps/evolution/calendar/display/timezone", "UTC", NULL);
+ location = bonobo_config_get_string_with_default (db,
+ "/Calendar/Display/Timezone", "UTC", NULL);
if (!location || !location[0]) {
g_free (location);
location = g_strdup ("UTC");
@@ -463,7 +475,7 @@ get_default_timezone (void)
timezone = icaltimezone_get_builtin_timezone (location);
g_free (location);
- g_object_unref (listener);
+ bonobo_object_release_unref (db, NULL);
return timezone;
}
@@ -582,7 +594,7 @@ local_record_from_comp (EToDoLocalRecord *local, CalComponent *comp, EToDoCondui
g_return_if_fail (comp != NULL);
local->comp = comp;
- g_object_ref (comp);
+ gtk_object_ref (GTK_OBJECT (comp));
cal_component_get_uid (local->comp, &uid);
local->local.ID = e_pilot_map_lookup_pid (ctxt->map, uid, TRUE);
@@ -681,13 +693,13 @@ local_record_from_uid (EToDoLocalRecord *local,
if (status == CAL_CLIENT_GET_SUCCESS) {
local_record_from_comp (local, comp, ctxt);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
} else if (status == CAL_CLIENT_GET_NOT_FOUND) {
comp = cal_component_new ();
cal_component_set_new_vtype (comp, CAL_COMPONENT_TODO);
cal_component_set_uid (comp, uid);
local_record_from_comp (local, comp, ctxt);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
} else {
INFO ("Object did not exist");
}
@@ -1181,7 +1193,7 @@ add_record (GnomePilotConduitSyncAbs *conduit,
update_comp (conduit, comp, ctxt);
e_pilot_map_insert (ctxt->map, remote->ID, uid, FALSE);
- g_object_unref (comp);
+ gtk_object_unref (GTK_OBJECT (comp));
return retval;
}
@@ -1201,7 +1213,7 @@ replace_record (GnomePilotConduitSyncAbs *conduit,
print_local (local), print_remote (remote));
new_comp = comp_from_remote_record (conduit, remote, local->comp, ctxt->timezone);
- g_object_unref (local->comp);
+ gtk_object_unref (GTK_OBJECT (local->comp));
local->comp = new_comp;
update_comp (conduit, local->comp, ctxt);
@@ -1358,6 +1370,16 @@ revert_settings (GnomePilotConduit *conduit, EToDoConduitContext *ctxt)
ctxt->new_cfg = todoconduit_dupe_configuration (ctxt->cfg);
}
+static ORBit_MessageValidationResult
+accept_all_cookies (CORBA_unsigned_long request_id,
+ CORBA_Principal *principal,
+ CORBA_char *operation)
+{
+ /* allow ALL cookies */
+ return ORBIT_MESSAGE_ALLOW_ALL;
+}
+
+
GnomePilotConduit *
conduit_get_gpilot_conduit (guint32 pilot_id)
{
@@ -1366,6 +1388,21 @@ conduit_get_gpilot_conduit (guint32 pilot_id)
LOG ("in todo's conduit_get_gpilot_conduit\n");
+ /* we need to find wombat with oaf, so make sure oaf
+ is initialized here. once the desktop is converted
+ to oaf and gpilotd is built with oaf, this can go away */
+ if (!oaf_is_initialized ()) {
+ char *argv[ 1 ] = {"hi"};
+ oaf_init (1, argv);
+
+ if (bonobo_init (CORBA_OBJECT_NIL,
+ CORBA_OBJECT_NIL,
+ CORBA_OBJECT_NIL) == FALSE)
+ g_error (_("Could not initialize Bonobo"));
+
+ ORBit_set_request_validation_handler (accept_all_cookies);
+ }
+
retval = gnome_pilot_conduit_sync_abs_new ("ToDoDB", 0x746F646F);
g_assert (retval != NULL);