--- configure.in	2007-11-27 15:30:48.000000000 +0530
> +++ configure.in	2007-11-27 15:31:55.000000000 +0530
> @@ -1696,7 +1696,7 @@ plugins_base_always="calendar-file calen
>  plugins_base="$plugins_base_always $SA_JUNK_PLUGIN $BF_JUNK_PLUGIN $EXCHANGE_PLUGIN $MONO_PLUGIN" 
>  all_plugins_base="$plugins_base_always sa-junk-plugin bogo-junk-plugin exchange-operations mono"
>  
> -plugins_standard_always="bbdb subject-thread save-calendar select-one-source copy-tool mail-to-task mark-calendar-offline audio-inline mailing-list-actions new-mail-notify default-mailer import-ics-attachments prefer-plain mail-notification attachment-reminder face backup-restore" 
> +plugins_standard_always="bbdb subject-thread save-calendar select-one-source copy-tool mail-to-task mark-calendar-offline audio-inline mailing-list-actions new-mail-notify default-mailer import-ics-attachments prefer-plain mail-notification attachment-reminder face backup-restore email-custom-header" 
>  plugins_standard="$plugins_standard_always"
>  all_plugins_standard="$plugins_standard"
>  
> @@ -2042,6 +2042,7 @@ plugins/import-ics-attachments/Makefile
>  plugins/imap-features/Makefile
>  plugins/tnef-attachments/Makefile
>  plugins/face/Makefile
> +plugins/email-custom-header/Makefile
>  smime/Makefile
>  smime/lib/Makefile
>  smime/gui/Makefile
> --- /dev/null	2007-09-22 03:20:58.000000000 +0530
> +++ plugins/email-custom-header/custom-header.c	2007-11-29 16:54:34.000000000 +0530
> @@ -0,0 +1,481 @@
> +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
> + *
> + * Authors: Ashish Shrivastava <shashish@novell.com>
> + *
> + * Copyright (C) 2004 Novell, Inc.
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of version 2 of the GNU General Public
> + * License as published by the Free Software Foundation.
> + *
> + * 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., 51 Franklin Street, Fifth Floor, MA 02110-1301.
> + */
> +
> +#ifdef HAVE_CONFIG_H
> +#include <config.h>
> +#endif
> +
> +#include <string.h>
> +#include <glib.h>
> +#include <libedataserverui/e-name-selector.h>
> +#include <libedataserverui/e-contact-store.h>
> +#include <e-util/e-error.h>
> +#include <gtk/gtksignal.h>
> +#include <gtk/gtktogglebutton.h>
> +#include <gtk/gtk.h>
> 
If you are including gtk.h you do not need to include the individual headers like gtktogglebutton.h The best solution is to identify all the individual headers and include them 


> +#include <libgnome/libgnome.h>
> +#include <libgnome/gnome-i18n.h>
> +#include <glade/glade.h>
> +#include <libxml/tree.h>
> +#include <libxml/parser.h>
> +#include <libxml/xmlmemory.h>
> +#include <e-util/e-xml-utils.h>
> +#include "composer/e-msg-composer.h"
> +#include "composer/e-msg-composer-hdrs.h"
> +#include "libedataserver/e-account.h"
> +#include "e-util/e-util-private.h"
> +
> +#include "custom-header.h"
> 
Naming conventions need to be followed. It should be email-custom-header.h

> +
> +struct _CustomHeaderOptionsDialogPrivate {
> +	/* Glade XML data */
> +	GladeXML *xml;
> +
> +	/*Widgets*/
> +
> +	GtkWidget *main;
> +
> +        GtkWidget *page;
> + 
> +        GtkNotebook *notebook;
> +        
> +        GtkWidget *header_table;
> +
> +	GtkWidget *headerTypeName_label;
> +
> +        GtkWidget *headerSubtypeValue_combo_box[MAX_ROW][MAX_COLUMN];
> +	char *help_section;
> +};
> +
> +
> +static void custom_headeroptions_dialog_class_init (GObjectClass *object_class);
> +static void custom_headeroptions_dialog_finalize (GObject *object);
> +static void custom_headeroptions_dialog_init (GObject *object);
> +static void custom_headeroptions_dialog_dispose (GObject *object);
> +static void setup_custom_header_widgets (CustomHeaderOptionsDialog *sod);
> +
> +static GObjectClass *parent_class = NULL;
> +enum {
> +	SOD_RESPONSE,
> 
What is this SOD ? We do not deal with "Send Options". You may need to rename this enum.


> +	LAST_SIGNAL
> +};
> +
> +gint indexSubtype[CUSTOM_SUB_TYPE];
> +static guint signals[LAST_SIGNAL] = {0};
> 
> 
What are these hard-coded values ? You may want to use a GArray.


