File gnome-panel-bgo633566-clock-app-show-ews.patch of Package gnome-panel.import4835
--- gnome-panel-2.32.1/applets/clock/calendar-window.c.orig 2010-06-23 01:00:27.000000000 +0200
+++ gnome-panel-2.32.1/applets/clock/calendar-window.c 2011-03-03 10:17:10.000000000 +0100
@@ -247,7 +247,7 @@
enum {
APPOINTMENT_COLUMN_UID,
- APPOINTMENT_COLUMN_URI,
+ APPOINTMENT_COLUMN_TYPE,
APPOINTMENT_COLUMN_SUMMARY,
APPOINTMENT_COLUMN_DESCRIPTION,
APPOINTMENT_COLUMN_START_TIME,
@@ -259,6 +259,12 @@
};
enum {
+ APPOINTMENT_TYPE_APPOINTMENT,
+ APPOINTMENT_TYPE_BIRTHDAY,
+ APPOINTMENT_TYPE_WEATHER
+};
+
+enum {
TASK_COLUMN_UID,
TASK_COLUMN_SUMMARY,
TASK_COLUMN_DESCRIPTION,
@@ -272,6 +278,7 @@
TASK_COLUMN_COLOR,
TASK_COLUMN_PRIORITY,
N_TASK_COLUMNS
+
};
static char *
@@ -441,48 +448,15 @@
}
static gboolean
-is_appointment (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- gchar *uri;
-
- gtk_tree_model_get (model, iter, APPOINTMENT_COLUMN_URI, &uri, -1);
- if (uri)
- return (g_ascii_strcasecmp (uri, "file") == 0 ||
- g_ascii_strcasecmp (uri, "webcal") == 0 ||
- g_ascii_strcasecmp (uri, "caldav") == 0 ||
- g_ascii_strcasecmp (uri, "exchange") == 0 ||
- g_ascii_strcasecmp (uri, "groupwise") == 0 ||
- g_ascii_strcasecmp (uri, "google") == 0);
- return FALSE;
-}
-
-static gboolean
-is_birthday (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- gchar *uri;
-
- gtk_tree_model_get (model, iter, APPOINTMENT_COLUMN_URI, &uri, -1);
- if (uri)
- return (g_ascii_strcasecmp (uri, "contacts") == 0);
- return FALSE;
-}
+is_for_filter (GtkTreeModel *model,
+ GtkTreeIter *iter,
+ gpointer data)
+ {
+ gint type;
+ gtk_tree_model_get (model, iter, APPOINTMENT_COLUMN_TYPE, &type, -1);
+ return type == GPOINTER_TO_INT (data);
+ }
-static gboolean
-is_weather (GtkTreeModel *model,
- GtkTreeIter *iter,
- gpointer data)
-{
- gchar *uri;
-
- gtk_tree_model_get (model, iter, APPOINTMENT_COLUMN_URI, &uri, -1);
- if (uri)
- return (g_ascii_strcasecmp (uri, "weather") == 0);
- return FALSE;
-}
static gboolean
filter_out_tasks (GtkTreeModel *model,
@@ -961,6 +935,7 @@
CalendarAppointment *appointment = l->data;
GtkTreeIter iter;
char *start_text;
+ gint type;
g_assert (CALENDAR_EVENT (appointment)->type == CALENDAR_EVENT_APPOINTMENT);
@@ -970,13 +945,18 @@
start_text = format_time (calwin->priv->time_format,
appointment->start_time,
year, month, day);
-
+ if (g_ascii_strcasecmp (appointment->uri, "weather") == 0)
+ type = APPOINTMENT_TYPE_WEATHER;
+ else if (g_ascii_strcasecmp (appointment->uri, "contacts") == 0)
+ type = APPOINTMENT_TYPE_BIRTHDAY;
+ else
+ type = APPOINTMENT_TYPE_APPOINTMENT;
gtk_list_store_append (calwin->priv->appointments_model,
&iter);
gtk_list_store_set (calwin->priv->appointments_model, &iter,
APPOINTMENT_COLUMN_UID, appointment->uid,
- APPOINTMENT_COLUMN_URI, appointment->uri,
+ APPOINTMENT_COLUMN_TYPE, type,
APPOINTMENT_COLUMN_SUMMARY, appointment->summary,
APPOINTMENT_COLUMN_DESCRIPTION, appointment->description,
APPOINTMENT_COLUMN_START_TIME, (gint64)appointment->start_time,
@@ -1003,7 +983,7 @@
create_list_for_appointment_model (CalendarWindow *calwin,
const char *label,
GtkTreeModelFilter **filter,
- GtkTreeModelFilterVisibleFunc is_for_filter,
+ gint filter_type,
GtkTreeCellDataFunc set_pixbuf_cell,
gboolean show_start,
GtkWidget **tree_view,
@@ -1043,7 +1023,7 @@
gtk_tree_model_filter_set_visible_func (
*filter,
(GtkTreeModelFilterVisibleFunc) is_for_filter,
- calwin,
+ GINT_TO_POINTER (filter_type),
NULL);
}
@@ -1105,7 +1085,7 @@
calwin,
_("Appointments"),
&calwin->priv->appointments_filter,
- is_appointment,
+ APPOINTMENT_TYPE_APPOINTMENT,
appointment_pixbuf_cell_data_func,
TRUE,
tree_view,
@@ -1130,7 +1110,7 @@
calwin,
_("Birthdays and Anniversaries"),
&calwin->priv->birthdays_filter,
- is_birthday,
+ APPOINTMENT_TYPE_BIRTHDAY,
birthday_pixbuf_cell_data_func,
FALSE,
tree_view,
@@ -1155,7 +1135,7 @@
calwin,
_("Weather Information"),
&calwin->priv->weather_filter,
- is_weather,
+ APPOINTMENT_TYPE_WEATHER,
weather_pixbuf_cell_data_func,
FALSE,
tree_view,
@@ -1217,7 +1197,7 @@
calwin->priv->appointments_model =
gtk_list_store_new (N_APPOINTMENT_COLUMNS,
G_TYPE_STRING, /* uid */
- G_TYPE_STRING, /* uri */
+ G_TYPE_INT, /* type */
G_TYPE_STRING, /* summary */
G_TYPE_STRING, /* description */
G_TYPE_INT64, /* start time */