aboutsummaryrefslogtreecommitdiffstats
path: root/addressbook/gui
diff options
context:
space:
mode:
authorMatthew Loper <mloper@src.gnome.org>2000-04-10 02:33:50 +0800
committerMatthew Loper <mloper@src.gnome.org>2000-04-10 02:33:50 +0800
commit99612fe24cfc0dcb5bc8f020fe759ccb3cfc1416 (patch)
tree1d9cbc180c215df2f66f0786f8c1180415934128 /addressbook/gui
parent01bf08bdbc72d2183d40aa88b503b07bea8fff11 (diff)
downloadgsoc2013-evolution-99612fe24cfc0dcb5bc8f020fe759ccb3cfc1416.tar
gsoc2013-evolution-99612fe24cfc0dcb5bc8f020fe759ccb3cfc1416.tar.gz
gsoc2013-evolution-99612fe24cfc0dcb5bc8f020fe759ccb3cfc1416.tar.bz2
gsoc2013-evolution-99612fe24cfc0dcb5bc8f020fe759ccb3cfc1416.tar.lz
gsoc2013-evolution-99612fe24cfc0dcb5bc8f020fe759ccb3cfc1416.tar.xz
gsoc2013-evolution-99612fe24cfc0dcb5bc8f020fe759ccb3cfc1416.tar.zst
gsoc2013-evolution-99612fe24cfc0dcb5bc8f020fe759ccb3cfc1416.zip
+ * addressbook/Makefile.am: Compile contact-editor, _then_ gui,
+ since the gui now depends on the contact editor (shouldn't the + contact-editor directory be moved into 'gui'?). + + * addressbook/gui/component/addressbook.c (card_added_cb): New + function. Gets called when a card is successfully added via the + contact-editor. + (new_contact_cb): New function. Gets called when a user clicks the + "new contact" button on the toolbar, and creates a contact-editor + to edit a new contact entry. + (control_activate): Call gnome_app_fill_toolbar_with_data() + instead of gnome_app_fill_toolbar(), so that our toolbar can find + the right book to add a new card to. + (addressbook_factory): On an "activate" signal, send the book up + to control_activate_cb. + + * addressbook/gui/component/addressbook-factory.c (init_bonobo): + Call glade_gnome_init(), so that our contact-editor (which + requires glade) doesn't barf. + + * addressbook/gui/component/Makefile.am: added the contact-editor + to our libraries and include files. + + * addressbook/contact-editor/e-contact-editor.c + (e_contact_editor_new): Set "card" gtk property to the passed-in + card property. svn path=/trunk/; revision=2351
Diffstat (limited to 'addressbook/gui')
-rw-r--r--addressbook/gui/component/Makefile.am2
-rw-r--r--addressbook/gui/component/addressbook-factory.c4
-rw-r--r--addressbook/gui/component/addressbook.c102
-rw-r--r--addressbook/gui/contact-editor/e-contact-editor.c2
4 files changed, 90 insertions, 20 deletions
diff --git a/addressbook/gui/component/Makefile.am b/addressbook/gui/component/Makefile.am
index f5269071c4..486cc9d528 100644
--- a/addressbook/gui/component/Makefile.am
+++ b/addressbook/gui/component/Makefile.am
@@ -5,6 +5,7 @@ INCLUDES = \
-I$(top_srcdir)/e-util \
-I$(top_srcdir) \
-I$(top_srcdir)/addressbook/gui/minicard \
+ -I$(top_srcdir)/addressbook/contact-editor \
-I$(top_srcdir)/addressbook/backend/ebook \
$(BONOBO_HTML_GNOME_CFLAGS) \
-DEVOLUTION_VERSION=\""$(VERSION)"\" \
@@ -28,6 +29,7 @@ evolution_addressbook_LDADD = \
$(top_builddir)/widgets/e-text/libetext.a \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
+ $(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
$(top_builddir)/libversit/libversit.la
evolution_addressbook_LDFLAGS = `gnome-config --libs gdk_pixbuf`
diff --git a/addressbook/gui/component/addressbook-factory.c b/addressbook/gui/component/addressbook-factory.c
index cf59177f84..83257b1189 100644
--- a/addressbook/gui/component/addressbook-factory.c
+++ b/addressbook/gui/component/addressbook-factory.c
@@ -12,7 +12,7 @@
#include <gnome.h>
#include <libgnorba/gnorba.h>
#include <bonobo.h>
-
+#include <glade/glade.h>
#include "addressbook.h"
CORBA_Environment ev;
@@ -30,6 +30,8 @@ init_bonobo (int argc, char **argv)
if (bonobo_init (orb, NULL, NULL) == FALSE)
g_error (_("Could not initialize Bonobo"));
+
+ glade_gnome_init ();
}
int
diff --git a/addressbook/gui/component/addressbook.c b/addressbook/gui/component/addressbook.c
index 28422e4194..1ac90fcf28 100644
--- a/addressbook/gui/component/addressbook.c
+++ b/addressbook/gui/component/addressbook.c
@@ -1,20 +1,12 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
- * folder-browser-factory.c: A Bonobo Control factory for Folder Browsers
+ * addressbook.c:
*
* Author:
- * Miguel de Icaza (miguel@helixcode.com)
+ * Chris Lahey (clahey@helixcode.com)
*
* (C) 2000 Helix Code, Inc.
*/
-/*
- * bonobo-clock-control.c
- *
- * Copyright 1999, Helix Code, Inc.
- *
- * Author:
- * Nat Friedman (nat@nat.org)
- */
#include <config.h>
#include <gnome.h>
@@ -26,6 +18,7 @@
#include "e-book.h"
#include "e-canvas.h"
#include "e-minicard-view.h"
+#include "e-contact-editor.h"
static void
control_deactivate (BonoboControl *control, BonoboUIHandler *uih)
@@ -42,9 +35,81 @@ do_nothing_cb (BonoboUIHandler *uih, void *user_data, const char *path)
{
printf ("Yow! I am called back!\n");
}
+
+
+#define BLANK_VCARD \
+"BEGIN:VCARD
+" \
+"FN:
+" \
+"N:
+" \
+"BDAY:
+" \
+"TEL;WORK:
+" \
+"TEL;CELL:
+" \
+"EMAIL;INTERNET:
+" \
+"EMAIL;INTERNET:
+" \
+"ADR;WORK;POSTAL:
+" \
+"ADR;HOME;POSTAL;INTL:
+" \
+"END:VCARD
+" \
+"
+"
+
+
+static void
+card_added_cb (EBook* book, EBookStatus status, const char *id,
+ gpointer user_data)
+{
+ g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__);
+}
+
+
+static void
+new_contact_cb (BonoboUIHandler *uih, EBook *book, const char *path)
+{
+ gint result;
+ GtkWidget* contact_editor =
+ e_contact_editor_new(e_card_new(BLANK_VCARD));
+
+ GtkWidget* dlg = gnome_dialog_new ("Contact Editor", "Save", "Cancel", NULL);
+
+ g_assert (E_IS_BOOK (book));
+
+ gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dlg)->vbox),
+ contact_editor, TRUE, TRUE, 0);
+
+ gtk_widget_show_all (dlg);
+
+ gnome_dialog_close_hides (GNOME_DIALOG (dlg), TRUE);
+ result = gnome_dialog_run_and_close (GNOME_DIALOG (dlg));
+
+
+ /* If the user clicks "okay"...*/
+ if (result == 0) {
+ g_assert (contact_editor);
+ g_assert (GTK_IS_OBJECT (contact_editor));
+
+ /* Add the card in the contact editor to our ebook */
+ e_book_add_card (
+ book,
+ E_CONTACT_EDITOR(contact_editor)->card,
+ card_added_cb,
+ NULL);
+ }
+
+}
+
static GnomeUIInfo gnome_toolbar [] = {
- GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new contact"), do_nothing_cb, GNOME_STOCK_PIXMAP_NEW),
+ GNOMEUIINFO_ITEM_STOCK (N_("New"), N_("Create a new contact"), new_contact_cb, GNOME_STOCK_PIXMAP_NEW),
GNOMEUIINFO_SEPARATOR,
@@ -57,9 +122,8 @@ static GnomeUIInfo gnome_toolbar [] = {
-
static void
-control_activate (BonoboControl *control, BonoboUIHandler *uih)
+control_activate (BonoboControl *control, BonoboUIHandler *uih, EBook *book)
{
Bonobo_UIHandler remote_uih;
GtkWidget *toolbar;
@@ -77,9 +141,9 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih)
toolbar = gtk_toolbar_new (GTK_ORIENTATION_HORIZONTAL,
GTK_TOOLBAR_BOTH);
- gnome_app_fill_toolbar (GTK_TOOLBAR (toolbar),
- gnome_toolbar,
- NULL);
+ gnome_app_fill_toolbar_with_data (GTK_TOOLBAR (toolbar),
+ gnome_toolbar,
+ NULL, book);
gtk_widget_show_all (toolbar);
@@ -96,7 +160,7 @@ control_activate (BonoboControl *control, BonoboUIHandler *uih)
static void
control_activate_cb (BonoboControl *control,
gboolean activate,
- gpointer user_data)
+ EBook* book)
{
BonoboUIHandler *uih;
@@ -104,7 +168,7 @@ control_activate_cb (BonoboControl *control,
g_assert (uih);
if (activate)
- control_activate (control, uih);
+ control_activate (control, uih, book);
else
control_deactivate (control, uih);
}
@@ -261,7 +325,7 @@ addressbook_factory (BonoboGenericFactory *Factory, void *closure)
control = bonobo_control_new(vbox);
gtk_signal_connect (GTK_OBJECT (control), "activate",
- control_activate_cb, NULL);
+ control_activate_cb, book);
gtk_widget_pop_visual ();
gtk_widget_pop_colormap ();
diff --git a/addressbook/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c
index 9277eef1fd..81916847f7 100644
--- a/addressbook/gui/contact-editor/e-contact-editor.c
+++ b/addressbook/gui/contact-editor/e-contact-editor.c
@@ -254,6 +254,8 @@ e_contact_editor_new (ECard *card)
gtk_object_set (GTK_OBJECT(widget),
"card", card,
NULL);
+
+ E_CONTACT_EDITOR (widget)->card = card;
return widget;
}