correct path to libecontacteditor.a. (minicard_widget_test_LDADD): same.

2001-06-24  Chris Toshok  <toshok@ximian.com>

	* gui/widgets/Makefile.am (minicard_test_LDADD): correct path to
	libecontacteditor.a.
	(minicard_widget_test_LDADD): same.
	(INCLUDES): same, for the includes.

	* gui/widgets/e-minicard.h: correct e-contact-editor.h path.

	* gui/widgets/e-addressbook-util.h: correct path to
	e-contact-editor.h, and add e-contact-list-editor.h.  Add
	prototype for e_addressbook_show_contact_list_editor.

	* gui/widgets/e-addressbook-util.c: remove #include
	"e-contact-editor.h" (our header includes it.)
	(added_cb): rename card_added_cb to this, and make it so it can be
	reused in both the list and card cases.  remove the g_print too.
	(modified_cb): same for modified case.
	(deleted_cb): same for deleted case.
	(editor_closed_cb): change first arg to GtkObject* so we can reuse
	this for both list and card.
	(e_addressbook_show_contact_editor): use added_cb, modified_cb,
	deleted_cb, and pass FALSE as user_data.
	(e_addressbook_show_contact_list_editor): new function, same as
	above but creating a contact-list-editor, and pass TRUE as
	user_data.

	* gui/component/e-address-popup.c: correct path to contact-editor.

	* gui/component/e-address-widget.c: same.

	* gui/component/select-names/e-select-names-popup.c: same.

	* gui/component/select-names/e-select-names-text-model.c: same.

	* gui/component/addressbook.c (new_contact_list_cb): new function.
	(update_command_state): update ContactNewList command.
	(verbs): remove ViewAll from the toolbar from the verb list.  Add
	ContactNewList.
	(pixmaps): same for pixmaps.

	* gui/component/Makefile.am (evolution_addressbook_LDADD): new
	path for contact-editor.
	(INCLUDES): same.

	* gui/contact-list-editor/e-contact-list-model.h:
	* gui/contact-list-editor/e-contact-list-model.c:
	* gui/contact-list-editor/e-contact-list-editor.h:
	* gui/contact-list-editor/e-contact-list-editor.c:
	* gui/contact-list-editor/Makefile.am: Initial contact-list editor
	  commit.

	* gui/Makefile.am (SUBDIRS): add contact-editor.

	* Makefile.am: (SUBDIRS): remove contact-editor.

svn path=/trunk/; revision=10463
This commit is contained in:
Chris Toshok
2001-06-25 01:09:43 +00:00
committed by Chris Toshok
parent dcf2e1a4ac
commit 8cb68557ae
37 changed files with 1315 additions and 7238 deletions

View File

@ -1,3 +1,59 @@
2001-06-24 Chris Toshok <toshok@ximian.com>
* gui/widgets/Makefile.am (minicard_test_LDADD): correct path to
libecontacteditor.a.
(minicard_widget_test_LDADD): same.
(INCLUDES): same, for the includes.
* gui/widgets/e-minicard.h: correct e-contact-editor.h path.
* gui/widgets/e-addressbook-util.h: correct path to
e-contact-editor.h, and add e-contact-list-editor.h. Add
prototype for e_addressbook_show_contact_list_editor.
* gui/widgets/e-addressbook-util.c: remove #include
"e-contact-editor.h" (our header includes it.)
(added_cb): rename card_added_cb to this, and make it so it can be
reused in both the list and card cases. remove the g_print too.
(modified_cb): same for modified case.
(deleted_cb): same for deleted case.
(editor_closed_cb): change first arg to GtkObject* so we can reuse
this for both list and card.
(e_addressbook_show_contact_editor): use added_cb, modified_cb,
deleted_cb, and pass FALSE as user_data.
(e_addressbook_show_contact_list_editor): new function, same as
above but creating a contact-list-editor, and pass TRUE as
user_data.
* gui/component/e-address-popup.c: correct path to contact-editor.
* gui/component/e-address-widget.c: same.
* gui/component/select-names/e-select-names-popup.c: same.
* gui/component/select-names/e-select-names-text-model.c: same.
* gui/component/addressbook.c (new_contact_list_cb): new function.
(update_command_state): update ContactNewList command.
(verbs): remove ViewAll from the toolbar from the verb list. Add
ContactNewList.
(pixmaps): same for pixmaps.
* gui/component/Makefile.am (evolution_addressbook_LDADD): new
path for contact-editor.
(INCLUDES): same.
* gui/contact-list-editor/e-contact-list-model.h:
* gui/contact-list-editor/e-contact-list-model.c:
* gui/contact-list-editor/e-contact-list-editor.h:
* gui/contact-list-editor/e-contact-list-editor.c:
* gui/contact-list-editor/Makefile.am: Initial contact-list editor
commit.
* gui/Makefile.am (SUBDIRS): add contact-editor.
* Makefile.am: (SUBDIRS): remove contact-editor.
2001-06-21 Jon Trowbridge <trow@ximian.com>
* gui/component/select-names/e-select-names-popup.c

View File

@ -3,5 +3,5 @@ CONDUIT_SUBDIR=conduit
endif
SUBDIRS = \
backend printing contact-editor gui $(CONDUIT_SUBDIR)
backend printing gui $(CONDUIT_SUBDIR)

View File

@ -1,63 +0,0 @@
INCLUDES = \
$(BONOBO_GNOME_CFLAGS) \
$(EXTRA_GNOME_CFLAGS) \
-I$(top_srcdir) \
-I$(top_srcdir)/addressbook/ \
-I$(top_srcdir)/addressbook/backend \
-I$(top_srcdir)/addressbook/gui/merging \
-I$(top_srcdir)/widgets/e-table \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTIONDIR=\""$(evolutiondir)"\" \
-DG_LOG_DOMAIN=\"contact-editor\"
noinst_LIBRARIES = \
libecontacteditor.a
libecontacteditor_a_SOURCES = \
e-contact-editor-address.c \
e-contact-editor-address.h \
e-contact-editor-fullname.c \
e-contact-editor-fullname.h \
e-contact-editor.c \
e-contact-editor.h \
e-contact-save-as.c \
e-contact-save-as.h \
e-contact-quick-add.c \
e-contact-quick-add.h
# noinst_PROGRAMS = \
# contact-editor-test
# contact_editor_test_SOURCES = \
# test-editor.c
# contact_editor_test_LDADD = \
# libecontacteditor.a \
# $(top_builddir)/e-util/libeutil.la \
# $(top_builddir)/addressbook/printing/libecontactprint.a \
# $(top_builddir)/addressbook/backend/ebook/libebook.la \
# $(top_builddir)/e-util/ename/libename.la \
# $(top_builddir)/libversit/libversit.la \
# $(GNOMEGNORBA_LIBS) \
# $(BONOBO_GNOME_LIBS) \
# $(top_builddir)/widgets/misc/libemiscwidgets.a \
# $(top_builddir)/e-util/libeutil.la \
# $(GNOME_PRINT_LIBS) \
# $(EXTRA_GNOME_LIBS)
evolutiondir = $(datadir)/evolution
evolution_DATA = arrow.png
gladedir = $(datadir)/evolution/glade
glade_DATA = \
contact-editor.glade \
fulladdr.glade \
fullname.glade \
e-contact-editor-confirm-delete.glade
EXTRA_DIST = $(evolution_DATA) \
$(glade_DATA)

Binary file not shown.

Before

Width:  |  Height:  |  Size: 174 B

File diff suppressed because it is too large Load Diff

View File

@ -1,243 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* e-contact-editor-address.c
* Copyright (C) 2000 Ximian, Inc.
* Author: Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <libgnomeui/gnome-stock.h>
#include <gal/widgets/e-unicode.h>
#include <e-contact-editor-address.h>
static void e_contact_editor_address_init (EContactEditorAddress *card);
static void e_contact_editor_address_class_init (EContactEditorAddressClass *klass);
static void e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
static void e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_contact_editor_address_destroy (GtkObject *object);
static void fill_in_info(EContactEditorAddress *editor);
static void extract_info(EContactEditorAddress *editor);
static GnomeDialogClass *parent_class = NULL;
/* The arguments we take */
enum {
ARG_0,
ARG_ADDRESS,
ARG_IS_READ_ONLY
};
GtkType
e_contact_editor_address_get_type (void)
{
static GtkType contact_editor_address_type = 0;
if (!contact_editor_address_type)
{
static const GtkTypeInfo contact_editor_address_info =
{
"EContactEditorAddress",
sizeof (EContactEditorAddress),
sizeof (EContactEditorAddressClass),
(GtkClassInitFunc) e_contact_editor_address_class_init,
(GtkObjectInitFunc) e_contact_editor_address_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
contact_editor_address_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_address_info);
}
return contact_editor_address_type;
}
static void
e_contact_editor_address_class_init (EContactEditorAddressClass *klass)
{
GtkObjectClass *object_class;
GnomeDialogClass *dialog_class;
object_class = (GtkObjectClass*) klass;
dialog_class = (GnomeDialogClass *) klass;
parent_class = gtk_type_class (gnome_dialog_get_type ());
gtk_object_add_arg_type ("EContactEditorAddress::address", GTK_TYPE_POINTER,
GTK_ARG_READWRITE, ARG_ADDRESS);
gtk_object_add_arg_type ("EContactEditorAddress::editable", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_IS_READ_ONLY);
object_class->set_arg = e_contact_editor_address_set_arg;
object_class->get_arg = e_contact_editor_address_get_arg;
object_class->destroy = e_contact_editor_address_destroy;
}
static void
e_contact_editor_address_init (EContactEditorAddress *e_contact_editor_address)
{
GladeXML *gui;
GtkWidget *widget;
gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address),
GNOME_STOCK_BUTTON_OK);
gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_address),
GNOME_STOCK_BUTTON_CANCEL);
gtk_window_set_policy(GTK_WINDOW(e_contact_editor_address), FALSE, TRUE, FALSE);
e_contact_editor_address->address = NULL;
gui = glade_xml_new (EVOLUTION_GLADEDIR "/fulladdr.glade", NULL);
e_contact_editor_address->gui = gui;
widget = glade_xml_get_widget(gui, "table-checkaddress");
gtk_widget_ref(widget);
gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_address)->vbox), widget, TRUE, TRUE, 0);
gtk_widget_unref(widget);
}
void
e_contact_editor_address_destroy (GtkObject *object)
{
EContactEditorAddress *e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS(object);
if (e_contact_editor_address->gui)
gtk_object_unref(GTK_OBJECT(e_contact_editor_address->gui));
e_card_delivery_address_free(e_contact_editor_address->address);
}
GtkWidget*
e_contact_editor_address_new (const ECardDeliveryAddress *address)
{
GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_address_get_type ()));
gtk_object_set (GTK_OBJECT(widget),
"address", address,
NULL);
return widget;
}
static void
e_contact_editor_address_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
EContactEditorAddress *e_contact_editor_address;
e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (o);
switch (arg_id){
case ARG_ADDRESS:
if (e_contact_editor_address->address)
e_card_delivery_address_free(e_contact_editor_address->address);
e_contact_editor_address->address = e_card_delivery_address_copy(GTK_VALUE_POINTER (*arg));
fill_in_info(e_contact_editor_address);
break;
case ARG_IS_READ_ONLY: {
int i;
char *entry_names[] = {
"entry-street",
"entry-city",
"entry-ext",
"entry-po",
"entry-region",
"combo-country",
"entry-code",
NULL
};
e_contact_editor_address->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
for (i = 0; entry_names[i] != NULL; i ++) {
gtk_widget_set_sensitive (glade_xml_get_widget(e_contact_editor_address->gui, entry_names[i]), e_contact_editor_address->editable);
}
break;
}
}
}
static void
e_contact_editor_address_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
EContactEditorAddress *e_contact_editor_address;
e_contact_editor_address = E_CONTACT_EDITOR_ADDRESS (object);
switch (arg_id) {
case ARG_ADDRESS:
extract_info(e_contact_editor_address);
GTK_VALUE_POINTER (*arg) = e_card_delivery_address_copy(e_contact_editor_address->address);
break;
case ARG_IS_READ_ONLY:
GTK_VALUE_BOOL (*arg) = e_contact_editor_address->editable ? TRUE : FALSE;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
static void
fill_in_field(EContactEditorAddress *editor, char *field, char *string)
{
GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field));
if (editable) {
e_utf8_gtk_editable_set_text(editable, string);
}
}
static void
fill_in_info(EContactEditorAddress *editor)
{
ECardDeliveryAddress *address = editor->address;
if (address) {
fill_in_field(editor, "entry-street" , address->street );
fill_in_field(editor, "entry-po" , address->po );
fill_in_field(editor, "entry-ext" , address->ext );
fill_in_field(editor, "entry-city" , address->city );
fill_in_field(editor, "entry-region" , address->region );
fill_in_field(editor, "entry-code" , address->code );
fill_in_field(editor, "entry-country", address->country);
}
}
static char *
extract_field(EContactEditorAddress *editor, char *field)
{
GtkEditable *editable = GTK_EDITABLE(glade_xml_get_widget(editor->gui, field));
if (editable)
return e_utf8_gtk_editable_get_text(editable);
else
return NULL;
}
static void
extract_info(EContactEditorAddress *editor)
{
ECardDeliveryAddress *address = editor->address;
if (!address) {
address = e_card_delivery_address_new();
editor->address = address;
}
address->street = extract_field(editor, "entry-street" );
address->po = extract_field(editor, "entry-po" );
address->ext = extract_field(editor, "entry-ext" );
address->city = extract_field(editor, "entry-city" );
address->region = extract_field(editor, "entry-region" );
address->code = extract_field(editor, "entry-code" );
address->country = extract_field(editor, "entry-country");
}

