From 0c3101c24a3bb76c57d545ba6071acee529ee3a8 Mon Sep 17 00:00:00 2001 From: Ettore Perazzoli Date: Sat, 6 Nov 1999 21:10:09 +0000 Subject: Some initial work on the dialog for entering addresses from the address book. svn path=/trunk/; revision=1370 --- widgets/ChangeLog | 27 ++ widgets/Makefile.am | 3 + widgets/e-msg-composer-address-dialog.c | 311 +++++++++++++++ widgets/e-msg-composer-address-dialog.glade | 574 ++++++++++++++++++++++++++++ widgets/e-msg-composer-address-dialog.h | 67 ++++ widgets/e-msg-composer-attachment-bar.c | 3 + widgets/e-msg-composer-attachment.c | 3 +- widgets/e-msg-composer.c | 59 ++- widgets/e-msg-composer.glade | 15 +- widgets/e-msg-composer.h | 2 + widgets/e-table/ChangeLog | 27 ++ widgets/e-table/Makefile.am | 3 + 12 files changed, 1089 insertions(+), 5 deletions(-) create mode 100644 widgets/e-msg-composer-address-dialog.c create mode 100644 widgets/e-msg-composer-address-dialog.glade create mode 100644 widgets/e-msg-composer-address-dialog.h (limited to 'widgets') diff --git a/widgets/ChangeLog b/widgets/ChangeLog index 77a6c36c61..e8426055fc 100644 --- a/widgets/ChangeLog +++ b/widgets/ChangeLog @@ -1,3 +1,27 @@ +1999-11-06 Ettore Perazzoli + + * e-msg-composer-attachment-bar.c (destroy): Call the destroy + method of the parent class. + + * e-msg-composer.c: #include "e-msg-composer-address-dialog.h". + (address_dialog_cb): New callback to start the address dialog. + (setup_signals): Connect it to the appropriate button/menu item. + (init): Initialize the new `address_dialog' member to NULL. + (destroy): Destroy the `address_dialog' if not NULL. + + * e-msg-composer.h: New member `address_dialog' in `struct + _EMsgComposer'. + + * e-msg-composer.glade: Added button to activate the address + composition dialog. + + * e-msg-composer-address-dialog.h, e-msg-composer-address-dialog.c: + New files implementing the address composition dialog for Evolution. + + * e-msg-composer-address-dialog.glade: New file. + + * e-msg-composer-attachment.c: `signals' made static. + 1999-11-05 Ettore Perazzoli * Makefile.am: Compile the new files in a `libevolutionwidgets' @@ -21,6 +45,9 @@ * e-msg-composer-hdrs.c, e-msg-composer-hdrs.h: New files implementing a widget for editing of email message headers. + * e-msg-composer-attachment.glade: New file. + * e-msg-composer.glade: New file. + 1999-10-31 Miguel de Icaza * widgets/e-table-column.c, e-table-column.h: New file, implements the diff --git a/widgets/Makefile.am b/widgets/Makefile.am index 35d1bc64a4..a9614cf1d7 100644 --- a/widgets/Makefile.am +++ b/widgets/Makefile.am @@ -1,6 +1,7 @@ guidir = $(datadir)/evolution/gui gui_DATA = \ + e-msg-composer-address-dialog.glade \ e-msg-composer-attachment.glade \ e-msg-composer.glade @@ -16,6 +17,8 @@ noinst_LTLIBRARIES = \ libevolutionwidgets.la libevolutionwidgets_la_SOURCES = \ + e-msg-composer-address-dialog.c \ + e-msg-composer-address-dialog.h \ e-msg-composer-address-entry.c \ e-msg-composer-address-entry.h \ e-msg-composer-attachment-bar.c \ diff --git a/widgets/e-msg-composer-address-dialog.c b/widgets/e-msg-composer-address-dialog.c new file mode 100644 index 0000000000..aed0a61c9d --- /dev/null +++ b/widgets/e-msg-composer-address-dialog.c @@ -0,0 +1,311 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* e-msg-composer-address-dialog.c + * + * Copyright (C) 1999 Helix Code, Inc. + * + * 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. + * + * Author: Ettore Perazzoli + */ + +#include +#include "e-msg-composer-address-dialog.h" + + +enum { + APPLY, + LAST_SIGNAL +}; +static guint signals[LAST_SIGNAL] = { 0 }; + +static GnomeDialogClass *parent_class = NULL; + + +/* This function should load the addresses we know of into the dialog. We + don't have a precise setup for the addressbook yet, so we will just put some + fake entries in. */ +static void +load_addresses (EMsgComposerAddressDialog *dialog) +{ + gchar *text[][3] = { + { "Bertrand Guiheneuf", "Bertrand.Guiheneuf@aful.org", NULL }, + { "Ettore Perazzoli", "ettore@gnu.org", NULL }, + { "Miguel de Icaza", "miguel@gnu.org", NULL }, + { "Nat Friedman", "nat@nat.org", NULL }, + { NULL, NULL, NULL } + }; + GtkCList *clist; + guint i; + + clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, "address_clist")); + + for (i = 0; text[i][0] != NULL; i++) + gtk_clist_append (clist, text[i]); +} + +/* This loads the selected address in the address GtkCList into the requested + GtkList. */ +static void +add_address (EMsgComposerAddressDialog *dialog, + const gchar *list_name) +{ + GtkCList *src_clist; + GtkCList *dest_clist; + guint row; + gchar *text[2]; + + src_clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, "address_clist")); + dest_clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, list_name)); + row = GPOINTER_TO_INT (src_clist->selection->data); + + gtk_clist_get_text (src_clist, row, 0, &text[0]); + text[1] = NULL; + gtk_clist_append (dest_clist, text); + gtk_clist_set_row_data (dest_clist, dest_clist->rows - 1, + GINT_TO_POINTER (row)); +} + + +/* Signals. */ + +static void +add_to_cb (GtkWidget *widget, + gpointer data) +{ + add_address (E_MSG_COMPOSER_ADDRESS_DIALOG (data), "to_clist"); +} + +static void +add_cc_cb (GtkWidget *widget, + gpointer data) +{ + add_address (E_MSG_COMPOSER_ADDRESS_DIALOG (data), "cc_clist"); +} + +static void +add_bcc_cb (GtkWidget *widget, + gpointer data) +{ + add_address (E_MSG_COMPOSER_ADDRESS_DIALOG (data), "bcc_clist"); +} + +static void +glade_connect (GladeXML *gui, + const gchar *widget_name, + const gchar *signal_name, + GtkSignalFunc callback, + gpointer callback_data) +{ + GtkWidget *widget; + + widget = glade_xml_get_widget (gui, widget_name); + if (widget == NULL) + g_warning ("Widget `%s' was not found.", widget_name); + else + gtk_signal_connect (GTK_OBJECT (widget), signal_name, + GTK_SIGNAL_FUNC (callback), callback_data); +} + +static void +setup_signals (EMsgComposerAddressDialog *dialog) +{ + glade_connect (dialog->gui, "to_add_button", "clicked", add_to_cb, + dialog); + glade_connect (dialog->gui, "cc_add_button", "clicked", add_cc_cb, + dialog); + glade_connect (dialog->gui, "bcc_add_button", "clicked", add_bcc_cb, + dialog); +} + + +/* GtkObject methods. */ + +static void +destroy (GtkObject *object) +{ + EMsgComposerAddressDialog *dialog; + GtkCList *address_clist; + GList *p; + + dialog = E_MSG_COMPOSER_ADDRESS_DIALOG (object); + + gtk_object_unref (GTK_OBJECT (dialog->gui)); + + if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); +} + + +/* Initialization. */ + +static void +class_init (EMsgComposerAddressDialogClass *class) +{ + GtkObjectClass *object_class; + + object_class = GTK_OBJECT_CLASS (class); + object_class->destroy = destroy; + + parent_class = gtk_type_class (gnome_dialog_get_type ()); + + signals[APPLY] + = gtk_signal_new ("apply", + GTK_RUN_FIRST, + object_class->type, + GTK_SIGNAL_OFFSET (EMsgComposerAddressDialogClass, + apply), + gtk_marshal_NONE__NONE, + GTK_TYPE_NONE, 0); + + gtk_object_class_add_signals (object_class, signals, LAST_SIGNAL); +} + +static void +init (EMsgComposerAddressDialog *dialog) +{ + dialog->gui = NULL; +} + + +GtkType +e_msg_composer_address_dialog_get_type (void) +{ + static GtkType type = 0; + + if (type == 0) { + static const GtkTypeInfo info = { + "EMsgComposerAddressDialog", + sizeof (EMsgComposerAddressDialog), + sizeof (EMsgComposerAddressDialogClass), + (GtkClassInitFunc) class_init, + (GtkObjectInitFunc) init, + /* reserved_1 */ NULL, + /* reserved_2 */ NULL, + (GtkClassInitFunc) NULL, + }; + + type = gtk_type_unique (gnome_dialog_get_type (), &info); + } + + return type; +} + +void +e_msg_composer_address_dialog_construct (EMsgComposerAddressDialog *dialog) +{ + static const gchar *buttons[] = { + GNOME_STOCK_BUTTON_OK, + GNOME_STOCK_BUTTON_APPLY, + GNOME_STOCK_BUTTON_CANCEL, + NULL + }; + + g_return_if_fail (dialog != NULL); + g_return_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog)); + + gnome_dialog_constructv (GNOME_DIALOG (dialog), + _("Select recipients' addresses"), + buttons); + + dialog->gui = glade_xml_new + (E_GUIDIR "/e-msg-composer-address-dialog.glade", "main_table"); + if (dialog->gui == NULL) { + g_warning ("Cannot load `e-msg-composer-address-dialog.glade"); + return; + } + + gtk_container_add (GTK_CONTAINER (GNOME_DIALOG (dialog)->vbox), + glade_xml_get_widget (dialog->gui, "main_table")); + + load_addresses (dialog); + setup_signals (dialog); +} + +GtkWidget * +e_msg_composer_address_dialog_new (void) +{ + EMsgComposerAddressDialog *new; + + new = gtk_type_new (e_msg_composer_address_dialog_get_type ()); + e_msg_composer_address_dialog_construct (new); + + return GTK_WIDGET (new); +} + + +static gchar * +make_full_address (const gchar *name, + const gchar *email) +{ + /* FIXME handle quoting. */ + + return g_strconcat (name, " <", email, ">", NULL); +} + +static GList * +get_list (EMsgComposerAddressDialog *dialog, + const gchar *clist_name) +{ + GtkCList *address_clist; + GtkCList *clist; + GList *list; + guint i; + + address_clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, + "address_clist")); + clist = GTK_CLIST (glade_xml_get_widget (dialog->gui, clist_name)); + + list = NULL; + for (i = 0; i < clist->rows; i++) { + gchar *name, *email; + guint addr_row; + + addr_row = GPOINTER_TO_INT (gtk_clist_get_row_data (clist, i)); + gtk_clist_get_text (clist, addr_row, 0, &name); + gtk_clist_get_text (clist, addr_row, 0, &email); + + list = g_list_prepend (list, make_full_address (name, email)); + } + + return g_list_reverse (list); +} + +GList * +e_msg_composer_address_dialog_get_to_list (EMsgComposerAddressDialog *dialog) +{ + g_return_val_if_fail (dialog != NULL, NULL); + g_return_val_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog), NULL); + + return get_list (dialog, "to_clist"); +} + +GList * +e_msg_composer_address_dialog_get_cc_list (EMsgComposerAddressDialog *dialog) +{ + g_return_val_if_fail (dialog != NULL, NULL); + g_return_val_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog), NULL); + + return get_list (dialog, "cc_clist"); +} + +GList * +e_msg_composer_address_dialog_get_bcc_list (EMsgComposerAddressDialog *dialog) +{ + g_return_val_if_fail (dialog != NULL, NULL); + g_return_val_if_fail (E_IS_MSG_COMPOSER_ADDRESS_DIALOG (dialog), NULL); + + return get_list (dialog, "bcc_clist"); +} diff --git a/widgets/e-msg-composer-address-dialog.glade b/widgets/e-msg-composer-address-dialog.glade new file mode 100644 index 0000000000..7a66d9ab8c --- /dev/null +++ b/widgets/e-msg-composer-address-dialog.glade @@ -0,0 +1,574 @@ + + + + + address-composer + address-composer + + src + pixmaps + C + True + True + False + True + True + True + True + interface.c + interface.h + callbacks.c + callbacks.h + support.c + support.h + + + + + GnomeDialog + dialog1 + GTK_WINDOW_TOPLEVEL + GTK_WIN_POS_NONE + False + False + False + False + False + False + + + GtkVBox + GnomeDialog:vbox + dialog-vbox1 + False + 8 + + 4 + True + True + + + + GtkTable + main_table + 3 + 2 + False + 0 + 0 + + 0 + True + True + + + + GtkLabel + label3 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 1 + 2 + 2 + 3 + 0 + 0 + False + False + False + False + False + False + + + + + GtkHBox + hbox2 + True + 0 + + 0 + 1 + 2 + 3 + 0 + 0 + False + False + False + False + True + True + + + + GtkButton + button5 + True + + + 10 + True + True + + + + + GtkButton + button6 + True + + + 10 + True + True + + + + + + GtkScrolledWindow + scrolledwindow1 + 200 + 200 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 0 + 1 + 1 + 2 + 5 + 10 + True + True + False + False + True + True + + + + GtkCList + address_clist + True + 2 + 128,80 + GTK_SELECTION_SINGLE + True + GTK_SHADOW_IN + + + GtkLabel + CList:title + label5 + 150 + + GTK_JUSTIFY_LEFT + False + 0.5 + 0.5 + 0 + 0 + + + + GtkLabel + CList:title + label6 + 1024 + + GTK_JUSTIFY_LEFT + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkTable + table2 + 3 + 2 + False + 0 + 0 + + 1 + 2 + 1 + 2 + 0 + 10 + False + False + False + False + True + True + + + + GtkButton + cc_add_button + 60 + True + + + 0 + 1 + 1 + 2 + 10 + 0 + True + True + False + False + True + False + + + + + GtkButton + to_add_button + 60 + True + + + 0 + 1 + 0 + 1 + 10 + 0 + True + True + False + False + True + False + + + + + GtkButton + bcc_add_button + 60 + True + + + 0 + 1 + 2 + 3 + 10 + 0 + True + True + False + False + True + False + + + + + GtkScrolledWindow + scrolledwindow2 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 2 + 0 + 1 + 5 + 0 + True + True + False + False + True + True + + + + GtkCList + to_clist + 200 + 100 + True + 1 + 80 + GTK_SELECTION_SINGLE + False + GTK_SHADOW_IN + + + GtkLabel + CList:title + label7 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkScrolledWindow + scrolledwindow4 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 2 + 2 + 3 + 5 + 0 + True + True + False + False + True + True + + + + GtkCList + bcc_clist + 200 + 100 + True + 1 + 80 + GTK_SELECTION_SINGLE + False + GTK_SHADOW_IN + + + GtkLabel + CList:title + label9 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + GtkScrolledWindow + scrolledwindow3 + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC + GTK_UPDATE_CONTINUOUS + GTK_UPDATE_CONTINUOUS + + 1 + 2 + 1 + 2 + 5 + 10 + True + True + False + False + True + True + + + + GtkCList + cc_clist + 200 + 100 + True + 1 + 80 + GTK_SELECTION_SINGLE + False + GTK_SHADOW_IN + + + GtkLabel + CList:title + label8 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + + + + + + GtkLabel + label1 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 1 + 2 + 0 + 1 + 0 + 0 + True + True + False + False + True + True + + + + + GtkHBox + hbox1 + False + 0 + + 0 + 1 + 0 + 1 + 5 + 0 + False + False + False + False + False + False + + + + GtkLabel + label2 + + GTK_JUSTIFY_CENTER + False + 0.5 + 0.5 + 0 + 0 + + 5 + False + False + + + + + GtkEntry + name_entry + True + True + True + 0 + + + 5 + True + True + + + + + GtkButton + search_button + 65 + True + + + 5 + False + False + + + + + + + GtkHButtonBox + GnomeDialog:action_area + dialog-action_area1 + GTK_BUTTONBOX_END + 8 + 85 + 27 + 7 + 0 + + 0 + False + True + GTK_PACK_END + + + + GtkButton + button1 + True + True + GNOME_STOCK_BUTTON_OK + + + + GtkButton + button2 + True + True + GNOME_STOCK_BUTTON_APPLY + + + + GtkButton + button3 + True + True + GNOME_STOCK_BUTTON_CANCEL + + + + + + diff --git a/widgets/e-msg-composer-address-dialog.h b/widgets/e-msg-composer-address-dialog.h new file mode 100644 index 0000000000..5ff4723aa9 --- /dev/null +++ b/widgets/e-msg-composer-address-dialog.h @@ -0,0 +1,67 @@ +/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ +/* e-msg-composer-address-dialog.h + * + * Copyright (C) 1999 Helix Code, Inc. + * + * 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. + * + * Author: Ettore Perazzoli + */ +#ifndef __E_MSG_COMPOSER_ADDRESS_DIALOG_H__ +#define __E_MSG_COMPOSER_ADDRESS_DIALOG_H__ + +#include +#include + +#ifdef __cplusplus +extern "C" { +#pragma } +#endif /* __cplusplus */ + + +#define E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG (e_msg_composer_address_dialog_get_type ()) +#define E_MSG_COMPOSER_ADDRESS_DIALOG(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG, EMsgComposerAddressDialog)) +#define E_MSG_COMPOSER_ADDRESS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG, EMsgComposerAddressDialogClass)) +#define E_IS_MSG_COMPOSER_ADDRESS_DIALOG(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG)) +#define E_IS_MSG_COMPOSER_ADDRESS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_DIALOG)) + + +typedef struct _EMsgComposerAddressDialog EMsgComposerAddressDialog; +typedef struct _EMsgComposerAddressDialogClass EMsgComposerAddressDialogClass; + +struct _EMsgComposerAddressDialog { + GnomeDialog parent; + + GladeXML *gui; +}; + +struct _EMsgComposerAddressDialogClass { + GnomeDialogClass parent_class; + + void (* apply) (EMsgComposerAddressDialog *dialog); +}; + + +GtkType e_msg_composer_address_dialog_get_type (void); +GtkWidget *e_msg_composer_address_dialog_new (void); +void e_msg_composer_address_dialog_construct (EMsgComposerAddressDialog *dialog); + +#ifdef __cplusplus +} +#endif /* __cplusplus */ + + +#endif /* __E_MSG_COMPOSER_ADDRESS_DIALOG_H__ */ diff --git a/widgets/e-msg-composer-attachment-bar.c b/widgets/e-msg-composer-attachment-bar.c index 25cc2ff138..9722741a0c 100644 --- a/widgets/e-msg-composer-attachment-bar.c +++ b/widgets/e-msg-composer-attachment-bar.c @@ -369,6 +369,9 @@ destroy (GtkObject *object) bar = E_MSG_COMPOSER_ATTACHMENT_BAR (object); free_attachment_list (bar); + + if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) + (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } diff --git a/widgets/e-msg-composer-attachment.c b/widgets/e-msg-composer-attachment.c index 9e0f7e218e..c9e5029c9b 100644 --- a/widgets/e-msg-composer-attachment.c +++ b/widgets/e-msg-composer-attachment.c @@ -29,7 +29,7 @@ enum { CHANGED, LAST_SIGNAL }; -guint signals[LAST_SIGNAL] = { 0 }; +static guint signals[LAST_SIGNAL] = { 0 }; static GtkObjectClass *parent_class = NULL; @@ -90,7 +90,6 @@ real_changed (EMsgComposerAttachment *msg_composer_attachment) { g_return_if_fail (msg_composer_attachment != NULL); g_return_if_fail (E_IS_MSG_COMPOSER_ATTACHMENT (msg_composer_attachment)); - } diff --git a/widgets/e-msg-composer.c b/widgets/e-msg-composer.c index 70602c0018..6654ddfd17 100644 --- a/widgets/e-msg-composer.c +++ b/widgets/e-msg-composer.c @@ -39,6 +39,7 @@ #include #include "e-msg-composer.h" +#include "e-msg-composer-address-dialog.h" #include "e-msg-composer-attachment-bar.h" #include "e-msg-composer-hdrs.h" @@ -121,7 +122,20 @@ show_attachments (EMsgComposer *composer, } -/* Callbacks. */ +/* Address dialog callbacks. */ + +static void +address_dialog_destroy_cb (GtkWidget *widget, + gpointer data) +{ + EMsgComposer *composer; + + composer = E_MSG_COMPOSER (data); + composer->address_dialog = NULL; +} + + +/* Message composer window callbacks. */ static void send_cb (GtkWidget *widget, @@ -163,6 +177,24 @@ add_attachment_cb (GtkWidget *widget, NULL); } +static void +address_dialog_cb (GtkWidget *widget, + gpointer data) +{ + EMsgComposer *composer; + + composer = E_MSG_COMPOSER (data); + if (composer->address_dialog == NULL) { + composer->address_dialog = e_msg_composer_address_dialog_new (); + gtk_signal_connect (GTK_OBJECT (composer->address_dialog), + "destroy", address_dialog_destroy_cb, + composer); + } + + gtk_widget_show (composer->address_dialog); + gdk_window_show (composer->address_dialog->window); +} + static void glade_connect (GladeXML *gui, const gchar *widget_name, @@ -218,6 +250,13 @@ setup_signals (EMsgComposer *composer) "clicked", GTK_SIGNAL_FUNC (add_attachment_cb), composer); + glade_connect (composer->menubar_gui, "menubar_address_dialog", + "activate", + GTK_SIGNAL_FUNC (address_dialog_cb), composer); + glade_connect (composer->toolbar_gui, "toolbar_address_dialog", + "clicked", + GTK_SIGNAL_FUNC (address_dialog_cb), composer); + gtk_signal_connect (GTK_OBJECT (composer->attachment_bar), "changed", GTK_SIGNAL_FUNC (attachment_bar_changed), @@ -238,6 +277,9 @@ destroy (GtkObject *object) gtk_object_unref (GTK_OBJECT (composer->toolbar_gui)); gtk_object_unref (GTK_OBJECT (composer->appbar_gui)); + if (composer->address_dialog != NULL) + gtk_widget_destroy (composer->address_dialog); + if (GTK_OBJECT_CLASS (parent_class)->destroy != NULL) (* GTK_OBJECT_CLASS (parent_class)->destroy) (object); } @@ -285,6 +327,8 @@ init (EMsgComposer *composer) composer->text = NULL; composer->text_scrolled_window = NULL; + composer->address_dialog = NULL; + composer->attachment_bar = NULL; composer->attachment_scrolled_window = NULL; } @@ -314,6 +358,12 @@ e_msg_composer_get_type (void) } +/** + * e_msg_composer_construct: + * @composer: A message composer widget + * + * Construct @composer. + **/ void e_msg_composer_construct (EMsgComposer *composer) { @@ -390,6 +440,13 @@ e_msg_composer_construct (EMsgComposer *composer) setup_signals (composer); } +/** + * e_msg_composer_new: + * + * Create a new message composer widget. + * + * Return value: A pointer to the newly created widget + **/ GtkWidget * e_msg_composer_new (void) { diff --git a/widgets/e-msg-composer.glade b/widgets/e-msg-composer.glade index c2d18b8125..b747c6f979 100644 --- a/widgets/e-msg-composer.glade +++ b/widgets/e-msg-composer.glade @@ -460,7 +460,7 @@ GtkPixmapMenuItem - address_book + menubar_address_dialog activate on_address_book_activate @@ -528,7 +528,8 @@ Toolbar:button toolbar_send Send this message - + GNOME_STOCK_PIXMAP_MAIL_SND @@ -550,6 +551,16 @@ attachments + + + GtkButton + Toolbar:button + toolbar_address_dialog + Go to addressbook + + GNOME_STOCK_PIXMAP_BOOK_RED + diff --git a/widgets/e-msg-composer.h b/widgets/e-msg-composer.h index 46657479a3..3028dedca3 100644 --- a/widgets/e-msg-composer.h +++ b/widgets/e-msg-composer.h @@ -61,6 +61,8 @@ struct _EMsgComposer { GtkWidget *attachment_bar; GtkWidget *attachment_scrolled_window; + GtkWidget *address_dialog; + gboolean attachment_bar_visible : 1; }; diff --git a/widgets/e-table/ChangeLog b/widgets/e-table/ChangeLog index 77a6c36c61..e8426055fc 100644 --- a/widgets/e-table/ChangeLog +++ b/widgets/e-table/ChangeLog @@ -1,3 +1,27 @@ +1999-11-06 Ettore Perazzoli + + * e-msg-composer-attachment-bar.c (destroy): Call the destroy + method of the parent class. + + * e-msg-composer.c: #include "e-msg-composer-address-dialog.h". + (address_dialog_cb): New callback to start the address dialog. + (setup_signals): Connect it to the appropriate button/menu item. + (init): Initialize the new `address_dialog' member to NULL. + (destroy): Destroy the `address_dialog' if not NULL. + + * e-msg-composer.h: New member `address_dialog' in `struct + _EMsgComposer'. + + * e-msg-composer.glade: Added button to activate the address + composition dialog. + + * e-msg-composer-address-dialog.h, e-msg-composer-address-dialog.c: + New files implementing the address composition dialog for Evolution. + + * e-msg-composer-address-dialog.glade: New file. + + * e-msg-composer-attachment.c: `signals' made static. + 1999-11-05 Ettore Perazzoli * Makefile.am: Compile the new files in a `libevolutionwidgets' @@ -21,6 +45,9 @@ * e-msg-composer-hdrs.c, e-msg-composer-hdrs.h: New files implementing a widget for editing of email message headers. + * e-msg-composer-attachment.glade: New file. + * e-msg-composer.glade: New file. + 1999-10-31 Miguel de Icaza * widgets/e-table-column.c, e-table-column.h: New file, implements the diff --git a/widgets/e-table/Makefile.am b/widgets/e-table/Makefile.am index 35d1bc64a4..a9614cf1d7 100644 --- a/widgets/e-table/Makefile.am +++ b/widgets/e-table/Makefile.am @@ -1,6 +1,7 @@ guidir = $(datadir)/evolution/gui gui_DATA = \ + e-msg-composer-address-dialog.glade \ e-msg-composer-attachment.glade \ e-msg-composer.glade @@ -16,6 +17,8 @@ noinst_LTLIBRARIES = \ libevolutionwidgets.la libevolutionwidgets_la_SOURCES = \ + e-msg-composer-address-dialog.c \ + e-msg-composer-address-dialog.h \ e-msg-composer-address-entry.c \ e-msg-composer-address-entry.h \ e-msg-composer-attachment-bar.c \ -- cgit