> +
> +CustomHeaderDetails headerDetails[MAX_ROW];
> +/* custom_header_options_get_widgets_data(CustomHeaderOptionsDialog *sod)
> +   Return Value:This function returns a -1 if an error occurs. In case of error-free operation \
> +   a 1 is returned.
> +*/
> +static int
> +custom_header_options_get_widgets_data (CustomHeaderOptionsDialog *sod)
> 
> 
All function names should adhere to the conventions followed in rest of the plugins. epech_* etc


> +{
> +	CustomHeaderOptionsDialogPrivate *priv;
> +        int indexComboBoxRow,indexComboBoxColumn;
> 
> 
Variable naming conventions as well.


> +	priv = sod->priv;
> +	
> +	/* This block helps us fetch the address of the delegator(s). If no delegator is \
> +           selected or more than one delegatee has been selected then an info dialog is \
> +           popped up to help the user.	
> +	*/
> +
> +        for(indexComboBoxRow=0,indexComboBoxColumn=0;indexComboBoxColumn<headerDetails[0].numberOfHeader;\
> 
Will this even compile ? What is that \ ? 

Coding conventions should be followed. There is no spacing between statements in the for (;;)


> +             indexComboBoxColumn++) {
> +             indexSubtype[indexComboBoxColumn] = gtk_combo_box_get_active \
> +                    ((GtkComboBox *)priv->headerSubtypeValue_combo_box\
> +                    [indexComboBoxRow][indexComboBoxColumn]);
> +        }
> +
> +	return 1;
> +}
> +
> +static gboolean
> +get_widgets (CustomHeaderOptionsDialog *sod) 
> +{
> +	CustomHeaderOptionsDialogPrivate *priv;
> +
> +	priv = sod->priv;
> +
> +#define CUSTOM_HEADER(name) glade_xml_get_widget (priv->xml, name)
> +
> +	priv->main = CUSTOM_HEADER ("custom_header");
> +	if (!priv->main)
> +		return FALSE;
> +
> +        priv->page  = CUSTOM_HEADER ("vbox");	
> +        priv->notebook = (GtkNotebook *) CUSTOM_HEADER ("notebook");
> +        priv->header_table = CUSTOM_HEADER ("header-options");	
> +
> +#undef CUSTOM_HEADER
> 
Any specific reason why you want to follow this style ? It is fairly okay, but I guess it will be good to stay consistent with the rest of the code. 

+
> +	return (priv->page
> +		&&priv->notebook
> +		&&priv->header_table);
> +}
> +	
> +static void
> +custom_header_options_fill_widgets_with_data (CustomHeaderOptionsDialog *sod)
> +{
> +	CustomHeaderOptionsDialogPrivate *priv;
> +        int setIndexComboBoxRow,setIndexComboBoxColumn;	
> +	priv = sod->priv;
> +
> +	priv->help_section = g_strdup ("usage-mail");
> 
> 
Leaks ? 


> +
> +        for(setIndexComboBoxRow=0,setIndexComboBoxColumn=0;\
> +              setIndexComboBoxColumn<headerDetails[0].numberOfHeader;\
> +                    setIndexComboBoxColumn++) {
> +             gtk_combo_box_set_active ((GtkComboBox *)priv->headerSubtypeValue_combo_box\
> +                    [setIndexComboBoxRow][setIndexComboBoxColumn],0);
> +        }
> +}
> +
> +CustomHeaderOptionsDialog *
> +custom_headeroptions_dialog_new (void) {
> +	CustomHeaderOptionsDialog *sod;
> +
> +	sod = g_object_new (CUSTOM_HEADER_OPTIONS_DIALOG, NULL);
> +	
> +	return sod;
> 
> 
CustomHeaderOptionsDialog is cod 

I guess you copied from SendOptionDialog for GroupWise. Change the variable name.


> +}
> +
> +GType custom_headeroptions_dialog_get_type (void)
> +{
> +  static GType type = 0;
> +  if (type == 0) {
> +    static const GTypeInfo info = {
> +      sizeof (CustomHeaderOptionsDialogClass),
> +      NULL,   /* base_init */
> +      NULL,   /* base_finalize */
> +      (GClassInitFunc) custom_headeroptions_dialog_class_init,   /* class_init */
> +      NULL,   /* class_finalize */
> +      NULL,   /* class_data */
> +      sizeof (CustomHeaderOptionsDialog),
> +     0,      /* n_preallocs */
> +     (GInstanceInitFunc) custom_headeroptions_dialog_init,
> + 	NULL    /* instance_init */
> +    };
> +    type = g_type_register_static (G_TYPE_OBJECT,
> +                                   "CustomHeaderOptionsDialogType",
> +                                   &info, 0);
> +  }
> +  return type;
> +}
> +
> +static void custom_header_options_cb (GtkDialog *dialog, gint state, gpointer func_data)
> +{
> +   	CustomHeaderOptionsDialogPrivate *priv;
> +   	CustomHeaderOptionsDialog *sod;
> +        GError *error = NULL;     
> +		
> +	sod = func_data;
> +        priv = sod->priv;
> +	
> +	switch (state) {			
> +		case GTK_RESPONSE_OK:
> +		     if(custom_header_options_get_widgets_data (sod) < 0) 
> +			return;
> 
I guess you miss some code here.

+		case GTK_RESPONSE_CANCEL:
> +		    	gtk_widget_hide (priv->main);
> +	    	    	gtk_widget_destroy (priv->main);
> +	           	g_object_unref (priv->xml);
> +	             	break;	     
> +		case GTK_RESPONSE_HELP:
> +		     	gnome_help_display (
> +				"evolution.xml", priv->help_section, &error);
> +			if (error != NULL) {
> +				g_warning ("%s", error->message);
> +				g_error_free (error);
> +			}
> +	    	    	break;
> +	}
> +	g_signal_emit (G_OBJECT (func_data), signals[SOD_RESPONSE], 0, state);
> 
> 
Why we need this signal ? Will function calls be not sufficient ?


> +
> +}
> +
> +gboolean 
> +custom_headeroptions_dialog_run (CustomHeaderOptionsDialog *sod, GtkWidget *parent)
> +{	
> +	CustomHeaderOptionsDialogPrivate *priv;
> +
> +        CustomHeaderDetails *headerPointerDetails;
> 
> 
Indentations gone for a toss. And we do not follow C#/Java style naming for variables.


> +
> +	GtkWidget *toplevel;
> +	gchar *filename;
> +
> +	g_return_val_if_fail (sod != NULL || CUSTOM_IS_HEADEROPTIONS_DIALOG (sod), FALSE);
> 
May be this macro's name should change. Two separate g_retu* statements will do better.

+	
> +	priv = sod->priv;
> +
> +        headerPointerDetails = get_custom_header_type_list ();
> +	if (headerPointerDetails == NULL)
> +		return;
> +
> +	filename = g_build_filename (EVOLUTION_GLADEDIR,
> +				     "org-gnome-custom-header.glade",
> +				     NULL);
> +	priv->xml = glade_xml_new (filename, NULL, NULL);
> +	g_free (filename);
> +
> +	if (!priv->xml) {
> +		g_message ( G_STRLOC ": Could not load the Glade XML file ");
> +		return FALSE;
> +	}
> +
> +	if (!get_widgets(sod)) {
> +		g_object_unref (priv->xml);
> +		g_message (G_STRLOC ": Could not get the Widgets******** \n");
> +		return FALSE;
> +	}
> +
> +        setup_custom_header_widgets (sod);
> + 
> +	toplevel =  gtk_widget_get_toplevel (priv->main);
> +	if (parent)
> +		gtk_window_set_transient_for (GTK_WINDOW (toplevel),
> +				      GTK_WINDOW (parent));
> +
> +	custom_header_options_fill_widgets_with_data (sod);
> +
> +	g_signal_connect (GTK_DIALOG (priv->main), "response", 
> +				G_CALLBACK(custom_header_options_cb), sod);
> 
> 
IIRC, you need to disconnect this on exit.


> +
> +	gtk_window_set_modal ((GtkWindow *) priv->main, TRUE);
> +	gtk_widget_show (priv->main);
> +       
> +	return TRUE;
> +}
> +
> +CustomHeaderDetails *
> +get_custom_header_type_list (void)
> +{
> +        gchar *filename, *file_contents=NULL;
> +        GError *error = NULL;
> +        gsize length;
> +
> +	const char *headerlist_path;
> +	xmlDocPtr header_xml;
> +	xmlNodePtr root, child, headerlist,header;
> +	GList *headers = NULL;
> +        int headerTypeIndex,headerSubTypeIndex;
> +
> +	headerlist_path = g_build_path ("/", getenv ("HOME"), ".evolution/customheader.xml", NULL);
> 
> 
You can use a file similar to your .glade file; that gets installed.  Or as Srini suggested, you can use gconf to do this in case you want to enable this for lock-down.

+      
> +        memset(headerDetails, 0, sizeof(headerDetails));
> +
> +        headerTypeIndex = 0;
> +	header_xml = xmlParseFile (headerlist_path);
> +	if (! header_xml) {
> +                e_error_run (NULL, "org.gnome.evolution.plugins.email-custom-header:file-not-found", NULL, NULL);
> +		fprintf (stderr, "customHeader: Could not open custom header list.\n");
> +		return NULL;
> +	}
> +
> +        g_file_get_contents (headerlist_path, &file_contents, &length, &error);
> +        if (length < 212) {
> +            e_error_run (NULL, "org.gnome.evolution.plugins.email-custom-header:invalid-file-size", NULL, NULL);
> +            return NULL;
> +        }
> +         
> +	g_free (headerlist_path);
> +
> +	root = xmlDocGetRootElement (header_xml);
> +	if (strcmp ((const char *)root->name, "customheader")) {
> +                e_error_run (NULL, "org.gnome.evolution.plugins.email-custom-header:file-not-parse-root", NULL, NULL);
> +		fprintf (stderr, "customHeader: can not parse file,Could not find root in xml file.\n");
> +		xmlFreeDoc (header_xml);
> +		return NULL;
> +	}
> +
> +	headerlist = NULL;
> +	for (child = root->children; child != NULL; child = child->next) {
> +		if (! strcmp ((const char *)child->name, "headerlist")) {
> +			headerlist = child;
> +			break;
> +		}
> +	}
> +	if (headerlist == NULL) {
> +                e_error_run (NULL, "org.gnome.evolution.plugins.email-custom-header:file-not-parse-headerlist", NULL, NULL);
> +		fprintf (stderr, "customHeader: Could not find 'headerlist' element in custom header list.\n");
> +		xmlFreeDoc (header_xml);
> +		return NULL;
> +	}
> +
> +        header = NULL;
> +	for (child = headerlist->children; child != NULL; child = child->next) {
> +		if (! strcmp ((const char *)child->name, "header"))
> +                {
> +
> +                        strcpy(headerDetails[headerTypeIndex].type, e_xml_get_string_prop_by_name (child, (const unsigned char *)"name"));
> +                        headerDetails[0].numberOfHeader++;
> +                        headerSubTypeIndex=0;
> +			parse_custom_header_type (child, &headers, headerTypeIndex,headerSubTypeIndex);
> +                        headerTypeIndex++;
> +                }
> +	}
> 
Using gconf will leave you from all these hassles.


> +
> +	xmlFreeDoc (header_xml);
> +
> +	return headers;
> +}
> +
> +gchar *
> +parse_custom_header_type (xmlNodePtr contact, GList **customheaders, int header_Type_Index,int header_SubType_Index)
> +{
> +	xmlNodePtr  child;
> +	xmlNodePtr  headername = NULL;
> +
> +	CustomHeaderDetails  *chd;
> +	chd = g_new0 (CustomHeaderDetails, 1);
> +
> +	for (child = contact->children; child != NULL; child = child->next) {
> +	    if (! strcmp ((const char *)child->name, "subtype")) {
> +			strcpy(headerDetails[header_Type_Index].subTypeHeader[header_SubType_Index].subtype,\
> +                             e_xml_get_string_prop_by_name (child, (const unsigned char *)"name"));
> +
> +			headername = child;
> +
> +			if (headername == NULL) {
> +                                e_error_run (NULL, "org.gnome.evolution.plugins.email-custom-header:file-not-parse-headervalue", NULL, NULL);
> +				fprintf (stderr, "customHeader: Could not find header in headerList.\n");
> +				return;
> +			}
> +			else{
> +				parse_custom_header_type (child, customheaders, header_Type_Index,header_SubType_Index++);
> +                        }
> +	    }
> +
> +	}
> +
> +        headerDetails[header_Type_Index].numberOfSubTypeHeader = header_SubType_Index;
> +	*customheaders = g_list_prepend (*customheaders, chd);
> +        return headerDetails[header_Type_Index].subTypeHeader[header_SubType_Index].subtype;
> +}
> 
Same comment as above goes here.


