diff options
author | Ettore Perazzoli <ettore@src.gnome.org> | 2002-03-19 04:06:00 +0800 |
---|---|---|
committer | Ettore Perazzoli <ettore@src.gnome.org> | 2002-03-19 04:06:00 +0800 |
commit | 6f9b8ecfb38192df1c8bca8ac34db6c3eae254aa (patch) | |
tree | e21aa020a307fb81b48babe2980a28687f17f9f0 | |
parent | 16af96a2ab47b8f58f1c86380162e26530842868 (diff) | |
download | gsoc2013-evolution-6f9b8ecfb38192df1c8bca8ac34db6c3eae254aa.tar gsoc2013-evolution-6f9b8ecfb38192df1c8bca8ac34db6c3eae254aa.tar.gz gsoc2013-evolution-6f9b8ecfb38192df1c8bca8ac34db6c3eae254aa.tar.bz2 gsoc2013-evolution-6f9b8ecfb38192df1c8bca8ac34db6c3eae254aa.tar.lz gsoc2013-evolution-6f9b8ecfb38192df1c8bca8ac34db6c3eae254aa.tar.xz gsoc2013-evolution-6f9b8ecfb38192df1c8bca8ac34db6c3eae254aa.tar.zst gsoc2013-evolution-6f9b8ecfb38192df1c8bca8ac34db6c3eae254aa.zip |
[Search bar re-design implementation, Take 2.]
* e-search-bar.c (clear_verb_cb): New.
(setup_standard_verbs): New.
(e_search_bar_set_ui_component): Call it if a new
BonoboUIComponent is set.
(append_xml_menu_item): New helper function.
(update_bonobo_menus): Use it. Also add a "Clear" menu item.
(e_search_bar_construct): @menu_items can be NULL now.
(e_search_bar_new): Same here.
(set_menu): Work with NULL items.
* e-filter-bar.c (menubar_activated): Don't handle
E_FILTERBAR_RESET_ID anymore.
* e-filter-bar.h: Remove `E_FILTERBAR_RESET_ID' and `E_FILTERBAR_RESET'.
* folder-browser.c: Remove E_FILTERBAR_RESET menu entry.
* gui/cal-search-bar.c: Removed `search_menu_items'.
(cal_search_bar_menu_activated): Removed.
(cal_search_bar_class_init): Don't install.
(cal_search_bar_construct): No menu items here.
* gui/component/addressbook.c (addressbook_menu_activated):
Removed.
(addressbook_factory_new_control): Don't connect anymore, as this
signal has been removed from the ESearchBar.
(addressbook_factory_new_control): No more custom menu items here.
svn path=/trunk/; revision=16194
-rw-r--r-- | addressbook/ChangeLog | 15 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 24 | ||||
-rw-r--r-- | calendar/ChangeLog | 7 | ||||
-rw-r--r-- | calendar/gui/cal-search-bar.c | 32 | ||||
-rw-r--r-- | mail/ChangeLog | 4 | ||||
-rw-r--r-- | mail/folder-browser.c | 1 | ||||
-rw-r--r-- | widgets/misc/ChangeLog | 17 | ||||
-rw-r--r-- | widgets/misc/e-filter-bar.c | 7 | ||||
-rw-r--r-- | widgets/misc/e-filter-bar.h | 11 | ||||
-rw-r--r-- | widgets/misc/e-search-bar.c | 69 |
10 files changed, 102 insertions, 85 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 64a6c4b6cf..57e7c81f98 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,3 +1,11 @@ +2002-03-18 Ettore Perazzoli <ettore@ximian.com> + + * gui/component/addressbook.c (addressbook_menu_activated): + Removed. + (addressbook_factory_new_control): Don't connect anymore, as this + signal has been removed from the ESearchBar. + (addressbook_factory_new_control): No more custom menu items here. + 2002-03-15 Jeffrey Stedfast <fejj@ximian.com> * gui/widgets/e-addressbook-view.c (table_right_click): Update to @@ -12,6 +20,13 @@ 2002-03-15 Ettore Perazzoli <ettore@ximian.com> + * gui/component/addressbook.c: Remove the + `addressbook_search_menu_items'. + (addressbook_menu_activated): Removed. + (addressbook_factory_new_control): Don't connect. No menu items. + +2002-03-15 Ettore Perazzoli <ettore@ximian.com> + * gui/component/addressbook.c (control_activate): Call `e_search_bar_set_ui_component()' to set the BonoboUIComponent for the search bar. diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index a0f9bda94b..02428c1350 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -813,11 +813,6 @@ set_prop (BonoboPropertyBag *bag, } } -static ESearchBarItem addressbook_search_menu_items[] = { - E_FILTERBAR_RESET, - { NULL, -1, NULL }, -}; - enum { ESB_FULL_NAME, ESB_EMAIL, @@ -849,20 +844,6 @@ alphabet_state_changed (EAddressbookView *eav, gunichar letter, AddressbookView } static void -addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view) -{ - switch (id) { - case E_FILTERBAR_RESET_ID: - /* e_addressbook_view_show_all(view->view); */ - view->ignore_search_changes = TRUE; - e_search_bar_set_item_id (view->search, ESB_ANY); - view->ignore_search_changes = FALSE; - e_search_bar_set_text (esb, ""); - break; - } -} - -static void addressbook_search_activated (ESearchBar *esb, AddressbookView *view) { ECategoriesMasterList *master_list; @@ -1127,8 +1108,7 @@ addressbook_factory_new_control (void) /* Create the control. */ view->control = bonobo_control_new (view->vbox); - view->search = E_SEARCH_BAR(e_search_bar_new(addressbook_search_menu_items, - addressbook_search_option_items)); + view->search = E_SEARCH_BAR (e_search_bar_new (NULL, addressbook_search_option_items)); make_suboptions (view); connect_master_list_changed (view); @@ -1138,8 +1118,6 @@ addressbook_factory_new_control (void) GTK_SIGNAL_FUNC (addressbook_query_changed), view); gtk_signal_connect (GTK_OBJECT (view->search), "search_activated", GTK_SIGNAL_FUNC (addressbook_search_activated), view); - gtk_signal_connect (GTK_OBJECT (view->search), "menu_activated", - GTK_SIGNAL_FUNC (addressbook_menu_activated), view); view->view = E_ADDRESSBOOK_VIEW(e_addressbook_view_new()); gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET (view->view)); diff --git a/calendar/ChangeLog b/calendar/ChangeLog index 85c66502e8..89599907dd 100644 --- a/calendar/ChangeLog +++ b/calendar/ChangeLog @@ -1,3 +1,10 @@ +2002-03-18 Ettore Perazzoli <ettore@ximian.com> + + * gui/cal-search-bar.c: Removed `search_menu_items'. + (cal_search_bar_menu_activated): Removed. + (cal_search_bar_class_init): Don't install. + (cal_search_bar_construct): No menu items here. + 2002-03-15 Jeffrey Stedfast <fejj@ximian.com> * gui/e-day-view.c: Updated to use new EPopupMenu API. diff --git a/calendar/gui/cal-search-bar.c b/calendar/gui/cal-search-bar.c index 329795c518..2483b2b126 100644 --- a/calendar/gui/cal-search-bar.c +++ b/calendar/gui/cal-search-bar.c @@ -36,12 +36,6 @@ -/* Menu items for the ESearchBar */ -static ESearchBarItem search_menu_items[] = { - E_FILTERBAR_RESET, - { NULL, -1, NULL } -}; - /* IDs and option items for the ESearchBar */ enum { SEARCH_ANY_FIELD_CONTAINS, @@ -78,7 +72,6 @@ static void cal_search_bar_init (CalSearchBar *cal_search); static void cal_search_bar_destroy (GtkObject *object); static void cal_search_bar_search_activated (ESearchBar *search); -static void cal_search_bar_menu_activated (ESearchBar *search, int item); static ESearchBarClass *parent_class = NULL; @@ -160,7 +153,6 @@ cal_search_bar_class_init (CalSearchBarClass *class) class->category_changed = NULL; e_search_bar_class->search_activated = cal_search_bar_search_activated; - e_search_bar_class->menu_activated = cal_search_bar_menu_activated; object_class->destroy = cal_search_bar_destroy; } @@ -368,28 +360,6 @@ cal_search_bar_search_activated (ESearchBar *search) regen_query (cal_search); } -/* menu_activated handler for the calendar search bar */ -static void -cal_search_bar_menu_activated (ESearchBar *search, int item) -{ - CalSearchBar *cal_search; - - cal_search = CAL_SEARCH_BAR (search); - - switch (item) { - case E_FILTERBAR_RESET_ID: - notify_sexp_changed (cal_search, "#t"); /* match all */ - /* FIXME: should we change the rest of the search bar so that - * the user sees that he selected "show all" instead of some - * type/text search combination? - */ - break; - - default: - g_assert_not_reached (); - } -} - /* Creates the suboptions menu for the ESearchBar with the list of categories */ @@ -464,7 +434,7 @@ cal_search_bar_construct (CalSearchBar *cal_search) g_return_val_if_fail (cal_search != NULL, NULL); g_return_val_if_fail (IS_CAL_SEARCH_BAR (cal_search), NULL); - e_search_bar_construct (E_SEARCH_BAR (cal_search), search_menu_items, search_option_items); + e_search_bar_construct (E_SEARCH_BAR (cal_search), NULL, search_option_items); make_suboptions (cal_search); e_search_bar_set_ids (E_SEARCH_BAR (cal_search), SEARCH_CATEGORY_IS, CATEGORIES_ALL); diff --git a/mail/ChangeLog b/mail/ChangeLog index c33e4ba7b4..6a74eabc12 100644 --- a/mail/ChangeLog +++ b/mail/ChangeLog @@ -1,3 +1,7 @@ +2002-03-18 Ettore Perazzoli <ettore@ximian.com> + + * folder-browser.c: Remove E_FILTERBAR_RESET menu entry. + 2002-03-15 Jeffrey Stedfast <fejj@ximian.com> * folder-browser.c (on_right_click): Draw colour rectangles for diff --git a/mail/folder-browser.c b/mail/folder-browser.c index 73f3ec0ed5..140bcb376d 100644 --- a/mail/folder-browser.c +++ b/mail/folder-browser.c @@ -1075,7 +1075,6 @@ enum { }; static ESearchBarItem folder_browser_search_menu_items[] = { - E_FILTERBAR_RESET, E_FILTERBAR_SAVE, { N_("Create vFolder from Search"), ESB_SAVE, NULL }, E_FILTERBAR_EDIT, diff --git a/widgets/misc/ChangeLog b/widgets/misc/ChangeLog index a568847879..4081b8c66a 100644 --- a/widgets/misc/ChangeLog +++ b/widgets/misc/ChangeLog @@ -1,3 +1,20 @@ +2002-03-18 Ettore Perazzoli <ettore@ximian.com> + + * e-search-bar.c (clear_verb_cb): New. + (setup_standard_verbs): New. + (e_search_bar_set_ui_component): Call it if a new + BonoboUIComponent is set. + (append_xml_menu_item): New helper function. + (update_bonobo_menus): Use it. Also add a "Clear" menu item. + (e_search_bar_construct): @menu_items can be NULL now. + (e_search_bar_new): Same here. + (set_menu): Work with NULL items. + + * e-filter-bar.c (menubar_activated): Don't handle + E_FILTERBAR_RESET_ID anymore. + + * e-filter-bar.h: Remove `E_FILTERBAR_RESET_ID' and `E_FILTERBAR_RESET'. + 2002-03-15 Ettore Perazzoli <ettore@ximian.com> * e-search-bar.c (init): Init various members to NULL. diff --git a/widgets/misc/e-filter-bar.c b/widgets/misc/e-filter-bar.c index f32a2c0ad9..91fb195779 100644 --- a/widgets/misc/e-filter-bar.c +++ b/widgets/misc/e-filter-bar.c @@ -137,13 +137,6 @@ menubar_activated (ESearchBar *esb, int id, void *data) EFilterBar *efb = (EFilterBar *)esb; switch (id) { - case E_FILTERBAR_RESET_ID: - d(printf("Reset menu\n")); - efb->current_query = NULL; - e_search_bar_set_item_id (esb, efb->option_base); - e_search_bar_set_text (esb, NULL); - gtk_widget_set_sensitive (esb->entry, TRUE); - break; case E_FILTERBAR_EDIT_ID: if (!efb->save_dialogue) { GnomeDialog *gd; diff --git a/widgets/misc/e-filter-bar.h b/widgets/misc/e-filter-bar.h index 7577236ee3..d0a81d3b55 100644 --- a/widgets/misc/e-filter-bar.h +++ b/widgets/misc/e-filter-bar.h @@ -81,25 +81,20 @@ struct _EFilterBarClass /* "preset" items */ enum { /* preset menu options */ - E_FILTERBAR_RESET_ID = -2, - E_FILTERBAR_SAVE_ID = -3, - E_FILTERBAR_EDIT_ID = -4, + E_FILTERBAR_SAVE_ID = -2, + E_FILTERBAR_EDIT_ID = -3, /* preset option options */ - E_FILTERBAR_ADVANCED_ID = -5, - - E_FILTERBAR_LAST_ID = -6, + E_FILTERBAR_ADVANCED_ID = -4, }; #define E_FILTERBAR_SAVE { N_("Add to Saved Searches"), E_FILTERBAR_SAVE_ID, NULL } -#define E_FILTERBAR_RESET { N_("Clear"), E_FILTERBAR_RESET_ID, NULL } #define E_FILTERBAR_EDIT { N_("Edit..."), E_FILTERBAR_EDIT_ID, NULL } #define E_FILTERBAR_ADVANCED { N_("Advanced..."), E_FILTERBAR_ADVANCED_ID, NULL } #ifdef JUST_FOR_TRANSLATORS const char * strings[] = { N_("Save As..."), - N_("Show All"), N_("Edit..."), N_("Advanced...") }; diff --git a/widgets/misc/e-search-bar.c b/widgets/misc/e-search-bar.c index ffca59e9a5..9254732905 100644 --- a/widgets/misc/e-search-bar.c +++ b/widgets/misc/e-search-bar.c @@ -97,7 +97,29 @@ emit_menu_activated (ESearchBar *esb, int item) } -/* Callbacks. */ +/* Callbacks -- Standard verbs. */ + +static void +clear_verb_cb (BonoboUIComponent *ui_component, + void *data, + const char *verb_name) +{ + ESearchBar *esb; + + esb = E_SEARCH_BAR (data); + e_search_bar_set_text (esb, ""); + + emit_search_activated (esb); +} + +static void +setup_standard_verbs (ESearchBar *search_bar) +{ + bonobo_ui_component_add_verb (search_bar->ui_component, "ESearchBar:Clear", + clear_verb_cb, search_bar); +} + +/* Callbacks -- The verbs for all the definable items. */ static void search_verb_cb (BonoboUIComponent *ui_component, @@ -310,6 +332,26 @@ copy_subitems (ESearchBarSubitem *subitems) } static void +append_xml_menu_item (GString *xml, + const char *name, + const char *label, + const char *verb, + const char *accelerator) +{ + char *encoded_label; + + encoded_label = bonobo_ui_util_encode_str (label); + g_string_sprintfa (xml, "<menuitem name=\"%s\" verb=\"%s\" label=\"%s\"", + name, verb, encoded_label); + g_free (encoded_label); + + if (accelerator != NULL) + g_string_sprintfa (xml, " accel=\"%s\"", accelerator); + + g_string_sprintfa (xml, "/>"); +} + +static void update_bonobo_menus (ESearchBar *esb) { GString *xml; @@ -318,6 +360,8 @@ update_bonobo_menus (ESearchBar *esb) xml = g_string_new ("<placeholder name=\"SearchBar\">"); + append_xml_menu_item (xml, "Clear", _("Clear"), "ESearchBar:Clear", "*Control**Shift*b"); + for (p = esb->menu_items; p != NULL; p = p->next) { const ESearchBarItem *item; @@ -326,16 +370,12 @@ update_bonobo_menus (ESearchBar *esb) verb_name = g_strdup_printf ("ESearchBar:Activate:%d", item->id); bonobo_ui_component_add_verb (esb->ui_component, verb_name, search_verb_cb, esb); - if (item->text == NULL) { + if (item->text == NULL) g_string_append (xml, "<separator/>"); - } else { - char *encoded_label; + else + append_xml_menu_item (xml, verb_name, item->text, verb_name, NULL); - encoded_label = bonobo_ui_util_encode_str (item->text); - g_string_sprintfa (xml, "<menuitem name=\"%s\" verb=\"%s\" label=\"%s\"/>", - verb_name, verb_name, encoded_label); - g_free (encoded_label); - } + g_free (verb_name); } g_string_sprintfa (xml, "</placeholder>"); @@ -343,7 +383,6 @@ update_bonobo_menus (ESearchBar *esb) bonobo_ui_component_set (esb->ui_component, "/menu/Search", xml->str, NULL); g_string_free (xml, TRUE); - g_free (verb_name); } static void @@ -351,7 +390,10 @@ set_menu (ESearchBar *esb, ESearchBarItem *items) { int i; - + + if (items == NULL) + return; + for (i = 0; items[i].id != -1; i++) { ESearchBarItem *new_item; @@ -678,7 +720,6 @@ e_search_bar_construct (ESearchBar *search_bar, { g_return_if_fail (search_bar != NULL); g_return_if_fail (E_IS_SEARCH_BAR (search_bar)); - g_return_if_fail (menu_items != NULL); g_return_if_fail (option_items != NULL); gtk_box_set_spacing (GTK_BOX (search_bar), 1); @@ -713,7 +754,6 @@ e_search_bar_set_menu (ESearchBar *search_bar, ESearchBarItem *menu_items) { g_return_if_fail (search_bar != NULL); g_return_if_fail (E_IS_SEARCH_BAR (search_bar)); - g_return_if_fail (menu_items != NULL); ((ESearchBarClass *)((GtkObject *)search_bar)->klass)->set_menu (search_bar, menu_items); } @@ -723,7 +763,6 @@ e_search_bar_add_menu (ESearchBar *search_bar, ESearchBarItem *menu_item) { g_return_if_fail (search_bar != NULL); g_return_if_fail (E_IS_SEARCH_BAR (search_bar)); - g_return_if_fail (menu_item != NULL); set_menu (search_bar, menu_item); } @@ -788,7 +827,6 @@ e_search_bar_new (ESearchBarItem *menu_items, { GtkWidget *widget; - g_return_val_if_fail (menu_items != NULL, NULL); g_return_val_if_fail (option_items != NULL, NULL); widget = GTK_WIDGET (gtk_type_new (e_search_bar_get_type ())); @@ -810,6 +848,7 @@ e_search_bar_set_ui_component (ESearchBar *search_bar, search_bar->ui_component = ui_component; if (ui_component != NULL) { bonobo_object_ref (BONOBO_OBJECT (ui_component)); + setup_standard_verbs (search_bar); update_bonobo_menus (search_bar); } } |