View File

@ -1,78 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* e-contact-editor-address.h
* Copyright (C) 2000 Ximian, Inc.
* Author: Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __E_CONTACT_EDITOR_ADDRESS_H__
#define __E_CONTACT_EDITOR_ADDRESS_H__
#include <libgnomeui/gnome-dialog.h>
#include <glade/glade.h>
#include <ebook/e-card.h>
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
/* EContactEditorAddress - A dialog displaying information about a contact.
*
* The following arguments are available:
*
* name type read/write description
* --------------------------------------------------------------------------------
* name ECardName * RW The card currently being edited. Returns a copy.
*/
#define E_CONTACT_EDITOR_ADDRESS_TYPE (e_contact_editor_address_get_type ())
#define E_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddress))
#define E_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_ADDRESS_TYPE, EContactEditorAddressClass))
#define E_IS_CONTACT_EDITOR_ADDRESS(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE))
#define E_IS_CONTACT_EDITOR_ADDRESS_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_ADDRESS_TYPE))
typedef struct _EContactEditorAddress EContactEditorAddress;
typedef struct _EContactEditorAddressClass EContactEditorAddressClass;
struct _EContactEditorAddress
{
GnomeDialog parent;
/* item specific fields */
ECardDeliveryAddress *address;
guint editable : 1;
GladeXML *gui;
};
struct _EContactEditorAddressClass
{
GnomeDialogClass parent_class;
};
GtkWidget *e_contact_editor_address_new(const ECardDeliveryAddress *name);
GtkType e_contact_editor_address_get_type (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __E_CONTACT_EDITOR_ADDRESS_H__ */

View File

@ -1,83 +0,0 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>e-contact-editor-confirm-delete</name>
<program_name>e-contact-editor-confirm-delete</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file>
<output_support_files>False</output_support_files>
<output_build_files>False</output_build_files>
<gnome_help_support>True</gnome_help_support>
</project>
<widget>
<class>GnomeMessageBox</class>
<name>confirm-dialog</name>
<message_box_type>GNOME_MESSAGE_BOX_QUESTION</message_box_type>
<message>Are you sure you want
to delete this contact?</message>
<title>Delete Contact?</title>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>False</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>True</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>dialog-vbox1</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>dialog-action_area1</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button1</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>button2</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -1,243 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* e-contact-editor-fullname.c
* Copyright (C) 2000 Ximian, Inc.
* Author: Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <libgnomeui/gnome-stock.h>
#include <gal/widgets/e-unicode.h>
#include "e-contact-editor-fullname.h"
static void e_contact_editor_fullname_init (EContactEditorFullname *card);
static void e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass);
static void e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
static void e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_contact_editor_fullname_destroy (GtkObject *object);
static void fill_in_info(EContactEditorFullname *editor);
static void extract_info(EContactEditorFullname *editor);
static GnomeDialogClass *parent_class = NULL;
/* The arguments we take */
enum {
ARG_0,
ARG_NAME,
ARG_IS_READ_ONLY
};
GtkType
e_contact_editor_fullname_get_type (void)
{
static GtkType contact_editor_fullname_type = 0;
if (!contact_editor_fullname_type)
{
static const GtkTypeInfo contact_editor_fullname_info =
{
"EContactEditorFullname",
sizeof (EContactEditorFullname),
sizeof (EContactEditorFullnameClass),
(GtkClassInitFunc) e_contact_editor_fullname_class_init,
(GtkObjectInitFunc) e_contact_editor_fullname_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
contact_editor_fullname_type = gtk_type_unique (gnome_dialog_get_type (), &contact_editor_fullname_info);
}
return contact_editor_fullname_type;
}
static void
e_contact_editor_fullname_class_init (EContactEditorFullnameClass *klass)
{
GtkObjectClass *object_class;
GnomeDialogClass *dialog_class;
object_class = (GtkObjectClass*) klass;
dialog_class = (GnomeDialogClass *) klass;
parent_class = gtk_type_class (gnome_dialog_get_type ());
gtk_object_add_arg_type ("EContactEditorFullname::name", GTK_TYPE_POINTER,
GTK_ARG_READWRITE, ARG_NAME);
gtk_object_add_arg_type ("EContactEditorFullname::editable", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_IS_READ_ONLY);
object_class->set_arg = e_contact_editor_fullname_set_arg;
object_class->get_arg = e_contact_editor_fullname_get_arg;
object_class->destroy = e_contact_editor_fullname_destroy;
}
static void
e_contact_editor_fullname_init (EContactEditorFullname *e_contact_editor_fullname)
{
GladeXML *gui;
GtkWidget *widget;
gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname),
GNOME_STOCK_BUTTON_OK);
gnome_dialog_append_button ( GNOME_DIALOG(e_contact_editor_fullname),
GNOME_STOCK_BUTTON_CANCEL);
gtk_window_set_policy(GTK_WINDOW(e_contact_editor_fullname), TRUE, TRUE, FALSE);
e_contact_editor_fullname->name = NULL;
gui = glade_xml_new (EVOLUTION_GLADEDIR "/fullname.glade", NULL);
e_contact_editor_fullname->gui = gui;
widget = glade_xml_get_widget(gui, "table-checkfullname");
gtk_widget_ref(widget);
gtk_container_remove(GTK_CONTAINER(widget->parent), widget);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (e_contact_editor_fullname)->vbox), widget, TRUE, TRUE, 0);
gtk_widget_unref(widget);
}
void
e_contact_editor_fullname_destroy (GtkObject *object)
{
EContactEditorFullname *e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME(object);
if (e_contact_editor_fullname->gui)
gtk_object_unref(GTK_OBJECT(e_contact_editor_fullname->gui));
e_card_name_free(e_contact_editor_fullname->name);
}
GtkWidget*
e_contact_editor_fullname_new (const ECardName *name)
{
GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_fullname_get_type ()));
gtk_object_set (GTK_OBJECT(widget),
"name", name,
NULL);
return widget;
}
static void
e_contact_editor_fullname_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
EContactEditorFullname *e_contact_editor_fullname;
e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (o);
switch (arg_id){
case ARG_NAME:
if (e_contact_editor_fullname->name)
e_card_name_free(e_contact_editor_fullname->name);
e_contact_editor_fullname->name = e_card_name_copy(GTK_VALUE_POINTER (*arg));
fill_in_info(e_contact_editor_fullname);
break;
case ARG_IS_READ_ONLY: {
int i;
char *entry_names[] = {
"combo-title",
"combo-suffix",
"entry-first",
"entry-middle",
"entry-last",
NULL
};
e_contact_editor_fullname->editable = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
for (i = 0; entry_names[i] != NULL; i ++) {
gtk_widget_set_sensitive (glade_xml_get_widget(e_contact_editor_fullname->gui,
entry_names[i]),
e_contact_editor_fullname->editable);
}
break;
}
}
}
static void
e_contact_editor_fullname_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
EContactEditorFullname *e_contact_editor_fullname;
e_contact_editor_fullname = E_CONTACT_EDITOR_FULLNAME (object);
switch (arg_id) {
case ARG_NAME:
extract_info(e_contact_editor_fullname);
GTK_VALUE_POINTER (*arg) = e_card_name_copy(e_contact_editor_fullname->name);
break;
case ARG_IS_READ_ONLY:
GTK_VALUE_BOOL (*arg) = e_contact_editor_fullname->editable ? TRUE : FALSE;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
static void
fill_in_field(EContactEditorFullname *editor, char *field, char *string)
{
GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field));
if (entry) {
if (string)
e_utf8_gtk_entry_set_text(entry, string);
else
gtk_entry_set_text(entry, "");
}
}
static void
fill_in_info(EContactEditorFullname *editor)
{
ECardName *name = editor->name;
if (name) {
fill_in_field(editor, "entry-title", name->prefix);
fill_in_field(editor, "entry-first", name->given);
fill_in_field(editor, "entry-middle", name->additional);
fill_in_field(editor, "entry-last", name->family);
fill_in_field(editor, "entry-suffix", name->suffix);
}
}
static char *
extract_field(EContactEditorFullname *editor, char *field)
{
GtkEntry *entry = GTK_ENTRY(glade_xml_get_widget(editor->gui, field));
if (entry)
return e_utf8_gtk_entry_get_text(entry);
else
return NULL;
}
static void
extract_info(EContactEditorFullname *editor)
{
ECardName *name = editor->name;
if (!name) {
name = e_card_name_new();
editor->name = name;
}
name->prefix = extract_field(editor, "entry-title" );
name->given = extract_field(editor, "entry-first" );
name->additional = extract_field(editor, "entry-middle");
name->family = extract_field(editor, "entry-last" );
name->suffix = extract_field(editor, "entry-suffix");
}

View File