> +
> +static void 
> +setup_custom_header_widgets (CustomHeaderOptionsDialog *sod)
> +{
> +        CustomHeaderOptionsDialogPrivate *priv;
> +        int headerSectionId,subTypeIndex,row,column,labelrow;
> +	priv = sod->priv;
> +
> +        for (headerSectionId=0,labelrow=0,row=0,column=1; \
> +                 headerSectionId<headerDetails[0].numberOfHeader;headerSectionId++,\
> +                 row++,column++) {
> +		priv->headerTypeName_label = gtk_label_new ("");
> +		gtk_label_set_markup (GTK_LABEL (priv->headerTypeName_label), \
> +                      headerDetails[headerSectionId].type);
> +		gtk_table_attach (GTK_TABLE (priv->header_table), priv->headerTypeName_label, \
> +                        0, 1, row, column,
> +			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
> +			(GtkAttachOptions) (0), 0, 0);
> +		gtk_misc_set_alignment (GTK_MISC (priv->headerTypeName_label), 0, 0.5);
> +		gtk_widget_show (priv->headerTypeName_label);
> +                    
> +		priv->headerSubtypeValue_combo_box[labelrow][row] = gtk_combo_box_new_text ();
> +		gtk_table_attach (GTK_TABLE (priv->header_table), \
> +                        priv->headerSubtypeValue_combo_box[labelrow][row], 1, 2, row, column,
> +			(GtkAttachOptions) (GTK_EXPAND | GTK_FILL),
> +			(GtkAttachOptions) (GTK_FILL), 0, 0);
> +
> +	for (subTypeIndex=0;subTypeIndex<headerDetails[headerSectionId].numberOfSubTypeHeader;subTypeIndex++) {
> +			gtk_combo_box_append_text (GTK_COMBO_BOX (priv->headerSubtypeValue_combo_box[labelrow][row]), \
> +                              headerDetails[headerSectionId].subTypeHeader[subTypeIndex].subtype);
> 
> I really do not follow these trailing \ es.

> +		}
> +			gtk_widget_show (priv->headerSubtypeValue_combo_box[labelrow][row]);
> +	}
> +}
> +
> +	static void
> +custom_headeroptions_dialog_class_init (GObjectClass *object)
> 
epch_* 


