From e881e3acc10b2690267ae2021d9bff2d1ef1a11b Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Tue, 14 Aug 2001 17:55:12 +0000 Subject: Make the "Any Category" item consistent with the one in the addressbook. 2001-08-14 Federico Mena Quintero * gui/cal-search-bar.c (make_suboptions): Make the "Any Category" item consistent with the one in the addressbook. Also, free the items correctly. svn path=/trunk/; revision=12020 --- calendar/ChangeLog | 6 ++++++ calendar/gui/cal-search-bar.c | 15 +++++++++------ 2 files changed, 15 insertions(+), 6 deletions(-) diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 14b34f4a48..c258bfe192 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,9 @@ +2001-08-14 Federico Mena Quintero + + * gui/cal-search-bar.c (make_suboptions): Make the "Any Category" + item consistent with the one in the addressbook. Also, free the + items correctly. + 2001-08-14 Federico Mena Quintero * gui/cal-search-bar.c (get_current_category): Handle an array of diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c index 4c0937097f..b6fde4e6f4 100644 --- a/calendar/gui/cal-search-bar.c +++ b/calendar/gui/cal-search-bar.c @@ -63,7 +63,7 @@ static ESearchBarItem search_option_items[] = { /* IDs for the categories suboptions */ #define CATEGORIES_ALL 0 #define CATEGORIES_UNMATCHED 1 -#define CATEGORIES_OFFSET 2 +#define CATEGORIES_OFFSET 3 /* Private part of the CalSearchBar structure */ struct CalSearchBarPrivate { @@ -409,7 +409,7 @@ make_suboptions (CalSearchBar *cal_search) /* All, unmatched, separator */ - subitems[0].text = _("Any"); + subitems[0].text = _("Any Category"); subitems[0].id = CATEGORIES_ALL; subitems[0].translate = FALSE; @@ -417,12 +417,12 @@ make_suboptions (CalSearchBar *cal_search) subitems[1].id = CATEGORIES_UNMATCHED; subitems[1].translate = FALSE; + /* All the other items */ + if (priv->categories->len > 0) { subitems[2].text = NULL; /* separator */ subitems[2].id = 0; - /* All the other items */ - for (i = 0; i < priv->categories->len; i++) { const char *category; char *str; @@ -435,8 +435,6 @@ make_suboptions (CalSearchBar *cal_search) subitems[i + CATEGORIES_OFFSET].text = str; subitems[i + CATEGORIES_OFFSET].id = i + CATEGORIES_OFFSET; subitems[i + CATEGORIES_OFFSET].translate = FALSE; - - g_free (str); } subitems[i + CATEGORIES_OFFSET].id = -1; /* terminator */ @@ -444,6 +442,11 @@ make_suboptions (CalSearchBar *cal_search) subitems[2].id = -1; /* terminator */ e_search_bar_set_suboption (E_SEARCH_BAR (cal_search), SEARCH_CATEGORY_IS, subitems); + + /* Free the strings */ + for (i = 0; i < priv->categories->len; i++) + g_free (subitems[i + CATEGORIES_OFFSET].text); + g_free (subitems); } -- cgit v1.2.3