aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
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
parent862d1f25dea4fde774aca9b8e849f22b2e0b9d93 (diff)
downloadgsoc2013-evolution-d56dbcd9247a965250888c0486464f976e668057.tar.gz
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')
-rw-r--r--addressbook/gui/component/addressbook.c83
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c1
-rw-r--r--addressbook/gui/minicard/e-minicard-view.c10
-rw-r--r--addressbook/gui/widgets/e-minicard-view.c10
4 files changed, 95 insertions, 9 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;
}
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index dd4ec4d567..e8062d83b9 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -938,6 +938,7 @@ setup_tab_order(GladeXML *gui)
list = add_to_tab_order(list, gui, "alignment-contacts");
list = g_list_reverse(list);
e_container_change_tab_order(GTK_CONTAINER(container), list);
+ g_list_free(list);
}
}
diff --git a/addressbook/gui/minicard/e-minicard-view.c b/addressbook/gui/minicard/e-minicard-view.c
index 8e275bdb2b..011ff9158f 100644
--- a/addressbook/gui/minicard/e-minicard-view.c
+++ b/addressbook/gui/minicard/e-minicard-view.c
@@ -211,12 +211,14 @@ e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_BOOK:
if (view->book)
gtk_object_unref(GTK_OBJECT(view->book));
- view->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
- if (view->book) {
+ if (GTK_VALUE_OBJECT (*arg)) {
+ view->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
gtk_object_ref(GTK_OBJECT(view->book));
if (view->get_view_idle == 0)
view->get_view_idle = g_idle_add((GSourceFunc)get_view, view);
}
+ else
+ view->book = NULL;
break;
case ARG_QUERY:
g_free(view->query);
@@ -360,6 +362,10 @@ disconnect_signals(EMinicardView *view)
if (view->book_view && view->modify_card_id)
gtk_signal_disconnect(GTK_OBJECT (view->book_view),
view->modify_card_id);
+
+ view->create_card_id = 0;
+ view->remove_card_id = 0;
+ view->modify_card_id = 0;
}
static void
diff --git a/addressbook/gui/widgets/e-minicard-view.c b/addressbook/gui/widgets/e-minicard-view.c
index 8e275bdb2b..011ff9158f 100644
--- a/addressbook/gui/widgets/e-minicard-view.c
+++ b/addressbook/gui/widgets/e-minicard-view.c
@@ -211,12 +211,14 @@ e_minicard_view_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
case ARG_BOOK:
if (view->book)
gtk_object_unref(GTK_OBJECT(view->book));
- view->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
- if (view->book) {
+ if (GTK_VALUE_OBJECT (*arg)) {
+ view->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
gtk_object_ref(GTK_OBJECT(view->book));
if (view->get_view_idle == 0)
view->get_view_idle = g_idle_add((GSourceFunc)get_view, view);
}
+ else
+ view->book = NULL;
break;
case ARG_QUERY:
g_free(view->query);
@@ -360,6 +362,10 @@ disconnect_signals(EMinicardView *view)
if (view->book_view && view->modify_card_id)
gtk_signal_disconnect(GTK_OBJECT (view->book_view),
view->modify_card_id);
+
+ view->create_card_id = 0;
+ view->remove_card_id = 0;
+ view->modify_card_id = 0;
}
static void