> +{
> +	CustomHeaderOptionsDialogClass *klass;
> +	GObjectClass *object_class;
> +
> +	klass = CUSTOM_HEADEROPTIONS_DIALOG_CLASS (object);
> +	parent_class = g_type_class_peek_parent (klass);
> +	object_class = G_OBJECT_CLASS (klass);
> +
> +	object_class->finalize = custom_headeroptions_dialog_finalize;
> +	object_class->dispose = custom_headeroptions_dialog_dispose;
> +	signals[SOD_RESPONSE] = g_signal_new ("esod_response",
> +			G_TYPE_FROM_CLASS (klass),
> +			G_SIGNAL_RUN_FIRST,
> +			G_STRUCT_OFFSET (CustomHeaderOptionsDialogClass, esod_response),
> +			NULL, NULL,
> +			g_cclosure_marshal_VOID__INT,
> +			G_TYPE_NONE, 1,
> +			G_TYPE_INT);
> +
> +}
> 
> 
> +
> +	static void
> +custom_headeroptions_dialog_init (GObject *object)
> +{
> +
> +	CustomHeaderOptionsDialog *sod;
> +	CustomHeaderOptionsDialogPrivate *priv;
> +
> +	sod = CUSTOM_HEADEROPTIONS_DIALOG (object);
> +
> +	priv = g_new0 (CustomHeaderOptionsDialogPrivate, 1);
> +
> +	sod->priv = priv;
> +
> +	priv->xml = NULL;
> +	priv->main = NULL;
> +	priv->notebook = NULL;
> +	priv->header_table = NULL;
> +}
> +
> +	static void
> +custom_headeroptions_dialog_finalize (GObject *object)
> +{
> +	CustomHeaderOptionsDialog *sod = (CustomHeaderOptionsDialog *)object;
> +	CustomHeaderOptionsDialogPrivate *priv;
> +
> +	g_return_if_fail (CUSTOM_IS_HEADEROPTIONS_DIALOG (sod));
> +	priv = sod->priv;
> +
> +	g_free (priv->help_section);
> +
> +	if (sod->priv) {
> +		g_free (sod->priv);
> +		sod->priv = NULL;
> +	}
> +
> +	if (parent_class->finalize) 
> +		(* parent_class->finalize) (object);
> +
> +}
> +
> +	static void
> +custom_headeroptions_dialog_dispose (GObject *object)
> +{
> +	CustomHeaderOptionsDialog *sod = (CustomHeaderOptionsDialog *) object;
> +
> +	g_return_if_fail (CUSTOM_IS_HEADEROPTIONS_DIALOG (sod));
> +
> +	if (parent_class->dispose)
> +		(* parent_class->dispose) (object);
> +
> +}	
> +
> --- /dev/null	2007-09-22 03:20:58.000000000 +0530
> +++ plugins/email-custom-header/custom-header.h	2007-11-29 16:54:11.000000000 +0530
> @@ -0,0 +1,75 @@
> + /* Evolution Email custom header options
> + * Copyright (C) 2004 Novell, Inc.
> + *
> + * Authors: Ashish <shashish@novell.com>
> + *
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of version 2 of the GNU General Public
> + * License as published by the Free Software Foundation.
> + *
> + * 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., 51 Franklin Street, Fifth Floor, MA 02110-1301.
> + */
> +
> +#ifndef __CUSTOM_HEADEROPTIONS_DIALOG_H__
> +#define __CUSTOM_HEADEROPTIONS_DIALOG_H__
> +
> +#include <gtk/gtkwidget.h>
> +#include <gtk/gtk.h>
> 
Avoid including gtk.h and include individual headers.


