diff options
Diffstat (limited to 'addressbook/contact-editor')
-rw-r--r-- | addressbook/contact-editor/.cvsignore | 7 | ||||
-rw-r--r-- | addressbook/contact-editor/Makefile.am | 20 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.c | 438 | ||||
-rw-r--r-- | addressbook/contact-editor/e-contact-editor.h | 74 | ||||
-rw-r--r-- | addressbook/contact-editor/email.png | bin | 0 -> 331 bytes | |||
-rw-r--r-- | addressbook/contact-editor/head.png | bin | 0 -> 493 bytes | |||
-rw-r--r-- | addressbook/contact-editor/phone.png | bin | 0 -> 506 bytes | |||
-rw-r--r-- | addressbook/contact-editor/snailmail.png | bin | 0 -> 516 bytes | |||
-rw-r--r-- | addressbook/contact-editor/test-editor.c | 79 | ||||
-rw-r--r-- | addressbook/contact-editor/web.png | bin | 0 -> 573 bytes |
10 files changed, 618 insertions, 0 deletions
diff --git a/addressbook/contact-editor/.cvsignore b/addressbook/contact-editor/.cvsignore new file mode 100644 index 0000000000..1771e82554 --- /dev/null +++ b/addressbook/contact-editor/.cvsignore @@ -0,0 +1,7 @@ +.deps +.libs +Makefile +Makefile.in +*.lo +*.la +contact-editor-test
\ No newline at end of file diff --git a/addressbook/contact-editor/Makefile.am b/addressbook/contact-editor/Makefile.am new file mode 100644 index 0000000000..0286af7c49 --- /dev/null +++ b/addressbook/contact-editor/Makefile.am @@ -0,0 +1,20 @@ + +INCLUDES = \ + $(GNOME_INCLUDEDIR) + +noinst_LIBRARIES = \ + libecontacteditor.a + +libecontacteditor_a_SOURCES = \ + e-contact-editor.c \ + e-contact-editor.h + +noinst_PROGRAMS = \ + contact-editor-test + +contact_editor_test_SOURCES = \ + test-editor.c + +contact_editor_test_LDADD = \ + $(EXTRA_GNOME_LIBS) \ + libecontacteditor.a diff --git a/addressbook/contact-editor/e-contact-editor.c b/addressbook/contact-editor/e-contact-editor.c new file mode 100644 index 0000000000..73b48a7eb8 --- /dev/null +++ b/addressbook/contact-editor/e-contact-editor.c @@ -0,0 +1,438 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * e-contact-editor.c + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey <clahey@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 <gnome.h> +#include "e-contact-editor.h" +static void e_contact_editor_init (EContactEditor *card); +static void e_contact_editor_class_init (EContactEditorClass *klass); +static void e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id); +static void e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id); + +static GtkNotebookClass *parent_class = NULL; + +#if 0 +enum { + E_CONTACT_EDITOR_RESIZE, + E_CONTACT_EDITOR_LAST_SIGNAL +}; + +static guint e_contact_editor_signals[E_CONTACT_EDITOR_LAST_SIGNAL] = { 0 }; +#endif + +/* The arguments we take */ +enum { + ARG_0, + ARG_CARD +}; + +GtkType +e_contact_editor_get_type (void) +{ + static GtkType contact_editor_type = 0; + + if (!contact_editor_type) + { + static const GtkTypeInfo contact_editor_info = + { + "EContactEditor", + sizeof (EContactEditor), + sizeof (EContactEditorClass), + (GtkClassInitFunc) e_contact_editor_class_init, + (GtkObjectInitFunc) e_contact_editor_init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + contact_editor_type = gtk_type_unique (gtk_notebook_get_type (), &contact_editor_info); + } + + return contact_editor_type; +} + +static void +e_contact_editor_class_init (EContactEditorClass *klass) +{ + GtkObjectClass *object_class; + GtkNotebookClass *notebook_class; + + object_class = (GtkObjectClass*) klass; + notebook_class = (GtkNotebookClass *) klass; + + parent_class = gtk_type_class (gtk_notebook_get_type ()); + +#if 0 + e_contact_editor_signals[E_CONTACT_EDITOR_RESIZE] = + gtk_signal_new ("resize", + GTK_RUN_LAST, + object_class->type, + GTK_SIGNAL_OFFSET (EContactEditorClass, resize), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + + gtk_object_class_add_signals (object_class, e_contact_editor_signals, E_CONTACT_EDITOR_LAST_SIGNAL); +#endif + + gtk_object_add_arg_type ("EContactEditor::card", GTK_TYPE_OBJECT, + GTK_ARG_READWRITE, ARG_CARD); + + object_class->set_arg = e_contact_editor_set_arg; + object_class->get_arg = e_contact_editor_get_arg; +} + +static GtkWidget * +_create_page_general_name(EContactEditor *e_contact_editor) +{ + GtkWidget *table; + GtkWidget *alignment; + table = gtk_table_new(3, 4, FALSE); + alignment = gtk_alignment_new(0, 0, 0, 0); + gtk_container_add(GTK_CONTAINER(alignment), + gnome_pixmap_new_from_file("head.png")); + gtk_table_attach(GTK_TABLE(table), + alignment, + 0, 1, 0, 4, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Full Name:")), + 1, 2, 0, 1, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Job Title:")), + 1, 2, 1, 2, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Company:")), + 1, 2, 2, 3, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("File as:")), + 1, 2, 3, 4, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 0, 1, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 1, 2, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 2, 3, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_combo_new(), + 2, 3, 3, 4, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + return table; +} + +static GtkWidget * +_create_page_general_phone(EContactEditor *e_contact_editor) +{ + GtkWidget *table; + GtkWidget *alignment; + table = gtk_table_new(3, 4, FALSE); + alignment = gtk_alignment_new(0,0,0,0); + gtk_container_add(GTK_CONTAINER(alignment), + gnome_pixmap_new_from_file("phone.png")); + + gtk_table_attach(GTK_TABLE(table), + alignment, + 0, 1, 0, 4, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Home:")), + 1, 2, 0, 1, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Car:")), + 1, 2, 1, 2, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Mobile:")), + 1, 2, 2, 3, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Business Fax:")), + 1, 2, 3, 4, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 0, 1, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 1, 2, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 2, 3, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 3, 4, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + return table; +} + +static GtkWidget * +_create_page_general_email(EContactEditor *e_contact_editor) +{ + GtkWidget *table; + GtkWidget *alignment; + table = gtk_table_new(3, 1, FALSE); + alignment = gtk_alignment_new(0,0,0,0); + gtk_container_add(GTK_CONTAINER(alignment), + gnome_pixmap_new_from_file("email.png")); + + gtk_table_attach(GTK_TABLE(table), + alignment, + 0, 1, 0, 1, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Email:")), + 1, 2, 0, 1, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 0, 1, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + return table; +} + +static GtkWidget * +_create_page_general_web(EContactEditor *e_contact_editor) +{ + GtkWidget *table; + GtkWidget *alignment; + table = gtk_table_new(3, 1, FALSE); + alignment = gtk_alignment_new(0,0,0,0); + gtk_container_add(GTK_CONTAINER(alignment), + gnome_pixmap_new_from_file("web.png")); + + gtk_table_attach(GTK_TABLE(table), + alignment, + 0, 1, 0, 1, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Web page address:")), + 1, 2, 0, 1, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_entry_new(), + 2, 3, 0, 1, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + return table; +} + +static GtkWidget * +_create_page_general_snailmail(EContactEditor *e_contact_editor) +{ + GtkWidget *table; + GtkWidget *alignment; + GtkWidget *text; + table = gtk_table_new(3, 3, FALSE); + alignment = gtk_alignment_new(0,0,0,0); + gtk_container_add(GTK_CONTAINER(alignment), + gnome_pixmap_new_from_file("snailmail.png")); + + gtk_table_attach(GTK_TABLE(table), + alignment, + 0, 1, 0, 1, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Address:")), + 1, 2, 0, 1, + 0, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_label_new(_("Business:")), + 1, 2, 1, 2, + 0, 0, + 0, 0); + text = gtk_text_new(NULL, NULL); + gtk_object_set(GTK_OBJECT(text), + "editable", TRUE, + NULL); + gtk_table_attach(GTK_TABLE(table), + text, + 2, 3, 0, 2, + GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + gtk_check_button_new_with_label(_("This is the mailing address")), + 2, 3, 2, 3, + 0, 0, + 0, 0); + return table; +} + +static GtkWidget * +_create_page_general_comments(EContactEditor *e_contact_editor) +{ + GtkWidget *text; + text = gtk_text_new(NULL, NULL); + gtk_object_set (GTK_OBJECT(text), + "editable", TRUE, + NULL); + return text; +} + +static GtkWidget * +_create_page_general_extras(EContactEditor *e_contact_editor) +{ + return gtk_entry_new(); +} + +static GtkWidget * +_create_page_general( EContactEditor *e_contact_editor ) +{ + GtkWidget *table; + table = gtk_table_new(2, 5, FALSE); + gtk_table_attach(GTK_TABLE(table), + _create_page_general_name(e_contact_editor), + 0, 1, + 0, 1, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + _create_page_general_phone(e_contact_editor), + 1, 2, + 0, 1, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + _create_page_general_email(e_contact_editor), + 0, 1, + 1, 2, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + _create_page_general_web(e_contact_editor), + 0, 1, + 2, 3, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + _create_page_general_snailmail(e_contact_editor), + 1, 2, + 1, 3, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + _create_page_general_comments(e_contact_editor), + 0, 2, + 3, 4, + GTK_FILL | GTK_EXPAND, GTK_FILL | GTK_EXPAND, + 0, 0); + gtk_table_attach(GTK_TABLE(table), + _create_page_general_extras(e_contact_editor), + 0, 2, + 4, 5, + GTK_FILL | GTK_EXPAND, 0, + 0, 0); + return table; +} + +static void +e_contact_editor_init (EContactEditor *e_contact_editor) +{ + GtkNotebook *notebook = GTK_NOTEBOOK (e_contact_editor); + + /* e_contact_editor->card = NULL;*/ + e_contact_editor->fields = NULL; + + gtk_notebook_append_page (notebook, + _create_page_general(e_contact_editor), + gtk_label_new(_("General"))); +} + +GtkWidget* +e_contact_editor_new (void *card) +{ + GtkWidget *widget = GTK_WIDGET (gtk_type_new (e_contact_editor_get_type ())); + gtk_object_set (GTK_OBJECT(widget), + "card", card, + NULL); + return widget; +} + +static void +e_contact_editor_set_arg (GtkObject *o, GtkArg *arg, guint arg_id) +{ + EContactEditor *e_contact_editor; + + e_contact_editor = E_CONTACT_EDITOR (o); + + switch (arg_id){ + case ARG_CARD: + /* e_contact_editor->card = GTK_VALUE_POINTER (*arg); + _update_card(e_contact_editor); + gnome_canvas_item_request_update (item);*/ + break; + } +} + +static void +e_contact_editor_get_arg (GtkObject *object, GtkArg *arg, guint arg_id) +{ + EContactEditor *e_contact_editor; + + e_contact_editor = E_CONTACT_EDITOR (object); + + switch (arg_id) { + case ARG_CARD: + /* GTK_VALUE_POINTER (*arg) = e_contact_editor->card; */ + break; + default: + arg->type = GTK_TYPE_INVALID; + break; + } +} diff --git a/addressbook/contact-editor/e-contact-editor.h b/addressbook/contact-editor/e-contact-editor.h new file mode 100644 index 0000000000..45f3ae5597 --- /dev/null +++ b/addressbook/contact-editor/e-contact-editor.h @@ -0,0 +1,74 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* e-contact-editor.h + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey <clahey@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_EDITOR_H__ +#define __E_CONTACT_EDITOR_H__ + +#include <gnome.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 * R 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_MINICARD(obj) (GTK_CHECK_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) +#define E_IS_MINICARD_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_CONTACT_EDITOR_TYPE)) + + +typedef struct _EContactEditor EContactEditor; +typedef struct _EContactEditorClass EContactEditorClass; + +struct _EContactEditor +{ + GtkNotebook parent; + + /* item specific fields */ + /* ECard *card; */ + + GList *fields; /* Of type GnomeCanvasItem. */ +}; + +struct _EContactEditorClass +{ + GtkNotebookClass parent_class; +}; + + +GtkWidget *e_contact_editor_new(void *card); +GtkType e_contact_editor_get_type (void); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __E_CONTACT_EDITOR_H__ */ diff --git a/addressbook/contact-editor/email.png b/addressbook/contact-editor/email.png Binary files differnew file mode 100644 index 0000000000..f3ff02e343 --- /dev/null +++ b/addressbook/contact-editor/email.png diff --git a/addressbook/contact-editor/head.png b/addressbook/contact-editor/head.png Binary files differnew file mode 100644 index 0000000000..ca00b75f92 --- /dev/null +++ b/addressbook/contact-editor/head.png diff --git a/addressbook/contact-editor/phone.png b/addressbook/contact-editor/phone.png Binary files differnew file mode 100644 index 0000000000..ebec84ba0b --- /dev/null +++ b/addressbook/contact-editor/phone.png diff --git a/addressbook/contact-editor/snailmail.png b/addressbook/contact-editor/snailmail.png Binary files differnew file mode 100644 index 0000000000..647ae8f68c --- /dev/null +++ b/addressbook/contact-editor/snailmail.png diff --git a/addressbook/contact-editor/test-editor.c b/addressbook/contact-editor/test-editor.c new file mode 100644 index 0000000000..737c3028c4 --- /dev/null +++ b/addressbook/contact-editor/test-editor.c @@ -0,0 +1,79 @@ +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ +/* + * test-editor.c + * Copyright (C) 2000 Helix Code, Inc. + * Author: Chris Lahey <clahey@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 "config.h" + +#include <gnome.h> +#include "e-contact-editor.h" + +/* This is a horrible thing to do, but it is just a test. */ +GtkWidget *editor; + +static void destroy_callback(GtkWidget *app, gpointer data) +{ + exit(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, Helix Code, Inc." ), + authors, + _( "This should test the contact editor canvas item" ), + NULL); + gtk_widget_show (about); +} + +int main( int argc, char *argv[] ) +{ + GtkWidget *app; + + /* bindtextdomain (PACKAGE, GNOMELOCALEDIR); + textdomain (PACKAGE);*/ + + gnome_init( "Contact Editor Test", VERSION, argc, argv); + app = gnome_app_new("Contact Editor Test", NULL); + + editor = e_contact_editor_new(NULL); + + gnome_app_set_contents( GNOME_APP( app ), editor ); + + /* Connect the signals */ + gtk_signal_connect( GTK_OBJECT( app ), "destroy", + GTK_SIGNAL_FUNC( destroy_callback ), + ( gpointer ) app ); + + gtk_widget_show_all( app ); + + gtk_main(); + + /* Not reached. */ + return 0; +} diff --git a/addressbook/contact-editor/web.png b/addressbook/contact-editor/web.png Binary files differnew file mode 100644 index 0000000000..3211a11b19 --- /dev/null +++ b/addressbook/contact-editor/web.png |