aboutsummaryrefslogtreecommitdiffstats
path: root/calendar/gui/cal-search-bar.c
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@novell.com>2004-05-27 23:45:28 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-05-27 23:45:28 +0800
commitd5af60adc1e263d46890789aa2c3621380ad82dd (patch)
treef9f124d95d3a442232de0de86d75a83ab9a9af8d /calendar/gui/cal-search-bar.c
parent34620f5fb64f6667c84cc61a73c05448067b919e (diff)
downloadgsoc2013-evolution-d5af60adc1e263d46890789aa2c3621380ad82dd.tar
gsoc2013-evolution-d5af60adc1e263d46890789aa2c3621380ad82dd.tar.gz
gsoc2013-evolution-d5af60adc1e263d46890789aa2c3621380ad82dd.tar.bz2
gsoc2013-evolution-d5af60adc1e263d46890789aa2c3621380ad82dd.tar.lz
gsoc2013-evolution-d5af60adc1e263d46890789aa2c3621380ad82dd.tar.xz
gsoc2013-evolution-d5af60adc1e263d46890789aa2c3621380ad82dd.tar.zst
gsoc2013-evolution-d5af60adc1e263d46890789aa2c3621380ad82dd.zip
Fix for bug #57818.
2004-05-26 Jeffrey Stedfast <fejj@novell.com> Fix for bug #57818. * gui/e-tasks.c (setup_widgets): Same. * gui/gnome-cal.c (setup_widgets): Updated to pass a set of bitflags to cal_search_bar_new(). * gui/cal-search-bar.c (cal_search_bar_new): Now takes a bit flag argument specifying which search options to present. (cal_search_bar_construct): Same as above. Construct the search menu to use based on the bit flags. * gui/apps_evolution_calendar.schemas.in.in: Changed the default "Tasks due today" colour to be a light-blue (one of the default colour values in the colour picker dialog). Fixes bug #53412. svn path=/trunk/; revision=26112
Diffstat (limited to 'calendar/gui/cal-search-bar.c')
-rw-r--r--calendar/gui/cal-search-bar.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c
index 876b0523f1..3bdb542516 100644
--- a/calendar/gui/cal-search-bar.c
+++ b/calendar/gui/cal-search-bar.c
@@ -33,7 +33,6 @@
#include <gal/util/e-util.h>
#include "cal-search-bar.h"
-
/* IDs and option items for the ESearchBar */
enum {
@@ -42,7 +41,7 @@ enum {
SEARCH_DESCRIPTION_CONTAINS,
SEARCH_COMMENT_CONTAINS,
SEARCH_LOCATION_CONTAINS,
- SEARCH_CATEGORY_IS,
+ SEARCH_CATEGORY_IS
};
/* Comments are disabled because they are kind of useless right now, see bug 33247 */
@@ -50,12 +49,9 @@ static ESearchBarItem search_option_items[] = {
{ N_("Any field contains"), SEARCH_ANY_FIELD_CONTAINS, NULL },
{ N_("Summary contains"), SEARCH_SUMMARY_CONTAINS, NULL },
{ N_("Description contains"), SEARCH_DESCRIPTION_CONTAINS, NULL },
-#if 0
{ N_("Comment contains"), SEARCH_COMMENT_CONTAINS, NULL },
-#endif
{ N_("Location contains"), SEARCH_LOCATION_CONTAINS, NULL },
{ N_("Category is"), SEARCH_CATEGORY_IS, NULL },
- { NULL, -1, NULL }
};
/* IDs for the categories suboptions */
@@ -401,18 +397,36 @@ make_suboptions (CalSearchBar *cal_search)
/**
* cal_search_bar_construct:
* @cal_search: A calendar search bar.
+ * @flags: bitfield of items to appear in the search menu
*
* Constructs a calendar search bar by binding its menu and option items.
*
* Return value: The same value as @cal_search.
**/
CalSearchBar *
-cal_search_bar_construct (CalSearchBar *cal_search)
+cal_search_bar_construct (CalSearchBar *cal_search, guint32 flags)
{
- g_return_val_if_fail (cal_search != NULL, NULL);
+ ESearchBarItem *items;
+ guint32 bit = 0x1;
+ int i, j;
+
g_return_val_if_fail (IS_CAL_SEARCH_BAR (cal_search), NULL);
-
- e_search_bar_construct (E_SEARCH_BAR (cal_search), NULL, search_option_items);
+
+ items = g_alloca ((G_N_ELEMENTS (search_option_items) + 1) * sizeof (ESearchBarItem));
+ for (i = 0, j = 0; i < G_N_ELEMENTS (search_option_items); i++, bit <<= 1) {
+ if ((flags & bit) != 0) {
+ items[j].text = search_option_items[i].text;
+ items[j].id = search_option_items[i].id;
+ items[j].subitems = search_option_items[i].subitems;
+ j++;
+ }
+ }
+
+ items[j].text = NULL;
+ items[j].id = -1;
+ items[j].subitems = NULL;
+
+ e_search_bar_construct (E_SEARCH_BAR (cal_search), NULL, items);
make_suboptions (cal_search);
e_search_bar_set_ids (E_SEARCH_BAR (cal_search), SEARCH_CATEGORY_IS, CATEGORIES_ALL);
@@ -422,6 +436,7 @@ cal_search_bar_construct (CalSearchBar *cal_search)
/**
* cal_search_bar_new:
+ * flags: bitfield of items to appear in the search menu
*
* Creates a new calendar search bar.
*
@@ -429,12 +444,12 @@ cal_search_bar_construct (CalSearchBar *cal_search)
* "sexp_changed" signal to monitor changes in the generated sexps.
**/
GtkWidget *
-cal_search_bar_new (void)
+cal_search_bar_new (guint32 flags)
{
CalSearchBar *cal_search;
cal_search = g_object_new (TYPE_CAL_SEARCH_BAR, NULL);
- return GTK_WIDGET (cal_search_bar_construct (cal_search));
+ return GTK_WIDGET (cal_search_bar_construct (cal_search, flags));
}
/* Used from qsort() */
@@ -485,7 +500,6 @@ cal_search_bar_set_categories (CalSearchBar *cal_search, GPtrArray *categories)
{
CalSearchBarPrivate *priv;
- g_return_if_fail (cal_search != NULL);
g_return_if_fail (IS_CAL_SEARCH_BAR (cal_search));
g_return_if_fail (categories != NULL);