Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 357197
Collapse All | Expand All

(-)gnome-panel-2.32.1/applets/clock/calendar-window.c.orig (-50 / +30 lines)
Lines 247-253 Link Here
247
247
248
enum {
248
enum {
249
        APPOINTMENT_COLUMN_UID,
249
        APPOINTMENT_COLUMN_UID,
250
        APPOINTMENT_COLUMN_URI,
250
        APPOINTMENT_COLUMN_TYPE,
251
        APPOINTMENT_COLUMN_SUMMARY,
251
        APPOINTMENT_COLUMN_SUMMARY,
252
        APPOINTMENT_COLUMN_DESCRIPTION,
252
        APPOINTMENT_COLUMN_DESCRIPTION,
253
        APPOINTMENT_COLUMN_START_TIME,
253
        APPOINTMENT_COLUMN_START_TIME,
Lines 259-264 Link Here
259
};
259
};
260
260
261
enum {
261
enum {
262
	APPOINTMENT_TYPE_APPOINTMENT,
263
	APPOINTMENT_TYPE_BIRTHDAY,
264
	APPOINTMENT_TYPE_WEATHER
265
};
266
267
enum {
262
        TASK_COLUMN_UID,
268
        TASK_COLUMN_UID,
263
        TASK_COLUMN_SUMMARY,
269
        TASK_COLUMN_SUMMARY,
264
        TASK_COLUMN_DESCRIPTION,
270
        TASK_COLUMN_DESCRIPTION,
Lines 272-277 Link Here
272
        TASK_COLUMN_COLOR,
278
        TASK_COLUMN_COLOR,
273
        TASK_COLUMN_PRIORITY,
279
        TASK_COLUMN_PRIORITY,
274
        N_TASK_COLUMNS
280
        N_TASK_COLUMNS
281
275
};
282
};
276
283
277
static char *
284
static char *
Lines 441-488 Link Here
441
}
448
}
442
449
443
static gboolean
450
static gboolean
444
is_appointment (GtkTreeModel *model,
451
is_for_filter (GtkTreeModel *model,
445
		GtkTreeIter  *iter,
452
	      GtkTreeIter  *iter,
446
		gpointer      data)
453
	      gpointer      data)
447
{
454
 {
448
	gchar *uri;
455
 	gint type;
449
456
	gtk_tree_model_get (model, iter, APPOINTMENT_COLUMN_TYPE, &type, -1);
450
	gtk_tree_model_get (model, iter, APPOINTMENT_COLUMN_URI, &uri, -1);
457
	return type == GPOINTER_TO_INT (data);
451
	if (uri)
458
 }
452
		return (g_ascii_strcasecmp (uri, "file")   == 0 ||
453
			g_ascii_strcasecmp (uri, "webcal") == 0 ||
454
			g_ascii_strcasecmp (uri, "caldav") == 0 ||
455
			g_ascii_strcasecmp (uri, "exchange")  == 0 ||
456
			g_ascii_strcasecmp (uri, "groupwise") == 0 ||
457
			g_ascii_strcasecmp (uri, "google") == 0);
458
	return FALSE;
459
}
460
461
static gboolean
462
is_birthday (GtkTreeModel *model,
463
	     GtkTreeIter  *iter,
464
	     gpointer      data)
465
{
466
	gchar *uri;
467
468
	gtk_tree_model_get (model, iter, APPOINTMENT_COLUMN_URI, &uri, -1);
469
	if (uri)
470
		return (g_ascii_strcasecmp (uri, "contacts") == 0);
471
	return FALSE;
472
}
473
459
474
static gboolean
475
is_weather (GtkTreeModel *model,
476
	    GtkTreeIter  *iter,
477
	    gpointer      data)
