aboutsummaryrefslogtreecommitdiffstats
path: root/widgets
diff options
context:
space:
mode:
authorHarish Krishnaswamy <kharish@novell.com>2006-06-30 17:46:32 +0800
committerHarish Krishnaswamy <kharish@src.gnome.org>2006-06-30 17:46:32 +0800
commita1d6678af2c9f8a075d9d7832c2a6da981afe216 (patch)
tree9004c48377a85caf85ce21a5f91df6f18bd3ca7c /widgets
parentefd7b846b86bafc3efc361a316b9fd204a75ac89 (diff)
downloadgsoc2013-evolution-a1d6678af2c9f8a075d9d7832c2a6da981afe216.tar.gz
gsoc2013-evolution-a1d6678af2c9f8a075d9d7832c2a6da981afe216.tar.zst
gsoc2013-evolution-a1d6678af2c9f8a075d9d7832c2a6da981afe216.zip
Enhanced search functionality. patch submitted by Johnny Jacob Reviewed
2006-06-30 Harish Krishnaswamy <kharish@novell.com> Enhanced search functionality. patch submitted by Johnny Jacob Reviewed and committed by Harish. svn path=/trunk/; revision=32207
Diffstat (limited to 'widgets')
-rw-r--r--widgets/ChangeLog34
-rw-r--r--widgets/misc/Makefile.am2
-rw-r--r--widgets/misc/e-filter-bar.c158
-rw-r--r--widgets/misc/e-filter-bar.h24
-rw-r--r--widgets/misc/e-search-bar.c898
-rw-r--r--widgets/misc/e-search-bar.h60
-rw-r--r--widgets/table/e-tree-table-adapter.c2
7 files changed, 682 insertions, 496 deletions
diff --git a/widgets/ChangeLog b/widgets/ChangeLog
index 952c71177d..3cb3ceb474 100644
--- a/widgets/ChangeLog
+++ b/widgets/ChangeLog
@@ -1,3 +1,37 @@
+2006-06-30 Johnny Jacob <jjohnny@novell.com>
+ * misc/Makefile.am: Added e-icon-entry.c, e-icon-entry.h
+ * misc/e-filter-bar.c: (rule_advanced_response),
+ (save_search_dialog), (menubar_activated), (option_changed),
+ (dup_item_no_subitems), (build_items), (free_built_items),
+ (free_items), (set_menu), (get_property), (e_filter_bar_new):
+ * misc/e-filter-bar.h:
+ * misc/e-search-bar.c: (set_find_now_sensitive),
+ (clear_search), (emit_search_activated), (search_now_verb_cb),
+ (clear_verb_cb), (setup_standard_verbs), (search_verb_cb),
+ (get_selected_item_label), (entry_focus_in_cb),
+ (entry_focus_out_cb), (entry_activated_cb), (entry_changed_cb),
+ (viewitem_activated_cb), (scopeitem_activated_cb),
+ (option_activated_cb), (option_button_clicked_cb),
+ (clear_button_clicked_cb), (scopeoption_changed_cb), (set_menu),
+ (set_option), (impl_get_property), (impl_set_property),
+ (impl_dispose), (class_init), (init), (e_search_bar_construct),
+ (e_search_bar_set_viewoption_menufunc),
+ (e_search_bar_set_viewoption_menu),
+ (e_search_bar_get_selected_viewitem),
+ (e_search_bar_set_viewoption), (e_search_bar_set_scopeoption),
+ (e_search_bar_set_scopeoption_menu),
+ (e_search_bar_set_viewitem_id), (e_search_bar_set_item_id),
+ (e_search_bar_set_search_scope), (e_search_bar_get_item_id),
+ (e_search_bar_get_search_scope), (e_search_bar_get_viewitem_id),
+ (e_search_bar_set_ids), (e_search_bar_set_text),
+ (e_search_bar_get_text):
+ * misc/e-search-bar.h:
+ * table/e-tree-table-adapter.c:
+ (e_tree_table_adapter_save_expanded_state): Added code for search
+ ui.
+ * misc/e-icon-entry.c : Added.
+ * misc/e-icon-entry.h : Added.
+
2006-06-20 Harish Krishnaswamy <kharish@novell.com>
* e-timezone-dialog/e-timezone-dialog.c
diff --git a/widgets/misc/Makefile.am b/widgets/misc/Makefile.am
index 3cc799964f..559f426a28 100644
--- a/widgets/misc/Makefile.am
+++ b/widgets/misc/Makefile.am
@@ -50,6 +50,7 @@ widgetsinclude_HEADERS = \
e-dateedit.h \
e-dropdown-button.h \
e-expander.h \
+ e-icon-entry.h \
e-image-chooser.h \
e-info-label.h \
e-map.h \
@@ -97,6 +98,7 @@ libemiscwidgets_la_SOURCES = \
e-dateedit.c \
e-dropdown-button.c \
e-expander.c \
+ e-icon-entry.c \
e-image-chooser.c \
e-info-label.c \
e-map.c \
diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c
index 75d1b0d9e3..a67554b29a 100644
--- a/widgets/misc/e-filter-bar.c
+++ b/widgets/misc/e-filter-bar.c
@@ -125,6 +125,7 @@ rule_advanced_response (GtkWidget *dialog, int response, void *data)
gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
+ gtk_widget_show (esb->clear_button);
if (response == GTK_RESPONSE_APPLY) {
if (!rule_context_find_rule (efb->context, rule->name, rule->source))
@@ -189,13 +190,57 @@ do_advanced (ESearchBar *esb)
}
static void
+save_search_dialog (ESearchBar *esb)
+{
+ FilterRule *rule;
+ char *name, *text;
+ GtkWidget *dialog, *w;
+
+ EFilterBar *efb = (EFilterBar *)esb;
+
+ rule = filter_rule_clone (efb->current_query);
+ text = e_search_bar_get_text (esb);
+ name = g_strdup_printf ("%s %s", rule->name, text && text[0] ? text : "''");
+ filter_rule_set_name (rule, name);
+ g_free (text);
+ g_free (name);
+
+ w = filter_rule_get_widget (rule, efb->context);
+ filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
+ gtk_container_set_border_width (GTK_CONTAINER (w), 12);
+
+ /* FIXME: get the toplevel window... */
+ dialog = gtk_dialog_new_with_buttons (_("Save Search"), NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
+ GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
+ GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
+ efb->save_dialog = dialog;
+ gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
+ gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
+
+ gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
+
+ gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), w, TRUE, TRUE, 0);
+
+ g_object_ref (rule);
+ g_object_set_data_full ((GObject *) dialog, "rule", rule, (GDestroyNotify) g_object_unref);
+ g_signal_connect (dialog, "response", G_CALLBACK (rule_editor_response), efb);
+ g_object_weak_ref ((GObject *) dialog, (GWeakNotify) rule_editor_destroyed, efb);
+
+ e_search_bar_set_menu_sensitive (esb, E_FILTERBAR_SAVE_ID, FALSE);
+ gtk_widget_set_sensitive (esb->entry, FALSE);
+
+ gtk_widget_show (dialog);
+}
+
+static void
menubar_activated (ESearchBar *esb, int id, void *data)
{
EFilterBar *efb = (EFilterBar *)esb;
GtkWidget *dialog, *w;
d(printf ("menubar activated!\n"));
-
+
switch (id) {
case E_FILTERBAR_EDIT_ID:
if (!efb->save_dialog) {
@@ -208,44 +253,8 @@ menubar_activated (ESearchBar *esb, int id, void *data)
}
break;
case E_FILTERBAR_SAVE_ID:
- if (efb->current_query && !efb->save_dialog) {
- FilterRule *rule;
- char *name, *text;
-
- rule = filter_rule_clone (efb->current_query);
- text = e_search_bar_get_text (esb);
- name = g_strdup_printf ("%s %s", rule->name, text && text[0] ? text : "''");
- filter_rule_set_name (rule, name);
- g_free (text);
- g_free (name);
-
- w = filter_rule_get_widget (rule, efb->context);
- filter_rule_set_source (rule, FILTER_SOURCE_INCOMING);
- gtk_container_set_border_width (GTK_CONTAINER (w), 12);
-
- /* FIXME: get the toplevel window... */
- dialog = gtk_dialog_new_with_buttons (_("Save Search"), NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT,
- GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,
- GTK_STOCK_OK, GTK_RESPONSE_OK, NULL);
- efb->save_dialog = dialog;
- gtk_dialog_set_has_separator (GTK_DIALOG (dialog), FALSE);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), 0);
- gtk_container_set_border_width (GTK_CONTAINER (GTK_DIALOG (dialog)->action_area), 12);
-
- gtk_window_set_default_size (GTK_WINDOW (dialog), 500, 300);
-
- gtk_box_pack_start (GTK_BOX (GTK_DIALOG (dialog)->vbox), w, TRUE, TRUE, 0);
-
- g_object_ref (rule);
- g_object_set_data_full ((GObject *) dialog, "rule", rule, (GDestroyNotify) g_object_unref);
- g_signal_connect (dialog, "response", G_CALLBACK (rule_editor_response), efb);
- g_object_weak_ref ((GObject *) dialog, (GWeakNotify) rule_editor_destroyed, efb);
-
- e_search_bar_set_menu_sensitive (esb, E_FILTERBAR_SAVE_ID, FALSE);
- gtk_widget_set_sensitive (esb->entry, FALSE);
-
- gtk_widget_show (dialog);
- }
+ if (efb->current_query && !efb->save_dialog)
+ save_search_dialog (esb);
d(printf("Save menu\n"));
break;
@@ -289,8 +298,12 @@ option_changed (ESearchBar *esb, void *data)
if (efb->setquery)
return;
-
+
switch (id) {
+ case E_FILTERBAR_SAVE_ID:
+ /* Fixme */
+ /* save_search_dialog (esb); */
+ break;
case E_FILTERBAR_ADVANCED_ID:
d(printf ("do_advanced\n"));
do_advanced (esb);
@@ -299,7 +312,7 @@ option_changed (ESearchBar *esb, void *data)
if (id >= efb->option_base && id < efb->option_base + efb->option_rules->len) {
efb->current_query = (FilterRule *)efb->option_rules->pdata[id - efb->option_base];
if (efb->config && efb->current_query) {
- g_object_get (G_OBJECT (esb), "text", &query, NULL);
+ query = e_search_bar_get_text (esb);
efb->config (efb, efb->current_query, id, query, efb->config_data);
g_free (query);
}
@@ -318,11 +331,9 @@ static void
dup_item_no_subitems (ESearchBarItem *dest,
const ESearchBarItem *src)
{
- g_assert (src->subitems == NULL);
-
dest->id = src->id;
dest->text = g_strdup (src->text);
- dest->subitems = NULL;
+ dest->type = src->type;
}
static GArray *
@@ -356,7 +367,7 @@ build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrA
}
*start = id;
-
+
if (type == 0) {
source = FILTER_SOURCE_INCOMING;
@@ -364,7 +375,7 @@ build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrA
if (rule_context_next_rule (efb->context, rule, source) != NULL) {
item.id = 0;
item.text = NULL;
- item.subitems = NULL;
+ item.type = 0;
g_array_append_vals (menu, &item, 1);
}
} else {
@@ -381,8 +392,6 @@ build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrA
} else {
item.text = g_strdup (rule->name);
}
-
- item.subitems = NULL;
g_array_append_vals (menu, &item, 1);
if (g_slist_find(gtksux, rule) == NULL) {
@@ -410,17 +419,19 @@ build_items (ESearchBar *esb, ESearchBarItem *items, int type, int *start, GPtrA
/* always add on the advanced menu */
if (type == 1) {
- ESearchBarItem sb_items[2] = { E_FILTERBAR_SEPARATOR, E_FILTERBAR_ADVANCED };
+ ESearchBarItem sb_items[2] = { E_FILTERBAR_SEPARATOR, E_FILTERBAR_ADVANCED,
+ /* E_FILTERBAR_SEPARATOR, E_FILTERBAR_SAVE */ };
ESearchBarItem dup_items[2];
dup_item_no_subitems (&dup_items[0], &sb_items[0]);
dup_item_no_subitems (&dup_items[1], &sb_items[1]);
+ /* dup_item_no_subitems (&dup_items[2], &sb_items[2]); */
+ /* dup_item_no_subitems (&dup_items[3], &sb_items[3]); */
g_array_append_vals (menu, &dup_items, 2);
}
item.id = -1;
item.text = NULL;
- item.subitems = NULL;
g_array_append_vals (menu, &item, 1);
return menu;
@@ -436,8 +447,6 @@ free_built_items (GArray *menu)
item = & g_array_index (menu, ESearchBarItem, i);
g_free (item->text);
-
- g_assert (item->subitems == NULL);
}
g_array_free (menu, TRUE);
@@ -454,39 +463,14 @@ generate_menu (ESearchBar *esb, ESearchBarItem *items)
free_built_items (menu);
}
-static ESearchBarSubitem *
-copy_subitems (ESearchBarSubitem *subitems)
-{
- ESearchBarSubitem *items;
- int i, num;
-
- for (num = 0; subitems[num].id != -1; num++)
- ;
-
- items = g_new (ESearchBarSubitem, num + 1);
- for (i = 0; i < num + 1; i++) {
- items[i].text = g_strdup (subitems[i].text);
- items[i].id = subitems[i].id;
- items[i].translate = subitems[i].translate;
- }
-
- return items;
-}
-
static void
free_items (ESearchBarItem *items)
{
int i, j;
- for (i = 0; items[i].id != -1; i++) {
+ for (i = 0; items[i].id != -1; i++)
g_free (items[i].text);
- if (items[i].subitems) {
- for (j = 0; items[i].subitems[j].id != -1; j++)
- g_free (items[i].subitems[j].text);
-
- g_free (items[i].subitems);
- }
- }
+
g_free (items);
}
@@ -509,10 +493,7 @@ set_menu (ESearchBar *esb, ESearchBarItem *items)
for (i = 0; i < num + 1; i++) {
default_items[i].text = g_strdup (items[i].text);
default_items[i].id = items[i].id;
- if (items[i].subitems)
- default_items[i].subitems = copy_subitems (items[i].subitems);
- else
- default_items[i].subitems = NULL;
+ default_items[i].type = items[i].type;
}
efb->default_items = default_items;
@@ -586,7 +567,7 @@ get_property (GObject *object, guint property_id, GValue *value, GParamSpec *psp
case PROP_STATE: {
/* FIXME: we should have ESearchBar save its own state to the xmlDocPtr */
char *xmlbuf, *text, buf[12];
- int subitem_id, item_id, n;
+ int searchscope, item_id, n;
xmlNodePtr root, node;
xmlDocPtr doc;
@@ -603,14 +584,14 @@ get_property (GObject *object, guint property_id, GValue *value, GParamSpec *psp
} else {
/* simple query, save the searchbar state */
text = e_search_bar_get_text ((ESearchBar *) efb);
- subitem_id = e_search_bar_get_subitem_id ((ESearchBar *) efb);
+ searchscope = e_search_bar_get_search_scope ((ESearchBar *) efb);
node = xmlNewChild (root, NULL, "search-bar", NULL);
xmlSetProp (node, "text", text ? text : "");
sprintf (buf, "%d", item_id);
xmlSetProp (node, "item_id", buf);
- sprintf (buf, "%d", subitem_id);
- xmlSetProp (node, "subitem_id", buf);
+ sprintf (buf, "%d", searchscope);
+ xmlSetProp (node, "searchscope", buf);
g_free (text);
}
@@ -889,6 +870,9 @@ e_filter_bar_new (RuleContext *context,
bar->systemrules = g_strdup (systemrules);
bar->userrules = g_strdup (userrules);
+ bar->all_account_search_vf = NULL;
+ bar->account_search_vf = NULL;
+
e_search_bar_construct ((ESearchBar *)bar, &item, &item);
g_signal_connect (context, "changed", G_CALLBACK (context_changed), bar);
diff --git a/widgets/misc/e-filter-bar.h b/widgets/misc/e-filter-bar.h
index 4b85a36d79..2b1ff53416 100644
--- a/widgets/misc/e-filter-bar.h
+++ b/widgets/misc/e-filter-bar.h
@@ -21,6 +21,7 @@
#define __E_FILTER_BAR_H__
#include <gtk/gtk.h>
+#include <camel/camel-vee-folder.h>
#include "e-search-bar.h"
@@ -55,14 +56,13 @@ typedef void (*EFilterBarConfigRule)(EFilterBar *, FilterRule *rule, int id, con
struct _EFilterBar {
ESearchBar parent;
-
int menu_base, option_base;
GPtrArray *menu_rules, *option_rules;
ESearchBarItem *default_items;
GtkWidget *save_dialog; /* current save dialogue (so we dont pop up multiple ones) */
-
+
FilterRule *current_query; /* as it says */
int setquery; /* true when we're setting a query directly to advanced, so dont popup the dialog */
@@ -72,6 +72,10 @@ struct _EFilterBar {
EFilterBarConfigRule config;
void *config_data;
+
+ CamelVeeFolder *all_account_search_vf;
+ CamelVeeFolder *account_search_vf;
+
};
struct _EFilterBarClass
@@ -87,12 +91,20 @@ enum {
/* preset option options */
E_FILTERBAR_ADVANCED_ID = -5,
+ E_FILTERBAR_CURRENT_MESSAGE_ID = -6,
+ E_FILTERBAR_CURRENT_FOLDER_ID = -7,
+ E_FILTERBAR_CURRENT_ACCOUNT_ID = -8,
+ E_FILTERBAR_ALL_ACCOUNTS_ID = -9,
};
-#define E_FILTERBAR_SAVE { N_("_Save Search..."), E_FILTERBAR_SAVE_ID, NULL }
-#define E_FILTERBAR_EDIT { N_("_Edit Saved Searches..."), E_FILTERBAR_EDIT_ID, NULL }
-#define E_FILTERBAR_ADVANCED { N_("_Advanced Search..."), E_FILTERBAR_ADVANCED_ID, NULL }
-#define E_FILTERBAR_SEPARATOR { NULL, 0, NULL }
+#define E_FILTERBAR_SAVE { N_("_Save Search..."), E_FILTERBAR_SAVE_ID, 0 }
+#define E_FILTERBAR_EDIT { N_("_Edit Saved Searches..."), E_FILTERBAR_EDIT_ID, 0 }
+#define E_FILTERBAR_ADVANCED { N_("_Advanced Search..."), E_FILTERBAR_ADVANCED_ID, 0 }
+#define E_FILTERBAR_ALL_ACCOUNTS { N_("All Accounts"), E_FILTERBAR_ALL_ACCOUNTS_ID, ESB_ITEMTYPE_RADIO }
+#define E_FILTERBAR_CURRENT_ACCOUNT { N_("Current Account"), E_FILTERBAR_CURRENT_ACCOUNT_ID, ESB_ITEMTYPE_RADIO }
+#define E_FILTERBAR_CURRENT_FOLDER { N_("Current Folder"), E_FILTERBAR_CURRENT_FOLDER_ID, ESB_ITEMTYPE_RADIO }
+#define E_FILTERBAR_CURRENT_MESSAGE { N_("Current Message"), E_FILTERBAR_CURRENT_MESSAGE_ID, ESB_ITEMTYPE_RADIO }
+#define E_FILTERBAR_SEPARATOR { NULL, 0, NULL, 0 }
#ifdef JUST_FOR_TRANSLATORS
const char * strings[] = {
diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c
index f0895dbdbb..f0b77efd5c 100644
--- a/widgets/misc/e-search-bar.c
+++ b/widgets/misc/e-search-bar.c
@@ -8,7 +8,6 @@
* Chris Lahey <clahey@ximian.com>
* Ettore Perazzoli <ettore@ximian.com>
* Jon Trowbridge <trow@ximian.com>
-
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of version 2 of the GNU General Public
@@ -34,6 +33,8 @@
#include <gtk/gtkeventbox.h>
#include <gtk/gtkmenuitem.h>
#include <gtk/gtkoptionmenu.h>
+#include <gtk/gtkradiomenuitem.h>
+#include <gtk/gtkstock.h>
#include <gtk/gtkmain.h>
#include <gtk/gtkversion.h>
@@ -47,6 +48,7 @@
#include <stdlib.h>
#include <string.h>
+#include "e-icon-entry.h"
#include "e-search-bar.h"
#include "e-util/e-util-marshal.h"
#include "e-util/e-icon-factory.h"
@@ -55,7 +57,7 @@ enum {
QUERY_CHANGED,
MENU_ACTIVATED,
SEARCH_ACTIVATED,
-
+ SEARCH_CLEARED,
LAST_SIGNAL
};
@@ -75,7 +77,6 @@ enum {
/* Forward decls. */
static int find_id (GtkWidget *menu, int idin, const char *type, GtkWidget **widget);
-static void activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems);
static void emit_search_activated (ESearchBar *esb);
static void emit_query_changed (ESearchBar *esb);
@@ -91,8 +92,6 @@ set_find_now_sensitive (ESearchBar *search_bar,
bonobo_ui_component_set_prop (search_bar->ui_component,
"/commands/ESearchBar:FindNow",
"sensitive", sensitive ? "1" : "0", NULL);
-
- gtk_widget_set_sensitive (search_bar->activate_button, sensitive);
}
static char *
@@ -107,36 +106,13 @@ verb_name_from_id (int id)
static void
clear_search (ESearchBar *esb)
{
- GtkWidget *widget;
- ESearchBarSubitem *subitems;
-
e_search_bar_set_text (esb, "");
e_search_bar_set_item_id (esb, 0);
-
- find_id (esb->option_menu, 0, "EsbChoiceId", &widget);
-
- subitems = g_object_get_data (G_OBJECT (widget), "EsbChoiceSubitems");
- activate_by_subitems (esb, 0, subitems);
+ e_search_bar_set_viewitem_id (esb, 0);
emit_search_activated (esb);
}
-/* Frees an array of subitem information */
-static void
-free_subitems (ESearchBarSubitem *subitems)
-{
- ESearchBarSubitem *s;
-
- g_assert (subitems != NULL);
-
- for (s = subitems; s->id != -1; s++) {
- if (s->text)
- g_free (s->text);
- }
-
- g_free (subitems);
-}
-
static void
free_menu_items (ESearchBar *esb)
{
@@ -171,7 +147,7 @@ emit_query_changed (ESearchBar *esb)
}
static void
-emit_search_activated (ESearchBar *esb)
+emit_search_activated(ESearchBar *esb)
{
if (esb->pending_activate) {
g_source_remove (esb->pending_activate);
@@ -204,14 +180,18 @@ search_now_verb_cb (BonoboUIComponent *ui_component,
const char *text;
esb = E_SEARCH_BAR (data);
- text = gtk_entry_get_text (GTK_ENTRY (esb->entry));
+ text = e_search_bar_get_text (esb);
if (text && *text) {
gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (esb->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+
} else {
gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
}
emit_search_activated (esb);
@@ -227,7 +207,8 @@ clear_verb_cb (BonoboUIComponent *ui_component,
gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
-
+ gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
+
clear_search (esb);
}
@@ -246,7 +227,7 @@ setup_standard_verbs (ESearchBar *search_bar)
"</commands>"),
NULL);
- /* Make sure the entries are created with the correct sensitivity. */
+ /* Make sure the entries are created with the correct sensitivity. */
set_find_now_sensitive (search_bar, FALSE);
}
@@ -267,9 +248,68 @@ search_verb_cb (BonoboUIComponent *ui_component,
g_assert (p != NULL);
id = atoi (p + 1);
+
emit_menu_activated (esb, id);
}
+/* Get the selected menu item's label */
+static const gchar *
+get_selected_item_label (GtkWidget *menu)
+{
+ GtkWidget *label, *item;
+ const gchar *text = NULL;
+
+ item = gtk_menu_get_active ((GtkMenu *)menu);
+ label = gtk_bin_get_child ((GtkBin *)item);
+
+ if (GTK_IS_LABEL (label))
+ text = gtk_label_get_text ((GtkLabel *)label);
+
+ return text;
+}
+
+static gboolean
+entry_focus_in_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ ESearchBar *esb)
+{
+ GtkStyle *entry_style, *default_style;
+
+ entry_style = gtk_widget_get_style (esb->entry);
+ default_style = gtk_widget_get_default_style ();
+
+ if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE]))) {
+ gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
+ gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
+ }
+
+ return FALSE;
+}
+
+static gboolean
+entry_focus_out_cb (GtkWidget *widget,
+ GdkEventFocus *event,
+ ESearchBar *esb)
+{
+ GtkStyle *style = gtk_widget_get_default_style ();
+ const gchar *text = NULL;
+
+ if (!GTK_IS_RADIO_MENU_ITEM (gtk_menu_get_active ( GTK_MENU (esb->option_menu))))
+ return FALSE;
+
+ text = gtk_entry_get_text (GTK_ENTRY (widget));
+ if (!(text && *text)) {
+ /* no query in search entry .. so set the current option */
+ text = get_selected_item_label (esb->option_menu);
+ if (text && *text) {
+ gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_INSENSITIVE]));
+ gtk_entry_set_text (GTK_ENTRY (esb->entry), text);
+ gtk_widget_hide (esb->clear_button);
+ }
+ }
+ return FALSE;
+}
+
static void
entry_activated_cb (GtkWidget *widget,
ESearchBar *esb)
@@ -278,11 +318,14 @@ entry_activated_cb (GtkWidget *widget,
GtkStyle *style = gtk_widget_get_default_style ();
if (text && *text) {
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
+ gtk_widget_modify_base (esb->viewoption, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
} else {
gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
+ gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
}
emit_search_activated (esb);
@@ -292,24 +335,65 @@ static void
entry_changed_cb (GtkWidget *widget,
ESearchBar *esb)
{
- set_find_now_sensitive (esb, TRUE);
+ const char *text = gtk_entry_get_text (GTK_ENTRY (esb->entry));
+ GtkStyle *entry_style, *default_style;
+
+ entry_style = gtk_widget_get_style (esb->entry);
+ default_style = gtk_widget_get_default_style ();
+
+ if (text && *text)
+ if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE])))
+ gtk_widget_hide (esb->clear_button);
+ else
+ gtk_widget_show (esb->clear_button);
+ else
+ gtk_widget_hide (esb->clear_button);
}
static void
-subitem_activated_cb (GtkWidget *widget, ESearchBar *esb)
+viewitem_activated_cb(GtkWidget *widget, ESearchBar *esb)
{
- gint id, subid;
+ gint viewid;
+ GtkStyle *entry_style, *default_style;
+
+ widget = gtk_menu_get_active (GTK_MENU (esb->viewoption_menu));
+
+ viewid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId"));
+ esb->viewitem_id = viewid;
- id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId"));
- subid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbSubitemId"));
+ entry_style = gtk_widget_get_style (esb->entry);
+ default_style = gtk_widget_get_default_style ();
+
+ /* If the text is grayed, Its not the query string */
+ if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE]))) {
+ gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
+ gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
+ }
- esb->item_id = id;
- esb->subitem_id = subid;
emit_search_activated (esb);
+}
- set_find_now_sensitive (esb, FALSE);
-
- gtk_widget_grab_focus (esb->entry);
+static void
+scopeitem_activated_cb(GtkWidget *widget, ESearchBar *esb)
+{
+ gint scopeid;
+ GtkStyle *entry_style, *default_style;
+
+ widget = gtk_menu_get_active (GTK_MENU (esb->scopeoption_menu));
+
+ scopeid = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId"));
+ esb->scopeitem_id = scopeid;
+
+ entry_style = gtk_widget_get_style (esb->entry);
+ default_style = gtk_widget_get_default_style ();
+
+ /* If the text is grayed, Its not the query string */
+ if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE]))) {
+ gtk_entry_set_text (GTK_ENTRY (esb->entry), "");
+ gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
+ }
+
+ emit_search_activated (esb);
}
static char *
@@ -339,170 +423,45 @@ string_without_underscores (const char *s)
}
static void
-activate_by_subitems (ESearchBar *esb, gint item_id, ESearchBarSubitem *subitems)
-{
- if (subitems == NULL) {
- /* This item uses the entry. */
-
- /* Remove the menu */
- if (esb->suboption && esb->subitem_id != -1) {
- g_assert (esb->suboption->parent == esb->entry_box);
- g_assert (!esb->entry || esb->entry->parent == NULL);
- gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->suboption);
- }
-
- /* Create and add the entry */
-
- if (esb->entry == NULL) {
- AtkObject *a11y;
-
- esb->entry = gtk_entry_new();
- gtk_widget_set_size_request (esb->entry, 4, -1);
- g_object_ref (esb->entry);
- g_signal_connect (esb->entry, "changed",
- G_CALLBACK (entry_changed_cb), esb);
- g_signal_connect (esb->entry, "activate",
- G_CALLBACK (entry_activated_cb), esb);
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
- gtk_widget_show(esb->entry);
-
- a11y = gtk_widget_get_accessible (esb->entry);
- /* To translators: This is the accessibility name of
- the search bar's text entry widget */
- atk_object_set_name (a11y, _("Search"));
-
- esb->subitem_id = -1;
- }
-
- if (esb->subitem_id == -1) {
- g_assert (esb->entry->parent == esb->entry_box);
- g_assert (!esb->suboption || esb->suboption->parent == NULL);
- } else {
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->entry);
- gtk_widget_grab_focus (esb->entry);
-
- esb->subitem_id = -1;
-
- }
- } else {
- /* This item uses a submenu */
- GtkWidget *menu;
- GtkWidget *menu_item;
- gint i;
-
- /* Remove the entry */
- if (esb->entry && esb->subitem_id == -1) {
- g_assert (esb->entry->parent == esb->entry_box);
- g_assert (!esb->suboption || esb->suboption->parent == NULL);
- gtk_container_remove (GTK_CONTAINER (esb->entry_box), esb->entry);
- }
-
- /* Create and add the menu */
-
- if (esb->suboption == NULL) {
- esb->suboption = gtk_option_menu_new ();
- g_object_ref (esb->suboption);
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
- gtk_widget_show (esb->suboption);
-
- esb->subitem_id = subitems[0].id;
- }
-
- if (esb->subitem_id != -1) {
- g_assert (esb->suboption->parent == esb->entry_box);
- g_assert (!esb->entry || esb->entry->parent == NULL);
- } else {
- gtk_container_add (GTK_CONTAINER (esb->entry_box), esb->suboption);
- esb->subitem_id = subitems[0].id;
- }
-
- /* Create the items */
-
- esb->suboption_menu = menu = gtk_menu_new ();
- for (i = 0; subitems[i].id != -1; ++i) {
- if (subitems[i].text) {
- char *str;
-
- if (subitems[i].translate)
- str = string_without_underscores (_(subitems[i].text));
- else
- str = string_without_underscores (subitems[i].text);
-
- menu_item = gtk_menu_item_new_with_label (str);
-
- g_free (str);
- } else {
- menu_item = gtk_menu_item_new ();
- gtk_widget_set_sensitive (menu_item, FALSE);
- }
-
- g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
- GINT_TO_POINTER (item_id));
- g_object_set_data (G_OBJECT (menu_item), "EsbSubitemId",
- GINT_TO_POINTER (subitems[i].id));
-
- g_signal_connect (menu_item,
- "activate",
- G_CALLBACK (subitem_activated_cb),
- esb);
-
- gtk_widget_show (menu_item);
- gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
- }
-
- gtk_option_menu_remove_menu (GTK_OPTION_MENU (esb->suboption));
- gtk_option_menu_set_menu (GTK_OPTION_MENU (esb->suboption), menu);
- }
-
- if (esb->activate_button)
- gtk_widget_set_sensitive (esb->activate_button, subitems == NULL);
-}
-
-static void
option_activated_cb (GtkWidget *widget,
ESearchBar *esb)
{
- int id;
-
- id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbChoiceId"));
+/* int id; */
+
+/* id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), "EsbItemId")); */
- activate_by_subitems (esb, id, g_object_get_data (G_OBJECT (widget), "EsbChoiceSubitems"));
-
- esb->item_id = id;
+/* esb->item_id = id; */
emit_query_changed (esb);
+ emit_search_activated (esb);
}
static void
-activate_button_clicked_cb (GtkWidget *widget,
- ESearchBar *esb)
+option_button_clicked_cb (GtkWidget *widget, GdkEventButton *event,
+ ESearchBar *esb)
{
- const char *text = gtk_entry_get_text (GTK_ENTRY (esb->entry));
- GtkStyle *style = gtk_widget_get_default_style ();
-
- if (text && *text) {
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, &(style->base[GTK_STATE_SELECTED]));
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, &(style->text[GTK_STATE_SELECTED]));
- } else {
- gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
- gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
- }
- emit_search_activated (esb);
+ gtk_menu_popup (GTK_MENU (esb->option_menu), NULL, NULL, NULL, NULL,1,gtk_get_current_event_time());
gtk_widget_grab_focus (esb->entry);
}
static void
-clear_button_clicked_cb (GtkWidget *widget,
+clear_button_clicked_cb (GtkWidget *widget, GdkEventButton *event,
ESearchBar *esb)
{
gtk_widget_modify_base (esb->entry, GTK_STATE_NORMAL, NULL);
gtk_widget_modify_text (esb->entry, GTK_STATE_NORMAL, NULL);
-
+ gtk_widget_modify_base (esb->icon_entry, GTK_STATE_NORMAL, NULL);
+
clear_search (esb);
gtk_widget_grab_focus (esb->entry);
}
+static void
+scopeoption_changed_cb (GtkWidget *option_menu, ESearchBar *search_bar)
+{
+ emit_query_changed (search_bar);
+}
/* Widgetry creation. */
@@ -523,30 +482,6 @@ put_in_spacer_widget (GtkWidget *widget)
return holder;
}
-static ESearchBarSubitem *
-copy_subitems (ESearchBarSubitem *subitems)
-{
- gint i, N;
- ESearchBarSubitem *copy;
-
- if (subitems == NULL)
- return NULL;
-
- for (N=0; subitems[N].id != -1; ++N);
- copy = g_new (ESearchBarSubitem, N+1);
-
- for (i=0; i<N; ++i) {
- copy[i].text = g_strdup (subitems[i].text);
- copy[i].id = subitems[i].id;
- copy[i].translate = subitems[i].translate;
- }
-
- copy[N].text = NULL;
- copy[N].id = -1;
-
- return copy;
-}
-
static void
append_xml_menu_item (GString *xml,
const char *name,
@@ -643,12 +578,10 @@ set_menu (ESearchBar *esb,
for (i = 0; items[i].id != -1; i++) {
ESearchBarItem *new_item;
- g_assert (items[i].subitems == NULL);
-
new_item = g_new (ESearchBarItem, 1);
new_item->text = items[i].text ? g_strdup (_(items[i].text)) : NULL;
new_item->id = items[i].id;
- new_item->subitems = NULL;
+ new_item->type = items[i].type;
esb->menu_items = g_slist_append (esb->menu_items, new_item);
}
@@ -657,50 +590,59 @@ set_menu (ESearchBar *esb,
update_bonobo_menus (esb);
}
-/* Callback used when an option item is destroyed. We have to destroy its
- * suboption items.
- */
-static void
-option_item_destroy_cb (GtkObject *object, gpointer data)
-{
- ESearchBarSubitem *subitems;
+/* /\* Callback used when an option item is destroyed. We have to destroy its */
+/* * suboption items. */
+/* *\/ */
+/* static void */
+/* option_item_destroy_cb (GtkObject *object, gpointer data) */
+/* { */
+/* /\* ESearchBarSubitem *subitems; *\/ */
- subitems = data;
+/* /\* subitems = data; *\/ */
- g_assert (subitems != NULL);
- free_subitems (subitems);
- g_object_set_data (G_OBJECT (object), "EsbChoiceSubitems", NULL);
-}
+/* /\* g_assert (subitems != NULL); *\/ */
+/* /\* free_subitems (subitems); *\/ */
+/* /\* g_object_set_data (G_OBJECT (object), "EsbChoiceSubitems", NULL); *\/ */
+/* } */
static void
set_option (ESearchBar *esb, ESearchBarItem *items)
{
GtkWidget *menu;
+ GSList *group = NULL;
int i;
- if (esb->option) {
+ if (esb->option)
gtk_widget_destroy (esb->option_menu);
- } else {
- AtkObject *a11y;
-
- esb->option = gtk_option_menu_new ();
- gtk_widget_show (esb->option);
- gtk_box_pack_start (GTK_BOX (esb), esb->option, FALSE, FALSE, 0);
- a11y = gtk_widget_get_accessible (esb->option);
- atk_object_set_name (a11y, _("Search Type"));
-
- }
esb->option_menu = menu = gtk_menu_new ();
for (i = 0; items[i].id != -1; i++) {
GtkWidget *item;
- ESearchBarSubitem *subitems = NULL;
+
+ /* Create a new group */
+ if (items[i].id == 0)
+ group = 0;
if (items[i].text) {
char *str;
-
str = string_without_underscores (_(items[i].text));
- item = gtk_menu_item_new_with_label (str);
+ switch (items[i].type) {
+ case ESB_ITEMTYPE_NORMAL:
+ item = gtk_menu_item_new_with_label (str);
+ break;
+ case ESB_ITEMTYPE_CHECK:
+ item = gtk_check_menu_item_new_with_label (str);
+ break;
+ case ESB_ITEMTYPE_RADIO:
+ item = gtk_radio_menu_item_new_with_label (group, str);
+ group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM (item));
+ break;
+ default:
+ /* Fixme : this should be a normal item */
+ item = gtk_radio_menu_item_new_with_label (group, str);
+ group = gtk_radio_menu_item_get_group(GTK_RADIO_MENU_ITEM (item));
+ break;
+ }
g_free (str);
} else {
item = gtk_menu_item_new ();
@@ -709,17 +651,7 @@ set_option (ESearchBar *esb, ESearchBarItem *items)
gtk_menu_shell_append(GTK_MENU_SHELL(menu), item);
- g_object_set_data (G_OBJECT (item), "EsbChoiceId", GINT_TO_POINTER(items[i].id));
-
- if (items[i].subitems != NULL) {
- subitems = copy_subitems (items[i].subitems);
- g_object_set_data (G_OBJECT (item), "EsbChoiceSubitems", subitems);
- g_signal_connect (item, "destroy",
- G_CALLBACK (option_item_destroy_cb), subitems);
- }
-
- if (i == 0)
- activate_by_subitems (esb, items[i].id, subitems);
+ g_object_set_data (G_OBJECT (item), "EsbItemId", GINT_TO_POINTER(items[i].id));
g_signal_connect (item, "activate",
G_CALLBACK (option_activated_cb),
@@ -728,55 +660,9 @@ set_option (ESearchBar *esb, ESearchBarItem *items)
gtk_widget_show_all (menu);
- gtk_option_menu_set_menu (GTK_OPTION_MENU (esb->option), menu);
gtk_option_menu_set_history (GTK_OPTION_MENU (esb->option), 0);
- gtk_widget_set_sensitive (esb->option, TRUE);
-}
-
-static GtkWidget *
-add_button (ESearchBar *esb,
- const char *text,
- const char *stock,
- GCallback callback)
-{
- GtkWidget *holder;
- GtkWidget *button;
- GtkWidget *image;
-
-#if !GTK_CHECK_VERSION (2,6,0)
- GtkWidget *hbox = gtk_hbox_new (FALSE, 2);
- GtkWidget *label = gtk_label_new_with_mnemonic (text);
-
- gtk_misc_set_padding (GTK_MISC (label), 2, 0);
-#endif
-
- /* See the comment in `put_in_spacer_widget()' to understand
- why we have to do this. */
-
- image = gtk_image_new_from_stock (stock, GTK_ICON_SIZE_BUTTON);
- button = gtk_button_new_with_mnemonic (text);
-#if GTK_CHECK_VERSION (2,6,0)
- gtk_button_set_image (GTK_BUTTON (button), image);
-#else
- gtk_widget_show (image);
- gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, TRUE, 0);
- gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, TRUE, 0);
- gtk_widget_show (hbox);
-
- button = gtk_button_new ();
- gtk_container_add (GTK_CONTAINER (button), hbox);
-#endif
- gtk_widget_show (button);
-
- holder = put_in_spacer_widget (button);
- gtk_widget_show (holder);
-
- g_signal_connect (G_OBJECT (button), "clicked", callback, esb);
-
- gtk_box_pack_end (GTK_BOX (esb), holder, FALSE, FALSE, 1);
-
- return button;
+ entry_focus_out_cb (esb->entry, NULL, esb);
}
static int
@@ -814,10 +700,6 @@ impl_get_property (GObject *object, guint prop_id, GValue *value, GParamSpec *ps
g_value_set_int (value, e_search_bar_get_item_id (esb));
break;
- case PROP_SUBITEM_ID:
- g_value_set_int (value, e_search_bar_get_subitem_id (esb));
- break;
-
case PROP_TEXT:
g_value_set_string_take_ownership (value, e_search_bar_get_text (esb));
break;
@@ -838,10 +720,6 @@ impl_set_property (GObject *object, guint prop_id, const GValue *value, GParamSp
e_search_bar_set_item_id (esb, g_value_get_int (value));
break;
- case PROP_SUBITEM_ID:
- e_search_bar_set_subitem_id (esb, g_value_get_int (value));
- break;
-
case PROP_TEXT:
e_search_bar_set_text (esb, g_value_get_string (value));
break;
@@ -867,10 +745,10 @@ impl_dispose (GObject *object)
bonobo_object_unref (BONOBO_OBJECT (esb->ui_component));
esb->ui_component = NULL;
}
- if (esb->entry) {
- g_object_unref (esb->entry);
- esb->entry = NULL;
- }
+/* if (esb->entry) { */
+/* g_object_unref (esb->entry); */
+/* esb->entry = NULL; */
+/* } */
if (esb->suboption) {
g_object_unref (esb->suboption);
esb->suboption = NULL;
@@ -911,13 +789,6 @@ class_init (ESearchBarClass *klass)
0, 0, 0,
G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
- g_object_class_install_property (object_class, PROP_SUBITEM_ID,
- g_param_spec_int ("subitem_id",
- _("Subitem ID"),
- /*_( */"XXX blurb" /*)*/,
- 0, 0, 0,
- G_PARAM_READWRITE | G_PARAM_LAX_VALIDATION));
-
g_object_class_install_property (object_class, PROP_TEXT,
g_param_spec_string ("text",
_("Text"),
@@ -951,6 +822,7 @@ class_init (ESearchBarClass *klass)
NULL, NULL,
e_util_marshal_NONE__NONE,
G_TYPE_NONE, 0);
+
}
static void
@@ -965,14 +837,18 @@ init (ESearchBar *esb)
esb->option_menu = NULL;
esb->suboption_menu = NULL;
- esb->activate_button = NULL;
+ esb->option_button = NULL;
esb->clear_button = NULL;
esb->entry_box = NULL;
+ esb->scopeoption_menu = NULL;
+ esb->scopeoption = NULL;
+ esb->scopeoption_box = NULL;
+
esb->pending_activate = 0;
esb->item_id = 0;
- esb->subitem_id = 0;
+ esb->scopeitem_id = 0;
}
@@ -992,26 +868,88 @@ e_search_bar_construct (ESearchBar *search_bar,
ESearchBarItem *menu_items,
ESearchBarItem *option_items)
{
- GtkWidget *image;
+ GtkWidget *label, *hbox, *bighbox;
+
g_return_if_fail (search_bar != NULL);
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
g_return_if_fail (option_items != NULL);
- gtk_box_set_spacing (GTK_BOX (search_bar), 1);
-
- search_bar->clear_button = add_button (search_bar, _("_Clear"), "gtk-clear",
- G_CALLBACK (clear_button_clicked_cb));
- search_bar->activate_button = add_button (search_bar, _("Find No_w"), "gtk-find",
- G_CALLBACK (activate_button_clicked_cb));
+ gtk_box_set_spacing (GTK_BOX (search_bar), 3);
- e_search_bar_set_menu (search_bar, menu_items);
+ gtk_box_set_homogeneous (GTK_BOX (search_bar), FALSE);
+ bighbox = gtk_hbox_new (FALSE, 0);
search_bar->entry_box = gtk_hbox_new (0, FALSE);
+ search_bar->icon_entry = e_icon_entry_new ();
+ search_bar->entry = e_icon_entry_get_entry (E_ICON_ENTRY (search_bar->icon_entry));
+
+ g_signal_connect (search_bar->entry, "changed",
+ G_CALLBACK (entry_changed_cb), search_bar);
+ g_signal_connect (search_bar->entry, "activate",
+ G_CALLBACK (entry_activated_cb), search_bar);
+ g_signal_connect (search_bar->entry, "focus-in-event",
+ G_CALLBACK (entry_focus_in_cb), search_bar);
+ g_signal_connect (search_bar->entry, "focus-out-event",
+ G_CALLBACK (entry_focus_out_cb), search_bar);
+
+ search_bar->clear_button = e_icon_entry_create_button ("gtk-clear");
+ g_signal_connect (G_OBJECT (search_bar->clear_button), "button-press-event", clear_button_clicked_cb, search_bar);
+ e_icon_entry_pack_widget (E_ICON_ENTRY (search_bar->icon_entry), search_bar->clear_button, FALSE);
+
+ search_bar->option_button = e_icon_entry_create_button ("gtk-find");
+ g_signal_connect (G_OBJECT (search_bar->option_button), "button-press-event", option_button_clicked_cb, search_bar);
+ e_icon_entry_pack_widget (E_ICON_ENTRY (search_bar->icon_entry), search_bar->option_button, TRUE);
+
+ gtk_box_pack_start (GTK_BOX(search_bar->entry_box), search_bar->icon_entry, FALSE, FALSE, 0);
+
+ gtk_widget_show_all (search_bar->entry_box);
+ gtk_widget_hide (search_bar->clear_button);
+
+ /* Current View filter */
+ search_bar->viewoption_box = gtk_hbox_new (0, FALSE);
+
+ label = gtk_label_new_with_mnemonic (_("Show : "));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX(search_bar->viewoption_box), label, FALSE, FALSE, 0);
+
+ search_bar->viewoption = gtk_option_menu_new ();
+ gtk_box_pack_start (GTK_BOX(search_bar->viewoption_box), search_bar->viewoption, FALSE, TRUE, 0);
+ gtk_widget_show_all (search_bar->viewoption_box);
+ gtk_box_pack_start (GTK_BOX(search_bar), search_bar->viewoption_box, FALSE, FALSE, 0);
+
+ hbox = gtk_hbox_new (FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(search_bar), hbox, FALSE, FALSE, 0);
+
+ /* Search entry */
+ hbox = gtk_hbox_new (FALSE, 0);
+ label = gtk_label_new_with_mnemonic (_("S_earch : "));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 0);
+ gtk_box_pack_start (GTK_BOX(hbox), search_bar->entry_box, FALSE, FALSE, 0);
+ gtk_widget_show (search_bar->entry_box);
- e_search_bar_set_option (search_bar, option_items);
+ /* Search Scope Widgets */
+ search_bar->scopeoption_box = gtk_hbox_new (0, FALSE);
+ gtk_box_set_spacing (GTK_BOX (search_bar->scopeoption_box), 3);
+ label = gtk_label_new_with_mnemonic (_(" in "));
+ gtk_widget_show (label);
+ gtk_box_pack_start (GTK_BOX(search_bar->scopeoption_box), label, FALSE, FALSE, 0);
+
+ search_bar->scopeoption = gtk_option_menu_new ();
+ g_signal_connect (GTK_OPTION_MENU (search_bar->scopeoption), "changed", scopeoption_changed_cb, search_bar);
+ gtk_box_pack_start (GTK_BOX(search_bar->scopeoption_box), search_bar->scopeoption, FALSE, FALSE, 0);
+ gtk_widget_show_all (search_bar->scopeoption_box);
+ gtk_widget_hide (hbox);
+
+ gtk_box_pack_end (GTK_BOX(hbox), search_bar->scopeoption_box, FALSE, FALSE, 0);
+ gtk_widget_hide (search_bar->scopeoption_box);
+
+ gtk_box_pack_end (GTK_BOX(search_bar), hbox, FALSE, FALSE, 0);
+ gtk_widget_show (hbox);
- gtk_widget_show (search_bar->entry_box);
- gtk_box_pack_start (GTK_BOX(search_bar), search_bar->entry_box, TRUE, TRUE, 0);
+ /* Set the menu */
+ e_search_bar_set_menu (search_bar, menu_items);
+ e_search_bar_set_option (search_bar, option_items);
/*
* If the default choice for the option menu has subitems, then we need to
@@ -1020,11 +958,8 @@ e_search_bar_construct (ESearchBar *search_bar,
* so we can't emit here. Thus we launch a one-shot idle function that will
* emit the changed signal, so that the proper callback will get invoked.
*/
- if (search_bar->subitem_id >= 0) {
- gtk_widget_set_sensitive (search_bar->activate_button, FALSE);
- search_bar->pending_activate = g_idle_add (idle_activate_hack, search_bar);
- }
+ search_bar->pending_activate = g_idle_add (idle_activate_hack, search_bar);
}
void
@@ -1055,8 +990,14 @@ e_search_bar_set_option (ESearchBar *search_bar, ESearchBarItem *option_items)
((ESearchBarClass *) GTK_OBJECT_GET_CLASS (search_bar))->set_option (search_bar, option_items);
}
+void
+e_search_bar_set_viewoption_menufunc (ESearchBar *search_bar, ESearchBarMenuFunc *menu_gen_func, void *data)
+{
+ g_signal_connect (search_bar->viewoption, "button_press_event", G_CALLBACK (menu_gen_func), data);
+}
+
/**
- * e_search_bar_set_suboption:
+ * e_search_bar_set_viewoption_menu:
* @search_bar: A search bar.
* @option_id: Identifier of the main option menu item under which the subitems
* are to be set.
@@ -1064,41 +1005,155 @@ e_search_bar_set_option (ESearchBar *search_bar, ESearchBarItem *option_items)
*
* Sets the items for the secondary option menu of a search bar.
**/
-void
-e_search_bar_set_suboption (ESearchBar *search_bar, int option_id, ESearchBarSubitem *subitems)
+void
+e_search_bar_set_viewoption_menu (ESearchBar *search_bar, GtkWidget *menu)
{
- int row;
- GtkWidget *item;
- ESearchBarSubitem *old_subitems;
- ESearchBarSubitem *new_subitems;
+
+ if (search_bar->viewoption_menu != NULL)
+ gtk_option_menu_remove_menu (GTK_OPTION_MENU (search_bar->viewoption));
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ search_bar->viewoption_menu = menu;
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (search_bar->viewoption), search_bar->viewoption_menu);
+
+ g_signal_connect (search_bar->viewoption_menu,
+ "selection-done",
+ G_CALLBACK (viewitem_activated_cb),
+ search_bar);
+}
+
+GtkWidget *
+e_search_bar_get_selected_viewitem (ESearchBar *search_bar)
+{
+ GtkWidget *widget = NULL;
+
+ widget = gtk_menu_get_active (GTK_MENU (search_bar->viewoption_menu));
+
+ return widget;
+}
+
+/**
+ * e_search_bar_set_viewoption:
+ * @search_bar: A search bar.
+ * @option_id: Identifier of the main option menu item under which the subitems
+ * are to be set.
+ * @subitems: Array of subitem information.
+ *
+ * Sets the items for the secondary option menu of a search bar.
+ **/
+void
+e_search_bar_set_viewoption (ESearchBar *search_bar, int option_id, ESearchBarItem *subitems)
+{
+ GtkWidget *menu;
+ GtkWidget *menu_item;
+ gint i;
+
+ /* Create the menu if it is not there. right scenario ????*/
+
+ if (search_bar->viewoption_menu == NULL) {
+ search_bar->viewoption_menu = menu = gtk_menu_new ();
+ } else {
+ gtk_option_menu_remove_menu (GTK_OPTION_MENU (search_bar->viewoption));
+ search_bar->viewoption_menu = menu = gtk_menu_new ();
+ }
+
+ /* Create the items */
+
+ for (i = 0; subitems[i].id != -1; ++i) {
+ if (subitems[i].text) {
+ char *str = NULL;
+ str = string_without_underscores (subitems[i].text);
+ menu_item = gtk_menu_item_new_with_label (str);
+ g_free (str);
+ } else {
+ menu_item = gtk_menu_item_new ();
+ gtk_widget_set_sensitive (menu_item, FALSE);
+ }
+
+ g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
+ GINT_TO_POINTER (subitems[i].id));
+
+ g_signal_connect (menu_item,
+ "activate",
+ G_CALLBACK (viewitem_activated_cb),
+ search_bar);
+
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
+ }
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (search_bar->viewoption), menu);
+
+}
+
+/**
+ * e_search_bar_set_scopeoption:
+ * @search_bar: A search bar.
+ * are to be set.
+ * @scopeitems: Array of scope information.
+ *
+ * Sets the items for the search scope option menu of a search bar.
+ **/
+void
+e_search_bar_set_scopeoption (ESearchBar *search_bar, ESearchBarItem *scopeitems)
+{
+ GtkWidget *menu;
+ GtkWidget *menu_item;
+ gint i;
- row = find_id (search_bar->option_menu, option_id, "EsbChoiceId", &item);
- g_return_if_fail (row != -1);
- g_assert (item != NULL);
-
- old_subitems = g_object_get_data (G_OBJECT (item), "EsbChoiceSubitems");
- if (old_subitems) {
- /* This was connected in set_option() */
- g_signal_handlers_disconnect_matched (item,
- G_SIGNAL_MATCH_DATA,
- 0, 0, NULL, NULL,
- old_subitems);
- free_subitems (old_subitems);
- g_object_set_data (G_OBJECT (item), "EsbChoiceSubitems", NULL);
+ gtk_widget_show (search_bar->scopeoption_box);
+ if (search_bar->scopeoption_menu != NULL) {
+ gtk_option_menu_remove_menu (GTK_OPTION_MENU (search_bar->scopeoption));
+ }
+
+ search_bar->scopeoption_menu = menu = gtk_menu_new ();
+
+ /* Generate items */
+ for (i = 0; scopeitems[i].id != -1; ++i) {
+ if (scopeitems[i].text) {
+ char *str;
+ str = string_without_underscores (scopeitems[i].text);
+ menu_item = gtk_menu_item_new_with_label (str);
+ g_free (str);
+ } else {
+ menu_item = gtk_menu_item_new ();
+ gtk_widget_set_sensitive (menu_item, FALSE);
+ }
+
+ g_object_set_data (G_OBJECT (menu_item), "EsbItemId",
+ GINT_TO_POINTER (scopeitems[i].id));
+
+ g_signal_connect (menu_item,
+ "activate",
+ G_CALLBACK (scopeitem_activated_cb),
+ search_bar);
+
+ gtk_widget_show (menu_item);
+ gtk_menu_shell_append(GTK_MENU_SHELL(menu), menu_item);
}
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (search_bar->scopeoption), menu);
+}
+
+
+/**
+ * e_search_bar_set_scopeoption_menu:
+ * @search_bar: A search bar.
+ * @menu: the scope option menu
+ *
+ * Sets the items for the secondary option menu of a search bar.
+ **/
+void
+e_search_bar_set_scopeoption_menu (ESearchBar *search_bar, GtkMenu *menu)
+{
- if (subitems) {
- new_subitems = copy_subitems (subitems);
- g_object_set_data (G_OBJECT (item), "EsbChoiceSubitems", new_subitems);
- g_signal_connect (item, "destroy",
- G_CALLBACK (option_item_destroy_cb), new_subitems);
- } else
- new_subitems = NULL;
+ if (search_bar->scopeoption_menu != NULL)
+ gtk_option_menu_remove_menu (GTK_OPTION_MENU (search_bar->scopeoption));
+
+ search_bar->scopeoption_menu = GTK_WIDGET (menu);
+ gtk_option_menu_set_menu (GTK_OPTION_MENU (search_bar->scopeoption), search_bar->scopeoption_menu);
- if (search_bar->item_id == option_id)
- activate_by_subitems (search_bar, option_id, new_subitems);
+ g_signal_connect (search_bar->scopeoption_menu,
+ "selection-done",
+ G_CALLBACK (scopeitem_activated_cb),
+ search_bar);
}
GtkWidget *
@@ -1176,6 +1231,22 @@ e_search_bar_get_type (void)
return type;
}
+void
+e_search_bar_set_viewitem_id (ESearchBar *search_bar, int id)
+{
+ int row;
+
+ g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+
+ row = find_id (search_bar->viewoption_menu, id, "EsbItemId", NULL);
+ g_return_if_fail (row != -1);
+
+ search_bar->viewitem_id = id;
+ gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->viewoption), row);
+
+ emit_query_changed (search_bar);
+}
+
/**
* e_search_bar_set_item_id:
* @search_bar: A search bar.
@@ -1190,14 +1261,39 @@ e_search_bar_set_item_id (ESearchBar *search_bar, int id)
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
- row = find_id (search_bar->option_menu, id, "EsbChoiceId", NULL);
+ row = find_id (search_bar->option_menu, id, "EsbItemId", NULL);
+ g_return_if_fail (row != -1);
+
+ search_bar->item_id = id;
+ gtk_menu_set_active (search_bar->option_menu, row);
+
+ emit_query_changed (search_bar);
+}
+
+/**
+ * e_search_bar_set_search_scope:
+ * @search_bar: A search bar.
+ * @id: Identifier of the item to set.
+ *
+ * Sets the active item in the options menu of a search bar.
+ **/
+void
+e_search_bar_set_search_scope (ESearchBar *search_bar, int id)
+{
+ int row;
+
+ g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+
+ row = find_id (search_bar->option_menu, id, "EsbItemId", NULL);
g_return_if_fail (row != -1);
search_bar->item_id = id;
gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->option), row);
+
emit_query_changed (search_bar);
}
+
/**
* e_search_bar_get_item_id:
* @search_bar: A search bar.
@@ -1209,44 +1305,69 @@ e_search_bar_set_item_id (ESearchBar *search_bar, int id)
int
e_search_bar_get_item_id (ESearchBar *search_bar)
{
+ GtkWidget *menu_item;
+ gint item_id;
+
g_return_val_if_fail (search_bar != NULL, -1);
g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
+ menu_item = gtk_menu_get_active (GTK_MENU (search_bar->option_menu));
+ item_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "EsbItemId"));
+ search_bar->item_id = item_id;
+
return search_bar->item_id;
}
-void
-e_search_bar_set_subitem_id (ESearchBar *search_bar, int id)
+/**
+ * e_search_bar_get_search_scope:
+ * @search_bar: A search bar.
+ *
+ * Queries the currently selected search type in the options menu of a search bar.
+ *
+ * Return value: Identifier of the selected item in the options menu.
+ **/
+int
+e_search_bar_get_search_scope (ESearchBar *search_bar)
{
- int row;
+ GtkWidget *menu_item;
+ gint scopeitem_id;
- g_return_if_fail (search_bar != NULL);
- g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
+ g_return_val_if_fail (search_bar != NULL, -1);
+ g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
- row = find_id (search_bar->suboption_menu, id, "EsbSubitemId", NULL);
- g_return_if_fail (row != -1);
+ menu_item = gtk_menu_get_active (GTK_MENU (search_bar->scopeoption_menu));
+ scopeitem_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "EsbItemId"));
- search_bar->subitem_id = id;
- gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->suboption), row);
+ search_bar->scopeitem_id = scopeitem_id;
+
+ return search_bar->scopeitem_id;
}
/**
- * e_search_bar_get_subitem_id:
+ * e_search_bar_get_viewitem_id:
* @search_bar: A search bar.
*
- * Queries the currently selected item in the suboptions menu of a search bar.
+ * Queries the currently selected item in the viewoptions menu of a search bar.
*
- * Return value: Identifier of the selected item in the suboptions menu.
- * If the search bar currently contains an entry rather than a a suboption menu,
+ * Return value: Identifier of the selected item in the viewoptions menu.
+ * If the search bar currently contains an entry rather than a a viewoption menu,
* a value less than zero is returned.
**/
int
-e_search_bar_get_subitem_id (ESearchBar *search_bar)
+e_search_bar_get_viewitem_id (ESearchBar *search_bar)
{
+ GtkWidget *menu_item;
+ gint viewitem_id;
+
g_return_val_if_fail (search_bar != NULL, -1);
g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), -1);
- return search_bar->subitem_id;
+ menu_item = gtk_menu_get_active (GTK_MENU (search_bar->viewoption_menu));
+ viewitem_id = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (menu_item), "EsbItemId"));
+
+ search_bar->viewitem_id = viewitem_id;
+
+ return search_bar->viewitem_id;
}
/**
@@ -1263,7 +1384,6 @@ e_search_bar_set_ids (ESearchBar *search_bar, int item_id, int subitem_id)
{
int item_row;
GtkWidget *item_widget;
- ESearchBarSubitem *subitems;
g_return_if_fail (search_bar != NULL);
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
@@ -1272,14 +1392,9 @@ e_search_bar_set_ids (ESearchBar *search_bar, int item_id, int subitem_id)
g_return_if_fail (item_row != -1);
g_assert (item_widget != NULL);
- subitems = g_object_get_data (G_OBJECT (item_widget), "EsbChoiceSubitems");
- g_return_if_fail (subitems != NULL);
-
search_bar->item_id = item_id;
gtk_option_menu_set_history (GTK_OPTION_MENU (search_bar->option), item_row);
- activate_by_subitems (search_bar, item_id, subitems);
- e_search_bar_set_subitem_id (search_bar, subitem_id);
}
/**
@@ -1293,7 +1408,6 @@ void
e_search_bar_set_text (ESearchBar *search_bar, const char *text)
{
g_return_if_fail (E_IS_SEARCH_BAR (search_bar));
-
gtk_entry_set_text (GTK_ENTRY (search_bar->entry), text);
}
@@ -1310,8 +1424,18 @@ e_search_bar_set_text (ESearchBar *search_bar, const char *text)
char *
e_search_bar_get_text (ESearchBar *search_bar)
{
+ GtkStyle *entry_style, *default_style;
+
g_return_val_if_fail (search_bar != NULL, NULL);
g_return_val_if_fail (E_IS_SEARCH_BAR (search_bar), NULL);
-
- return search_bar->subitem_id < 0 ? g_strdup (gtk_entry_get_text (GTK_ENTRY (search_bar->entry))) : NULL;
+
+ entry_style = gtk_widget_get_style (search_bar->entry);
+ default_style = gtk_widget_get_default_style ();
+
+ if (gdk_color_equal (&(entry_style->text[GTK_STATE_NORMAL]), &(default_style->text[GTK_STATE_INSENSITIVE]))) {
+ gtk_entry_set_text (GTK_ENTRY (search_bar->entry), "");
+ gtk_widget_modify_text (search_bar->entry, GTK_STATE_NORMAL, NULL);
+ }
+
+ return g_strdup (gtk_entry_get_text (GTK_ENTRY (search_bar->entry)));
}
diff --git a/widgets/misc/e-search-bar.h b/widgets/misc/e-search-bar.h
index b0333ad58b..7f6c9237a4 100644
--- a/widgets/misc/e-search-bar.h
+++ b/widgets/misc/e-search-bar.h
@@ -43,21 +43,24 @@ G_BEGIN_DECLS
#define E_IS_SEARCH_BAR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), E_SEARCH_BAR_TYPE))
#define E_IS_SEARCH_BAR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), E_SEARCH_BAR_TYPE))
+enum _ESearchBarItemType {
+ ESB_ITEMTYPE_NORMAL,
+ ESB_ITEMTYPE_CHECK,
+ ESB_ITEMTYPE_RADIO,
+};
+typedef enum _ESearchBarItemType ESearchBarItemType;
+
typedef struct {
char *text;
int id;
- gboolean translate; /* whether to translate the text */
-} ESearchBarSubitem;
-
-typedef struct {
- char *text;
- int id;
- ESearchBarSubitem *subitems;
+ int type;
} ESearchBarItem;
typedef struct _ESearchBar ESearchBar;
typedef struct _ESearchBarClass ESearchBarClass;
+typedef void (*ESearchBarMenuFunc)(ESearchBar *esb, ESearchBarItem *menu_items );
+
struct _ESearchBar
{
GtkHBox parent;
@@ -75,14 +78,27 @@ struct _ESearchBar
GtkWidget *dropdown_holder; /* holds the dropdown */
GtkWidget *option_menu;
GtkWidget *suboption_menu;
- GtkWidget *activate_button;
+ GtkWidget *option_button;
GtkWidget *clear_button;
GtkWidget *entry_box;
+ GtkWidget *icon_entry;
+
+ /* show option widgets */
+ GtkWidget *viewoption_box;
+ GtkWidget *viewoption; /* an option menu for the choices associated with some search options */
+ GtkWidget *viewoption_menu;
+
+ /* search scope widgets */
+ GtkWidget *scopeoption_box;
+ GtkWidget *scopeoption; /* an option menu for the choices associated with scope search */
+ GtkWidget *scopeoption_menu;
+
guint pending_activate;
/* The currently-selected item & subitem */
int item_id;
- int subitem_id; /* < 0 if the entry widget is active */
+ int viewitem_id; /* Current View Id */
+ int scopeitem_id; /* Scope of search */
};
struct _ESearchBarClass
@@ -94,6 +110,7 @@ struct _ESearchBarClass
/* signals */
void (*search_activated) (ESearchBar *search);
+ void (*search_cleared) (ESearchBar *search);
void (*query_changed) (ESearchBar *search);
void (*menu_activated) (ESearchBar *search, int item);
};
@@ -121,9 +138,10 @@ void e_search_bar_add_menu (ESearchBar *search_bar,
void e_search_bar_set_option (ESearchBar *search_bar,
ESearchBarItem *option_items);
-void e_search_bar_set_suboption (ESearchBar *search_bar,
- int option_id,
- ESearchBarSubitem *subitems);
+
+void e_search_bar_set_viewoption (ESearchBar *search_bar,
+ int option_id,
+ ESearchBarItem *subitems);
void e_search_bar_set_menu_sensitive (ESearchBar *search_bar,
int id,
@@ -133,14 +151,26 @@ void e_search_bar_set_item_id (ESearchBar *search_bar,
int id);
int e_search_bar_get_item_id (ESearchBar *search_bar);
-void e_search_bar_set_subitem_id (ESearchBar *search_bar,
- int id);
-int e_search_bar_get_subitem_id (ESearchBar *search_bar);
+int e_search_bar_get_viewitem_id (ESearchBar *search_bar);
void e_search_bar_set_ids (ESearchBar *search_bar,
int item_id,
int subitem_id);
+void e_search_bar_set_scopeoption (ESearchBar *search_bar, ESearchBarItem *scopeitems);
+
+void e_search_bar_set_scopeoption_menu (ESearchBar *search_bar, GtkMenu *menu);
+
+void e_search_bar_set_search_scope (ESearchBar *search_bar, int id);
+
+void e_search_bar_set_viewoption_menu (ESearchBar *search_bar, GtkWidget *menu);
+
+void e_search_bar_set_viewoption_menufunc (ESearchBar *search_bar, ESearchBarMenuFunc *menu_gen_func, void *data);
+
+GtkWidget *e_search_bar_get_selected_viewitem (ESearchBar *search_bar);
+
+int e_search_bar_get_search_scope (ESearchBar *search_bar);
+
void e_search_bar_set_text (ESearchBar *search_bar,
const char *text);
char *e_search_bar_get_text (ESearchBar *search_bar);
diff --git a/widgets/table/e-tree-table-adapter.c b/widgets/table/e-tree-table-adapter.c
index 4514a7b15e..c4585f240a 100644
--- a/widgets/table/e-tree-table-adapter.c
+++ b/widgets/table/e-tree-table-adapter.c
@@ -913,7 +913,7 @@ e_tree_table_adapter_save_expanded_state (ETreeTableAdapter *etta, const char *f
e_xml_set_bool_prop_by_name (root, "default", tar.expanded_default);
g_hash_table_foreach (etta->priv->nodes, save_expanded_state_func, &tar);
-
+
e_xml_save_file (filename, doc);
xmlFreeDoc (doc);
}