@ -1,78 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* e-contact-editor-fullname.h
* Copyright (C) 2000 Ximian, Inc.
* Author: Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __E_CONTACT_EDITOR_FULLNAME_H__
#define __E_CONTACT_EDITOR_FULLNAME_H__
#include <libgnomeui/gnome-dialog.h>
#include <glade/glade.h>
#include <ebook/e-card.h>
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
/* EContactEditorFullname - A dialog displaying information about a contact.
*
* The following arguments are available:
*
* name type read/write description
* --------------------------------------------------------------------------------
* name ECardName * RW The card currently being edited. Returns a copy.
*/
#define E_CONTACT_EDITOR_FULLNAME_TYPE (e_contact_editor_fullname_get_type ())
#define E_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullname))
#define E_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_FULLNAME_TYPE, EContactEditorFullnameClass))
#define E_IS_CONTACT_EDITOR_FULLNAME(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE))
#define E_IS_CONTACT_EDITOR_FULLNAME_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_FULLNAME_TYPE))
typedef struct _EContactEditorFullname EContactEditorFullname;
typedef struct _EContactEditorFullnameClass EContactEditorFullnameClass;
struct _EContactEditorFullname
{
GnomeDialog parent;
/* item specific fields */
ECardName *name;
GladeXML *gui;
/* Whether the dialog will accept modifications */
guint editable : 1;
};
struct _EContactEditorFullnameClass
{
GnomeDialogClass parent_class;
};
GtkWidget *e_contact_editor_fullname_new(const ECardName *name);
GtkType e_contact_editor_fullname_get_type (void);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __E_CONTACT_EDITOR_FULLNAME_H__ */

File diff suppressed because it is too large Load Diff

View File

@ -1,131 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* e-contact-editor.h
* Copyright (C) 2000 Ximian, Inc.
* Author: Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __E_CONTACT_EDITOR_H__
#define __E_CONTACT_EDITOR_H__
#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-app-helper.h>
#include <bonobo/bonobo-ui-component.h>
#include <glade/glade.h>
#include "addressbook/backend/ebook/e-book.h"
#include "addressbook/backend/ebook/e-card.h"
#include "addressbook/backend/ebook/e-card-simple.h"
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
/* EContactEditor - A dialog displaying information about a contact.
*
* The following arguments are available:
*
* name type read/write description
* --------------------------------------------------------------------------------
* card ECard * RW The card currently being edited
*/
#define E_CONTACT_EDITOR_TYPE (e_contact_editor_get_type ())
#define E_CONTACT_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_EDITOR_TYPE, EContactEditor))
#define E_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_EDITOR_TYPE, EContactEditorClass))
#define E_IS_CONTACT_EDITOR(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE))
#define E_IS_CONTACT_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE))
typedef struct _EContactEditor EContactEditor;
typedef struct _EContactEditorClass EContactEditorClass;
struct _EContactEditor
{
GtkObject object;
/* item specific fields */
EBook *book;
ECard *card;
ECardSimple *simple;
/* UI handler */
BonoboUIComponent *uic;
GladeXML *gui;
GtkWidget *app;
GnomeUIInfo *email_info;
GnomeUIInfo *phone_info;
GnomeUIInfo *address_info;
GtkWidget *email_popup;
GtkWidget *phone_popup;
GtkWidget *address_popup;
GList *email_list;
GList *phone_list;
GList *address_list;
ECardName *name;
char *company;
ECardSimpleEmailId email_choice;
ECardSimplePhoneId phone_choice[4];
ECardSimpleAddressId address_choice;
GList *arbitrary_fields;
/* Whether we are editing a new card or an existing one */
guint is_new_card : 1;
/* Whether the card has been changed since bringing up the contact editor */
guint changed : 1;
/* Whether the contact editor will accept modifications */
guint editable : 1;
EList *writable_fields;
};
struct _EContactEditorClass
{
GtkObjectClass parent_class;
/* Notification signals */
void (* card_added) (EContactEditor *ce, EBookStatus status, ECard *card);
void (* card_modified) (EContactEditor *ce, EBookStatus status, ECard *card);
void (* card_deleted) (EContactEditor *ce, EBookStatus status, ECard *card);
void (* editor_closed) (EContactEditor *ce);
};
EContactEditor *e_contact_editor_new (EBook *book,
ECard *card,
gboolean is_new_card,
gboolean editable);
GtkType e_contact_editor_get_type (void);
void e_contact_editor_show (EContactEditor *editor);
void e_contact_editor_close (EContactEditor *editor);
void e_contact_editor_raise (EContactEditor *editor);
gboolean e_contact_editor_confirm_delete (GtkWindow *parent);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __E_CONTACT_EDITOR_H__ */

View File

@ -1,416 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* e-contact-quick-add.c
*
* Copyright (C) 2001 Ximian, Inc.
*
* Developed by Jon Trowbridge <trow@ximian.com>
*/
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
#include <config.h>
#include <ctype.h>
#include <glib.h>
#include <gtk/gtkentry.h>
#include <gtk/gtklabel.h>
#include <gtk/gtktable.h>
#include <libgnome/gnome-defs.h>
#include <libgnome/gnome-i18n.h>
#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-dialog.h>
#include <libgnomeui/gnome-stock.h>
#include <gal/widgets/e-unicode.h>
#include <addressbook/backend/ebook/e-book.h>
#include <addressbook/backend/ebook/e-book-util.h>
#include <addressbook/backend/ebook/e-card.h>
#include "e-contact-editor.h"
#include "e-contact-quick-add.h"
#include "e-card-merging.h"
typedef struct _QuickAdd QuickAdd;
struct _QuickAdd {
gchar *name;
gchar *email;
ECard *card;
EContactQuickAddCallback cb;
gpointer closure;
GtkWidget *name_entry;
GtkWidget *email_entry;
gint refs;
};
static QuickAdd *
quick_add_new (void)
{
QuickAdd *qa = g_new0 (QuickAdd, 1);
qa->card = e_card_new ("");
qa->refs = 1;
return qa;
}
static void
quick_add_ref (QuickAdd *qa)
{
if (qa) {
++qa->refs;
}
}
static void
quick_add_unref (QuickAdd *qa)
{
if (qa) {
--qa->refs;
if (qa->refs == 0) {
g_message ("freeing %s / %s", qa->name, qa->email);
g_free (qa->name);
g_free (qa->email);
gtk_object_unref (GTK_OBJECT (qa->card));
g_free (qa);
}
}
}
static void
quick_add_set_name (QuickAdd *qa, const gchar *name)
{
ECardSimple *simple;
g_free (qa->name);
qa->name = g_strdup (name);
simple = e_card_simple_new (qa->card);
e_card_simple_set (simple, E_CARD_SIMPLE_FIELD_FULL_NAME, name);
e_card_simple_sync_card (simple);
gtk_object_unref (GTK_OBJECT (simple));
}
static void
quick_add_set_email (QuickAdd *qa, const gchar *email)
{
ECardSimple *simple;
g_free (qa->email);
qa->email = g_strdup (email);
simple = e_card_simple_new (qa->card);
e_card_simple_set (simple, E_CARD_SIMPLE_FIELD_EMAIL, email);
e_card_simple_sync_card (simple);
gtk_object_unref (GTK_OBJECT (simple));
}
static void
merge_cb (EBook *book, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
if (book != NULL) {
e_card_merging_book_add_card (book, qa->card, NULL, NULL);
if (qa->cb)
qa->cb (qa->card, qa->closure);
} else {
/* Something went wrong. */
if (qa->cb)
qa->cb (NULL, qa->closure);
}
quick_add_unref (qa);
}
static void
quick_add_merge_card (QuickAdd *qa)
{
quick_add_ref (qa);
e_book_use_local_address_book (merge_cb, qa);
}
/*
* Raise a contact editor with all fields editable, and hook up all signals accordingly.
*/
static void
card_added_cb (EContactEditor *ce, EBookStatus status, ECard *card, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
if (qa->cb)
qa->cb (qa->card, qa->closure);
quick_add_unref (qa);
}
static void
editor_closed_cb (GtkWidget *w, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
g_warning ("editor_closed_cb");
quick_add_unref (qa);
gtk_object_unref (GTK_OBJECT (w));
}
static void
ce_have_book (EBook *book, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
if (book == NULL) {
g_warning ("Couldn't open local address book.");
quick_add_unref (qa);
} else {
EContactEditor *contact_editor = e_contact_editor_new (book, qa->card, TRUE, FALSE /* XXX */);
gtk_signal_connect (GTK_OBJECT (contact_editor),
"card_added",
GTK_SIGNAL_FUNC (card_added_cb),
qa);
gtk_signal_connect (GTK_OBJECT (contact_editor),
"editor_closed",
GTK_SIGNAL_FUNC (editor_closed_cb),
qa);
}
}
static void
edit_card (QuickAdd *qa)
{
e_book_use_local_address_book (ce_have_book, qa);
}
static void
clicked_cb (GtkWidget *w, gint button, gpointer closure)
{
QuickAdd *qa = (QuickAdd *) closure;
/* Get data out of entries. */
if (button == 0 || button == 1) {
gchar *name = NULL;
gchar *email = NULL;
if (qa->name_entry) {
gchar *tmp;
tmp = gtk_editable_get_chars (GTK_EDITABLE (qa->name_entry), 0, -1);
name = e_utf8_from_gtk_string (qa->name_entry, tmp);
g_free (tmp);
}
if (qa->email_entry) {
gchar *tmp;
tmp = gtk_editable_get_chars (GTK_EDITABLE (qa->email_entry), 0, -1);
email = e_utf8_from_gtk_string (qa->email_entry, tmp);
g_free (tmp);
}
quick_add_set_name (qa, name);
quick_add_set_email (qa, email);
g_free (name);
g_free (email);
}
gtk_widget_destroy (w);
if (button == 0) {
/* OK */
quick_add_merge_card (qa);
} else if (button == 1) {
/* EDIT FULL */
edit_card (qa);
} else {
/* CANCEL */
quick_add_unref (qa);
}
}
static GtkWidget *
build_quick_add_dialog (QuickAdd *qa)
{
GtkWidget *dialog;
GtkTable *table;
const gint xpad=1, ypad=1;
g_return_val_if_fail (qa != NULL, NULL);
dialog = gnome_dialog_new (_("Contact Quick-Add"),
GNOME_STOCK_BUTTON_OK,
_("Edit Full"),
GNOME_STOCK_BUTTON_CANCEL,
NULL);
gtk_signal_connect (GTK_OBJECT (dialog),
"clicked",
clicked_cb,
qa);
qa->name_entry = gtk_entry_new ();
if (qa->name) {
gchar *str = e_utf8_to_gtk_string (qa->name_entry, qa->name);
gtk_entry_set_text (GTK_ENTRY (qa->name_entry), str);
g_free (str);
}
qa->email_entry = gtk_entry_new ();
if (qa->email) {
gchar *str = e_utf8_to_gtk_string (qa->email_entry, qa->email);
gtk_entry_set_text (GTK_ENTRY (qa->email_entry), str);
g_free (str);
}
table = GTK_TABLE (gtk_table_new (2, 2, FALSE));
gtk_table_attach (table, gtk_label_new (_("Full Name")),
0, 1, 0, 1,
0, 0, xpad, ypad);
gtk_table_attach (table, qa->name_entry,
1, 2, 0, 1,
GTK_EXPAND | GTK_FILL, GTK_EXPAND, xpad, ypad);
gtk_table_attach (table, gtk_label_new (_("E-mail")),
0, 1, 1, 2,
0, 0, xpad, ypad);
gtk_table_attach (table, qa->email_entry,
1, 2, 1, 2,
GTK_EXPAND | GTK_FILL, GTK_EXPAND, xpad, ypad);
gtk_box_pack_start (GTK_BOX (GNOME_DIALOG (dialog)->vbox),
GTK_WIDGET (table),
TRUE, TRUE, 0);
gtk_widget_show_all (GTK_WIDGET (table));
return dialog;
}
void
e_contact_quick_add (const gchar *name, const gchar *email,
EContactQuickAddCallback cb, gpointer closure)
{
QuickAdd *qa;
GtkWidget *dialog;
/* We need to have *something* to work with. */
if (name == NULL && email == NULL) {
if (cb)
cb (NULL, closure);
return;
}
qa = quick_add_new ();
qa->cb = cb;
qa->closure = closure;
if (name)
quick_add_set_name (qa, name);
if (email)
quick_add_set_email (qa, email);
dialog = build_quick_add_dialog (qa);
gtk_widget_show_all (dialog);
}
void
e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure)
{
gchar *name=NULL, *email=NULL;
const gchar *last_at, *s;
gboolean in_quote;
if (text == NULL) {
e_contact_quick_add (NULL, NULL, cb, closure);
return;
}
/* Look for things that look like e-mail addresses embedded in text */
in_quote = FALSE;
last_at = NULL;
for (s = text; *s; ++s) {
if (*s == '@' && !in_quote)
last_at = s;
else if (*s == '"')
in_quote = !in_quote;
}
if (last_at == NULL) {
/* No at sign, so we treat it all as the name */
name = g_strdup (text);
} else {
gboolean bad_char = FALSE;
/* walk backwards to whitespace or a < or a quote... */
while (last_at >= text && !bad_char
&& !(isspace ((gint) *last_at) || *last_at == '<' || *last_at == '"')) {
/* Check for some stuff that can't appear in a legal e-mail address. */
if (*last_at == '['
|| *last_at == ']'
|| *last_at == '('
|| *last_at == ')')
bad_char = TRUE;
--last_at;
}
if (last_at < text)
last_at = text;
/* ...and then split the text there */
if (!bad_char) {
if (text < last_at)
name = g_strndup (text, last_at-text);
email = g_strdup (last_at);
}
}
/* If all else has failed, make it the name. */
if (name == NULL && email == NULL)
name = g_strdup (text);
/* Clean up name */
if (name && *name)
g_strstrip (name);
/* Clean up email, remove bracketing <>s */
if (email && *email) {
gboolean changed = FALSE;
g_strstrip (email);
if (*email == '<') {
*email = ' ';
changed = TRUE;
}
if (email[strlen (email)-1] == '>') {
email[strlen (email)-1] = ' ';
changed = TRUE;
}
if (changed)
g_strstrip (email);
}
e_contact_quick_add (name, email, cb, closure);
g_free (name);
g_free (email);
}

