From f0544b36bf0ce4ec26f337bfc583f93af50cf705 Mon Sep 17 00:00:00 2001 From: Rodrigo Moya Date: Tue, 2 Jul 2002 23:18:47 +0000 Subject: Fixes #16034 2002-07-02 Rodrigo Moya Fixes #16034 * gui/e-day-view.c (e_day_view_reshape_long_event): (e_day_view_reshape_day_event): * gui/e-day-view-main-item.c (e_day_view_main_item_draw_day_event): * gui/e-week-view.c (e_week_view_reshape_event_span): * gui/e-week-view-event-item.c (e_week_view_event_item_draw_icons): Don't assume all categories have icons when allocating space for the icons. svn path=/trunk/; revision=17357 --- calendar/gui/e-day-view-main-item.c | 13 ++++++++++--- calendar/gui/e-day-view.c | 24 ++++++++++++++++++++---- calendar/gui/e-week-view-event-item.c | 13 ++++++++++--- calendar/gui/e-week-view.c | 12 ++++++++++-- 4 files changed, 50 insertions(+), 12 deletions(-) (limited to 'calendar/gui') diff --git a/calendar/gui/e-day-view-main-item.c b/calendar/gui/e-day-view-main-item.c index f7f86c6660..f28e0c6a2b 100644 --- a/calendar/gui/e-day-view-main-item.c +++ b/calendar/gui/e-day-view-main-item.c @@ -604,7 +604,15 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, cal_component_get_categories_list (comp, &categories_list); - num_icons += g_slist_length (categories_list); + for (elem = categories_list; elem; elem = elem->next) { + char *category; + GdkPixmap *pixmap = NULL; + GdkBitmap *mask = NULL; + + category = (char *) elem->data; + if (e_categories_config_get_icon_for (category, &pixmap, &mask)) + num_icons++; + } if (num_icons != 0) { if (item_h >= (E_DAY_VIEW_ICON_HEIGHT + E_DAY_VIEW_ICON_Y_PAD) @@ -683,8 +691,7 @@ e_day_view_main_item_draw_day_event (EDayViewMainItem *dvmitem, GdkBitmap *mask = NULL; category = (char *) elem->data; - e_categories_config_get_icon_for (category, &pixmap, &mask); - if (pixmap == NULL) + if (!e_categories_config_get_icon_for (category, &pixmap, &mask)) continue; max_icon_w = item_x + item_w - icon_x diff --git a/calendar/gui/e-day-view.c b/calendar/gui/e-day-view.c index d305190352..6e445dcaaf 100644 --- a/calendar/gui/e-day-view.c +++ b/calendar/gui/e-day-view.c @@ -5082,7 +5082,7 @@ e_day_view_reshape_long_event (EDayView *day_view, } if (show_icons) { - GSList *categories_list; + GSList *categories_list, *elem; if (cal_component_has_alarms (comp)) num_icons++; @@ -5092,7 +5092,15 @@ e_day_view_reshape_long_event (EDayView *day_view, num_icons++; cal_component_get_categories_list (comp, &categories_list); - num_icons += g_slist_length (categories_list); + for (elem = categories_list; elem; elem = elem->next) { + char *category; + GdkPixmap *pixmap = NULL; + GdkBitmap *mask = NULL; + + category = (char *) elem->data; + if (e_categories_config_get_icon_for (category, &pixmap, &mask)) + num_icons++; + } cal_component_free_categories_list (categories_list); } @@ -5221,7 +5229,7 @@ e_day_view_reshape_day_event (EDayView *day_view, if (day_view->resize_drag_pos == E_DAY_VIEW_POS_NONE || day_view->resize_event_day != day || day_view->resize_event_num != event_num) { - GSList *categories_list; + GSList *categories_list, *elem; if (cal_component_has_alarms (comp)) num_icons++; @@ -5231,7 +5239,15 @@ e_day_view_reshape_day_event (EDayView *day_view, num_icons++; cal_component_get_categories_list (comp, &categories_list); - num_icons += g_slist_length (categories_list); + for (elem = categories_list; elem; elem = elem->next) { + char *category; + GdkPixmap *pixmap = NULL; + GdkBitmap *mask = NULL; + + category = (char *) elem->data; + if (e_categories_config_get_icon_for (category, &pixmap, &mask)) + num_icons++; + } cal_component_free_categories_list (categories_list); } diff --git a/calendar/gui/e-week-view-event-item.c b/calendar/gui/e-week-view-event-item.c index 4d532be5bf..f680be8f0d 100644 --- a/calendar/gui/e-week-view-event-item.c +++ b/calendar/gui/e-week-view-event-item.c @@ -589,7 +589,15 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem, } cal_component_get_categories_list (comp, &categories_list); - num_icons += g_slist_length (categories_list); + for (elem = categories_list; elem; elem = elem->next) { + char *category; + GdkPixmap *pixmap = NULL; + GdkBitmap *mask = NULL; + + category = (char *) elem->data; + if (e_categories_config_get_icon_for (category, &pixmap, &mask)) + num_icons++; + } icon_x_inc = E_WEEK_VIEW_ICON_WIDTH + E_WEEK_VIEW_ICON_X_PAD; @@ -636,8 +644,7 @@ e_week_view_event_item_draw_icons (EWeekViewEventItem *wveitem, GdkBitmap *mask = NULL; category = (char *) elem->data; - e_categories_config_get_icon_for (category, &pixmap, &mask); - if (pixmap == NULL) + if (!e_categories_config_get_icon_for (category, &pixmap, &mask)) continue; if (icon_x + E_WEEK_VIEW_ICON_WIDTH <= x2) { diff --git a/calendar/gui/e-week-view.c b/calendar/gui/e-week-view.c index 514558cc58..22b4623f13 100644 --- a/calendar/gui/e-week-view.c +++ b/calendar/gui/e-week-view.c @@ -2614,7 +2614,7 @@ e_week_view_reshape_event_span (EWeekView *week_view, /* Calculate how many icons we need to show. */ num_icons = 0; if (show_icons) { - GSList *categories_list; + GSList *categories_list, *elem; if (cal_component_has_alarms (comp)) num_icons++; @@ -2624,7 +2624,15 @@ e_week_view_reshape_event_span (EWeekView *week_view, num_icons++; cal_component_get_categories_list (comp, &categories_list); - num_icons += g_slist_length (categories_list); + for (elem = categories_list; elem; elem = elem->next) { + char *category; + GdkPixmap *pixmap = NULL; + GdkBitmap *mask = NULL; + + category = (char *) elem->data; + if (e_categories_config_get_icon_for (category, &pixmap, &mask)) + num_icons++; + } cal_component_free_categories_list (categories_list); } -- cgit