> +
> +
> +
> +#define CUSTOM_HEADER_OPTIONS_DIALOG       (custom_headeroptions_dialog_get_type ())
> +#define CUSTOM_HEADEROPTIONS_DIALOG(obj)       (GTK_CHECK_CAST ((obj), CUSTOM_HEADER_OPTIONS_DIALOG, CustomHeaderOptionsDialog))
> +#define CUSTOM_HEADEROPTIONS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_CAST ((klass), CUSTOM_HEADER_OPTIONS_DIALOG, CustomHeaderOptionsDialogClass))
> +#define CUSTOM_IS_HEADEROPTIONS_DIALOG(obj)    (GTK_CHECK_TYPE ((obj), CUSTOM_HEADER_OPTIONS_DIALOG))
> +#define CUSTOM_IS_HEADEROPTIONS_DIALOG_CLASS(klass) (GTK_CHECK_CLASS_TYPE ((klass), CUSTOM_HEADER_OPTIONS_DIALOG))
> +
> +#define CUSTOM_SUB_TYPE 50
> +#define MAX_ROW 50
> +#define MAX_COLUMN 50
> 
> 
As I said earlier, I will prefer a GArray than these hard-coded values.


> +
> +typedef struct _CustomHeaderOptionsDialog		CustomHeaderOptionsDialog;
> +typedef struct _CustomHeaderOptionsDialogClass		CustomHeaderOptionsDialogClass;
> +typedef struct _CustomHeaderOptionsDialogPrivate	CustomHeaderOptionsDialogPrivate;
> +
> +/* We require the delegate_email and delegate_name to store the address of the delegator selected into 
> +   the destination store.
> +*/
> 
? is this ?