View File

@ -1,41 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* e-contact-quick-add.h
*
* Copyright (C) 2001 Ximian, Inc.
*
* Developed by Jon Trowbridge <trow@ximian.com>
*/
/*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
* USA.
*/
#ifndef __E_CONTACT_QUICK_ADD_H__
#define __E_CONTACT_QUICK_ADD_H__
#include <addressbook/backend/ebook/e-card.h>
typedef void (*EContactQuickAddCallback) (ECard *new_card, gpointer closure);
void e_contact_quick_add (const gchar *name, const gchar *email,
EContactQuickAddCallback cb, gpointer closure);
void e_contact_quick_add_free_form (const gchar *text, EContactQuickAddCallback cb, gpointer closure);
#endif /* __E_CONTACT_QUICK_ADD_H__ */

View File

@ -1,100 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* e-contact-editor.h
* Copyright (C) 2000 Ximian, Inc.
* Author: Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include <config.h>
#include <unistd.h>
#include <fcntl.h>
#include <gtk/gtkfilesel.h>
#include <gtk/gtksignal.h>
#include <gal/util/e-util.h>
#include "e-contact-save-as.h"
typedef struct {
GtkFileSelection *filesel;
char *vcard;
} SaveAsInfo;
static void
save_it(GtkWidget *widget, SaveAsInfo *info)
{
const char *filename = gtk_file_selection_get_filename (info->filesel);
e_write_file (filename, info->vcard, O_WRONLY | O_CREAT | O_EXCL | O_TRUNC);
g_free (info->vcard);
gtk_widget_destroy(GTK_WIDGET(info->filesel));
g_free(info);
}
static void
close_it(GtkWidget *widget, SaveAsInfo *info)
{
g_free (info->vcard);
gtk_widget_destroy (GTK_WIDGET (info->filesel));
g_free (info);
}
static void
delete_it(GtkWidget *widget, SaveAsInfo *info)
{
g_free (info->vcard);
g_free (info);
}
void
e_contact_save_as(char *title, ECard *card)
{
GtkFileSelection *filesel;
SaveAsInfo *info = g_new(SaveAsInfo, 1);
filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title));
info->filesel = filesel;
info->vcard = e_card_get_vcard(card);
gtk_signal_connect(GTK_OBJECT(filesel->ok_button), "clicked",
save_it, info);
gtk_signal_connect(GTK_OBJECT(filesel->cancel_button), "clicked",
close_it, info);
gtk_signal_connect(GTK_OBJECT(filesel), "delete_event",
delete_it, info);
gtk_widget_show(GTK_WIDGET(filesel));
}
void
e_contact_list_save_as(char *title, GList *list)
{
GtkFileSelection *filesel;
SaveAsInfo *info = g_new(SaveAsInfo, 1);
filesel = GTK_FILE_SELECTION(gtk_file_selection_new(title));
info->filesel = filesel;
info->vcard = e_card_list_get_vcard (list);
gtk_signal_connect(GTK_OBJECT(filesel->ok_button), "clicked",
save_it, info);
gtk_signal_connect(GTK_OBJECT(filesel->cancel_button), "clicked",
close_it, info);
gtk_signal_connect(GTK_OBJECT(filesel), "delete_event",
delete_it, info);
gtk_widget_show(GTK_WIDGET(filesel));
}

View File

@ -1,43 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* e-contact-save-as.h
* Copyright (C) 2000 Ximian, Inc.
* Author: Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __E_CONTACT_SAVE_AS_H__
#define __E_CONTACT_SAVE_AS_H__
#include <glade/glade.h>
#include "addressbook/backend/ebook/e-card.h"
#include "addressbook/backend/ebook/e-card-simple.h"
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
void
e_contact_save_as(gchar *title, ECard *card);
void
e_contact_list_save_as(gchar *title, GList *list);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __E_CONTACT_EDITOR_H__ */

View File

@ -1,475 +0,0 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>fulladdr</name>
<program_name>fulladdr</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file>
<output_support_files>False</output_support_files>
<output_build_files>False</output_build_files>
</project>
<widget>
<class>GnomeDialog</class>
<name>dialog-checkaddress</name>
<visible>False</visible>
<title>Check Address</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>True</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>vbox-container</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>hbuttonbox1</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button1</name>
<can_default>True</can_default>
<has_default>True</has_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>button2</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkTable</class>
<name>table-checkaddress</name>
<border_width>8</border_width>
<rows>4</rows>
<columns>4</columns>
<homogeneous>False</homogeneous>
<row_spacing>6</row_spacing>
<column_spacing>6</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<label>_Address:</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-street</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label4</name>
<label>_City:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-city</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-city</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-ext</name>
<width>100</width>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label8</name>
<label>_PO Box:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-po</focus_target>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<label>Address _2:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-ext</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-po</name>
<width>100</width>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-street</name>
<can_focus>True</can_focus>
<has_focus>True</has_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>4</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label5</name>
<label>_State/Province:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-region</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-region</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkCombo</class>
<name>combo-country</name>
<width>100</width>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items>USA
Canada
Finland
</items>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>entry-country</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-code</name>
<width>100</width>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label6</name>
<label>_ZIP Code:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-code</focus_target>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label7</name>
<label>Countr_y:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>1</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-country</focus_target>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -1,389 +0,0 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>fullname</name>
<program_name>fullname</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
<use_widget_names>True</use_widget_names>
<output_main_file>False</output_main_file>
<output_support_files>False</output_support_files>
<output_build_files>False</output_build_files>
</project>
<widget>
<class>GnomeDialog</class>
<name>dialog-checkfullname</name>
<visible>False</visible>
<title>Check Full Name</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>True</modal>
<allow_shrink>True</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<auto_close>False</auto_close>
<hide_on_close>False</hide_on_close>
<widget>
<class>GtkVBox</class>
<child_name>GnomeDialog:vbox</child_name>
<name>vbox-container</name>
<homogeneous>False</homogeneous>
<spacing>8</spacing>
<child>
<padding>4</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkHButtonBox</class>
<child_name>GnomeDialog:action_area</child_name>
<name>hbuttonbox1</name>
<layout_style>GTK_BUTTONBOX_END</layout_style>
<spacing>8</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<padding>0</padding>
<expand>False</expand>
<fill>True</fill>
<pack>GTK_PACK_END</pack>
</child>
<widget>
<class>GtkButton</class>
<name>button1</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_OK</stock_button>
</widget>
<widget>
<class>GtkButton</class>
<name>button2</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<stock_button>GNOME_STOCK_BUTTON_CANCEL</stock_button>
</widget>
</widget>
<widget>
<class>GtkTable</class>
<name>table-checkfullname</name>
<border_width>8</border_width>
<rows>5</rows>
<columns>3</columns>
<homogeneous>False</homogeneous>
<row_spacing>6</row_spacing>
<column_spacing>21</column_spacing>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkCombo</class>
<name>combo-title</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items>
Mr.
Mrs.
Ms.
Miss
Dr.
</items>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>entry-title</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GtkCombo</class>
<name>combo-suffix</name>
<value_in_list>False</value_in_list>
<ok_if_empty>True</ok_if_empty>
<case_sensitive>False</case_sensitive>
<use_arrows>True</use_arrows>
<use_arrows_always>False</use_arrows_always>
<items>
Sr.
Jr.
I
II
III
Esq.
</items>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
<widget>
<class>GtkEntry</class>
<child_name>GtkCombo:entry</child_name>
<name>entry-suffix</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
</widget>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-first</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-middle</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>entry-last</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<label>_First:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-first</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label1</name>
<label>_Title:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-title</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label3</name>
<label>_Middle:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-middle</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label5</name>
<label>_Last:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-last</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label4</name>
<label>_Suffix:</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<focus_target>entry-suffix</focus_target>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>4</top_attach>
<bottom_attach>5</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -1,145 +0,0 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/*
* test-editor.c
* Copyright (C) 2000 Ximian, Inc.
* Author: Chris Lahey <clahey@ximian.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "config.h"
#include <stdlib.h>
#include <gtk/gtkmain.h>
#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-init.h>
#include <glade/glade.h>
#include "e-contact-editor.h"
#define TEST_VCARD \
"BEGIN:VCARD
" \
"FN:Nat
" \
"N:Friedman;Nat;D;Mr.
" \
"BDAY:1977-08-06
" \
"TEL;WORK:617 679 1984
" \
"TEL;CELL:123 456 7890
" \
"EMAIL;INTERNET:nat@nat.org
" \
"EMAIL;INTERNET:nat@ximian.com
" \
"ADR;WORK;POSTAL:P.O. Box 101;;;Any Town;CA;91921-1234;
" \
"ADR;HOME;POSTAL;INTL:P.O. Box 202;;;Any Town 2;MI;12344-4321;USA
" \
"END:VCARD
" \
"
"
static char *
read_file (char *name)
{
int len;
char buff[65536];
char line[1024];
FILE *f;
f = fopen (name, "r");
if (f == NULL)
g_error ("Unable to open %s!\n", name);
len = 0;
while (fgets (line, sizeof (line), f) != NULL) {
strcpy (buff + len, line);
len += strlen (line);
}
fclose (f);
return g_strdup (buff);
}
/* Callback used when a contact editor is closed */
static void
editor_closed_cb (EContactEditor *ce, gpointer data)
{
static int count = 2;
count--;
gtk_object_unref (GTK_OBJECT (ce));
if (count == 0)
exit (0);
}
#if 0
static void about_callback( GtkWidget *widget, gpointer data )
{
const gchar *authors[] =
{
"Christopher James Lahey <clahey@umich.edu>",
NULL
};
GtkWidget *about =
gnome_about_new ( _( "Contact Editor Test" ), VERSION,
_( "Copyright (C) 2000, Ximian, Inc." ),
authors,
_( "This should test the contact editor canvas item" ),
NULL);
gtk_widget_show (about);
}
#endif
int main( int argc, char *argv[] )
{
char *cardstr;
EContactEditor *ce;
/* bindtextdomain (PACKAGE, GNOMELOCALEDIR);
textdomain (PACKAGE);*/
gnome_init( "Contact Editor Test", VERSION, argc, argv);
glade_gnome_init ();
cardstr = NULL;
if (argc == 2)
cardstr = read_file (argv [1]);
if (cardstr == NULL)
cardstr = TEST_VCARD;
ce = e_contact_editor_new (e_card_new (cardstr), TRUE, NULL, FALSE);
gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
ce = e_contact_editor_new (e_card_new (cardstr), TRUE, NULL, FALSE);
gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
gtk_main();
/* Not reached. */
return 0;
}

