diff options
author | Chris Lahey <clahey@src.gnome.org> | 2000-01-17 17:12:21 +0800 |
---|---|---|
committer | Chris Lahey <clahey@src.gnome.org> | 2000-01-17 17:12:21 +0800 |
commit | 4d4bcd89d8403e8ee275f8c4695f45c82e2dd9f9 (patch) | |
tree | 12c605c87784a60a1ed0d65cbf261b95d32abb92 | |
parent | 173a42036986044bc7907033a299cc1c71aa72e7 (diff) | |
download | gsoc2013-evolution-4d4bcd89d8403e8ee275f8c4695f45c82e2dd9f9.tar.gz gsoc2013-evolution-4d4bcd89d8403e8ee275f8c4695f45c82e2dd9f9.tar.zst gsoc2013-evolution-4d4bcd89d8403e8ee275f8c4695f45c82e2dd9f9.zip |
Images for e-contact-editor.c.
* head.png, phone.png, email.png, web.png, snailmail.png: Images
for e-contact-editor.c.
* addressbook/contact-editor/text-editor.c: Test program
for contact editor widget.
* addressbook/contact-editor/e-contact-editor.c,
addressbook/contact-editor/e-contact-editor.h: Contact editor
widget files.
* addressbook/contact-editor/.cvsignore,
addressbook/contact-editor/Makefile.am: New directory for contact
editor files.
* addressbook/.cvsignore, addressbook/Makefile.am: New directory
for addressbook files.
* widgets/.cvsignore: Added reflow-test.
* Makefile.am (SUBDIRS): Added addressbook subdirectory.
* configure.in, widgets/Makefile.am: Removed widgets/toolbar from
SUBDIRS since the lack of content was preventing it from
compiling.
* widgets/shortcut-bar/Makefile.am: Added gnomecanvaspixbuf to the
list of libraries used.
* widgets/e-text.c, widgets/e-text.h: Fixed a crashing bug.
svn path=/trunk/; revision=1581
20 files changed, 1236 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 diff --git a/addressbook/gui/contact-editor/.cvsignore b/addressbook/gui/contact-editor/.cvsignore new file mode 100644 index 0000000000..1771e82554 --- /dev/null +++ b/addressbook/gui/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/gui/contact-editor/Makefile.am b/addressbook/gui/contact-editor/Makefile.am new file mode 100644 index 0000000000..0286af7c49 --- /dev/null +++ b/addressbook/gui/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/gui/contact-editor/e-contact-editor.c b/addressbook/gui/contact-editor/e-contact-editor.c new file mode 100644 index 0000000000..73b48a7eb8 --- /dev/null +++ b/addressbook/gui/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/gui/contact-editor/e-contact-editor.h b/addressbook/gui/contact-editor/e-contact-editor.h new file mode 100644 index 0000000000..45f3ae5597 --- /dev/null +++ b/addressbook/gui/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/gui/contact-editor/email.png b/addressbook/gui/contact-editor/email.png Binary files differnew file mode 100644 index 0000000000..f3ff02e343 --- /dev/null +++ b/addressbook/gui/contact-editor/email.png diff --git a/addressbook/gui/contact-editor/head.png b/addressbook/gui/contact-editor/head.png Binary files differnew file mode 100644 index 0000000000..ca00b75f92 --- /dev/null +++ b/addressbook/gui/contact-editor/head.png diff --git a/addressbook/gui/contact-editor/phone.png b/addressbook/gui/contact-editor/phone.png Binary files differnew file mode 100644 index 0000000000..ebec84ba0b --- /dev/null +++ b/addressbook/gui/contact-editor/phone.png diff --git a/addressbook/gui/contact-editor/snailmail.png b/addressbook/gui/contact-editor/snailmail.png Binary files differnew file mode 100644 index 0000000000..647ae8f68c --- /dev/null +++ b/addressbook/gui/contact-editor/snailmail.png diff --git a/addressbook/gui/contact-editor/test-editor.c b/addressbook/gui/contact-editor/test-editor.c new file mode 100644 index 0000000000..737c3028c4 --- /dev/null +++ b/addressbook/gui/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/gui/contact-editor/web.png b/addressbook/gui/contact-editor/web.png Binary files differnew file mode 100644 index 0000000000..3211a11b19 --- /dev/null +++ b/addressbook/gui/contact-editor/web.png |