478
{
479
	gchar *uri;
480
481
	gtk_tree_model_get (model, iter, APPOINTMENT_COLUMN_URI, &uri, -1);
482
	if (uri)
483
		return (g_ascii_strcasecmp (uri, "weather") == 0);
484
	return FALSE;
485
}
486
460
487
static gboolean
461
static gboolean
488
filter_out_tasks (GtkTreeModel   *model,
462
filter_out_tasks (GtkTreeModel   *model,
Lines 961-966 Link Here
961
                CalendarAppointment *appointment = l->data;
935
                CalendarAppointment *appointment = l->data;
962
                GtkTreeIter          iter;
936
                GtkTreeIter          iter;
963
                char                *start_text;
937
                char                *start_text;
938
		gint                 type;
964
939
965
                g_assert (CALENDAR_EVENT (appointment)->type == CALENDAR_EVENT_APPOINTMENT);
940
                g_assert (CALENDAR_EVENT (appointment)->type == CALENDAR_EVENT_APPOINTMENT);
966
941
Lines 970-982 Link Here
970
                        start_text = format_time (calwin->priv->time_format,
945
                        start_text = format_time (calwin->priv->time_format,
971
                                                  appointment->start_time,
946
                                                  appointment->start_time,
972
                                                  year, month, day);
947
                                                  year, month, day);
973
948
		if (g_ascii_strcasecmp (appointment->uri, "weather") == 0)
949
		        type = APPOINTMENT_TYPE_WEATHER;
950
		else if (g_ascii_strcasecmp (appointment->uri, "contacts") == 0)
951
		        type = APPOINTMENT_TYPE_BIRTHDAY;
952
		else
953
		        type = APPOINTMENT_TYPE_APPOINTMENT;
974
954
975
                gtk_list_store_append (calwin->priv->appointments_model,
955
                gtk_list_store_append (calwin->priv->appointments_model,
976
				       &iter);
956
				       &iter);
977
                gtk_list_store_set (calwin->priv->appointments_model, &iter,
957
                gtk_list_store_set (calwin->priv->appointments_model, &iter,
978
                                    APPOINTMENT_COLUMN_UID,         appointment->uid,
958
                                    APPOINTMENT_COLUMN_UID,         appointment->uid,
979
                                    APPOINTMENT_COLUMN_URI,         appointment->uri,
959
                                    APPOINTMENT_COLUMN_TYPE,        type,
980
                                    APPOINTMENT_COLUMN_SUMMARY,     appointment->summary,
960
                                    APPOINTMENT_COLUMN_SUMMARY,     appointment->summary,
981
                                    APPOINTMENT_COLUMN_DESCRIPTION, appointment->description,
961
                                    APPOINTMENT_COLUMN_DESCRIPTION, appointment->description,
982
                                    APPOINTMENT_COLUMN_START_TIME,  (gint64)appointment->start_time,
962
                                    APPOINTMENT_COLUMN_START_TIME,  (gint64)appointment->start_time,
Lines 1003-1009 Link Here
1003
create_list_for_appointment_model (CalendarWindow      *calwin,
983
create_list_for_appointment_model (CalendarWindow      *calwin,
1004
				   const char          *label,
984
				   const char          *label,
1005
				   GtkTreeModelFilter **filter,
985
				   GtkTreeModelFilter **filter,
1006
				   GtkTreeModelFilterVisibleFunc is_for_filter,
986
				   gint                 filter_type,
1007
				   GtkTreeCellDataFunc  set_pixbuf_cell,
987
				   GtkTreeCellDataFunc  set_pixbuf_cell,
1008
				   gboolean             show_start,
988
				   gboolean             show_start,
1009
				   GtkWidget          **tree_view,
989
				   GtkWidget          **tree_view,
Lines 1043-1049 Link Here
1043
		gtk_tree_model_filter_set_visible_func (
1023
		gtk_tree_model_filter_set_visible_func (
1044
				*filter,
1024
				*filter,
1045
				(GtkTreeModelFilterVisibleFunc) is_for_filter,
1025
				(GtkTreeModelFilterVisibleFunc) is_for_filter,
1046
				calwin,
1026
				GINT_TO_POINTER (filter_type),
1047
				NULL);
1027
				NULL);
1048
        }
1028
        }
1049
1029
Lines 1105-1111 Link Here
1105
					calwin,
1085
					calwin,
1106
					_("Appointments"),
1086
					_("Appointments"),
1107
					&calwin->priv->appointments_filter,
1087
					&calwin->priv->appointments_filter,
1108
					is_appointment,
1088
					APPOINTMENT_TYPE_APPOINTMENT,
1109
					appointment_pixbuf_cell_data_func,
1089
					appointment_pixbuf_cell_data_func,
1110
					TRUE,
1090
					TRUE,
1111
					tree_view,
1091
					tree_view,
Lines 1130-1136 Link Here
1130
					calwin,
1110
					calwin,
1131
					_("Birthdays and Anniversaries"),
1111
					_("Birthdays and Anniversaries"),
1132
					&calwin->priv->birthdays_filter,
1112
					&calwin->priv->birthdays_filter,
1133
					is_birthday,
1113
					APPOINTMENT_TYPE_BIRTHDAY,
1134
					birthday_pixbuf_cell_data_func,
1114
					birthday_pixbuf_cell_data_func,
1135
					FALSE,
1115
					FALSE,
1136
					tree_view,
1116
					tree_view,
Lines 1155-1161 Link Here
1155
					calwin,
1135
					calwin,
1156
					_("Weather Information"),
1136
					_("Weather Information"),
1157
					&calwin->priv->weather_filter,
1137
					&calwin->priv->weather_filter,
1158
					is_weather,
1138
					APPOINTMENT_TYPE_WEATHER,
1159
					weather_pixbuf_cell_data_func,
1139
					weather_pixbuf_cell_data_func,
1160
					FALSE,
1140
					FALSE,
1161
					tree_view,
1141
					tree_view,
Lines 1217-1223 Link Here
1217
	calwin->priv->appointments_model =
1197
	calwin->priv->appointments_model =
1218
		gtk_list_store_new (N_APPOINTMENT_COLUMNS,
1198
		gtk_list_store_new (N_APPOINTMENT_COLUMNS,
1219
				    G_TYPE_STRING,   /* uid              */
1199
				    G_TYPE_STRING,   /* uid              */
1220
				    G_TYPE_STRING,   /* uri              */
1200
				    G_TYPE_INT,      /* type             */
1221
				    G_TYPE_STRING,   /* summary          */
1201
				    G_TYPE_STRING,   /* summary          */
1222
				    G_TYPE_STRING,   /* description      */
1202
				    G_TYPE_STRING,   /* description      */
1223
				    G_TYPE_INT64,    /* start time       */
1203
				    G_TYPE_INT64,    /* start time       */

Return to bug 357197