View File

@ -1 +1 @@
SUBDIRS = merging widgets search component
SUBDIRS = contact-editor contact-list-editor merging widgets search component

View File

@ -1,24 +1,25 @@
SUBDIRS = select-names
INCLUDES = \
-DG_LOG_DOMAIN=\"evolution-addressbook\" \
$(EXTRA_GNOME_CFLAGS) \
$(GNOME_INCLUDEDIR) \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/shell \
-I$(top_builddir)/shell \
-I$(top_srcdir)/widgets/misc \
-I$(top_srcdir)/addressbook/gui/minicard \
-I$(top_srcdir)/addressbook/gui/widgets \
-I$(top_srcdir)/addressbook/contact-editor \
-I$(top_srcdir)/addressbook/backend \
-I$(top_builddir)/addressbook/backend \
$(BONOBO_HTML_GNOME_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
INCLUDES = \
-DG_LOG_DOMAIN=\"evolution-addressbook\" \
$(EXTRA_GNOME_CFLAGS) \
$(GNOME_INCLUDEDIR) \
-I$(top_srcdir) \
-I$(top_builddir) \
-I$(top_srcdir)/shell \
-I$(top_builddir)/shell \
-I$(top_srcdir)/widgets/misc \
-I$(top_srcdir)/addressbook/gui/contact-editor \
-I$(top_srcdir)/addressbook/gui/contact-list-editor \
-I$(top_srcdir)/addressbook/gui/minicard \
-I$(top_srcdir)/addressbook/gui/widgets \
-I$(top_srcdir)/addressbook/backend \
-I$(top_builddir)/addressbook/backend \
$(BONOBO_HTML_GNOME_CFLAGS) \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DEVOLUTION_ICONSDIR=\""$(iconsdir)"\" \
-DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \
-DCAMEL_PROVIDERDIR=\""$(providerdir)"\"
bin_PROGRAMS = \
@ -49,7 +50,8 @@ evolution_addressbook_LDADD = \
$(top_builddir)/addressbook/gui/widgets/libeminicard.a \
$(top_builddir)/addressbook/backend/ebook/libebook.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
$(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \
$(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(top_builddir)/addressbook/printing/libecontactprint.a \

View File

@ -67,6 +67,21 @@ new_contact_cb (BonoboUIComponent *uih, void *user_data, const char *path)
e_addressbook_show_contact_editor (book, e_card_new(""), TRUE, e_addressbook_view_can_create(view->view));
}
static void
new_contact_list_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));
e_addressbook_show_contact_list_editor (book, e_card_new(""), TRUE, e_addressbook_view_can_create(view->view));
}
static void
config_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
@ -101,13 +116,6 @@ print_cb (BonoboUIComponent *uih, void *user_data, const char *path)
e_addressbook_view_print(view->view);
}
static void
show_all_contacts_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
AddressbookView *view = (AddressbookView *) user_data;
e_addressbook_view_show_all(view->view);
}
static void
stop_loading_cb (BonoboUIComponent *uih, void *user_data, const char *path)
{
@ -153,6 +161,10 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
"/commands/ContactNew",
"sensitive",
e_addressbook_view_can_create (view->view) ? "1" : "0", NULL);
bonobo_ui_component_set_prop (uic,
"/commands/ContactNewList",
"sensitive",
e_addressbook_view_can_create (view->view) ? "1" : "0", NULL);
/* Print Contact */
bonobo_ui_component_set_prop (uic,
@ -184,14 +196,6 @@ update_command_state (EAddressbookView *eav, AddressbookView *view)
e_addressbook_view_can_select_all (view->view) ? "1" : "0", NULL);
/* View All Contacts */
#if 0
/* this is always enabled */
bonobo_ui_component_set_prop (uic,
"/Toolbar/ContactViewAll",
"sensitive", "1", NULL);
#endif
/* Stop */
bonobo_ui_component_set_prop (uic,
"/commands/ContactStop",
@ -212,8 +216,8 @@ BonoboUIVerb verbs [] = {
BONOBO_UI_UNSAFE_VERB ("AddressbookConfig", config_cb),
BONOBO_UI_UNSAFE_VERB ("ContactNew", new_contact_cb),
BONOBO_UI_UNSAFE_VERB ("ContactNewList", new_contact_list_cb),
BONOBO_UI_UNSAFE_VERB ("ContactDelete", delete_contact_cb),
BONOBO_UI_UNSAFE_VERB ("ContactViewAll", show_all_contacts_cb),
BONOBO_UI_UNSAFE_VERB ("ContactStop", stop_loading_cb),
BONOBO_UI_UNSAFE_VERB ("ContactsCut", cut_contacts_cb),
@ -230,8 +234,8 @@ static EPixmap pixmaps [] = {
E_PIXMAP ("/menu/File/Print/ContactsPrintPreview", "print-preview.xpm"),
E_PIXMAP ("/menu/Tools/Component/AddressbookConfig", "configure_16_addressbook.xpm"),
E_PIXMAP ("/Toolbar/ContactViewAll", "all_contacts.xpm"),
E_PIXMAP ("/Toolbar/ContactNew", "new_contact.xpm"),
E_PIXMAP ("/Toolbar/ContactNewList", "all_contacts.xpm"),
E_PIXMAP_END
};

View File

@ -34,8 +34,8 @@
#include <gal/widgets/e-unicode.h>
#include <addressbook/backend/ebook/e-book.h>
#include <addressbook/backend/ebook/e-book-util.h>
#include <addressbook/contact-editor/e-contact-editor.h>
#include <addressbook/contact-editor/e-contact-quick-add.h>
#include <addressbook/gui/contact-editor/e-contact-editor.h>
#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
#include <addressbook/gui/widgets/e-minicard-widget.h>
#include <addressbook/gui/widgets/e-addressbook-util.h>
static GtkObjectClass *parent_class;

View File

@ -30,7 +30,7 @@
#include <bonobo/bonobo-control.h>
#include <bonobo/bonobo-property-bag.h>
#include <bonobo/bonobo-generic-factory.h>
#include <addressbook/contact-editor/e-contact-quick-add.h>
#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
#include "e-address-widget.h"
static void e_address_widget_class_init (EAddressWidgetClass *klass);

View File

@ -39,8 +39,8 @@
#include <libgnomeui/gnome-popup-menu.h>
#include <addressbook/backend/ebook/e-book-util.h>
#include <addressbook/contact-editor/e-contact-editor.h>
#include <addressbook/contact-editor/e-contact-quick-add.h>
#include <addressbook/gui/contact-editor/e-contact-editor.h>
#include <addressbook/gui/contact-editor/e-contact-quick-add.h>
#include "e-addressbook-util.h"
#include "e-select-names-popup.h"

View File

@ -16,7 +16,7 @@
#include <gal/e-text/e-text-model-repos.h>
#include <addressbook/contact-editor/e-contact-editor.h>
#include <addressbook/gui/contact-editor/e-contact-editor.h>
#include "e-select-names-text-model.h"
#include "e-addressbook-util.h"

View File

@ -0,0 +1,3 @@
Makefile.in
Makefile
.deps

View File

@ -0,0 +1,29 @@
INCLUDES = \
$(BONOBO_GNOME_CFLAGS) \
$(EXTRA_GNOME_CFLAGS) \
-I$(top_srcdir) \
-I$(top_srcdir)/addressbook/ \
-I$(top_srcdir)/addressbook/backend \
-I$(top_srcdir)/addressbook/gui/merging \
-I$(top_srcdir)/widgets/e-table \
-DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \
-DDATADIR=\""$(datadir)"\" \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-DEVOLUTIONDIR=\""$(evolutiondir)"\" \
-DG_LOG_DOMAIN=\"contact-list-editor\"
noinst_LIBRARIES = \
libecontactlisteditor.a
libecontactlisteditor_a_SOURCES = \
e-contact-list-editor.c \
e-contact-list-editor.h \
e-contact-list-model.c \
e-contact-list-model.h
gladedir = $(datadir)/evolution/glade
glade_DATA = \
contact-list-editor.glade
EXTRA_DIST = $(glade_DATA)

View File

@ -0,0 +1,287 @@
<?xml version="1.0"?>
<GTK-Interface>
<project>
<name>contact-list-editor</name>
<program_name>contact-list-editor</program_name>
<directory></directory>
<source_directory>src</source_directory>
<pixmaps_directory>pixmaps</pixmaps_directory>
<language>C</language>
<gnome_support>True</gnome_support>
<gettext_support>True</gettext_support>
</project>
<widget>
<class>GnomeApp</class>
<name>contact list editor</name>
<title>contact-list-editor</title>
<type>GTK_WINDOW_TOPLEVEL</type>
<position>GTK_WIN_POS_NONE</position>
<modal>False</modal>
<allow_shrink>False</allow_shrink>
<allow_grow>True</allow_grow>
<auto_shrink>False</auto_shrink>
<enable_layout_config>True</enable_layout_config>
<widget>
<class>GnomeDock</class>
<child_name>GnomeApp:dock</child_name>
<name>dock1</name>
<allow_floating>True</allow_floating>
<child>
<padding>0</padding>
<expand>True</expand>
<fill>True</fill>
</child>
<widget>
<class>GtkTable</class>
<child_name>GnomeDock:contents</child_name>
<name>table1</name>
<border_width>13</border_width>
<rows>6</rows>
<columns>4</columns>
<homogeneous>False</homogeneous>
<row_spacing>5</row_spacing>
<column_spacing>5</column_spacing>
<widget>
<class>Custom</class>
<name>contact-list-table</name>
<creation_function>e_contact_list_editor_create_table</creation_function>
<string1></string1>
<int1>0</int1>
<int2>0</int2>
<last_modification_time>Sat, 23 Jun 2001 06:00:16 GMT</last_modification_time>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>4</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>True</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>email-entry</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label1</name>
<label>Type an email address or drag a contact into the list below</label>
<justify>GTK_JUSTIFY_CENTER</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>1</left_attach>
<right_attach>3</right_attach>
<top_attach>2</top_attach>
<bottom_attach>3</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkLabel</class>
<name>label2</name>
<label>List Name:</label>
<justify>GTK_JUSTIFY_LEFT</justify>
<wrap>False</wrap>
<xalign>0</xalign>
<yalign>0.5</yalign>
<xpad>0</xpad>
<ypad>0</ypad>
<child>
<left_attach>1</left_attach>
<right_attach>2</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkEntry</class>
<name>list-name-entry</name>
<can_focus>True</can_focus>
<editable>True</editable>
<text_visible>True</text_visible>
<text_max_length>0</text_max_length>
<text></text>
<child>
<left_attach>2</left_attach>
<right_attach>3</right_attach>
<top_attach>0</top_attach>
<bottom_attach>1</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>True</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>False</yfill>
</child>
</widget>
<widget>
<class>GtkVButtonBox</class>
<name>vbuttonbox2</name>
<layout_style>GTK_BUTTONBOX_START</layout_style>
<spacing>10</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>7</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
<top_attach>4</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkButton</class>
<name>remove-button</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<label>Remove</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
<widget>
<class>GtkHSeparator</class>
<name>hseparator1</name>
<child>
<left_attach>1</left_attach>
<right_attach>4</right_attach>
<top_attach>1</top_attach>
<bottom_attach>2</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
<widget>
<class>GtkVButtonBox</class>
<name>vbuttonbox3</name>
<layout_style>GTK_BUTTONBOX_DEFAULT_STYLE</layout_style>
<spacing>10</spacing>
<child_min_width>85</child_min_width>
<child_min_height>27</child_min_height>
<child_ipad_x>0</child_ipad_x>
<child_ipad_y>0</child_ipad_y>
<child>
<left_attach>3</left_attach>
<right_attach>4</right_attach>
<top_attach>3</top_attach>
<bottom_attach>4</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
<widget>
<class>GtkButton</class>
<name>add-email-button</name>
<can_default>True</can_default>
<can_focus>True</can_focus>
<label>Add</label>
<relief>GTK_RELIEF_NORMAL</relief>
</widget>
</widget>
<widget>
<class>Custom</class>
<name>custom2</name>
<creation_function>e_create_image_widget</creation_function>
<string1>evolution-contacts-plain.png</string1>
<int1>0</int1>
<int2>0</int2>
<last_modification_time>Sat, 23 Jun 2001 05:59:21 GMT</last_modification_time>
<child>
<left_attach>0</left_attach>
<right_attach>1</right_attach>
<top_attach>0</top_attach>
<bottom_attach>6</bottom_attach>
<xpad>0</xpad>
<ypad>0</ypad>
<xexpand>False</xexpand>
<yexpand>False</yexpand>
<xshrink>False</xshrink>
<yshrink>False</yshrink>
<xfill>True</xfill>
<yfill>True</yfill>
</child>
</widget>
</widget>
</widget>
</widget>
</GTK-Interface>

View File

@ -0,0 +1,499 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* e-contact-list-editor.c
* Copyright (C) 2000 Helix Code, Inc.
* Author: Chris Toshok <toshok@helixcode.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#include "e-contact-list-editor.h"
#include "e-contact-list-model.h"
#include <bonobo/bonobo-ui-container.h>
#include <bonobo/bonobo-ui-util.h>
#include <gal/e-table/e-table-scrolled.h>
#include "widgets/misc/e-dateedit.h"
/* Signal IDs */
enum {
LIST_ADDED,
LIST_MODIFIED,
LIST_DELETED,
EDITOR_CLOSED,
LAST_SIGNAL
};
static void e_contact_list_editor_init (EContactListEditor *editor);
static void e_contact_list_editor_class_init (EContactListEditorClass *klass);
static void e_contact_list_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id);
static void e_contact_list_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id);
static void e_contact_list_editor_destroy (GtkObject *object);
static void create_ui (EContactListEditor *ce);
static void set_editable (EContactListEditor *editor);
static void command_state_changed (EContactListEditor *editor);
static void add_email_cb (GtkWidget *w, EContactListEditor *editor);
static void remove_entry_cb (GtkWidget *w, EContactListEditor *editor);
static void list_name_changed_cb (GtkWidget *w, EContactListEditor *editor);
static GtkObjectClass *parent_class = NULL;
static guint contact_list_editor_signals[LAST_SIGNAL];
/* The arguments we take */
enum {
ARG_0,
ARG_BOOK,
ARG_CARD,
ARG_IS_NEW_LIST,
ARG_EDITABLE
};
GtkType
e_contact_list_editor_get_type (void)
{
static GtkType contact_list_editor_type = 0;
if (!contact_list_editor_type)
{
static const GtkTypeInfo contact_list_editor_info =
{
"EContactListEditor",
sizeof (EContactListEditor),
sizeof (EContactListEditorClass),
(GtkClassInitFunc) e_contact_list_editor_class_init,
(GtkObjectInitFunc) e_contact_list_editor_init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
contact_list_editor_type = gtk_type_unique (GTK_TYPE_OBJECT, &contact_list_editor_info);
}
return contact_list_editor_type;
}
typedef void (*GtkSignal_NONE__INT_OBJECT) (GtkObject * object,
gint arg1,
GtkObject *arg2,
gpointer user_data);
static void
e_marshal_NONE__INT_OBJECT (GtkObject * object,
GtkSignalFunc func,
gpointer func_data, GtkArg * args)
{
GtkSignal_NONE__INT_OBJECT rfunc;
rfunc = (GtkSignal_NONE__INT_OBJECT) func;
(*rfunc) (object,
GTK_VALUE_INT (args[0]),
GTK_VALUE_OBJECT (args[1]),
func_data);
}
static void
e_contact_list_editor_class_init (EContactListEditorClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*) klass;
parent_class = gtk_type_class (GTK_TYPE_OBJECT);
gtk_object_add_arg_type ("EContactListEditor::book", GTK_TYPE_OBJECT,
GTK_ARG_READWRITE, ARG_BOOK);
gtk_object_add_arg_type ("EContactListEditor::card", GTK_TYPE_OBJECT,
GTK_ARG_READWRITE, ARG_CARD);
gtk_object_add_arg_type ("EContactListEditor::is_new_list", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_IS_NEW_LIST);
gtk_object_add_arg_type ("EContactListEditor::editable", GTK_TYPE_BOOL,
GTK_ARG_READWRITE, ARG_EDITABLE);
contact_list_editor_signals[LIST_ADDED] =
gtk_signal_new ("list_added",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (EContactListEditorClass, list_added),
e_marshal_NONE__INT_OBJECT,
GTK_TYPE_NONE, 2,
GTK_TYPE_INT, GTK_TYPE_OBJECT);
contact_list_editor_signals[LIST_MODIFIED] =
gtk_signal_new ("list_modified",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (EContactListEditorClass, list_modified),
e_marshal_NONE__INT_OBJECT,
GTK_TYPE_NONE, 2,
GTK_TYPE_INT, GTK_TYPE_OBJECT);
contact_list_editor_signals[LIST_DELETED] =
gtk_signal_new ("list_deleted",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (EContactListEditorClass, list_deleted),
e_marshal_NONE__INT_OBJECT,
GTK_TYPE_NONE, 2,
GTK_TYPE_INT, GTK_TYPE_OBJECT);
contact_list_editor_signals[EDITOR_CLOSED] =
gtk_signal_new ("editor_closed",
GTK_RUN_FIRST,
object_class->type,
GTK_SIGNAL_OFFSET (EContactListEditorClass, editor_closed),
gtk_marshal_NONE__NONE,
GTK_TYPE_NONE, 0);
gtk_object_class_add_signals (object_class, contact_list_editor_signals, LAST_SIGNAL);
object_class->set_arg = e_contact_list_editor_set_arg;
object_class->get_arg = e_contact_list_editor_get_arg;
object_class->destroy = e_contact_list_editor_destroy;
}
static void
e_contact_list_editor_init (EContactListEditor *editor)
{
GladeXML *gui;
GtkWidget *bonobo_win;
BonoboUIContainer *container;
editor->card = NULL;
editor->changed = FALSE;
editor->editable = TRUE;
editor->is_new_list = FALSE;
gui = glade_xml_new (EVOLUTION_GLADEDIR "/contact-list-editor.glade", NULL);
editor->gui = gui;
editor->app = glade_xml_get_widget (gui, "contact list editor");
editor->table = glade_xml_get_widget (gui, "contact-list-table");
editor->add_button = glade_xml_get_widget (editor->gui, "add-email-button");
editor->remove_button = glade_xml_get_widget (editor->gui, "remove-button");
editor->email_entry =glade_xml_get_widget (gui, "email-entry");
editor->list_name_entry =glade_xml_get_widget (gui, "list-name-entry");
editor->model = gtk_object_get_data (GTK_OBJECT(editor->table), "model");
/* Construct the app */
bonobo_win = bonobo_window_new ("contact-list-editor", "Contact List Editor");
/* FIXME: The sucking bit */
{
GtkWidget *contents;
contents = gnome_dock_get_client_area (
GNOME_DOCK (GNOME_APP (editor->app)->dock));
if (!contents) {
g_message ("contact_list_editor_construct(): Could not get contents");
return;
}
gtk_widget_ref (contents);
gtk_container_remove (GTK_CONTAINER (contents->parent), contents);
bonobo_window_set_contents (BONOBO_WINDOW (bonobo_win), contents);
gtk_widget_destroy (editor->app);
editor->app = bonobo_win;
}
/* Build the menu and toolbar */
container = bonobo_ui_container_new ();
bonobo_ui_container_set_win (container, BONOBO_WINDOW (editor->app));
editor->uic = bonobo_ui_component_new_default ();
if (!editor->uic) {
g_message ("e_contact_list_editor_init(): eeeeek, could not create the UI handler!");
return;
}
bonobo_ui_component_set_container (editor->uic,
bonobo_object_corba_objref (
BONOBO_OBJECT (container)));
create_ui (editor);
/* connect signals */
gtk_signal_connect (GTK_OBJECT(editor->add_button),
"clicked", GTK_SIGNAL_FUNC(add_email_cb), editor);
gtk_signal_connect (GTK_OBJECT(editor->email_entry),
"activate", GTK_SIGNAL_FUNC(add_email_cb), editor);
gtk_signal_connect (GTK_OBJECT(editor->remove_button),
"clicked", GTK_SIGNAL_FUNC(remove_entry_cb), editor);
gtk_signal_connect (GTK_OBJECT(editor->list_name_entry),
"changed", GTK_SIGNAL_FUNC(list_name_changed_cb), editor);
command_state_changed (editor);
/* Connect to the deletion of the dialog */
#if 0
gtk_signal_connect (GTK_OBJECT (editor->app), "delete_event",
GTK_SIGNAL_FUNC (app_delete_event_cb), editor);
#endif
}
static void
e_contact_list_editor_destroy (GtkObject *object)
{
}
static
BonoboUIVerb verbs [] = {
#if 0
BONOBO_UI_UNSAFE_VERB ("ContactEditorSave", file_save_cb),
BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveAs", file_save_as_cb),
BONOBO_UI_UNSAFE_VERB ("ContactEditorSaveClose", tb_save_and_close_cb),
BONOBO_UI_UNSAFE_VERB ("ContactEditorSendAs", file_send_as_cb),
BONOBO_UI_UNSAFE_VERB ("ContactEditorSendTo", file_send_to_cb),
BONOBO_UI_UNSAFE_VERB ("ContactEditorDelete", delete_cb),
BONOBO_UI_UNSAFE_VERB ("ContactEditorPrint", print_cb),
BONOBO_UI_UNSAFE_VERB ("ContactEditorPrintEnvelope", print_envelope_cb),
/* BONOBO_UI_UNSAFE_VERB ("ContactEditorPageSetup", file_page_setup_menu), */
BONOBO_UI_UNSAFE_VERB ("ContactEditorClose", file_close_cb),
#endif
BONOBO_UI_VERB_END
};
static void
create_ui (EContactListEditor *ce)
{
bonobo_ui_component_add_verb_list_with_data (
ce->uic, verbs, ce);
bonobo_ui_util_set_ui (ce->uic, EVOLUTION_DATADIR,
"evolution-contact-list-editor.xml",
"evolution-contact-list-editor");
}
EContactListEditor *
e_contact_list_editor_new (EBook *book,
ECard *list_card,
gboolean is_new_list,
gboolean editable)
{
EContactListEditor *ce;
ce = E_CONTACT_LIST_EDITOR (gtk_type_new (E_CONTACT_LIST_EDITOR_TYPE));
gtk_object_set (GTK_OBJECT (ce),
"book", book,
"card", list_card,
"is_new_list", is_new_list,
"editable", editable,
NULL);
return ce;
}
static void
e_contact_list_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id)
{
EContactListEditor *editor;
editor = E_CONTACT_LIST_EDITOR (o);
switch (arg_id){
case ARG_BOOK:
if (editor->book)
gtk_object_unref(GTK_OBJECT(editor->book));
editor->book = E_BOOK(GTK_VALUE_OBJECT (*arg));
gtk_object_ref (GTK_OBJECT (editor->book));
/* XXX more here about editable/etc. */
break;
case ARG_CARD:
if (editor->card)
gtk_object_unref(GTK_OBJECT(editor->card));
editor->card = e_card_duplicate(E_CARD(GTK_VALUE_OBJECT (*arg)));
#if 0
fill_in_info(editor);
#endif
editor->changed = FALSE;
break;
case ARG_IS_NEW_LIST: {
gboolean new_value = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
gboolean changed = (editor->is_new_list != new_value);
editor->is_new_list = new_value;
if (changed)
command_state_changed (editor);
break;
}
case ARG_EDITABLE: {
gboolean new_value = GTK_VALUE_BOOL (*arg) ? TRUE : FALSE;
gboolean changed = (editor->editable != new_value);
editor->editable = new_value;
if (changed) {
set_editable (editor);
command_state_changed (editor);
}
break;
}
}
}
static void
e_contact_list_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id)
{
EContactListEditor *editor;
editor = E_CONTACT_LIST_EDITOR (object);
switch (arg_id) {
case ARG_BOOK:
GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(editor->book);
break;
case ARG_CARD:
#if 0
e_card_simple_sync_card(editor->simple);
extract_info(editor);
#endif
GTK_VALUE_OBJECT (*arg) = GTK_OBJECT(editor->card);
break;
case ARG_IS_NEW_LIST:
GTK_VALUE_BOOL (*arg) = editor->is_new_list ? TRUE : FALSE;
break;
case ARG_EDITABLE:
GTK_VALUE_BOOL (*arg) = editor->editable ? TRUE : FALSE;
break;
default:
arg->type = GTK_TYPE_INVALID;
break;
}
}
void
e_contact_list_editor_show (EContactListEditor *editor)
{
gtk_widget_show (editor->app);
}
void
e_contact_list_editor_close (EContactListEditor *editor)
{
}
void
e_contact_list_editor_raise (EContactListEditor *editor)
{
}
#define SPEC "<ETableSpecification no-headers=\"true\" cursor-mode=\"line\" selection-mode=\"single\"> \
<ETableColumn model_col= \"0\" _title=\"Contact\" expansion=\"1.0\" minimum_width=\"20\" resizable=\"true\" cell=\"string\" compare=\"string\"/> \
<ETableState> \
<column source=\"0\"/> \
<grouping> <leaf column=\"0\" ascending=\"true\"/> </grouping> \
</ETableState> \
</ETableSpecification>"
GtkWidget *
e_contact_list_editor_create_table(gchar *name,
gchar *string1, gchar *string2,
gint int1, gint int2);
GtkWidget *
e_contact_list_editor_create_table(gchar *name,
gchar *string1, gchar *string2,
gint int1, gint int2)
{
ETableModel *model;
GtkWidget *table;
model = e_contact_list_model_new ();
table = e_table_scrolled_new (model, NULL, SPEC, NULL);
gtk_object_set_data(GTK_OBJECT(table), "model", model);
return table;
}
static void
add_email_cb (GtkWidget *w, EContactListEditor *editor)
{
char *text = gtk_entry_get_text (GTK_ENTRY(editor->email_entry));
if (text && *text)
e_contact_list_model_add_email (E_CONTACT_LIST_MODEL(editor->model), text);
gtk_entry_set_text (GTK_ENTRY(editor->email_entry), "");
if (!editor->changed) {
editor->changed = TRUE;
command_state_changed (editor);
}
}
static void
remove_row (int model_row, EContactListEditor *editor)
{
e_contact_list_model_remove_row (E_CONTACT_LIST_MODEL (editor->model), model_row);
}
static void
remove_entry_cb (GtkWidget *w, EContactListEditor *editor)
{
e_table_selected_row_foreach (e_table_scrolled_get_table(E_TABLE_SCROLLED(editor->table)),
(EForeachFunc)remove_row, editor);
}
static void
list_name_changed_cb (GtkWidget *w, EContactListEditor *editor)
{
if (!editor->changed) {
editor->changed = TRUE;
command_state_changed (editor);
}
}
static void
set_editable (EContactListEditor *editor)
{
gtk_widget_set_sensitive (editor->email_entry, editor->editable);
gtk_widget_set_sensitive (editor->list_name_entry, editor->editable);
gtk_widget_set_sensitive (editor->add_button, editor->editable);
gtk_widget_set_sensitive (editor->remove_button, editor->editable);
gtk_widget_set_sensitive (editor->table, editor->editable);
}
static void
command_state_changed (EContactListEditor *editor)
{
bonobo_ui_component_set_prop (editor->uic,
"/commands/ContactListEditorSaveClose",
"sensitive",
editor->changed && editor->editable ? "1" : "0", NULL);
bonobo_ui_component_set_prop (editor->uic,
"/commands/ContactListEditorSave",
"sensitive",
editor->changed && editor->editable ? "1" : "0", NULL);
bonobo_ui_component_set_prop (editor->uic,
"/commands/ContactListEditorDelete",
"sensitive",
editor->editable && !editor->is_new_list ? "1" : "0", NULL);
}

