Commit b681ec2b authored by Ettore Perazzoli's avatar Ettore Perazzoli

Here is my initial Evolution work: message composition widget and some

installation fixes for Camel.

svn path=/trunk/; revision=1369
parent c8fce201
1999-11-05 Ettore Perazzoli <ettore@gnu.org>
* tests/ui-tests/msg-composer-test.c: New file for testing the
`EMsgComposer' widget.
* tests/ui-tests/Makefile.am (noinst_PROGRAMS): Compile it. Do
not compile `store_listing' for now because it's currently broken.
(INCLUDES): Added the `widgets' source directory to the include
path list.
(LDADD): Removed the MH dependency; link with
`libevolutionwidgets.la' from the `widgets' directory.
* configure.in: Create `widgets/Makefile'.
* camel/gmime-rfc2047.c (rfc2047_clean): Removed C++-like comment.
* camel/camel-folder.c (camel_folder_get_message_uid_by_number):
Likewise.
* camel/gmime-content-field.c (gmime_content_field_get_parameter):
Likewise.
* camel/camel.c (camel_init): Likewise.
* camel/camel-provider.c (camel_provider_register): Likewise.
* camel/camel-multipart.c (_construct_from_stream): Likewise.
* camel/camel-mime-part.c (_write_content_to_stream): Likewise.
* camel/camel-medium.c (camel_medium_class_init): Likewise.
* camel/camel-data-wrapper.h (camel_data_wrapper_get_type): Make
prototype non-static.
* camel/Makefile.am (libcamelinclude_HEADERS): Move
`camel-exception-list.def' from `EXTRA_DIST' to
`libcamelinclude_HEADERS'.
* camel/camel.h: Do not #include <config.h>.
* camel/data-wrapper-repository.h: Likewise.
1999-11-05 Ettore Perazzoli <ettore@gnu.org>
* tests/Makefile.am (INCLUDES): Add `-I$(top_srcdir)'.
1999-10-13 bertrand <Bertrand.Guiheneuf@aful.org>
* camel/camel-folder.c (camel_folder_close): the
......
......@@ -98,6 +98,7 @@ libcamelinclude_HEADERS = \
md5-utils.h \
string-utils.h \
url-util.h \
camel-exception-list.def \
$(pthread_HDR)
libcamel_extra_sources = \
......@@ -106,4 +107,4 @@ libcamel_extra_sources = \
libcamel_la_LDFLAGS = -version-info 0:0:0 -rpath $(libdir)
EXTRA_DIST = README camel-exception-list.def
EXTRA_DIST = README
......@@ -79,7 +79,7 @@ GtkType camel_data_wrapper_get_type (void);
void camel_data_wrapper_write_to_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
void camel_data_wrapper_construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream);
void camel_data_wrapper_set_mime_type (CamelDataWrapper *data_wrapper, gchar *mime_type);
static gchar *camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper);
gchar *camel_data_wrapper_get_mime_type (CamelDataWrapper *data_wrapper);
GMimeContentField *camel_data_wrapper_get_mime_type_field (CamelDataWrapper *data_wrapper);
void camel_data_wrapper_set_mime_type_field (CamelDataWrapper *data_wrapper, GMimeContentField *mime_type);
......
......@@ -1128,8 +1128,8 @@ _get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelExcep
const gchar *
camel_folder_get_message_uid_by_number (CamelFolder *folder, gint message_number, CamelException *ex)
{
//if (!folder->has_uid_capability) return NULL;
//return CF_CLASS (folder)->get_message_uid_by_number (folder, message_number, ex);
/* if (!folder->has_uid_capability) return NULL; */
/* return CF_CLASS (folder)->get_message_uid_by_number (folder, message_number, ex); */
}
......
......@@ -67,11 +67,9 @@ camel_medium_class_init (CamelMediumClass *camel_medium_class)
camel_medium_class->set_content_object = _set_content_object;
camel_medium_class->get_content_object = _get_content_object;
/* virtual method overload */
// camel_data_wrapper_class->write_to_stream = _write_to_stream;
//camel_data_wrapper_class->construct_from_stream = _construct_from_stream;
/* camel_data_wrapper_class->write_to_stream = _write_to_stream; */
/* camel_data_wrapper_class->construct_from_stream = _construct_from_stream; */
gtk_object_class->finalize = _finalize;
}
......
......@@ -628,10 +628,13 @@ _write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
CAMEL_LOG_FULL_DEBUG ( "Entering CamelMimePart::_write_content_to_stream\n");
CAMEL_LOG_FULL_DEBUG ( "CamelMimePart::_write_content_to_stream, content=%p\n", content);
if (!content) return;
// buffer_size = camel_data_wrapper_size (content);
//buffer = g_malloc (buffer_size);
/* buffer_size = camel_data_wrapper_size (content); */
/* buffer = g_malloc (buffer_size); */
camel_data_wrapper_write_to_stream (content, stream);
#if 0
//if (mime_part->encoding) {
// encoded_buffer_size = gmime_encoded_size(buffer, buffer_size, encoding);
// encoded_buffer = g_malloc (encoded_buffer_size);
......@@ -642,6 +645,8 @@ _write_content_to_stream (CamelMimePart *mime_part, CamelStream *stream)
//fwrite (buffer, buffer_size, 1, file);
//camel_stream_write (stream, buffer, buffer_size);
//g_free (buffer);
#endif
CAMEL_LOG_FULL_DEBUG ( "Leaving CamelMimePart::_write_content_to_stream\n");
}
......
......@@ -474,7 +474,8 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
CAMEL_LOG_FULL_DEBUG ("CamelMultipart::construct_from_stream freeing new_part_stream:%p\n", new_part_stream);
gtk_object_unref (GTK_OBJECT (new_part_stream));
if (multipart->preface) g_free (multipart->preface);
//if ( (new_part->str)[0] != '\0') multipart->preface = g_strdup (new_part->str);
/* if ( (new_part->str)[0] != '\0') multipart->preface = g_strdup (new_part->str); */
/* read all the real parts */
while (!end_of_multipart) {
......@@ -490,12 +491,14 @@ _construct_from_stream (CamelDataWrapper *data_wrapper, CamelStream *stream)
}
//g_string_assign (new_part, "");
//_read_part (new_part, stream, real_boundary_line, end_boundary_line);
/* g_string_assign (new_part, ""); */
/* _read_part (new_part, stream, real_boundary_line, end_boundary_line); */
if (multipart->postface) g_free (multipart->postface);
//if ( (new_part->str)[0] != '\0') multipart->postface = g_strdup (new_part->str);
/* if ( (new_part->str)[0] != '\0') multipart->postface = g_strdup (new_part->str); */
/* g_string_free (new_part, TRUE); */
//g_string_free (new_part, TRUE);
g_free (real_boundary_line);
g_free (end_boundary_line);
CAMEL_LOG_FULL_DEBUG ("Leaving CamelMultipart::_construct_from_stream\n");
......
......@@ -72,15 +72,14 @@ camel_provider_register (CamelProvider *provider)
old_provider_node = g_list_find_custom (_provider_list, provider, _provider_name_cmp);
if (old_provider_node != NULL) {
// camel_provider_unref (CAMEL_PROVIDER (old_provider_node->data));
/* camel_provider_unref (CAMEL_PROVIDER (old_provider_node->data)); */
old_provider_node->data = provider;
} else {
/* be careful, we use prepend here, so that last registered
providers come first */
_provider_list = g_list_prepend (_provider_list, provider);
}
// camel_provider_ref (provider);
/* camel_provider_ref (provider); */
}
......
......@@ -35,6 +35,5 @@ camel_init()
printf ("Threads are not supported by glib\n");
#endif /* G_THREADS_ENABLED */
//return data_wrapper_repository_init ();
/* return data_wrapper_repository_init (); */
}
......@@ -34,7 +34,6 @@ extern "C" {
#endif /* __cplusplus }*/
#include <gtk/gtk.h>
#include <config.h>
#include <camel/data-wrapper-repository.h>
#include <camel/data-wrapper-repository.h>
#include <camel/camel-log.h>
......
......@@ -34,7 +34,6 @@ extern "C" {
#endif /* __cplusplus }*/
#include <glib.h>
#include <config.h>
#include "camel-data-wrapper.h"
......
......@@ -261,7 +261,7 @@ gmime_content_field_get_parameter (GMimeContentField *content_field, const gchar
g_assert (content_field->parameters);
g_assert (name);
CAMEL_LOG_FULL_DEBUG ("GMimeContentField::get_parameter looking for parameter \"%s\"\n", name);
//parameter = (const gchar *)g_hash_table_lookup (content_field->parameters, name);
/* parameter = (const gchar *)g_hash_table_lookup (content_field->parameters, name); */
parameter_exists = g_hash_table_lookup_extended (content_field->parameters,
name,
(gpointer *) &old_name,
......
......@@ -240,8 +240,9 @@ gmime_rfc2047_decode (const gchar *data, const gchar *into_what)
#define isnt_ascii(a) ((a) <= 0x1f || (a) >= 0x7f)
static int
rfc2047_clean (const gchar *string, const gchar *max) {
// if (strstr (string, "?=")) return 1;
rfc2047_clean (const gchar *string, const gchar *max)
{
/* if (strstr (string, "?=")) return 1; */
while (string < max) {
if (isnt_ascii ((unsigned char)*string))
return 0;
......
......@@ -106,4 +106,5 @@ devel-docs/Makefile
devel-docs/camel/Makefile
tests/Makefile
tests/ui-tests/Makefile
widgets/Makefile
])
# process this file with automake to create Makefile.in
INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir)/camel \
INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir) -I$(top_srcdir)/camel \
-I$(includedir) -I$(top_srcdir)/camel/providers/MH
LDADD = \
$(top_builddir)/camel/libcamel.la \
......
......@@ -3,3 +3,4 @@ Makefile
.deps
.libs
store_listing
msg-composer-test
# process this file with automake to create Makefile.in
INCLUDES = -I$(top_srcdir)/intl -I$(top_srcdir)/camel \
-I$(includedir) -I$(top_srcdir)/camel/providers/MH \
INCLUDES = \
-I$(top_srcdir)/intl \
-I$(top_srcdir)/camel \
-I$(includedir) \
-I$(top_srcdir)/camel/providers/MH \
-I$(top_srcdir)/widgets \
$(EXTRA_GNOME_CFLAGS)
LDADD = \
$(top_builddir)/camel/libcamel.la \
$(top_builddir)/camel/providers/MH/libcamelmh.la \
$(INTLLIBS) $(EXTRA_GNOME_LIBS) $(PTHREAD_LIB)
LDADD = \
$(top_builddir)/widgets/libevolutionwidgets.la \
$(top_builddir)/camel/libcamel.la \
$(INTLLIBS) \
$(EXTRA_GNOME_LIBS) \
$(PTHREAD_LIB)
noinst_PROGRAMS = \
store_listing
\ No newline at end of file
noinst_PROGRAMS = \
msg-composer-test
\ No newline at end of file
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
#include <gnome.h>
#include <camel/camel-data-wrapper.h>
#include <camel/camel-stream-fs.h>
#include <camel/camel-stream.h>
#include "e-msg-composer.h"
static void
send_cb (EMsgComposer *composer,
gpointer data)
{
CamelMimeMessage *message;
CamelStream *stream;
gint stdout_dup;
message = e_msg_composer_get_message (composer);
stdout_dup = dup (1);
stream = camel_stream_fs_new_with_fd (stdout_dup);
camel_data_wrapper_write_to_stream (CAMEL_DATA_WRAPPER (message),
stream);
camel_stream_close (stream);
gtk_object_unref (GTK_OBJECT (message));
#if 0
gtk_widget_destroy (GTK_WIDGET (composer));
gtk_main_quit ();
#endif
}
int
main (int argc, char **argv)
{
GtkWidget *composer;
gnome_init ("test", "0.0", argc, argv);
glade_gnome_init ();
composer = e_msg_composer_new ();
gtk_widget_show (composer);
gtk_signal_connect (GTK_OBJECT (composer), "send",
GTK_SIGNAL_FUNC (send_cb), NULL);
gtk_main ();
return 0;
}
.deps
.libs
Makefile
Makefile.in
*.lo
*.la
1999-11-05 Ettore Perazzoli <ettore@gnu.org>
* Makefile.am: Compile the new files in a `libevolutionwidgets'
library.
(CPPFLAGS): #define `E_GUIDIR'.
* e-msg-composer.c, e-msg-composer.h: New files implementing an
initial version of the Evolution message composer widget.
* e-msg-composer-address-entry.c, e-msg-composer-address-entry.h:
New files implementing a GtkEntry customized for entering email
address lists.
* e-msg-composer-attachment-bar.c, e-msg-composer-attachment-bar.h:
New files implementing a widget for editing mail attachments.
* e-msg-composer-attachment.c, e-msg-composer-attachment.h: New
files implementing file attachment objects for the message
composer.
* e-msg-composer-hdrs.c, e-msg-composer-hdrs.h: New files
implementing a widget for editing of email message headers.
1999-10-31 Miguel de Icaza <miguel@gnu.org>
* widgets/e-table-column.c, e-table-column.h: New file, implements the
......
noinst_LIBRARIES = \
e-table-simple.c \
e-table-simple.h \
e-table-model.c \
e-table-model.h \
e-table-column-model.c \
e-table-column-model.h \
guidir = $(datadir)/evolution/gui
gui_DATA = \
e-msg-composer-attachment.glade \
e-msg-composer.glade
INCLUDES = \
-I$(top_srcdir)/camel \
-I$(top_builddir)/camel \
$(GNOME_INCLUDEDIR)
CPPFLAGS = \
-DE_GUIDIR=\"$(guidir)\"
noinst_LTLIBRARIES = \
libevolutionwidgets.la
libevolutionwidgets_la_SOURCES = \
e-msg-composer-address-entry.c \
e-msg-composer-address-entry.h \
e-msg-composer-attachment-bar.c \
e-msg-composer-attachment-bar.h \
e-msg-composer-attachment.c \
e-msg-composer-attachment.h \
e-msg-composer-hdrs.c \
e-msg-composer-hdrs.h \
e-msg-composer.c \
e-msg-composer.h
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-msg-composer-address-entry.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
*/
/* This is a custom GtkEntry for entering address lists. For now, it does not
have any fancy features, but in the future we might want to make it
cooler. */
#include <gnome.h>
#include "e-msg-composer-address-entry.h"
static GtkEntryClass *parent_class = NULL;
/* Initialization. */
static void
class_init (EMsgComposerAddressEntryClass *klass)
{
GtkObjectClass *object_class;
object_class = (GtkObjectClass*) klass;
parent_class = gtk_type_class (gtk_entry_get_type ());
}
static void
init (EMsgComposerAddressEntry *msg_composer_address_entry)
{
}
GtkType
e_msg_composer_address_entry_get_type (void)
{
static GtkType type = 0;
if (type == 0) {
static const GtkTypeInfo info = {
"EMsgComposerAddressEntry",
sizeof (EMsgComposerAddressEntry),
sizeof (EMsgComposerAddressEntryClass),
(GtkClassInitFunc) class_init,
(GtkObjectInitFunc) init,
/* reserved_1 */ NULL,
/* reserved_2 */ NULL,
(GtkClassInitFunc) NULL,
};
type = gtk_type_unique (gtk_entry_get_type (), &info);
}
return type;
}
GtkWidget *
e_msg_composer_address_entry_new (void)
{
GtkWidget *new;
new = gtk_type_new (e_msg_composer_address_entry_get_type ());
return new;
}
/**
* e_msg_composer_address_entry_get_addresses:
* @entry: An address entry widget
*
* Retrieve the list of addresses stored in @entry.
*
* Return value: A GList of pointers to strings representing the addresses.
* Notice that the strings must be freed by the caller when not needed anymore.
**/
GList *
e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry)
{
GList *list;
const gchar *s;
const gchar *p, *oldp;
gboolean in_quotes;
s = gtk_entry_get_text (GTK_ENTRY (entry));
in_quotes = FALSE;
list = NULL;
p = s;
oldp = s;
while (1) {
if (*p == '"') {
in_quotes = ! in_quotes;
p++;
} else if ((! in_quotes && *p == ',') || *p == 0) {
if (p != oldp) {
gchar *new_addr;
new_addr = g_strndup (oldp, p - oldp);
new_addr = g_strstrip (new_addr);
if (*new_addr != '\0')
list = g_list_prepend (list, new_addr);
else
g_free (new_addr);
}
while (*p == ',' || *p == ' ' || *p == '\t')
p++;
if (*p == 0)
break;
oldp = p;
} else {
p++;
}
}
return g_list_reverse (list);
}
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-msg-composer-address-entry.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_ENTRY_H__
#define __E_MSG_COMPOSER_ADDRESS_ENTRY_H__
#include <gnome.h>
#ifdef __cplusplus
extern "C" {
#pragma }
#endif /* __cplusplus */
#define E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY (e_msg_composer_address_entry_get_type ())
#define E_MSG_COMPOSER_ADDRESS_ENTRY(obj) (GTK_CHECK_CAST ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY, EMsgComposerAddressEntry))
#define E_MSG_COMPOSER_ADDRESS_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY, EMsgComposerAddressEntryClass))
#define E_IS_MSG_COMPOSER_ADDRESS_ENTRY(obj) (GTK_CHECK_TYPE ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY))
#define E_IS_MSG_COMPOSER_ADDRESS_ENTRY_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((obj), E_TYPE_MSG_COMPOSER_ADDRESS_ENTRY))
typedef struct _EMsgComposerAddressEntry EMsgComposerAddressEntry;
typedef struct _EMsgComposerAddressEntryClass EMsgComposerAddressEntryClass;
struct _EMsgComposerAddressEntry {
GtkEntry parent;
};
struct _EMsgComposerAddressEntryClass {
GtkEntryClass parent_class;
};
GtkType e_msg_composer_address_entry_get_type (void);
GtkWidget *e_msg_composer_address_entry_new (void);
GList *e_msg_composer_address_entry_get_addresses (EMsgComposerAddressEntry *entry);
#ifdef __cplusplus
}
#endif /* __cplusplus */
#endif /* __E_MSG_COMPOSER_ADDRESS_ENTRY_H__ */
/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */
/* e-msg-composer-attachment-bar.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 <gnome.h>
#include <glade/glade.h>
#include "e-msg-composer-attachment.h"
#include "e-msg-composer-attachment-bar.h"
#define ICON_WIDTH 64
#define ICON_SEPARATORS " /-_."
#define ICON_SPACING 2
#define ICON_ROW_SPACING ICON_SPACING
#define ICON_COL_SPACING ICON_SPACING
#define ICON_BORDER 2
#define ICON_TEXT_SPACING 2
static GnomeIconListClass *parent_class = NULL;
struct _EMsgComposerAttachmentBarPrivate {
GList *attachments;
guint num_attachments;
GtkWidget *context_menu;
GtkWidget *icon_context_menu;
};
enum {
CHANGED,
LAST_SIGNAL
};
static guint signals[LAST_SIGNAL] = { 0 };
static void update (EMsgComposerAttachmentBar *bar);
/* Sorting. */
static gint
attachment_sort_func (gconstpointer a, gconstpointer b)
{
const EMsgComposerAttachment *attachment_a, *attachment_b;
attachment_a = (EMsgComposerAttachment *) a;
attachment_b = (EMsgComposerAttachment *) b;
return strcmp (attachment_a->description, attachment_b->description);
}
static void
sort (EMsgComposerAttachmentBar *bar)
{
EMsgComposerAttachmentBarPrivate *priv;
priv = bar->priv;
priv->attachments = g_list_sort (priv->attachments,
attachment_sort_func);
}
/* Attachment handling functions. */
static void
free_attachment_list (EMsgComposerAttachmentBar *bar)
{
EMsgComposerAttachmentBarPrivate *priv;
GList *p;
priv = bar->priv;
for (p = priv->attachments; p != NULL; p = p->next)
gtk_object_unref (GTK_OBJECT (p->data));
}
static void
attachment_changed_cb (EMsgComposerAttachment *attachment,
gpointer data)
{
update (E_MSG_COMPOSER_ATTACHMENT_BAR (data));
}
static void
add_from_file (EMsgComposerAttachmentBar *bar,
const gchar *file_name)
{
EMsgComposerAttachment *attachment;
attachment = e_msg_composer_attachment_new (file_name);
gtk_signal_connect (GTK_OBJECT (attachment), "changed",
GTK_SIGNAL_FUNC (attachment_changed_cb),
bar);
bar->priv->attachments = g_list_append (bar->priv->attachments,
attachment);
bar->priv->num_attachments++;
sort (bar);
update (bar);
gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]);
}
static void
remove_attachment (EMsgComposerAttachmentBar *bar,
EMsgComposerAttachment *attachment)
{
bar->priv->attachments = g_list_remove (bar->priv->attachments,
attachment);
bar->priv->num_attachments--;
gtk_object_unref (GTK_OBJECT (attachment));
gtk_signal_emit (GTK_OBJECT (bar), signals[CHANGED]);
}
/* Icon list contents handling. */
static void