+
> +struct _CustomHeaderOptionsDialog {
> +	GObject object;
> +
> +	/* Private data */
> +	CustomHeaderOptionsDialogPrivate *priv;
> +};
> +
> +typedef struct {
> +	char subtype[50];
> +} CustomHeaderSubType;
> +
> +typedef struct {
> +	char type[50];
> +	gint numberOfHeader;
> +	gint numberOfSubTypeHeader;
> +	CustomHeaderSubType subTypeHeader[50];
> +} CustomHeaderDetails;
> +
> +struct _CustomHeaderOptionsDialogClass {
> +	GObjectClass parent_class;
> +	void (* esod_response) (CustomHeaderOptionsDialog *esd, gint status);
> +};
> +
> +GType  custom_headeroptions_dialog_get_type     (void);
> +CustomHeaderOptionsDialog *custom_headeroptions_dialog_new (void);
> +gboolean custom_headeroptions_dialog_run (CustomHeaderOptionsDialog *sod, GtkWidget *parent);
> +CustomHeaderDetails *get_custom_header_type_list (void);
> +gchar *parse_custom_header_type (xmlNodePtr group, GList **customheaders, int numberk,int i);
> +#endif
> +
> --- /dev/null	2007-09-22 03:20:58.000000000 +0530
> +++ plugins/email-custom-header/mail-custom-header.c	2007-11-29 15:06:17.000000000 +0530
> @@ -0,0 +1,117 @@
> +/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*-
> + *
> + *  Authors: Ashish Shrivastava <shashish@novell.com>
> + *
> + * Copyright 2004 Novell, Inc. (www.novell.com)
> + * 
> + * This program is free software; you can redistribute it and/or
> + * modify it under the terms of version 2 of the GNU General Public
> + * License as published by the Free Software Foundation.
> + * 
> + * 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., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
> + *
> + */
> +
> +#include <string.h>
> +#include <stdio.h>
> +
> +#include <glib.h>
> +#include <glib/gi18n.h>
> +
> +#include <camel/camel-mime-message.h>
> +#include <camel/camel-address.h>
> +#include <gtk/gtk.h>
> +#include <glib/gi18n.h>
> +#include <mail/em-menu.h>
> +#include <e-util/e-error.h>
> +#include <libxml/tree.h>
> +#include <libxml/parser.h>
> +#include <libxml/xmlmemory.h>
> +#include <e-util/e-xml-utils.h>
> +
> +#include <string.h>
> +#include <sys/time.h>
> +#include <sys/stat.h>
> +#include <e-util/e-config.h>
> +
> +#include <e-util/e-config.h>
> +#include <mail/em-config.h>
> +#include <mail/em-event.h>
> +
> +#include "composer/e-msg-composer.h"
> +#include "composer/e-msg-composer-hdrs.h"
> +#include "libedataserver/e-account.h"
> +
> +#include "custom-header.h"
> +
> +#define d(x) x
> +
> +extern indexSubtype[CUSTOM_SUB_TYPE];
> +extern CustomHeaderDetails headerDetails[MAX_ROW];
> +
> +
> +void org_gnome_composer_custom_header (EPlugin * ep, EMMenuTargetWidget * target);
> +
> +static CustomHeaderOptionsDialog *dialog=NULL;
> +
> +
> +static void  
> +append_to_custom_header (CustomHeaderOptionsDialog *dialog, gint state, gpointer data)
> +{
> +	EMsgComposer *composer;
> +        int indexT, indexSub;
> +
> +	composer = (EMsgComposer *)data;
> +	if (state == GTK_RESPONSE_OK) {
> +
> +		for(indexT=0,indexSub=0;indexSub<headerDetails[indexT].numberOfHeader;indexSub++)
> +		{
> +			e_msg_composer_modify_header (composer, headerDetails[indexSub].type, \
> +					headerDetails[indexT].subTypeHeader[indexSubtype[indexSub]].subtype);		
> +		}			
> +	}
> +}
> +
> +
> +	static void
> +custome_header_options_commit (EMsgComposer *comp, gpointer user_data)
> +{
> +	if (!user_data && !CUSTOM_IS_HEADEROPTIONS_DIALOG (user_data))
> +		return;
> +
> +	if (dialog) {
> +		g_print ("\nDialog getting unreferenced ");
> 
You have defined a beautiful macro in the beginning of this file. Why not give it a try ;) ?


> +		g_object_unref (dialog);
> +		dialog = NULL;	
> +	}
> +}
> +
> +	void 
> +org_gnome_composer_custom_header (EPlugin * ep, EMMenuTargetWidget * t)
> +{
> +
> +	EMsgComposer *composer;
> +	GList       *headerlist;
> +
> +	composer = (EMsgComposer *) t->target.widget;
> +
> +	/*disply the custome_header options dialog*/
> +	if (!dialog) {
> +		g_print ("New dialog\n\n") ;
> +		dialog = custom_headeroptions_dialog_new () ;
> +	}
> +
> +	custom_headeroptions_dialog_run (dialog, GTK_WIDGET (composer));
> +
> +	g_signal_connect (dialog, "esod_response", G_CALLBACK (append_to_custom_header), GTK_WIDGET (composer));
> +	g_signal_connect (GTK_WIDGET (composer), "destroy",
> +			G_CALLBACK (custome_header_options_commit), dialog);
> +
> +}
> --- /dev/null	2007-09-22 03:20:58.000000000 +0530
> +++ plugins/email-custom-header/Makefile.am	2007-11-29 11:34:29.000000000 +0530
> @@ -0,0 +1,49 @@
> +INCLUDES = -I. 						\
> +	-I$(top_srcdir)	                                \
> +	-I$(top_srcdir)/widgets				\
> +	-I$(top_srcdir)/widgets/misc			\
> +	-I$(top_builddir)/mail                          \
> +	-I$(top_srcdir)/camel                           \
> +	-I$(top_builddir)/composer			\
> +	$(EVOLUTION_MAIL_CFLAGS)			\
> +	-DEVOLUTION_GLADEDIR=\""$(gladedir)"\"          \
> +	-DCONNECTOR_GLADEDIR=\""$(gladedir)"\"
> +
> +
> +@EVO_PLUGIN_RULE@
> +
> +plugin_DATA =	\
> +	org-gnome-custom-header.eplug	\
> +	org-gnome-custom-header-menu.xml  
> +
> +plugin_LTLIBRARIES = liborg-gnome-custom-header.la
> +
> +liborg_gnome_custom_header_la_SOURCES = 		\
> +	custom-header.c					\
> +	mail-custom-header.c				\
> +	custom-header.h					
> +liborg_gnome_custom_header_la_LIBADD = 			\
> +	$(top_builddir)/e-util/libeutil.la 			\
> +	$(top_builddir)/widgets/misc/libemiscwidgets.la		\
> +	$(top_builddir)/mail/libevolution-mail.la 		\
> +	$(NO_UNDEFINED_REQUIRED_LIBS)				
> +
> +liborg_gnome_custom_header_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED)
> +
> +error_DATA =							\
> +	org-gnome-custom-header.errors.xml
> +
> +errordir = $(privdatadir)/errors
> +
> +glade_DATA =							\
> +	org-gnome-custom-header.glade
> +EXTRA_DIST = 						\
> +	org-gnome-custom-header.eplug.xml			\
> +	org-gnome-custom-header-menu.xml				
> +	$(error_DATA)
> +
> +BUILT_SOURCES = 				\
> +	org-gnome-custom-header.eplug 			\
> +	$(error_i18n)
> +
> +CLEANFILES = $(BUILT_SOURCES)
> --- /dev/null	2007-09-22 03:20:58.000000000 +0530
> +++ plugins/email-custom-header/org-gnome-custom-header.eplug.xml	2007-11-28 11:03:50.000000000 +0530
> @@ -0,0 +1,22 @@
> +<?xml version="1.0"?>
> +<e-plugin-list>
> +	<e-plugin id="org.gnome.evolution.email-custom-header" type="shlib" _name="Custom Header" 
> +		location="@PLUGINDIR@/liborg-gnome-custom-header@SOEXT@">
> +
> +		<author name="Ashish Shrivastava" email="shashish@novell.com"/>
> +		<_description>Attach add Custom Header outgoing messages. User needs to configure custom header through option dialog window.</_description
> 
This definitely needs some change. I will prefer to discuss with doc writers here. All our plugins needs to improve their descriptions, sadly though :(


> +
> +		<hook class="org.gnome.evolution.mail.bonobomenu:1.0">
> +			<menu id="org.gnome.evolution.mail.composer" target="widget">
> +				<ui file="@PLUGINDIR@/org-gnome-custom-header-menu.xml"/>
> +				<item
> +					type="item"
> +					verb="Custom Header"
> +					path="/commands/Custom Header"			   
> +					activate="org_gnome_composer_custom_header"
> +					enable="one"
> +				/>
> +			</menu>
> +		</hook>
> +	</e-plugin>
> +</e-plugin-list>
> --- /dev/null	2007-09-22 03:20:58.000000000 +0530
> +++ plugins/email-custom-header/org-gnome-custom-header.glade	2007-11-28 11:03:50.000000000 +0530
> @@ -0,0 +1,143 @@
> +<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*-->
> +
> 
[snip]

+</glade-interface>
> --- /dev/null	2007-09-22 03:20:58.000000000 +0530
> +++ plugins/email-custom-header/org-gnome-custom-header-menu.xml	2007-11-29 11:43:11.000000000 +0530
> @@ -0,0 +1,13 @@
> +<Root>
> +  <commands>
> +  	<cmd name="Custom Header" _label="_Custom Header"/>
> +  </commands>
> +  <menu>
> + 	<submenu name="Insert">
> +  		<placeholder name="Component">
> +  			<menuitem name="Custom Header" verb="" />
> +                <separator f="" name="customheader1"/>
> +	  	</placeholder>
> +	</submenu>
> +  </menu>
> +</Root>
> --- /dev/null	2007-09-22 03:20:58.000000000 +0530
> +++ plugins/email-custom-header/org-gnome-custom-header.errors.xml	2007-11-29 16:29:56.000000000 +0530
> @@ -0,0 +1,26 @@
> +<?xml version="1.0" encoding="UTF-8"?>
> +<error-list domain="org.gnome.evolution.plugins.email-custom-header">
> +
> +	<error id="file-not-found" type="error">
> +		<primary>Failed:File cannot be read</primary>
> +		<secondary>Could not find xml file</secondary>
> +	</error>
> +
> +        <error id="file-not-parse-root" type="error">
> +		<primary>Failed:File cannot be parse</primary>
> +		<secondary>Could not find root in xml file</secondary>
> +	</error>
> +        <error id="file-not-parse-headerlist" type="error">
> +		<primary>Failed:File cannot be parse</primary>
> +		<secondary>Could not find headerlist element in xml file</secondary>
> +	</error>
> +        <error id="file-not-parse-header-value" type="error">
> +		<primary>Failed:File cannot be parse</primary>
> +		<secondary>Could not find header element in xml file</secondary>
> +	</error>
> +	<error id="invalid-file-size" type="error">
> +		<primary>Invalid File Contents</primary>
> +		<secondary>The XML file you loaded is too small. Please check file have proper header and header's values. </secondary>
> +	</error>
> 
> 
May be all this will go away if you can use gconf. Discuss with doc before committing the strings.


