Added gcal_compare_event_widget_by_date function.
Method added so I can sort the widgets by its start date on the views.
This commit is contained in:
committed by
Rene A. Viant Moran
parent
ee66a85e4d
commit
0e39c4f618
@@ -19,6 +19,8 @@
|
||||
*/
|
||||
|
||||
#include "gcal-utils.h"
|
||||
#include "gcal-event-widget.h"
|
||||
#include "gcal-view.h"
|
||||
|
||||
#include <libedataserver/libedataserver.h>
|
||||
#include <libedataserverui/libedataserverui.h>
|
||||
@@ -258,6 +260,25 @@ gcal_get_pixbuf_from_color (GdkColor *color)
|
||||
return pix;
|
||||
}
|
||||
|
||||
gint
|
||||
gcal_compare_event_widget_by_date (gconstpointer a,
|
||||
gconstpointer b)
|
||||
{
|
||||
/* negative value if a < b; zero if a = b; positive value if a > b. */
|
||||
GcalViewChild *a_child;
|
||||
GcalViewChild *b_child;
|
||||
icaltimetype *a_date;
|
||||
icaltimetype *b_date;
|
||||
|
||||
a_child = (GcalViewChild*) a;
|
||||
b_child = (GcalViewChild*) b;
|
||||
|
||||
a_date = gcal_event_widget_get_date (GCAL_EVENT_WIDGET (a_child->widget));
|
||||
b_date = gcal_event_widget_get_date (GCAL_EVENT_WIDGET (b_child->widget));
|
||||
|
||||
return icaltime_compare (*a_date, *b_date);
|
||||
}
|
||||
|
||||
/* Function to do a last minute fixup of the AM/PM stuff if the locale
|
||||
* and gettext haven't done it right. Most English speaking countries
|
||||
* except the USA use the 24 hour clock (UK, Australia etc). However
|
||||
|
||||
@@ -81,6 +81,9 @@ gchar* gcal_get_month_name (gint
|
||||
|
||||
GdkPixbuf* gcal_get_pixbuf_from_color (GdkColor *color);
|
||||
|
||||
gint gcal_compare_event_widget_by_date (gconstpointer a,
|
||||
gconstpointer b);
|
||||
|
||||
/* code brought from evolution */
|
||||
gsize e_strftime_fix_am_pm (gchar *str,
|
||||
gsize max,
|
||||
|
||||
Reference in New Issue
Block a user