Re: [evolution-patches] Free/Busy Bounty rev 2



On Sun, 2004-01-11 at 21:38 -0700, Gary Ekker wrote:
> I have attached a new revision of the patch to the bug: 
> 
> http://bugzilla.gnome.org/show_bug.cgi?id=127539
> 
> My ISP's ftp server is down, so I didn't post any screenshots. Hopefully
> this is the final revision. It will now check to see if it needs to
> publish, and do so if it has been more than a day or week depending on
> what the user has set. It will also publish after the the settings have
> been changed. Additionaly you can arbitrarily publish with the Actions
> menu or the pop-up menu.
> 
> Automatic publishing is set up in calendar-component.c: createControls.
> It occured to me that it may be good to only check to publish on the
> initial creation of the component and then remove the callback with
> g_idle_remove rather than have it continue to try, the code to do this
> is there, but commented out. This would especially be good if the server
> to which the user is publishing is down. Thoughts?
> 
but if you remove the g_idle handler, how would you publish again, in
the next hour or day?

more comments below

> +static gboolean
> +init_calendar_publishing_cb (gpointer data)
> +{
> +#if 0
> +       guint *idle_id = (guint *) data;
> +
> +       /* remove the idle function--We could do this so that it runs
once 
> +       on each startup */
> +       g_source_remove (*idle_id);
> +       g_free (idle_id);
> +#endif
>
returning FALSE on the callback will disable calling it again, so there
is no need to g_source_remove it.

> +       idle_id = g_new0 (guint, 1);
> +       *idle_id = g_idle_add ((GSourceFunc)
init_calendar_publishing_cb, idle_id);
>
instead of allocating memory, you can pass the integer as 'user_data' by
using GINT_TO_POINTER. Then, you can retrieve it with GPOINTER_TO_INT,
in the callback.

> +                       icomp = e_cal_component_get_icalcomponent
(pub_comp);
> +                       icomp_clone =
e_cal_component_get_icalcomponent (*clone);
> +                       for (prop = icalcomponent_get_first_property
(icomp,
> +
ICAL_FREEBUSY_PROPERTY);
> +                               prop != NULL;
> +                               prop = icalcomponent_get_next_property
(icomp, 
> +
ICAL_FREEBUSY_PROPERTY))
> +                       {
> +                               icalproperty *p;
> +               
> +                               p = icalproperty_new_clone (prop);
> +                               icalcomponent_add_property
(icomp_clone, p);
> +                       }
>
what is this 'for' loop for? You are adding the properties from the
component you already cloned.

> +       /* Publish the component */
> +       session = soup_session_async_new ();
>
you should probably free the session before returning from
itip_publish_comp. There are a few places where the function returns
that needs memory to be freed.

cheers




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]