diff options
Diffstat (limited to 'calendar/conduits/todo')
-rw-r--r-- | calendar/conduits/todo/todo-conduit.c | 77 |
1 files changed, 55 insertions, 22 deletions
diff --git a/calendar/conduits/todo/todo-conduit.c b/calendar/conduits/todo/todo-conduit.c index a07ed35706..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); @@ -117,11 +119,7 @@ todoconduit_load_configuration (guint32 pilot_id) c->pilot_id = pilot_id; management = gnome_pilot_conduit_management_new ("e_todo_conduit", GNOME_PILOT_CONDUIT_MGMT_ID); - gtk_object_ref (GTK_OBJECT (management)); - gtk_object_sink (GTK_OBJECT (management)); config = gnome_pilot_conduit_config_new (management, pilot_id); - gtk_object_ref (GTK_OBJECT (config)); - gtk_object_sink (GTK_OBJECT (config)); if (!gnome_pilot_conduit_config_is_enabled (config, &c->sync_type)) c->sync_type = GnomePilotConduitSyncTypeNotSet; gtk_object_unref (GTK_OBJECT (config)); @@ -309,10 +307,10 @@ 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) - g_object_unref (ctxt->default_comp); + gtk_object_unref (GTK_OBJECT (ctxt->default_comp)); if (ctxt->uids != NULL) cal_obj_uid_list_free (ctxt->uids); @@ -419,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; @@ -451,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"); @@ -467,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; } @@ -586,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); @@ -685,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"); } @@ -780,7 +788,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, } if (!is_empty_time (todo.due)) { - due = tm_to_icaltimetype (&todo.due, TRUE); + due = tm_to_icaltimetype (&todo.due, FALSE); dt.value = &due; cal_component_set_due (comp, &dt); } @@ -805,7 +813,7 @@ comp_from_remote_record (GnomePilotConduitSyncAbs *conduit, cal_component_set_priority (comp, &priority); cal_component_set_transparency (comp, CAL_COMPONENT_TRANSP_NONE); - if (remote->secret) + if (remote->attr & dlpRecAttrSecret) cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PRIVATE); else cal_component_set_classification (comp, CAL_COMPONENT_CLASS_PUBLIC); @@ -1185,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; } @@ -1205,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); @@ -1362,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) { @@ -1370,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); |