View File

@ -0,0 +1,108 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
/* e-contact-list-editor.h
* Copyright (C) 2000 Helix Code, Inc.
* Author: Chris Toshok <toshok@helixcode.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of the
* License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* General Public License for more details.
*
* You should have received a copy of the GNU General Public
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
#ifndef __E_CONTACT_LIST_EDITOR_H__
#define __E_CONTACT_LIST_EDITOR_H__
#include <libgnomeui/gnome-app.h>
#include <libgnomeui/gnome-app-helper.h>
#include <bonobo/bonobo-ui-component.h>
#include <glade/glade.h>
#include <gal/e-table/e-table-model.h>
#include "addressbook/backend/ebook/e-book.h"
#include "addressbook/backend/ebook/e-card.h"
#include "addressbook/backend/ebook/e-card-simple.h"
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define E_CONTACT_LIST_EDITOR_TYPE (e_contact_list_editor_get_type ())
#define E_CONTACT_LIST_EDITOR(obj) (GTK_CHECK_CAST ((obj), E_CONTACT_LIST_EDITOR_TYPE, EContactListEditor))
#define E_CONTACT_LIST_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_CONTACT_LIST_EDITOR_TYPE, EContactListEditorClass))
#define E_IS_CONTACT_LIST_EDITOR(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_LIST_EDITOR_TYPE))
#define E_IS_CONTACT_LIST_EDITOR_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_LIST_EDITOR_TYPE))
typedef struct _EContactListEditor EContactListEditor;
typedef struct _EContactListEditorClass EContactListEditorClass;
struct _EContactListEditor
{
GtkObject object;
/* item specific fields */
EBook *book;
ECard *card;
/* UI handler */
BonoboUIComponent *uic;
GladeXML *gui;
GtkWidget *app;
GtkWidget *table;
ETableModel *model;
GtkWidget *email_entry;
GtkWidget *list_name_entry;
GtkWidget *add_button;
GtkWidget *remove_button;
/* Whether we are editing a new card or an existing one */
guint is_new_list : 1;
/* Whether the card has been changed since bringing up the contact editor */
guint changed : 1;
/* Whether the contact editor will accept modifications */
guint editable : 1;
};
struct _EContactListEditorClass
{
GtkObjectClass parent_class;
/* Notification signals */
void (* list_added) (EContactListEditor *cle, EBookStatus status, ECard *card);
void (* list_modified) (EContactListEditor *cle, EBookStatus status, ECard *card);
void (* list_deleted) (EContactListEditor *cle, EBookStatus status, ECard *card);
void (* editor_closed) (EContactListEditor *cle);
};
EContactListEditor *e_contact_list_editor_new (EBook *book,
ECard *list_card,
gboolean is_new_list,
gboolean editable);
GtkType e_contact_list_editor_get_type (void);
void e_contact_list_editor_show (EContactListEditor *editor);
void e_contact_list_editor_close (EContactListEditor *editor);
void e_contact_list_editor_raise (EContactListEditor *editor);
gboolean e_contact_list_editor_confirm_delete (GtkWindow *parent);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __E_CONTACT_LIST_EDITOR_H__ */

