aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui/component
diff options
context:
space:
mode:
authorChristopher James Lahey <clahey@helixcode.com>2000-08-20 07:36:35 +0800
committerChris Lahey <clahey@src.gnome.org>2000-08-20 07:36:35 +0800
commitd56dbcd9247a965250888c0486464f976e668057 (patch)
tree9ad294f7fafd65cb7c531d11586a910806b39ef5 /addressbook/gui/component
parent862d1f25dea4fde774aca9b8e849f22b2e0b9d93 (diff)
downloadgsoc2013-evolution-d56dbcd9247a965250888c0486464f976e668057.tar
gsoc2013-evolution-d56dbcd9247a965250888c0486464f976e668057.tar.gz
gsoc2013-evolution-d56dbcd9247a965250888c0486464f976e668057.tar.bz2
gsoc2013-evolution-d56dbcd9247a965250888c0486464f976e668057.tar.lz
gsoc2013-evolution-d56dbcd9247a965250888c0486464f976e668057.tar.xz
gsoc2013-evolution-d56dbcd9247a965250888c0486464f976e668057.tar.zst
gsoc2013-evolution-d56dbcd9247a965250888c0486464f976e668057.zip
Changed this to use ECardSimple.
2000-08-19 Christopher James Lahey <clahey@helixcode.com> * conduit/address-conduit.c, conduit/address-conduit.h: Changed this to use ECardSimple. * contact-editor/e-contact-editor.c: Fixed a memory leak. * gui/component/addressbook.c: Added stuff to the right click menu. Activated the new search dialog that doesn't quite work yet. * gui/minicard/e-minicard-view.c: Fixed some run time warnings. svn path=/trunk/; revision=4882
Diffstat (limited to 'addressbook/gui/component')
-rw-r--r--addressbook/gui/component/addressbook.c83
1 files changed, 78 insertions, 5 deletions
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 5834d2f857..6a997cd2a4 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -20,6 +20,7 @@
#include <e-util/e-util.h>
#include <e-util/e-popup-menu.h>
#include "e-minicard-view-widget.h"
+#include "addressbook/gui/search/e-addressbook-search-dialog.h"
#include <e-table.h>
#include <e-cell-text.h>
@@ -85,6 +86,7 @@ control_deactivate (BonoboControl *control, BonoboUIHandler *uih)
#ifdef HAVE_LDAP
bonobo_ui_handler_menu_remove (uih, "/Actions/New Directory Server");
#endif
+ bonobo_ui_handler_menu_remove (uih, "/Tools/Search");
/* remove our toolbar */
bonobo_ui_handler_dock_remove (uih, "/Toolbar");
}
@@ -225,6 +227,23 @@ new_server_cb (BonoboUIHandler *uih, void *user_data, const char *path)
}
#endif
+static void
+search_cb (BonoboUIHandler *uih, void *user_data, const char *path)
+{
+ EBook *book;
+ AddressbookView *view = (AddressbookView *) user_data;
+ GtkObject *object;
+
+ if (view->minicard_view)
+ object = GTK_OBJECT(view->minicard_view);
+ else
+ object = GTK_OBJECT(view->model);
+ gtk_object_get(object, "book", &book, NULL);
+ g_assert (E_IS_BOOK (book));
+
+ gtk_widget_show(e_addressbook_search_dialog_new(book));
+}
+
static char *
get_query (AddressbookView *view)
{
@@ -521,6 +540,13 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih,
(gpointer)view);
#endif
+ bonobo_ui_handler_menu_new_item (uih, "/Tools/Search",
+ N_("_Search for contacts"),
+ NULL, -1,
+ BONOBO_UI_HANDLER_PIXMAP_STOCK, GNOME_STOCK_MENU_SEARCH,
+ 0, 0, search_cb,
+ (gpointer)view);
+
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
GTK_TOOLBAR_BOTH);
@@ -870,19 +896,66 @@ table_double_click(ETableScrolled *table, gint row, AddressbookView *view)
gtk_object_unref(GTK_OBJECT(card));
}
+typedef struct {
+ EBook *book;
+ ECard *card;
+} CardAndBook;
+
+static void
+card_and_book_free (CardAndBook *card_and_book)
+{
+ gtk_object_unref(GTK_OBJECT(card_and_book->card));
+ gtk_object_unref(GTK_OBJECT(card_and_book->book));
+}
+
+static void
+save_as (GtkWidget *widget, CardAndBook *card_and_book)
+{
+ e_contact_save_as(_("Save as VCard"), card_and_book->card);
+ card_and_book_free(card_and_book);
+}
+
+static void
+print (GtkWidget *widget, CardAndBook *card_and_book)
+{
+ gtk_widget_show(e_contact_print_card_dialog_new(card_and_book->card));
+ card_and_book_free(card_and_book);
+}
+
static void
-save_as (GtkWidget *widget, ECard *card)
+delete (GtkWidget *widget, CardAndBook *card_and_book)
{
- e_contact_save_as(_("Save as VCard"), card);
+ if (e_contact_editor_confirm_delete()) {
+ /* Add the card in the contact editor to our ebook */
+ e_book_remove_card (card_and_book->book,
+ card_and_book->card,
+ NULL,
+ NULL);
+ }
+ card_and_book_free(card_and_book);
}
static gint
table_right_click(ETableScrolled *table, gint row, gint col, GdkEvent *event, AddressbookView *view)
{
- ECard *card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(view->model), row);
- EPopupMenu menu[] = { {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0}, {NULL, NULL, NULL, 0} };
+ CardAndBook *card_and_book;
+
+ EPopupMenu menu[] = {
+ {"Save as VCard", NULL, GTK_SIGNAL_FUNC(save_as), 0},
+ {"Print", NULL, GTK_SIGNAL_FUNC(print), 0},
+ {"Delete", NULL, GTK_SIGNAL_FUNC(delete), 0},
+ {NULL, NULL, NULL, 0}
+ };
+
+ card_and_book = g_new(CardAndBook, 1);
+ card_and_book->card = e_addressbook_model_get_card(E_ADDRESSBOOK_MODEL(view->model), row);
+ gtk_object_get(GTK_OBJECT(view->model),
+ "book", &(card_and_book->book),
+ NULL);
+
+ gtk_object_ref(GTK_OBJECT(card_and_book->book));
- e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, card);
+ e_popup_menu_run (menu, (GdkEventButton *)event, 0, 0, card_and_book);
return TRUE;
}