diff options
author | Chris Toshok <toshok@ximian.com> | 2001-08-08 10:54:11 +0800 |
---|---|---|
committer | Chris Toshok <toshok@src.gnome.org> | 2001-08-08 10:54:11 +0800 |
commit | 8db57316948801a0d0c91bf5487b9e22182a6d37 (patch) | |
tree | 7af7807340e101602d82890b355aab6d9d724aa8 | |
parent | 19f5c4472df77f2592abf7216f6350e3f6d55d3d (diff) | |
download | gsoc2013-evolution-8db57316948801a0d0c91bf5487b9e22182a6d37.tar.gz gsoc2013-evolution-8db57316948801a0d0c91bf5487b9e22182a6d37.tar.zst gsoc2013-evolution-8db57316948801a0d0c91bf5487b9e22182a6d37.zip |
pass view->view instead of the EBook. (addressbook_search_menu_items):
2001-08-07 Chris Toshok <toshok@ximian.com>
* gui/component/addressbook.c (search_cb): pass view->view instead
of the EBook.
(addressbook_search_menu_items): remove E_FILTERBAR_ADVANCED.
(addressbook_menu_activated): remove E_FILTERBAR_ADVANCED.
(addressbook_search_option_items): add "Advanced..." here.
(addressbook_query_changed): add special handling for Advanced...
* gui/search/e-addressbook-search-dialog.h (struct
_EAddressbookSearchDialog): add EAddressbookView and remove the
model/adapter fields. Also fix prototype of
e_addressbook_search_dialog_new.
* gui/search/e-addressbook-search-dialog.c
(e_addressbook_search_dialog_class_init): get rid of
set_arg/get_arg.
(button_press): set the query on the EAddressbookView, and always
close the dialog.
(e_addressbook_search_dialog_init): get rid of the minicard view,
and pack the other widgets accordingly.
(e_addressbook_search_dialog_new): pass EAddressbookView instead
of EBook.
(e_addressbook_search_dialog_destroy): remove model/adapter stuff.
svn path=/trunk/; revision=11760
-rw-r--r-- | addressbook/ChangeLog | 25 | ||||
-rw-r--r-- | addressbook/gui/component/addressbook.c | 86 | ||||
-rw-r--r-- | addressbook/gui/search/e-addressbook-search-dialog.c | 75 | ||||
-rw-r--r-- | addressbook/gui/search/e-addressbook-search-dialog.h | 10 |
4 files changed, 74 insertions, 122 deletions
diff --git a/addressbook/ChangeLog b/addressbook/ChangeLog index 1c5f1a5a0e..115e56a68a 100644 --- a/addressbook/ChangeLog +++ b/addressbook/ChangeLog @@ -1,5 +1,30 @@ 2001-08-07 Chris Toshok <toshok@ximian.com> + * gui/component/addressbook.c (search_cb): pass view->view instead + of the EBook. + (addressbook_search_menu_items): remove E_FILTERBAR_ADVANCED. + (addressbook_menu_activated): remove E_FILTERBAR_ADVANCED. + (addressbook_search_option_items): add "Advanced..." here. + (addressbook_query_changed): add special handling for Advanced... + + * gui/search/e-addressbook-search-dialog.h (struct + _EAddressbookSearchDialog): add EAddressbookView and remove the + model/adapter fields. Also fix prototype of + e_addressbook_search_dialog_new. + + * gui/search/e-addressbook-search-dialog.c + (e_addressbook_search_dialog_class_init): get rid of + set_arg/get_arg. + (button_press): set the query on the EAddressbookView, and always + close the dialog. + (e_addressbook_search_dialog_init): get rid of the minicard view, + and pack the other widgets accordingly. + (e_addressbook_search_dialog_new): pass EAddressbookView instead + of EBook. + (e_addressbook_search_dialog_destroy): remove model/adapter stuff. + +2001-08-07 Chris Toshok <toshok@ximian.com> + [ Fixes bug #5066 ] * gui/component/addressbook-storage.c (remove_ldap_folder): new function, remove the source. diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c index f87d49d689..04abcd005f 100644 --- a/addressbook/gui/component/addressbook.c +++ b/addressbook/gui/component/addressbook.c @@ -98,15 +98,9 @@ config_cb (BonoboUIComponent *uih, void *user_data, const char *path) static void search_cb (BonoboUIComponent *uih, void *user_data, const char *path) { - EBook *book; AddressbookView *view = (AddressbookView *) user_data; - gtk_object_get(GTK_OBJECT(view->view), - "book", &book, - NULL); - g_assert (E_IS_BOOK (book)); - - gtk_widget_show(e_addressbook_search_dialog_new(book)); + gtk_widget_show(e_addressbook_search_dialog_new(view->view)); } static void @@ -245,7 +239,7 @@ change_view_type (AddressbookView *view, EAddressbookViewType view_type) gtk_object_set (GTK_OBJECT (view->view), "type", view_type, NULL); } -BonoboUIVerb verbs [] = { +static BonoboUIVerb verbs [] = { BONOBO_UI_UNSAFE_VERB ("ContactsPrint", print_cb), BONOBO_UI_UNSAFE_VERB ("ContactsSaveAsVCard", save_contact_cb), BONOBO_UI_UNSAFE_VERB ("ToolSearch", search_cb), @@ -559,27 +553,16 @@ set_prop (BonoboPropertyBag *bag, static ESearchBarItem addressbook_search_menu_items[] = { E_FILTERBAR_RESET, - { NULL, 0 }, - E_FILTERBAR_ADVANCED, - { NULL, -1 } + { NULL, -1 }, }; static void addressbook_menu_activated (ESearchBar *esb, int id, AddressbookView *view) { - EBook *book; switch (id) { case E_FILTERBAR_RESET_ID: e_addressbook_view_show_all(view->view); break; - case E_FILTERBAR_ADVANCED_ID: - gtk_object_get(GTK_OBJECT(view->view), - "book", &book, - NULL); - g_assert (E_IS_BOOK (book)); - - gtk_widget_show(e_addressbook_search_dialog_new(book)); - break; } } @@ -588,6 +571,7 @@ enum { ESB_FULL_NAME, ESB_EMAIL, ESB_CATEGORY, + ESB_ADVANCED }; static ESearchBarItem addressbook_search_option_items[] = { @@ -595,6 +579,7 @@ static ESearchBarItem addressbook_search_option_items[] = { { N_("Name contains"), ESB_FULL_NAME }, { N_("Email contains"), ESB_EMAIL }, { N_("Category contains"), ESB_CATEGORY }, + { N_("Advanced..."), ESB_ADVANCED }, { NULL, -1 } }; @@ -609,37 +594,42 @@ addressbook_query_changed (ESearchBar *esb, AddressbookView *view) "option_choice", &search_type, NULL); - if (search_word && strlen (search_word)) { - switch (search_type) { - case ESB_ANY: - search_query = g_strdup_printf ("(contains \"x-evolution-any-field\" \"%s\")", - search_word); - break; - case ESB_FULL_NAME: - search_query = g_strdup_printf ("(contains \"full_name\" \"%s\")", - search_word); - break; - case ESB_EMAIL: - search_query = g_strdup_printf ("(contains \"email\" \"%s\")", - search_word); - break; - case ESB_CATEGORY: - search_query = g_strdup_printf ("(contains \"category\" \"%s\")", - search_word); - break; - default: + if (search_type == ESB_ADVANCED) { + gtk_widget_show(e_addressbook_search_dialog_new(view->view)); + } + else { + if (search_word && strlen (search_word)) { + switch (search_type) { + case ESB_ANY: + search_query = g_strdup_printf ("(contains \"x-evolution-any-field\" \"%s\")", + search_word); + break; + case ESB_FULL_NAME: + search_query = g_strdup_printf ("(contains \"full_name\" \"%s\")", + search_word); + break; + case ESB_EMAIL: + search_query = g_strdup_printf ("(contains \"email\" \"%s\")", + search_word); + break; + case ESB_CATEGORY: + search_query = g_strdup_printf ("(contains \"category\" \"%s\")", + search_word); + break; + default: + search_query = g_strdup ("(contains \"full_name\" \"\")"); + break; + } + } else search_query = g_strdup ("(contains \"full_name\" \"\")"); - break; - } - } else - search_query = g_strdup ("(contains \"full_name\" \"\")"); - gtk_object_set (GTK_OBJECT(view->view), - "query", search_query, - NULL); + gtk_object_set (GTK_OBJECT(view->view), + "query", search_query, + NULL); - g_free (search_query); - g_free (search_word); + g_free (search_query); + g_free (search_word); + } } static GNOME_Evolution_ShellView diff --git a/addressbook/gui/search/e-addressbook-search-dialog.c b/addressbook/gui/search/e-addressbook-search-dialog.c index 5450fb5b73..de1eb6f381 100644 --- a/addressbook/gui/search/e-addressbook-search-dialog.c +++ b/addressbook/gui/search/e-addressbook-search-dialog.c @@ -28,20 +28,15 @@ #include <libgnome/gnome-defs.h> #include <libgnome/gnome-i18n.h> #include <libgnomeui/gnome-stock.h> -#include <gal/widgets/e-canvas.h> -#include <gal/widgets/e-scroll-frame.h> #include "e-addressbook-search-dialog.h" -#include "addressbook/gui/widgets/e-minicard-view-widget.h" static void e_addressbook_search_dialog_init (EAddressbookSearchDialog *widget); static void e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass); -static void e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); -static void e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); static void e_addressbook_search_dialog_destroy (GtkObject *object); -static ECanvasClass *parent_class = NULL; +static GnomeDialog *parent_class = NULL; #define PARENT_TYPE (gnome_dialog_get_type()) @@ -88,8 +83,6 @@ e_addressbook_search_dialog_class_init (EAddressbookSearchDialogClass *klass) gtk_object_add_arg_type ("EAddressbookSearchDialog::book", GTK_TYPE_OBJECT, GTK_ARG_READWRITE, ARG_BOOK); - object_class->set_arg = e_addressbook_search_dialog_set_arg; - object_class->get_arg = e_addressbook_search_dialog_get_arg; object_class->destroy = e_addressbook_search_dialog_destroy; } @@ -134,13 +127,13 @@ button_press (GtkWidget *widget, int button, EAddressbookSearchDialog *dialog) if (button == 0) { query = get_query(dialog); - gtk_object_set(GTK_OBJECT(dialog->model), + gtk_object_set(GTK_OBJECT(dialog->view), "query", query, NULL); g_free(query); } - else - gnome_dialog_close(GNOME_DIALOG (dialog)); + + gnome_dialog_close(GNOME_DIALOG (dialog)); } static void @@ -149,9 +142,10 @@ e_addressbook_search_dialog_init (EAddressbookSearchDialog *view) GnomeDialog *dialog = GNOME_DIALOG (view); gtk_window_set_policy(GTK_WINDOW(view), FALSE, TRUE, FALSE); + gtk_window_set_default_size (GTK_WINDOW (view), 500, 400); view->search = get_widget(view); - gtk_box_pack_start(GTK_BOX(dialog->vbox), view->search, FALSE, FALSE, 0); + gtk_box_pack_start(GTK_BOX(dialog->vbox), view->search, TRUE, TRUE, 0); gtk_widget_show(view->search); gnome_dialog_append_buttons(dialog, @@ -162,76 +156,23 @@ e_addressbook_search_dialog_init (EAddressbookSearchDialog *view) gtk_signal_connect(GTK_OBJECT(dialog), "clicked", GTK_SIGNAL_FUNC(button_press), view); - - view->model = e_addressbook_model_new (); - view->adapter = E_ADDRESSBOOK_REFLOW_ADAPTER(e_addressbook_reflow_adapter_new (view->model)); - view->view = e_minicard_view_widget_new(view->adapter); - gtk_widget_show(view->view); - - view->scrolled_window = e_scroll_frame_new(NULL, NULL); - e_scroll_frame_set_policy(E_SCROLL_FRAME(view->scrolled_window), - GTK_POLICY_AUTOMATIC, GTK_POLICY_NEVER); - gtk_container_add(GTK_CONTAINER(view->scrolled_window), view->view); - - gtk_widget_show(view->scrolled_window); - - gtk_box_pack_start(GTK_BOX(dialog->vbox), view->scrolled_window, TRUE, TRUE, 0); } GtkWidget * -e_addressbook_search_dialog_new (EBook *book) +e_addressbook_search_dialog_new (EAddressbookView *addr_view) { EAddressbookSearchDialog *view = gtk_type_new (e_addressbook_search_dialog_get_type ()); - gtk_object_set(GTK_OBJECT(view->model), - "book", book, - NULL); + view->view = addr_view; return GTK_WIDGET(view); } static void -e_addressbook_search_dialog_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) -{ - EAddressbookSearchDialog *emvw; - - emvw = E_ADDRESSBOOK_SEARCH_DIALOG (o); - - switch (arg_id){ - case ARG_BOOK: - gtk_object_set(GTK_OBJECT(emvw->model), - "book", GTK_VALUE_OBJECT (*arg), - NULL); - break; - } -} - -static void -e_addressbook_search_dialog_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) -{ - EAddressbookSearchDialog *emvw; - - emvw = E_ADDRESSBOOK_SEARCH_DIALOG (object); - - switch (arg_id) { - case ARG_BOOK: - gtk_object_get(GTK_OBJECT(emvw->model), - "book", &(GTK_VALUE_OBJECT (*arg)), - NULL); - break; - default: - arg->type = GTK_TYPE_INVALID; - break; - } -} - -static void e_addressbook_search_dialog_destroy (GtkObject *object) { EAddressbookSearchDialog *view; view = E_ADDRESSBOOK_SEARCH_DIALOG (object); - gtk_object_unref((GtkObject *)view->model); - gtk_object_unref((GtkObject *)view->adapter); gtk_object_unref((GtkObject *)view->context); gtk_object_unref((GtkObject *)view->rule); diff --git a/addressbook/gui/search/e-addressbook-search-dialog.h b/addressbook/gui/search/e-addressbook-search-dialog.h index 9bc4c6ac18..86b30056d3 100644 --- a/addressbook/gui/search/e-addressbook-search-dialog.h +++ b/addressbook/gui/search/e-addressbook-search-dialog.h @@ -23,8 +23,7 @@ #include <ebook/e-book.h> -#include "addressbook/gui/widgets/e-addressbook-model.h" -#include "addressbook/gui/widgets/e-addressbook-reflow-adapter.h" +#include "addressbook/gui/widgets/e-addressbook-view.h" #include "filter/rule-context.h" #include "filter/filter-rule.h" @@ -50,14 +49,11 @@ struct _EAddressbookSearchDialog GnomeDialog parent; GtkWidget *search; - GtkWidget *view; - EAddressbookModel *model; - EAddressbookReflowAdapter *adapter; + EAddressbookView *view; RuleContext *context; FilterRule *rule; - GtkWidget *scrolled_window; }; struct _EAddressbookSearchDialogClass @@ -67,7 +63,7 @@ struct _EAddressbookSearchDialogClass GtkType e_addressbook_search_dialog_get_type (void); -GtkWidget *e_addressbook_search_dialog_new (EBook *book); +GtkWidget *e_addressbook_search_dialog_new (EAddressbookView *view); #ifdef __cplusplus } |