View File

@ -0,0 +1,190 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#include <config.h>
#include "e-contact-list-model.h"
#define PARENT_TYPE e_table_model_get_type()
ETableModelClass *parent_class;
#define COLS 1
/* This function returns the number of columns in our ETableModel. */
static int
contact_list_col_count (ETableModel *etc)
{
return COLS;
}
/* This function returns the number of rows in our ETableModel. */
static int
contact_list_row_count (ETableModel *etc)
{
EContactListModel *model = E_CONTACT_LIST_MODEL (etc);
return model->simple_count + model->email_count;
}
/* This function returns the value at a particular point in our ETableModel. */
static void *
contact_list_value_at (ETableModel *etc, int col, int row)
{
EContactListModel *model = E_CONTACT_LIST_MODEL (etc);
if (row < model->simple_count)
return (char*)e_card_simple_get_const (model->simples[row], E_CARD_SIMPLE_FIELD_EMAIL);
else
return model->emails [row - model->simple_count];
}
/* This function sets the value at a particular point in our ETableModel. */
static void
contact_list_set_value_at (ETableModel *etc, int col, int row, const void *val)
{
/* nothing */
}
/* This function returns whether a particular cell is editable. */
static gboolean
contact_list_is_cell_editable (ETableModel *etc, int col, int row)
{
return FALSE;
}
/* This function duplicates the value passed to it. */
static void *
contact_list_duplicate_value (ETableModel *etc, int col, const void *value)
{
return g_strdup(value);
}
/* This function frees the value passed to it. */
static void
contact_list_free_value (ETableModel *etc, int col, void *value)
{
g_free(value);
}
static void *
contact_list_initialize_value (ETableModel *etc, int col)
{
return g_strdup("");
}
static gboolean
contact_list_value_is_empty (ETableModel *etc, int col, const void *value)
{
return !(value && *(char *)value);
}
static char *
contact_list_value_to_string (ETableModel *etc, int col, const void *value)
{
return g_strdup(value);
}
static void
contact_list_model_destroy (GtkObject *o)
{
}
static void
e_contact_list_model_class_init (GtkObjectClass *object_class)
{
ETableModelClass *model_class = (ETableModelClass *) object_class;
parent_class = gtk_type_class (PARENT_TYPE);
object_class->destroy = contact_list_model_destroy;
model_class->column_count = contact_list_col_count;
model_class->row_count = contact_list_row_count;
model_class->value_at = contact_list_value_at;
model_class->set_value_at = contact_list_set_value_at;
model_class->is_cell_editable = contact_list_is_cell_editable;
model_class->duplicate_value = contact_list_duplicate_value;
model_class->free_value = contact_list_free_value;
model_class->initialize_value = contact_list_initialize_value;
model_class->value_is_empty = contact_list_value_is_empty;
model_class->value_to_string = contact_list_value_to_string;
}
static void
e_contact_list_model_init (GtkObject *object)
{
EContactListModel *model = E_CONTACT_LIST_MODEL(object);
model->simples = NULL;
model->simple_count = 0;
model->emails = NULL;
model->email_count = 0;
}
GtkType
e_contact_list_model_get_type (void)
{
static GtkType type = 0;
if (!type){
GtkTypeInfo info = {
"EContactListModel",
sizeof (EContactListModel),
sizeof (EContactListModelClass),
(GtkClassInitFunc) e_contact_list_model_class_init,
(GtkObjectInitFunc) e_contact_list_model_init,
NULL, /* reserved 1 */
NULL, /* reserved 2 */
(GtkClassInitFunc) NULL
};
type = gtk_type_unique (PARENT_TYPE, &info);
}
return type;
}
void
e_contact_list_model_construct (EContactListModel *model)
{
}
ETableModel *
e_contact_list_model_new ()
{
EContactListModel *model;
model = gtk_type_new (e_contact_list_model_get_type ());
e_contact_list_model_construct (model);
return E_TABLE_MODEL(model);
}
void
e_contact_list_model_add_email (EContactListModel *model,
const char *email)
{
model->email_count ++;
model->emails = g_renew (char*, model->emails, model->email_count);
model->emails[model->email_count - 1] = g_strdup (email);
e_table_model_changed (E_TABLE_MODEL (model));
}
void
e_contact_list_model_add_card (EContactListModel *model,
ECardSimple *simple)
{
}
void
e_contact_list_model_remove_row (EContactListModel *model, int row)
{
if (row < model->simple_count) {
memcpy (model->simples + row, model->simples + row + 1, model->simple_count - row);
model->simple_count --;
}
else {
int email_row = row - model->simple_count;
memcpy (model->emails + email_row, model->emails + email_row + 1, model->email_count - email_row);
model->email_count --;
}
e_table_model_row_deleted (E_TABLE_MODEL (model), row);
}

