aboutsummaryrefslogtreecommitdiffstats
path: root/calendar
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
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')
-rw-r--r--calendar/ChangeLog12
-rw-r--r--calendar/gui/cal-search-bar.c38
-rw-r--r--calendar/gui/cal-search-bar.h17
-rw-r--r--calendar/gui/e-tasks.c2
-rw-r--r--calendar/gui/gnome-cal.c2
5 files changed, 55 insertions, 16 deletions
diff --git a/calendar/ChangeLog b/calendar/ChangeLog
index 5f4dfd79ef..424d1bc81e 100644
--- a/calendar/ChangeLog
+++ b/calendar/ChangeLog
@@ -1,5 +1,17 @@
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.
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);
diff --git a/calendar/gui/cal-search-bar.h b/calendar/gui/cal-search-bar.h
index a8910ba7b4..311dacd606 100644
--- a/calendar/gui/cal-search-bar.h
+++ b/calendar/gui/cal-search-bar.h
@@ -37,6 +37,19 @@ G_BEGIN_DECLS
typedef struct CalSearchBarPrivate CalSearchBarPrivate;
+enum {
+ CAL_SEARCH_ANY_FIELD_CONTAINS = (1 << 0),
+ CAL_SEARCH_SUMMARY_CONTAINS = (1 << 1),
+ CAL_SEARCH_DESCRIPTION_CONTAINS = (1 << 2),
+ CAL_SEARCH_COMMENT_CONTAINS = (1 << 3),
+ CAL_SEARCH_LOCATION_CONTAINS = (1 << 4),
+ CAL_SEARCH_CATEGORY_IS = (1 << 5)
+};
+
+#define CAL_SEARCH_ALL (0xff)
+#define CAL_SEARCH_CALENDAR_DEFAULT (0x37)
+#define CAL_SEARCH_TASKS_DEFAULT (0x27)
+
typedef struct {
ESearchBar search_bar;
@@ -55,9 +68,9 @@ typedef struct {
GtkType cal_search_bar_get_type (void);
-CalSearchBar *cal_search_bar_construct (CalSearchBar *cal_search);
+CalSearchBar *cal_search_bar_construct (CalSearchBar *cal_search, guint32 flags);
-GtkWidget *cal_search_bar_new (void);
+GtkWidget *cal_search_bar_new (guint32 flags);
void cal_search_bar_set_categories (CalSearchBar *cal_search, GPtrArray *categories);
diff --git a/calendar/gui/e-tasks.c b/calendar/gui/e-tasks.c
index 07e2c9fdbd..22b2b1ce29 100644
--- a/calendar/gui/e-tasks.c
+++ b/calendar/gui/e-tasks.c
@@ -345,7 +345,7 @@ setup_widgets (ETasks *tasks)
priv = tasks->priv;
- priv->search_bar = cal_search_bar_new ();
+ priv->search_bar = cal_search_bar_new (CAL_SEARCH_TASKS_DEFAULT);
g_signal_connect (priv->search_bar, "sexp_changed",
G_CALLBACK (search_bar_sexp_changed_cb), tasks);
g_signal_connect (priv->search_bar, "category_changed",
diff --git a/calendar/gui/gnome-cal.c b/calendar/gui/gnome-cal.c
index 2819cb986c..d5cf2336a0 100644
--- a/calendar/gui/gnome-cal.c
+++ b/calendar/gui/gnome-cal.c
@@ -1015,7 +1015,7 @@ setup_widgets (GnomeCalendar *gcal)
priv = gcal->priv;
- priv->search_bar = cal_search_bar_new ();
+ priv->search_bar = cal_search_bar_new (CAL_SEARCH_CALENDAR_DEFAULT);
g_signal_connect (priv->search_bar, "sexp_changed",
G_CALLBACK (search_bar_sexp_changed_cb), gcal);
g_signal_connect (priv->search_bar, "category_changed",