View File

@ -0,0 +1,42 @@
/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */
#ifndef _E_CONTACT_LIST_MODEL_H_
#define _E_CONTACT_LIST_MODEL_H_
#include <gal/e-table/e-table-model.h>
#include "addressbook/backend/ebook/e-book.h"
#include "addressbook/backend/ebook/e-book-view.h"
#include "addressbook/backend/ebook/e-card-simple.h"
#define E_CONTACT_LIST_MODEL_TYPE (e_contact_list_model_get_type ())
#define E_CONTACT_LIST_MODEL(o) (GTK_CHECK_CAST ((o), E_CONTACT_LIST_MODEL_TYPE, EContactListModel))
#define E_CONTACT_LIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_CAST((k), E_CONTACT_LIST_MODEL_TYPE, EContactListModelClass))
#define E_IS_CONTACT_LIST_MODEL(o) (GTK_CHECK_TYPE ((o), E_CONTACT_LIST_MODEL_TYPE))
#define E_IS_CONTACT_LIST_MODEL_CLASS(k) (GTK_CHECK_CLASS_TYPE ((k), E_CONTACT_LIST_MODEL_TYPE))
typedef struct _EContactListModel EContactListModel;
typedef struct _EContactListModelClass EContactListModelClass;
struct _EContactListModel {
ETableModel parent;
ECardSimple **simples;
int simple_count;
char **emails;
int email_count;
};
struct _EContactListModelClass {
ETableModelClass parent_class;
};
GtkType e_contact_list_model_get_type (void);
void e_contact_list_model_construct (EContactListModel *model);
ETableModel *e_contact_list_model_new (void);
void e_contact_list_model_add_email (EContactListModel *model, const char *email);
void e_contact_list_model_add_card (EContactListModel *model, ECardSimple *simple);
void e_contact_list_model_remove_row (EContactListModel *model, int row);
#endif /* _E_CONTACT_LIST_MODEL_H_ */

View File

@ -4,7 +4,7 @@ INCLUDES = \
-DEVOLUTION_DATADIR=\""$(datadir)"\" \
-I$(top_srcdir) \
-I$(top_srcdir)/addressbook/backend/ebook \
-I$(top_srcdir)/addressbook/contact-editor \
-I$(top_srcdir)/addressbook/gui/contact-editor \
-I$(top_srcdir)/addressbook/gui/merging \
-I$(top_srcdir)/widgets/misc \
$(BONOBO_GNOME_CFLAGS) \
@ -66,7 +66,8 @@ minicard_test_LDADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
$(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \
$(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \
$(top_builddir)/addressbook/printing/libecontactprint.a \
$(top_builddir)/addressbook/gui/merging/libecardmerging.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
@ -118,7 +119,8 @@ minicard_widget_test_LDADD = \
$(top_builddir)/e-util/libeutil.la \
$(top_builddir)/libversit/libversit.la \
$(top_builddir)/e-util/ename/libename.la \
$(top_builddir)/addressbook/contact-editor/libecontacteditor.a \
$(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.a \
$(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.a \
$(top_builddir)/addressbook/printing/libecontactprint.a \
$(top_builddir)/widgets/misc/libemiscwidgets.a \
$(top_builddir)/e-util/libeutil.la \

View File

@ -25,7 +25,6 @@
#include <gnome.h>
#include "e-addressbook-util.h"
#include "e-contact-editor.h"
#include "e-card-merging.h"
void
@ -53,39 +52,38 @@ e_addressbook_error_dialog (const gchar *msg, EBookStatus status)
static void
card_added_cb (EBook* book, EBookStatus status, const char *id,
gpointer user_data)
added_cb (EBook* book, EBookStatus status, const char *id,
gboolean is_list)
{
g_print ("%s: %s(): a card was added\n", __FILE__, __FUNCTION__);
if (status != E_BOOK_STATUS_SUCCESS) {
e_addressbook_error_dialog (_("Error adding card"), status);
e_addressbook_error_dialog (is_list ? _("Error adding list") : _("Error adding card"), status);
}
}
static void
card_modified_cb (EBook* book, EBookStatus status,
gpointer user_data)
modified_cb (EBook* book, EBookStatus status,
gboolean is_list)
{
g_print ("%s: %s(): a card was modified\n", __FILE__, __FUNCTION__);
if (status != E_BOOK_STATUS_SUCCESS) {
e_addressbook_error_dialog (_("Error modifying card"), status);
e_addressbook_error_dialog (is_list ? _("Error modifying list") : _("Error modifying card"),
status);
}
}
static void
card_deleted_cb (EBook* book, EBookStatus status,
gpointer user_data)
deleted_cb (EBook* book, EBookStatus status,
gboolean is_list)
{
g_print ("%s: %s(): a card was removed\n", __FILE__, __FUNCTION__);
if (status != E_BOOK_STATUS_SUCCESS) {
e_addressbook_error_dialog (_("Error removing card"), status);
e_addressbook_error_dialog (is_list ? _("Error removing list") : _("Error removing card"),
status);
}
}
static void
editor_closed_cb (EContactEditor *ce, gpointer data)
editor_closed_cb (GtkObject *editor, gpointer data)
{
gtk_object_unref (GTK_OBJECT (ce));
gtk_object_unref (editor);
}
EContactEditor *
@ -98,13 +96,36 @@ e_addressbook_show_contact_editor (EBook *book, ECard *card,
ce = e_contact_editor_new (book, card, is_new_card, editable);
gtk_signal_connect (GTK_OBJECT (ce), "card_added",
GTK_SIGNAL_FUNC (card_added_cb), NULL);
GTK_SIGNAL_FUNC (added_cb), GINT_TO_POINTER (FALSE));
gtk_signal_connect (GTK_OBJECT (ce), "card_modified",
GTK_SIGNAL_FUNC (card_modified_cb), NULL);
GTK_SIGNAL_FUNC (modified_cb), GINT_TO_POINTER (FALSE));
gtk_signal_connect (GTK_OBJECT (ce), "card_deleted",
GTK_SIGNAL_FUNC (card_deleted_cb), NULL);
GTK_SIGNAL_FUNC (deleted_cb), GINT_TO_POINTER (FALSE));
gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
GTK_SIGNAL_FUNC (editor_closed_cb), NULL);
return ce;
}
EContactListEditor *
e_addressbook_show_contact_list_editor (EBook *book, ECard *card,
gboolean is_new_card,
gboolean editable)
{
EContactListEditor *ce;
ce = e_contact_list_editor_new (book, card, is_new_card, editable);
gtk_signal_connect (GTK_OBJECT (ce), "list_added",
GTK_SIGNAL_FUNC (added_cb), GINT_TO_POINTER (TRUE));
gtk_signal_connect (GTK_OBJECT (ce), "list_modified",
GTK_SIGNAL_FUNC (modified_cb), GINT_TO_POINTER (TRUE));
gtk_signal_connect (GTK_OBJECT (ce), "list_deleted",
GTK_SIGNAL_FUNC (deleted_cb), GINT_TO_POINTER (TRUE));
gtk_signal_connect (GTK_OBJECT (ce), "editor_closed",
GTK_SIGNAL_FUNC (editor_closed_cb), GINT_TO_POINTER (TRUE));
e_contact_list_editor_show (ce);
return ce;
}

View File

@ -22,7 +22,8 @@
#define __E_ADDRESSBOOK_UTIL_H__
#include "addressbook/backend/ebook/e-book.h"
#include "addressbook/contact-editor/e-contact-editor.h"
#include "addressbook/gui/contact-editor/e-contact-editor.h"
#include "addressbook/gui/contact-list-editor/e-contact-list-editor.h"
#ifdef __cplusplus
extern "C" {
@ -34,6 +35,9 @@ void e_addressbook_error_dialog (const gchar *msg,
EContactEditor* e_addressbook_show_contact_editor (EBook *book, ECard *card,
gboolean is_new_card,
gboolean editable);
EContactListEditor * e_addressbook_show_contact_list_editor (EBook *book, ECard *card,
gboolean is_new_card,
gboolean editable);
#ifdef __cplusplus
}

View File

@ -22,7 +22,7 @@
#define __E_MINICARD_H__
#include <libgnomeui/gnome-canvas.h>
#include "addressbook/contact-editor/e-contact-editor.h"
#include "addressbook/gui/contact-editor/e-contact-editor.h"
#include "addressbook/backend/ebook/e-card.h"
#include "addressbook/backend/ebook/e-card-simple.h"