diff options
Diffstat (limited to 'plugins')
173 files changed, 0 insertions, 17831 deletions
diff --git a/plugins/.cvsignore b/plugins/.cvsignore deleted file mode 100644 index cffa601193..0000000000 --- a/plugins/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -.deps -.libs -Makefile -Makefile.in diff --git a/plugins/Makefile.am b/plugins/Makefile.am deleted file mode 100644 index e8cba7c235..0000000000 --- a/plugins/Makefile.am +++ /dev/null @@ -1,2 +0,0 @@ -SUBDIRS = $(plugins_enabled) -DIST_SUBDIRS = $(plugins_base) $(plugins_all) diff --git a/plugins/addressbook-file/ChangeLog b/plugins/addressbook-file/ChangeLog deleted file mode 100644 index ac66da93e1..0000000000 --- a/plugins/addressbook-file/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2005-01-21 Sivaiah Nallagatla <snallagatla@novell.com> - - * initial commit diff --git a/plugins/addressbook-file/Makefile.am b/plugins/addressbook-file/Makefile.am deleted file mode 100644 index 76ae687dfd..0000000000 --- a/plugins/addressbook-file/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_CFLAGS) \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-addressbook-file.eplug -plugin_LTLIBRARIES = liborg-gnome-addressbook-file.la - - -liborg_gnome_addressbook_file_la_SOURCES = addressbook-file.c -liborg_gnome_addressbook_file_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-addressbook-file.eplug.in diff --git a/plugins/addressbook-file/addressbook-file.c b/plugins/addressbook-file/addressbook-file.c deleted file mode 100644 index 04b1e59b68..0000000000 --- a/plugins/addressbook-file/addressbook-file.c +++ /dev/null @@ -1,56 +0,0 @@ -/* - * - * - * Copyright (C) 2004 Sivaiah Nallagatla - * - * 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. - * - */ - -#include <gtk/gtklabel.h> -#include <gtk/gtkentry.h> -#include <gtk/gtktable.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkhbox.h> -#include <e-util/e-config.h> -#include <addressbook/gui/widgets/eab-config.h> -#include <libedataserver/e-source.h> -#include <libgnome/gnome-i18n.h> -#include <string.h> - -GtkWidget *e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data); - -GtkWidget * -e_book_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - EABConfigTargetSource *t = (EABConfigTargetSource *) data->target; - ESource *source = t->source; - char *uri_text; - - uri_text = e_source_get_uri (source); - if (strncmp (uri_text, "file", 4)) { - g_free (uri_text); - - return NULL; - } - - e_source_set_relative_uri (source, e_source_peek_uid (source)); - uri_text = e_source_get_uri (source); - - return NULL; -} diff --git a/plugins/addressbook-file/org-gnome-addressbook-file.eplug.in b/plugins/addressbook-file/org-gnome-addressbook-file.eplug.in deleted file mode 100644 index 7d1f8ad655..0000000000 --- a/plugins/addressbook-file/org-gnome-addressbook-file.eplug.in +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - location="@PLUGINDIR@/liborg-gnome-addressbook-file.so" - id="org.gnome.evolution.addressbook.file" - name="Local Address Books"> - <hook class="org.gnome.evolution.addressbook.config:1.0"> - <group - target="source" - id="com.novell.evolution.addressbook.config.accountEditor"> - <item - type="item" - path="00.general/10.display/00.file_dummy" - factory="e_book_file_dummy"/> - </group> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/addressbook-groupwise/ChangeLog b/plugins/addressbook-groupwise/ChangeLog deleted file mode 100644 index b51b27aa12..0000000000 --- a/plugins/addressbook-groupwise/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2005-01-29 Sivaiah Nallagatla <snallagatla@novell.com> - - * initial commit diff --git a/plugins/addressbook-groupwise/Makefile.am b/plugins/addressbook-groupwise/Makefile.am deleted file mode 100644 index 8a79c5b39c..0000000000 --- a/plugins/addressbook-groupwise/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_CFLAGS) \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-addressbook-groupwise.eplug -plugin_LTLIBRARIES = liborg-gnome-addressbook-groupwise.la - - -liborg_gnome_addressbook_groupwise_la_SOURCES = addressbook-groupwise.c -liborg_gnome_addressbook_groupwise_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-addressbook-groupwise.eplug.in diff --git a/plugins/addressbook-groupwise/addressbook-groupwise.c b/plugins/addressbook-groupwise/addressbook-groupwise.c deleted file mode 100644 index 1cd1691afb..0000000000 --- a/plugins/addressbook-groupwise/addressbook-groupwise.c +++ /dev/null @@ -1,75 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* * - * Copyright (C) 2004 Sivaiah Nallagatla <snallagtla@novell.com> - * - * 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. - * - */ - -#include <gtk/gtklabel.h> -#include <gtk/gtkentry.h> -#include <gtk/gtktable.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkhbox.h> -#include <e-util/e-config.h> -#include <addressbook/gui/widgets/eab-config.h> -#include <libedataserver/e-source.h> -#include <libgnome/gnome-i18n.h> -#include <string.h> - -void commit_groupwise_addressbook (EPlugin *epl, EConfigTarget *target); -GtkWidget *e_book_groupwise_dummy (EPlugin *epl, EConfigHookItemFactoryData *data); - -void -commit_groupwise_addressbook (EPlugin *epl, EConfigTarget *target) -{ - EABConfigTargetSource *t = (EABConfigTargetSource *) target; - ESource *source = t->source; - char *uri_text; - ESourceGroup *source_group; - char *relative_uri; - GSList *l; - - uri_text = e_source_get_uri (source); - if (strncmp (uri_text, "groupwise", 9)) { - g_free (uri_text); - - return ; - } - e_source_set_property (source, "auth-domain", "Groupwise"); - relative_uri = g_strconcat (";", e_source_peek_name (source), NULL); - e_source_set_relative_uri (source, relative_uri); - g_free (relative_uri); - - source_group = e_source_peek_group (source); - l = e_source_group_peek_sources(source_group); - if (l && l->data ) { - e_source_set_property(source, "auth", e_source_get_property(l->data, "auth")); - e_source_set_property(source, "user", e_source_get_property(l->data, "user")); - e_source_set_property(source, "use_ssl", e_source_get_property(l->data, "use_ssl")); - e_source_set_property(source, "port", e_source_get_property(l->data, "port")); - } -} - -GtkWidget * -e_book_groupwise_dummy (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - - - return NULL; -} diff --git a/plugins/addressbook-groupwise/org-gnome-addressbook-groupwise.eplug.in b/plugins/addressbook-groupwise/org-gnome-addressbook-groupwise.eplug.in deleted file mode 100644 index 6c4a76db71..0000000000 --- a/plugins/addressbook-groupwise/org-gnome-addressbook-groupwise.eplug.in +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - location="@PLUGINDIR@/liborg-gnome-addressbook-groupwise.so" - id="org.gnome.evolution.addressbook.groupwise" - name="Groupwise Address Books"> - <hook class="org.gnome.evolution.addressbook.config:1.0"> - <group - target="source" - id="com.novell.evolution.addressbook.config.accountEditor" - commit="commit_groupwise_addressbook"> - <item - type="item" - path="00.general/10.display/00.gw_dummy" - factory="e_book_groupwise_dummy" - /> - </group> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/audio-inline/.cvsignore b/plugins/audio-inline/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/audio-inline/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/audio-inline/ChangeLog b/plugins/audio-inline/ChangeLog deleted file mode 100644 index 6dbf786aa7..0000000000 --- a/plugins/audio-inline/ChangeLog +++ /dev/null @@ -1,34 +0,0 @@ -2004-11-26 JP Rosevear <jpr@novell.com> - - * audio-inline.c (org_gnome_audio_inline_add_button): get image - from icon factory directly - -2004-11-11 Radek Doulik <rodo@ximian.com> - - * org-gnome-audio-inline.eplug.in: fixed author and description - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-25 Radek Doulik <rodo@ximian.com> - - * audio-inline.c: removed unused enum declaration - (org_gnome_audio_inline_play_clicked): added cast to &argv to - quiet compiler - handle more mime types - - * org-gnome-audio-inline.eplug.in: handle application/x-ogg mime - type - handle more mime types - - * audio-inline.c: handle application/x-ogg mime type - - * org-gnome-audio-inline.eplug.in: handle audio/x-mp3 mime type - - * audio-inline.c: (org_gnome_audio_inline_play_clicked): handle - audio/x-mp3 mime type - -2004-10-25 Radek Doulik <rodo@ximian.com> - - * audio-inline.c: imported audio inline plugin
\ No newline at end of file diff --git a/plugins/audio-inline/Makefile.am b/plugins/audio-inline/Makefile.am deleted file mode 100644 index e969972b6b..0000000000 --- a/plugins/audio-inline/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(GSTREAMER_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-audio-inline.eplug -plugin_LTLIBRARIES = liborg-gnome-audio-inline.la - -liborg_gnome_audio_inline_la_SOURCES = audio-inline.c -liborg_gnome_audio_inline_la_LDFLAGS = -module -avoid-version -liborg_gnome_audio_inline_la_LIBADD = $(GSTREAMER_LIBS) - -EXTRA_DIST = org-gnome-audio-inline.eplug.in
\ No newline at end of file diff --git a/plugins/audio-inline/audio-inline.c b/plugins/audio-inline/audio-inline.c deleted file mode 100644 index 36c6cfed44..0000000000 --- a/plugins/audio-inline/audio-inline.c +++ /dev/null @@ -1,306 +0,0 @@ -/* - Copyright (C) 2004 Novell, Inc. - Author: Radek Doulik - - */ - -/* This file is licensed under the GNU GPL v2 or later */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <unistd.h> /* for unlink */ -#include <string.h> -#include "e-util/e-icon-factory.h" -#include "e-util/e-mktemp.h" -#include "camel/camel-medium.h" -#include "camel/camel-mime-part.h" -#include "camel/camel-stream.h" -#include "camel/camel-stream-fs.h" -#include "mail/em-format-hook.h" -#include "mail/em-format-html.h" -#include "gtk/gtkbutton.h" -#include "gtk/gtkbox.h" -#include "gtk/gtkimage.h" -#include "gtk/gtkhbbox.h" -#include "gtkhtml/gtkhtml-embedded.h" -#include "gst/gst.h" - -#define d(x) x - -void org_gnome_audio_inline_format (void *ep, EMFormatHookTarget *t); - -volatile static int org_gnome_audio_class_id_counter = 0; - -struct _org_gnome_audio_inline_pobject { - EMFormatHTMLPObject object; - - CamelMimePart *part; - char *filename; - GstElement *thread; -}; - -static void -org_gnome_audio_inline_pobject_free (EMFormatHTMLPObject *o) -{ - struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) o; - - d(printf ("audio inline formatter: pobject free\n")); - - if (po->part) { - camel_object_unref (po->part); - po->part = NULL; - } - if (po->filename) { - unlink (po->filename); - g_free (po->filename); - po->filename = NULL; - } - if (po->thread) { - gst_element_set_state (po->thread, GST_STATE_NULL); - gst_object_unref (GST_OBJECT (po->thread)); - po->thread = NULL; - } -} - -static void -org_gnome_audio_inline_pause_clicked (GtkWidget *button, EMFormatHTMLPObject *pobject) -{ - struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) pobject; - - if (po->thread) { - /* start playing */ - gst_element_set_state (po->thread, GST_STATE_PAUSED); - } -} - -static void -org_gnome_audio_inline_stop_clicked (GtkWidget *button, EMFormatHTMLPObject *pobject) -{ - struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) pobject; - - if (po->thread) { - /* start playing */ - gst_element_set_state (po->thread, GST_STATE_READY); - } -} - -static GstElement * -org_gnome_audio_inline_gst_mpeg_thread (GstElement *filesrc) -{ - GstElement *thread, *decoder, *audiosink; - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("org-gnome-audio-inline-mpeg-thread"); - - /* now it's time to get the decoder */ - decoder = gst_element_factory_make ("mad", "decoder"); - - /* and an audio sink */ - audiosink = gst_element_factory_make ("osssink", "play_audio"); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (thread), filesrc, decoder, audiosink, NULL); - - /* link src to sink */ - gst_element_link_many (filesrc, decoder, audiosink, NULL); - - return thread; -} - -static GstElement * -org_gnome_audio_inline_gst_ogg_thread (GstElement *filesrc) -{ - GstElement *thread, *demuxer, *decoder, *converter, *audiosink; - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("org-gnome-audio-inline-mpeg-thread"); - - /* create an ogg demuxer */ - demuxer = gst_element_factory_make ("oggdemux", "demuxer"); - g_assert (demuxer != NULL); - - /* create a vorbis decoder */ - decoder = gst_element_factory_make ("vorbisdec", "decoder"); - g_assert (decoder != NULL); - - /* create an audio converter */ - converter = gst_element_factory_make ("audioconvert", "converter"); - g_assert (decoder != NULL); - - /* and an audio sink */ - audiosink = gst_element_factory_make ("osssink", "play_audio"); - g_assert (audiosink != NULL); - - /* add objects to the thread */ - gst_bin_add_many (GST_BIN (thread), filesrc, demuxer, decoder, converter, audiosink, NULL); - - /* link them in the logical order */ - gst_element_link_many (filesrc, demuxer, decoder, converter, audiosink, NULL); - - return thread; -} - -static GstElement * -org_gnome_audio_inline_gst_flac_thread (GstElement *filesrc) -{ - GstElement *thread, *decoder, *audiosink; - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("org-gnome-audio-inline-flac-thread"); - - /* now it's time to get the decoder */ - decoder = gst_element_factory_make ("flacdec", "decoder"); - - /* and an audio sink */ - audiosink = gst_element_factory_make ("osssink", "play_audio"); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (thread), filesrc, decoder, audiosink, NULL); - - /* link src to sink */ - gst_element_link_many (filesrc, decoder, audiosink, NULL); - - return thread; -} - -static GstElement * -org_gnome_audio_inline_gst_mod_thread (GstElement *filesrc) -{ - GstElement *thread, *decoder, *audiosink; - - /* create a new thread to hold the elements */ - thread = gst_thread_new ("org-gnome-audio-inline-flac-thread"); - - /* now it's time to get the decoder */ - decoder = gst_element_factory_make ("mikmod", "decoder"); - - /* and an audio sink */ - audiosink = gst_element_factory_make ("osssink", "play_audio"); - - /* add objects to the main pipeline */ - gst_bin_add_many (GST_BIN (thread), filesrc, decoder, audiosink, NULL); - - /* link src to sink */ - gst_element_link_many (filesrc, decoder, audiosink, NULL); - - return thread; -} - -static void -org_gnome_audio_inline_play_clicked (GtkWidget *button, EMFormatHTMLPObject *pobject) -{ - struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) pobject; - - d(printf ("audio inline formatter: play\n")); - - if (!po->filename) { - CamelStream *stream; - CamelDataWrapper *data; - int argc = 1; - char *argv [] = { "org_gnome_audio_inline", NULL }; - - po->filename = e_mktemp ("org-gnome-audio-inline-file-XXXXXX"); - - d(printf ("audio inline formatter: write to temp file %s\n", po->filename)); - - stream = camel_stream_fs_new_with_name (po->filename, O_RDWR | O_CREAT | O_TRUNC, 0600); - data = camel_medium_get_content_object (CAMEL_MEDIUM (po->part)); - camel_data_wrapper_decode_to_stream (data, stream); - camel_stream_flush (stream); - camel_object_unref (stream); - - d(printf ("audio inline formatter: init gst thread\n")); - - if (gst_init_check (&argc, (char ***) &argv)) { - CamelContentType *type; - GstElement *filesrc; - - /* create a disk reader */ - filesrc = gst_element_factory_make ("filesrc", "disk_source"); - g_object_set (G_OBJECT (filesrc), "location", po->filename, NULL); - - type = camel_mime_part_get_content_type (po->part); - if (type) { - if (!strcasecmp (type->type, "audio")) { - if (!strcasecmp (type->subtype, "mpeg") || !strcasecmp (type->subtype, "x-mpeg") - || !strcasecmp (type->subtype, "mpeg3") || !strcasecmp (type->subtype, "x-mpeg3") - || !strcasecmp (type->subtype, "mp3") || !strcasecmp (type->subtype, "x-mp3")) { - po->thread = org_gnome_audio_inline_gst_mpeg_thread (filesrc); - } else if (!strcasecmp (type->subtype, "flac") || !strcasecmp (type->subtype, "x-flac")) { - po->thread = org_gnome_audio_inline_gst_flac_thread (filesrc); - } else if (!strcasecmp (type->subtype, "mod") || !strcasecmp (type->subtype, "x-mod")) { - po->thread = org_gnome_audio_inline_gst_mod_thread (filesrc); - } - } else if (!strcasecmp (type->type, "application")) { - if (!strcasecmp (type->subtype, "ogg") || !strcasecmp (type->subtype, "x-ogg")) { - po->thread = org_gnome_audio_inline_gst_ogg_thread (filesrc); - } - } - } - } - } - - if (po->thread) { - /* start playing */ - gst_element_set_state (po->thread, GST_STATE_PLAYING); - } -} - -static void -org_gnome_audio_inline_add_button (GtkWidget *box, char *icon_name, GCallback cb, gpointer data) -{ - GtkWidget *icon, *button; - GdkPixbuf *pixbuf; - - icon = e_icon_factory_get_image (icon_name, E_ICON_SIZE_LARGE_TOOLBAR); - gtk_widget_show (icon); - - button = gtk_button_new (); - g_signal_connect (button, "clicked", cb, data); - - gtk_container_add ((GtkContainer *) button, icon); - gtk_widget_show (button); - gtk_box_pack_end_defaults (GTK_BOX (box), button); -} - -static gboolean -org_gnome_audio_inline_button_panel (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) -{ - GtkWidget *box; - struct _org_gnome_audio_inline_pobject *po = (struct _org_gnome_audio_inline_pobject *) pobject; - - /* it is OK to call UI functions here, since we are called from UI thread */ - - box = gtk_hbutton_box_new (); - org_gnome_audio_inline_add_button (box, "stock_media-play", G_CALLBACK (org_gnome_audio_inline_play_clicked), po); - org_gnome_audio_inline_add_button (box, "stock_media-pause", G_CALLBACK (org_gnome_audio_inline_pause_clicked), po); - org_gnome_audio_inline_add_button (box, "stock_media-stop", G_CALLBACK (org_gnome_audio_inline_stop_clicked), po); - - gtk_widget_show (box); - gtk_container_add ((GtkContainer *) eb, box); - - return TRUE; -} - -void -org_gnome_audio_inline_format (void *ep, EMFormatHookTarget *t) -{ - struct _org_gnome_audio_inline_pobject *pobj; - char *classid = g_strdup_printf ("org-gnome-audio-inline-button-panel-%d", org_gnome_audio_class_id_counter); - - org_gnome_audio_class_id_counter ++; - - d(printf ("audio inline formatter: format classid %s\n", classid)); - - pobj = (struct _org_gnome_audio_inline_pobject *) em_format_html_add_pobject ((EMFormatHTML *) t->format, sizeof(*pobj), classid, - t->part, org_gnome_audio_inline_button_panel); - camel_object_ref (t->part); - pobj->part = t->part; - pobj->filename = NULL; - pobj->thread = NULL; - pobj->object.free = org_gnome_audio_inline_pobject_free; - - camel_stream_printf (t->stream, "<object classid=%s></object>\n", classid); -} diff --git a/plugins/audio-inline/org-gnome-audio-inline.eplug.in b/plugins/audio-inline/org-gnome-audio-inline.eplug.in deleted file mode 100644 index 0d87a36cc2..0000000000 --- a/plugins/audio-inline/org-gnome-audio-inline.eplug.in +++ /dev/null @@ -1,30 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.audioInline" - location="@PLUGINDIR@/liborg-gnome-audio-inline.la" - name="Audio inline plugin"> - - <description>A formatter plugin which displays audio attachments inline and allows you to play them directly from evolution</description> - <author name="Radek DoulÃk" email="rodo@novell.com"/> - - <hook class="org.gnome.evolution.mail.format:1.0"> - <group id="EMFormatHTMLDisplay"> - <item mime_type="audio/mpeg" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/x-mpeg" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/mpeg3" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/x-mpeg3" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/mp3" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/x-mp3" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/flac" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/x-flac" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/mod" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/x-mod" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="application/ogg" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="application/x-ogg" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - </group> - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/backup-restore/.cvsignore b/plugins/backup-restore/.cvsignore deleted file mode 100644 index 76bd16c42d..0000000000 --- a/plugins/backup-restore/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug -backup
\ No newline at end of file diff --git a/plugins/backup-restore/ChangeLog b/plugins/backup-restore/ChangeLog deleted file mode 100644 index df66bd61fc..0000000000 --- a/plugins/backup-restore/ChangeLog +++ /dev/null @@ -1,4 +0,0 @@ -2004-12-16 JP Rosevear <jpr@novell.com> - - * Imported backup/restore plugin - diff --git a/plugins/backup-restore/Makefile.am b/plugins/backup-restore/Makefile.am deleted file mode 100644 index 3627d1c69a..0000000000 --- a/plugins/backup-restore/Makefile.am +++ /dev/null @@ -1,26 +0,0 @@ -INCLUDES = \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \ - -DPREFIX=\""$(prefix)"\" \ - -DSYSCONFDIR=\""$(sysconfdir)"\" \ - -DDATADIR=\""$(datadir)"\" \ - -DLIBDIR=\""$(libdir)"\" \ - -I$(top_srcdir) \ - $(SHELL_CFLAGS) \ - $(E_UTIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-backup-restore.eplug org-gnome-backup-restore.xml -plugin_LTLIBRARIES = liborg-gnome-backup-restore.la - -liborg_gnome_backup_restore_la_SOURCES = backup-restore.c -liborg_gnome_backup_restore_la_LDFLAGS = -module -avoid-version - -privlibexec_PROGRAMS = backup -backup_SOURCES = backup.c -backup_LDADD = $(SHELL_LIBS) - -EXTRA_DIST = \ - org-gnome-backup-restore.eplug.in \ - org-gnome-backup-restore.xml
\ No newline at end of file diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c deleted file mode 100644 index 7344806e83..0000000000 --- a/plugins/backup-restore/backup-restore.c +++ /dev/null @@ -1,122 +0,0 @@ -#include <unistd.h> -#include <sys/types.h> -#include <sys/wait.h> -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include "shell/es-menu.h" - -void org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target); -void org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target); - -static void -backup (const char *filename, gboolean restart) -{ - if (restart) - execl (EVOLUTION_TOOLSDIR "/backup", "backup", "--backup", "--restart", filename, NULL); - else - execl (EVOLUTION_TOOLSDIR "/backup", "backup", "--backup", filename, NULL); -} - -static void -restore (const char *filename, gboolean restart) -{ - if (restart) - execl (EVOLUTION_TOOLSDIR "/backup", "backup", "--restore", "--restart", filename, NULL); - else - execl (EVOLUTION_TOOLSDIR "/backup", "backup", "--restore", filename, NULL); -} - -static gboolean -sanity_check (const char *filename) -{ - char *command; - int result; - - command = g_strdup_printf ("%s/backup --check %s", EVOLUTION_TOOLSDIR, filename); - result = system (command); - g_free (command); - - g_message ("Sanity check result %d:%d", WIFEXITED (result), WEXITSTATUS (result)); - - return WIFEXITED (result) && (WEXITSTATUS (result) == 0); -} - -void -org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target) -{ - GtkWidget *dlg; - GtkWidget *vbox, *check; - int response; - - dlg = gtk_file_chooser_dialog_new (_("Select name of Evolution archive"), GTK_WINDOW (target->target.widget), - GTK_FILE_CHOOSER_ACTION_SAVE, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL); - - gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlg), "evolution-backup.tar.gz"); - - vbox = gtk_vbox_new (FALSE, 6); - gtk_widget_show (vbox); - - check = gtk_check_button_new_with_mnemonic (_("_Restart Evolution after backup")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE); - gtk_widget_show (check); - - gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0); - gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dlg), vbox); - - response = gtk_dialog_run (GTK_DIALOG (dlg)); - if (response == GTK_RESPONSE_OK) { - char *filename; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg)); - - backup (filename, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))); - - g_free (filename); - } - - gtk_widget_destroy (dlg); -} - -void -org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target) -{ - GtkWidget *dlg; - GtkWidget *vbox, *check; - int response; - - dlg = gtk_file_chooser_dialog_new (_("Select Evolution archive to restore"), GTK_WINDOW (target->target.widget), - GTK_FILE_CHOOSER_ACTION_OPEN, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL); - - vbox = gtk_vbox_new (FALSE, 6); - gtk_widget_show (vbox); - - check = gtk_check_button_new_with_mnemonic (_("_Restart Evolution after restore")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), TRUE); - gtk_widget_show (check); - - gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, TRUE, 0); - gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dlg), vbox); - - response = gtk_dialog_run (GTK_DIALOG (dlg)); - if (response == GTK_RESPONSE_OK) { - char *filename; - - filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (dlg)); - - if (sanity_check (filename)) { - restore (filename, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check))); - } else { - g_message ("Invalid archive"); - } - - g_free (filename); - } - - gtk_widget_destroy (dlg); -} - - diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c deleted file mode 100644 index 9048ee2928..0000000000 --- a/plugins/backup-restore/backup.c +++ /dev/null @@ -1,153 +0,0 @@ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <errno.h> -#include <stdio.h> -#include <stdlib.h> -#include <string.h> -#include <sys/wait.h> - -#include <libgnome/gnome-i18n.h> -#include <libgnome/gnome-util.h> - -#define EVOLUTION "evolution-" BASE_VERSION -#define EVOLUTION_DIR "~/.evolution/" -#define EVOLUTION_DIR_BACKUP "~/.evolution-old/" -#define GCONF_DUMP_FILE "backup-restore-gconf.xml" -#define GCONF_DUMP_PATH EVOLUTION_DIR GCONF_DUMP_FILE -#define GCONF_DIR "/apps/evolution" -#define ARCHIVE_NAME "evolution-backup.tar.gz" - -static gboolean backup_op = FALSE; -static gboolean restore_op = FALSE; -static gboolean check_op = FALSE; -static gboolean restart_arg = FALSE; - -#define d(x) x - -/* #define s(x) system (x) */ -#define s(x) G_STMT_START { g_message (x); system (x); } G_STMT_END - -static void -backup (const char *filename) -{ - char *command; - - /* FIXME Will the versioned setting always work? */ - s (EVOLUTION " --force-shutdown"); - - s ("gconftool-2 --dump " GCONF_DIR " > " GCONF_DUMP_PATH); - - /* FIXME stay on this file system ,other options?" */ - /* FIXME compression type?" */ - /* FIXME date/time stamp?" */ - /* FIXME archive location?" */ - command = g_strdup_printf ("cd ~ && tar zpcf %s .evolution", filename); - s (command); - g_free (command); - - if (restart_arg) - s (EVOLUTION); -} - -static void -restore (const char *filename) -{ - char *command; - - /* FIXME Will the versioned setting always work? */ - s (EVOLUTION " --force-shutdown"); - - s ("mv " EVOLUTION_DIR " " EVOLUTION_DIR_BACKUP); - - command = g_strdup_printf ("cd ~ && tar zxf %s", filename); - s (command); - g_free (command); - - s ("gconftool-2 --load " GCONF_DUMP_PATH); - s ("rm -rf " GCONF_DUMP_PATH); - s ("rm -rf " EVOLUTION_DIR_BACKUP); - - if (restart_arg) - s (EVOLUTION); -} - -static void -check (const char *filename) -{ - char *command; - int result; - - command = g_strdup_printf ("tar ztf %s | grep -e \"^\\.evolution/$\"", filename); - result = system (command); - g_free (command); - - g_message ("First result %d", result); - if (result) - exit (result); - - command = g_strdup_printf ("tar ztf %s | grep -e \"^\\.evolution/%s$\"", filename, GCONF_DUMP_FILE); - result = system (command); - g_free (command); - - g_message ("Second result %d", result); - - exit (result); -} - -int -main (int argc, char **argv) -{ - GValue popt_context_value = { 0, }; - GnomeProgram *program; - poptContext popt_context; - const char **args; - - struct poptOption options[] = { - { "backup", '\0', POPT_ARG_NONE, &backup_op, 0, - N_("Backup Evolution directory"), NULL }, - { "restore", '\0', POPT_ARG_NONE, &restore_op, 0, - N_("Restore Evolution directory"), NULL }, - { "check", '\0', POPT_ARG_NONE, &check_op, 0, - N_("Check Evolution archive"), NULL }, - { "restart", '\0', POPT_ARG_NONE, &restart_arg, 0, - N_("Restart Evolution"), NULL }, - { NULL, '\0', 0, NULL, 0, NULL, NULL } - }; - - bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); - bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); - textdomain (GETTEXT_PACKAGE); - - program = gnome_program_init (PACKAGE, VERSION, LIBGNOME_MODULE, argc, argv, - GNOME_PROGRAM_STANDARD_PROPERTIES, - GNOME_PARAM_POPT_TABLE, options, - NULL); - - g_value_init (&popt_context_value, G_TYPE_POINTER); - g_object_get_property (G_OBJECT (program), GNOME_PARAM_POPT_CONTEXT, &popt_context_value); - popt_context = g_value_get_pointer (&popt_context_value); - args = poptGetArgs (popt_context); - - if (args != NULL) { - const char **p; - - for (p = args; *p != NULL; p++) { - if (backup_op) { - d(g_message ("Backing up to %s", (char *) *p)); - backup ((char *) *p); - } else if (restore_op) { - d(g_message ("Restoring from %s", (char *) *p)); - restore ((char *) *p); - } else if (check_op) { - d(g_message ("Checking %s", (char *) *p)); - check ((char *) *p); - } - } - } - - g_value_unset (&popt_context_value); - - return 0; -} diff --git a/plugins/backup-restore/org-gnome-backup-restore.eplug.in b/plugins/backup-restore/org-gnome-backup-restore.eplug.in deleted file mode 100644 index 09a080bf91..0000000000 --- a/plugins/backup-restore/org-gnome-backup-restore.eplug.in +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <!-- the path to the shared library --> - <e-plugin - id="org.gnome.plugin.backup.restore" - type="shlib" - location="@PLUGINDIR@/liborg-gnome-backup-restore.so" - name="Backup and restore plugin" - description="A plugin for backing up and restore Evolution data and settings."> - - <hook class="org.gnome.evolution.shell.bonobomenu:1.0"> - - <menu id="org.gnome.evolution.shell" target="shell"> - <!-- the path to the bonobo menu description --> - <ui file="@PLUGINDIR@/org-gnome-backup-restore.xml"/> - <item - type="item" - verb="EPBRBackup" - path="/commands/EPBRBackup" - enable="one" - activate="org_gnome_backup_restore_backup"/> - <item - type="item" - verb="EPBRRestore" - path="/commands/EPBRRestore" - enable="one" - activate="org_gnome_backup_restore_restore"/> - </menu> - - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/backup-restore/org-gnome-backup-restore.xml b/plugins/backup-restore/org-gnome-backup-restore.xml deleted file mode 100644 index 9af58343d1..0000000000 --- a/plugins/backup-restore/org-gnome-backup-restore.xml +++ /dev/null @@ -1,21 +0,0 @@ -<Root> - <commands> - <cmd name="EPBRBackup" _label="Backup Settings..." - _tip="Backup and restore Evolution data and settings" - pixtype="pixmap"/> - - <cmd name="EPBRRestore" _label="Restore Settings..." - _tip="Backup and restore Evolution data and settings" - pixtype="pixmap"/> - - </commands> - - <menu> - <submenu name="File"> - <placeholder name="FileOps"> - <menuitem name="EPBRBackup" verb=""/> - <menuitem name="EPBRRestore" verb=""/> - </placeholder> - </submenu> - </menu> -</Root> diff --git a/plugins/bbdb/.cvsignore b/plugins/bbdb/.cvsignore deleted file mode 100644 index 05cc709f87..0000000000 --- a/plugins/bbdb/.cvsignore +++ /dev/null @@ -1,4 +0,0 @@ -Makefile.in -Makefile -org-gnome-evolution-bbdb.eplug -test-evobuddy diff --git a/plugins/bbdb/ChangeLog b/plugins/bbdb/ChangeLog deleted file mode 100644 index adbf7d1eed..0000000000 --- a/plugins/bbdb/ChangeLog +++ /dev/null @@ -1,77 +0,0 @@ -2005-01-31 Sivaiah Nallagatla <snallagatla@novell.com> - - * gaimbuddies.c (bbdb_sync_buddy_list) : initialize - GError* to NULL - Fixes #71512 - - * bbdb.c (bbdb_open_addressbook) : ditto - -2005-01-22 Nat Friedman <nat@novell.com> - - * gaimbuddies.c (im_list_contains_buddy): Check the buddy account - name, not alias. Duh. - (free_contact_list): Removed. - -2005-01-13 Nat Friedman <nat@novell.com> - - * gaimbuddies.c (bbdb_sync_buddy_list_check): Remove some debug - printfs. - (bbdb_sync_buddy_list): Do not query for the IM name, which is - slow. Instead, query by alias and only commit the contact if we - have changes for it. - (bbdb_merge_buddy_to_contact): Return a boolean indicating whether - we dirtied the contact or not. - -2005-01-08 Nat Friedman <nat@novell.com> - - * org-gnome-evolution-bbdb.eplug.in: Reformatted the description. - -2004-11-03 Nat Friedman <nat@novell.com> - - * org-gnome-evolution-bbdb.eplug.in: Add description and author - fields. Change name. - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: list bbdb.h as a source so it gets disted - -2004-10-27 Nat Friedman <nat@novell.com> - - * bbdb.c (bbdb_page_factory): Use _with_mnemonic for the button. - - * Makefile.am: Don't build the test program by default. - -2004-10-25 Nat Friedman <nat@novell.com> - - * bbdb.c (e_plugin_lib_enable): Sync the Gaim buddy list. Set a - timer to check for Gaim buddy list chnages to sync. - (bbdb_do_it): Free some memory we were leaking before. - (bbdb_open_addressbook): New function for Gaim buddy list support. - (bbdb_check_gaim_enabled): Likewise. - (enable_gaim_toggled_cb): Likewise. - (synchronize_button_clicked_cb): Likewise. - (bbdb_page_factory): Added UI for Gaim buddy list sync support. - - * gaimbuddies.c: New file, contains routines to synchronize IM - information and buddy icons from a Gaim buddy list. - - * bbdb.h: New file, contains shared macros and prototypes. - - * test-evobuddy.c (main): New function, tests a gaim buddy list - sync. - -2004-10-23 Nat Friedman <nat@novell.com> - - * bbdb.c (bbdb_do_it): Change assertions to if statements, so as - not to issue warnings in the case of routine failures (name - is NULL). Don't add an email to a contact if the appropriate - contact is ambiguous. - -2004-10-22 Nat Friedman <nat@novell.com> - - * Initial checkin. - diff --git a/plugins/bbdb/Makefile.am b/plugins/bbdb/Makefile.am deleted file mode 100644 index d57c276b6f..0000000000 --- a/plugins/bbdb/Makefile.am +++ /dev/null @@ -1,14 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-evolution-bbdb.eplug -plugin_LTLIBRARIES = liborg-gnome-evolution-bbdb.la - -liborg_gnome_evolution_bbdb_la_SOURCES = bbdb.c bbdb.h gaimbuddies.c -liborg_gnome_evolution_bbdb_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-evolution-bbdb.eplug.in
\ No newline at end of file diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c deleted file mode 100644 index d1a9619277..0000000000 --- a/plugins/bbdb/bbdb.c +++ /dev/null @@ -1,467 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * An Evolution EPlugin that automatically populates your addressbook - * as you reply to messages. Inspired by an Emacs contact management - * tool called The Insidious Big Brother Database, a jwz joint. - * - * Nat Friedman - * 22 October 2004 - * Boston - * - * Copyright (C) 2004 Novell, Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include <string.h> - -#include <libebook/e-book.h> -#include <libedataserverui/e-source-option-menu.h> - -#include <e-util/e-config.h> -#include <mail/em-config.h> -#include <mail/em-event.h> -#include <camel/camel-mime-message.h> - -#include "bbdb.h" - -/* Plugin hooks */ -int e_plugin_lib_enable (EPluginLib *ep, int enable); -void bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target); -GtkWidget *bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); -GtkWidget *bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); - -/* For internal use */ -struct bbdb_stuff { - EMConfigTargetPrefs *target; - ESourceList *source_list; - - GtkWidget *option_menu; - GtkWidget *check; - GtkWidget *check_gaim; -}; - -/* Static forward declarations */ -static gboolean bbdb_timeout (gpointer data); -static void bbdb_do_it (EBook *book, const char *name, const char *email); -static void add_email_to_contact (EContact *contact, const char *email); -static void enable_toggled_cb (GtkWidget *widget, gpointer data); -static void source_changed_cb (GtkWidget *widget, ESource *source, gpointer data); -static GtkWidget *create_addressbook_option_menu (struct bbdb_stuff *stuff); -static void cleanup_cb (GObject *o, gpointer data); - -int -e_plugin_lib_enable (EPluginLib *ep, int enable) -{ - /* Start up the plugin. */ - if (enable) { - fprintf (stderr, "BBDB spinning up...\n"); - - if (bbdb_check_gaim_enabled ()) - bbdb_sync_buddy_list_check (); - - g_timeout_add (BBDB_BLIST_CHECK_INTERVAL, - (GSourceFunc) bbdb_timeout, - NULL); - } - - return 0; -} - -static gboolean -bbdb_timeout (gpointer data) -{ - bbdb_sync_buddy_list_check (); - - return TRUE; -} - -/* Code to populate addressbook when you reply to a mail follows */ - -void -bbdb_handle_reply (EPlugin *ep, EMEventTargetMessage *target) -{ - const CamelInternetAddress *cia; - const char *name; - const char *email; - EBook *book = NULL; - int i; - - /* Open the addressbook */ - book = bbdb_open_addressbook (); - - cia = camel_mime_message_get_from (target->message); - for (i = 0; i < camel_address_length CAMEL_ADDRESS (cia); i ++) { - camel_internet_address_get (cia, i, &name, &email); - bbdb_do_it (book, name, email); - } - - /* If this is a reply-all event, process To: and Cc: also. */ - if (((EEventTarget *) target)->mask & EM_EVENT_MESSAGE_REPLY_ALL) { - g_object_unref (G_OBJECT (book)); - return; - } - - cia = camel_mime_message_get_recipients (target->message, CAMEL_RECIPIENT_TYPE_TO); - for (i = 0; i < camel_address_length CAMEL_ADDRESS (cia); i ++) { - camel_internet_address_get (cia, i, &name, &email); - bbdb_do_it (book, name, email); - } - - cia = camel_mime_message_get_recipients (target->message, CAMEL_RECIPIENT_TYPE_CC); - for (i = 0; i < camel_address_length CAMEL_ADDRESS (cia); i ++) { - camel_internet_address_get (cia, i, &name, &email); - bbdb_do_it (book, name, email); - } - - g_object_unref (G_OBJECT (book)); -} - -static void -bbdb_do_it (EBook *book, const char *name, const char *email) -{ - char *query_string; - EBookQuery *query; - GList *contacts, *l; - EContact *contact; - - gboolean status; - GError *error = NULL; - - g_return_if_fail (book != NULL); - - if (name == NULL || email == NULL) - return; - - if (! strcmp (name, "") || ! strcmp (email, "")) - return; - - if (strchr (email, '@') == NULL) - return; - - /* If any contacts exists with this email address, don't do anything */ - query_string = g_strdup_printf ("(contains \"email\" \"%s\")", email); - query = e_book_query_from_string (query_string); - g_free (query_string); - - status = e_book_get_contacts (book, query, &contacts, NULL); - e_book_query_unref (query); - if (contacts != NULL) { - GList *l; - for (l = contacts; l != NULL; l = l->next) - g_object_unref ((GObject *)l->data); - g_list_free (contacts); - - return; - } - - /* If a contact exists with this name, add the email address to it. */ - query_string = g_strdup_printf ("(is \"full_name\" \"%s\")", name); - query = e_book_query_from_string (query_string); - g_free (query_string); - - status = e_book_get_contacts (book, query, &contacts, NULL); - e_book_query_unref (query); - if (contacts != NULL) { - - /* FIXME: If there's more than one contact with this - name, just give up; we're not smart enough for - this. */ - if (contacts->next != NULL) { - return; - } - - contact = (EContact *) contacts->data; - add_email_to_contact (contact, email); - if (! e_book_commit_contact (book, contact, &error)) { - g_warning ("bbdb: Could not modify contact: %s\n", error->message); - g_error_free (error); - } - - for (l = contacts; l != NULL; l = l->next) - g_object_unref ((GObject *)l->data); - g_list_free (contacts); - - return; - } - - /* Otherwise, create a new contact. */ - contact = e_contact_new (); - e_contact_set (contact, E_CONTACT_FULL_NAME, (gpointer) name); - add_email_to_contact (contact, email); - - if (! e_book_add_contact (book, contact, &error)) { - g_warning ("bbdb: Failed to add new contact: %s\n", error->message); - g_error_free (error); - return; - } - - g_object_unref (G_OBJECT (contact)); -} - -EBook * -bbdb_open_addressbook (void) -{ - GConfClient *gconf; - char *uri; - EBook *book = NULL; - - gboolean enable; - - gboolean status; - GError *error = NULL; - - gconf = gconf_client_get_default (); - - /* Check to see if we're supposed to be running */ - enable = gconf_client_get_bool (gconf, GCONF_KEY_ENABLE, NULL); - if (! enable) { - g_object_unref (G_OBJECT (gconf)); - return NULL; - } - - /* Open the appropriate addresbook. */ - uri = gconf_client_get_string (gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL); - g_object_unref (G_OBJECT (gconf)); - if (uri == NULL) - book = e_book_new_system_addressbook (&error); - else - book = e_book_new_from_uri (uri, &error); - if (book == NULL) { - g_warning ("bbdb: failed to get addressbook: %s\n", error->message); - g_error_free (error); - return NULL; - } - - status = e_book_open (book, FALSE, &error); - if (! status) { - g_warning ("bbdb: failed to open addressbook: %s\n", error->message); - g_error_free (error); - return NULL; - } - - return book; -} - -gboolean -bbdb_check_gaim_enabled () -{ - GConfClient *gconf; - gboolean gaim_enabled; - - gconf = gconf_client_get_default (); - gaim_enabled = gconf_client_get_bool (gconf, GCONF_KEY_ENABLE_GAIM, NULL); - - g_object_unref (G_OBJECT (gconf)); - - return gaim_enabled; -} - -static void -add_email_to_contact (EContact *contact, const char *email) -{ - GList *emails; - - emails = e_contact_get (contact, E_CONTACT_EMAIL); - emails = g_list_append (emails, (gpointer) email); - e_contact_set (contact, E_CONTACT_EMAIL, (gpointer) emails); -} - - - -/* Code to implement the configuration user interface follows */ - -static void -enable_toggled_cb (GtkWidget *widget, gpointer data) -{ - struct bbdb_stuff *stuff = (struct bbdb_stuff *) data; - gboolean active; - - active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - - /* Save the new setting to gconf */ - gconf_client_set_bool (stuff->target->gconf, GCONF_KEY_ENABLE, active, NULL); - - gtk_widget_set_sensitive (stuff->option_menu, active); -} - -static void -enable_gaim_toggled_cb (GtkWidget *widget, gpointer data) -{ - struct bbdb_stuff *stuff = (struct bbdb_stuff *) data; - gboolean active; - - active = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)); - - /* Save the new setting to gconf */ - gconf_client_set_bool (stuff->target->gconf, GCONF_KEY_ENABLE_GAIM, active, NULL); -} - -static void -synchronize_button_clicked_cb (GtkWidget *button) -{ - bbdb_sync_buddy_list (); -} - -static void -source_changed_cb (GtkWidget *widget, ESource *source, gpointer data) -{ - struct bbdb_stuff *stuff = (struct bbdb_stuff *) data; - - gconf_client_set_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK, e_source_get_uri (source), NULL); -} - -static GtkWidget * -create_addressbook_option_menu (struct bbdb_stuff *stuff) -{ - GtkWidget *menu; - ESourceList *source_list; - char *selected_source_uri; - ESource *selected_source; - - GConfClient *gconf = stuff->target->gconf; - - source_list = e_source_list_new_for_gconf (gconf, "/apps/evolution/addressbook/sources"); - menu = e_source_option_menu_new (source_list); - - selected_source_uri = gconf_client_get_string (gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL); - if (selected_source_uri != NULL) { - selected_source = e_source_new_with_absolute_uri ("", selected_source_uri); - e_source_option_menu_select (E_SOURCE_OPTION_MENU (menu), selected_source); - } - - gtk_widget_show (menu); - - stuff->source_list = source_list; - - return menu; -} - -GtkWidget * -bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) -{ - struct bbdb_stuff *stuff; - EMConfigTargetPrefs *target = (EMConfigTargetPrefs *) hook_data->config->target; - GtkWidget *page; - GtkWidget *tab_label; - GtkWidget *frame; - GtkWidget *frame_label; - GtkWidget *padding_label; - GtkWidget *hbox; - GtkWidget *inner_vbox; - GtkWidget *check; - GtkWidget *option; - GtkWidget *check_gaim; - GtkWidget *button; - - /* A structure to pass some stuff around */ - stuff = g_new0 (struct bbdb_stuff, 1); - stuff->target = target; - - /* Create a new notebook page */ - page = gtk_vbox_new (FALSE, 0); - GTK_CONTAINER (page)->border_width = 12; - tab_label = gtk_label_new (_("Automatic Contacts")); - gtk_notebook_append_page (GTK_NOTEBOOK (hook_data->parent), page, tab_label); - - /* Frame */ - frame = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0); - - /* "Automatic Contacts" */ - frame_label = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL (frame_label), _("<span weight=\"bold\">Automatic Contacts</span>")); - GTK_MISC (frame_label)->xalign = 0.0; - gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0); - - /* Indent/padding */ - hbox = gtk_hbox_new (FALSE, 12); - gtk_box_pack_start (GTK_BOX (frame), hbox, FALSE, TRUE, 0); - padding_label = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0); - inner_vbox = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, FALSE, FALSE, 0); - - /* Enable BBDB checkbox */ - check = gtk_check_button_new_with_mnemonic (_("_Automatically create entries in the addressbook when responding to mail")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE, NULL)); - g_signal_connect (GTK_TOGGLE_BUTTON (check), "toggled", G_CALLBACK (enable_toggled_cb), stuff); - gtk_box_pack_start (GTK_BOX (inner_vbox), check, FALSE, FALSE, 0); - stuff->check = check; - - /* Source selection open menu */ - option = create_addressbook_option_menu (stuff); - g_signal_connect (option, "source_selected", G_CALLBACK (source_changed_cb), stuff); - gtk_widget_set_sensitive (option, gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE, NULL)); - gtk_box_pack_start (GTK_BOX (inner_vbox), option, FALSE, FALSE, 0); - stuff->option_menu = option; - - /* "Instant Messaging Contacts" */ - frame = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 24); - - frame_label = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL (frame_label), _("<span weight=\"bold\">Instant Messaging Contacts</span>")); - GTK_MISC (frame_label)->xalign = 0.0; - gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0); - - /* Indent/padding */ - hbox = gtk_hbox_new (FALSE, 12); - gtk_box_pack_start (GTK_BOX (frame), hbox, FALSE, TRUE, 0); - padding_label = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0); - inner_vbox = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, FALSE, FALSE, 0); - - /* Enable Gaim Checkbox */ - check_gaim = gtk_check_button_new_with_mnemonic (_("Periodically synchronize contact information and images from my _instant messenger")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check_gaim), gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE_GAIM, NULL)); - g_signal_connect (GTK_TOGGLE_BUTTON (check_gaim), "toggled", G_CALLBACK (enable_gaim_toggled_cb), stuff); - gtk_box_pack_start (GTK_BOX (inner_vbox), check_gaim, FALSE, FALSE, 0); - stuff->check_gaim = check_gaim; - - /* Synchronize now button. */ - button = gtk_button_new_with_mnemonic (_("Synchronize with _buddy list now")); - g_signal_connect (GTK_BUTTON (button), "clicked", G_CALLBACK (synchronize_button_clicked_cb), stuff); - gtk_box_pack_start (GTK_BOX (inner_vbox), button, FALSE, FALSE, 0); - - /* Clean up */ - g_signal_connect (page, "destroy", G_CALLBACK (cleanup_cb), stuff); - - gtk_widget_show_all (page); - - return page; -} - -static void -cleanup_cb (GObject *o, gpointer data) -{ - struct bbdb_stuff *stuff = data; - - g_object_unref (stuff->source_list); - g_free (stuff); -} diff --git a/plugins/bbdb/bbdb.h b/plugins/bbdb/bbdb.h deleted file mode 100644 index 5fe9e39bdd..0000000000 --- a/plugins/bbdb/bbdb.h +++ /dev/null @@ -1,22 +0,0 @@ -#ifndef __BBDB_H__ -#define __BBDB_H__ - -/* Where to store the config values */ -#define GCONF_KEY_ENABLE "/apps/evolution/autocontacts/enable_autocontacts" -#define GCONF_KEY_ENABLE_GAIM "/apps/evolution/autocontacts/auto_sync_gaim" -#define GCONF_KEY_WHICH_ADDRESSBOOK "/apps/evolution/autocontacts/addressbook_source" -#define GCONF_KEY_GAIM_LAST_SYNC "/apps/evolution/autocontacts/gaim_last_sync_time" - -/* How often to poll the buddy list for changes (every two minutes) */ -#define BBDB_BLIST_CHECK_INTERVAL (2 * 60 * 1000) - -/* bbdb.c */ -EBook *bbdb_open_addressbook (void); -gboolean bbdb_check_gaim_enabled (void); - -/* gaimbuddies.c */ -void bbdb_sync_buddy_list (void); -void bbdb_sync_buddy_list_check (void); - - -#endif /* __BBDB_H__ */ diff --git a/plugins/bbdb/gaimbuddies.c b/plugins/bbdb/gaimbuddies.c deleted file mode 100644 index fd86bf537d..0000000000 --- a/plugins/bbdb/gaimbuddies.c +++ /dev/null @@ -1,439 +0,0 @@ -/* - * Routines to copy information from a Gaim buddy list into an - * Evolution addressbook. - * - * I currently copy IM account names and buddy icons, provided you - * don't already have a buddy icon defined for a person. - * - * This works today (25 October 2004), but is pretty sure to break - * later on as the Gaim buddylist file format shifts. - * - * Nat Friedman <nat@novell.com> - * - * Copyright 2004 Novell, Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <glib.h> -#include <libxml/tree.h> -#include <libxml/parser.h> -#include <libxml/xmlmemory.h> -#include <gal/util/e-xml-utils.h> - -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include <string.h> - -#include <libebook/e-book.h> -#include <libedataserverui/e-source-option-menu.h> - -#include <sys/time.h> -#include <sys/stat.h> - -#include <e-util/e-config.h> - -#include "bbdb.h" - -typedef struct { - char *account_name; - char *proto; - char *alias; - char *icon; -} GaimBuddy; - -/* Defined in bbdb.c */ -EBook *bbdb_open_addressbook (void); - -/* Forward declarations for this file. */ -void bbdb_sync_buddy_list (void); -static gboolean bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c); -static GList *bbdb_get_gaim_buddy_list (void); -static char *get_node_text (xmlNodePtr node); -static char *get_buddy_icon_from_setting (xmlNodePtr setting); -static char *get_node_text (xmlNodePtr node); -static void free_buddy_list (GList *blist); -static void parse_buddy_group (xmlNodePtr group, GList **buddies); -static EContactField proto_to_contact_field (const char *proto); - -void -bbdb_sync_buddy_list_check (void) -{ - GConfClient *gconf; - struct stat statbuf; - time_t last_sync; - char *blist_path; - char *last_sync_str; - - gconf = gconf_client_get_default (); - - if (! gconf_client_get_bool (gconf, GCONF_KEY_ENABLE_GAIM, NULL)) { - g_object_unref (G_OBJECT (gconf)); - return; - } - - blist_path = g_build_path ("/", getenv ("HOME"), ".gaim/blist.xml", NULL); - if (stat (blist_path, &statbuf) < 0) { - g_object_unref (G_OBJECT (gconf)); - return; - } - - /* Reprocess the buddy list if it's been updated. */ - last_sync_str = gconf_client_get_string (gconf, GCONF_KEY_GAIM_LAST_SYNC, NULL); - if (last_sync_str == NULL || ! strcmp (last_sync_str, "")) - last_sync = (time_t) 0; - else - last_sync = (time_t) g_ascii_strtoull (last_sync_str, NULL, 10); - - g_free (last_sync_str); - g_object_unref (G_OBJECT (gconf)); - - if (statbuf.st_mtime > last_sync) { - fprintf (stderr, "bbdb: Buddy list has changed since last sync.\n"); - - bbdb_sync_buddy_list (); - } -} - -void -bbdb_sync_buddy_list (void) -{ - GList *blist, *l; - EBook *book = NULL; - - /* Get the Gaim buddy list */ - blist = bbdb_get_gaim_buddy_list (); - if (blist == NULL) - return; - - /* Open the addressbook */ - book = bbdb_open_addressbook (); - if (book == NULL) { - free_buddy_list (blist); - return; - } - - printf ("bbdb: Synchronizing buddy list to contacts...\n"); - /* Walk the buddy list */ - for (l = blist; l != NULL; l = l->next) { - GaimBuddy *b = l->data; - EBookQuery *query; - GList *contacts; - GError *error = NULL; - EContact *c; - - if (b->alias == NULL || strlen (b->alias) == 0) - continue; - - /* Look for an exact match full name == buddy alias */ - query = e_book_query_field_test (E_CONTACT_FULL_NAME, E_BOOK_QUERY_IS, b->alias); - e_book_get_contacts (book, query, &contacts, NULL); - e_book_query_unref (query); - if (contacts != NULL) { - - /* FIXME: If there's more than one contact with this - name, just give up; we're not smart enough for - this. */ - if (contacts->next != NULL) - continue; - - c = E_CONTACT (contacts->data); - - if (! bbdb_merge_buddy_to_contact (book, b, c)) - continue; - - /* Write it out to the addressbook */ - if (! e_book_commit_contact (book, c, &error)) { - g_warning ("bbdb: Could not modify contact: %s\n", error->message); - g_error_free (error); - } - continue; - } - - /* Otherwise, create a new contact. */ - c = e_contact_new (); - e_contact_set (c, E_CONTACT_FULL_NAME, (gpointer) b->alias); - if (! bbdb_merge_buddy_to_contact (book, b, c)) { - g_object_unref (G_OBJECT (c)); - continue; - } - - if (! e_book_add_contact (book, c, &error)) { - g_warning ("bbdb: Failed to add new contact: %s\n", error->message); - g_error_free (error); - return; - } - g_object_unref (G_OBJECT (c)); - - } - - - /* Update the last-sync'd time */ - { - GConfClient *gconf; - time_t last_sync; - char *last_sync_str; - - gconf = gconf_client_get_default (); - - time (&last_sync); - last_sync_str = g_strdup_printf ("%ld", (glong) last_sync); - gconf_client_set_string (gconf, GCONF_KEY_GAIM_LAST_SYNC, last_sync_str, NULL); - g_free (last_sync_str); - - g_object_unref (G_OBJECT (gconf)); - } - printf ("bbdb: Done syncing buddy list to contacts.\n"); -} - -static gboolean -im_list_contains_buddy (GList *ims, GaimBuddy *b) -{ - GList *l; - - for (l = ims; l != NULL; l = l->next) { - char *im = (char *) l->data; - - if (! strcmp (im, b->account_name)) - return TRUE; - } - - return FALSE; -} - -static gboolean -bbdb_merge_buddy_to_contact (EBook *book, GaimBuddy *b, EContact *c) -{ - EContactField field; - GList *ims, *l; - gboolean dirty = FALSE; - - EContactPhoto *photo = NULL; - - GError *error = NULL; - - /* Set the IM account */ - field = proto_to_contact_field (b->proto); - ims = e_contact_get (c, field); - if (! im_list_contains_buddy (ims, b)) { - ims = g_list_append (ims, (gpointer) b->account_name); - e_contact_set (c, field, (gpointer) ims); - dirty = TRUE; - } - - /* Set the photo if it's not set */ - if (b->icon != NULL) { - photo = e_contact_get (c, E_CONTACT_PHOTO); - if (photo == NULL) { - - photo = g_new0 (EContactPhoto, 1); - - if (! g_file_get_contents (b->icon, &photo->data, &photo->length, &error)) { - g_warning ("bbdb: Could not read buddy icon: %s\n", error->message); - g_error_free (error); - for (l = ims; l != NULL; l = l->next) - g_free ((char *) l->data); - g_list_free (ims); - return dirty; - } - - e_contact_set (c, E_CONTACT_PHOTO, (gpointer) photo); - dirty = TRUE; - } - } - - /* Clean up */ - if (photo != NULL) - e_contact_photo_free (photo); - - for (l = ims; l != NULL; l = l->next) - g_free ((char *) l->data); - g_list_free (ims); - - return dirty; -} - -static EContactField -proto_to_contact_field (const char *proto) -{ - if (! strcmp (proto, "prpl-oscar")) - return E_CONTACT_IM_AIM; - if (! strcmp (proto, "prpl-novell")) - return E_CONTACT_IM_GROUPWISE; - if (! strcmp (proto, "prpl-msn")) - return E_CONTACT_IM_MSN; - if (! strcmp (proto, "prpl-icq")) - return E_CONTACT_IM_ICQ; - if (! strcmp (proto, "prpl-yahoo")) - return E_CONTACT_IM_YAHOO; - if (! strcmp (proto, "prpl-jabber")) - return E_CONTACT_IM_JABBER; - - return E_CONTACT_IM_AIM; -} - -static GList * -bbdb_get_gaim_buddy_list (void) -{ - char *blist_path; - xmlDocPtr buddy_xml; - xmlNodePtr root, child, blist; - GList *buddies = NULL; - - blist_path = g_build_path ("/", getenv ("HOME"), ".gaim/blist.xml", NULL); - - buddy_xml = xmlParseFile (blist_path); - g_free (blist_path); - if (! buddy_xml) { - fprintf (stderr, "bbdb: Could not open Gaim buddy list.\n"); - return NULL; - } - - root = xmlDocGetRootElement (buddy_xml); - if (strcmp (root->name, "gaim")) { - fprintf (stderr, "bbdb: Could not parse Gaim buddy list.\n"); - xmlFreeDoc (buddy_xml); - return NULL; - } - - blist = NULL; - for (child = root->children; child != NULL; child = child->next) { - if (! strcmp (child->name, "blist")) { - blist = child; - break; - } - } - if (blist == NULL) { - fprintf (stderr, "bbdb: Could not find 'blist' element in Gaim buddy list.\n"); - xmlFreeDoc (buddy_xml); - return NULL; - } - - for (child = blist->children; child != NULL; child = child->next) { - if (! strcmp (child->name, "group")) - parse_buddy_group (child, &buddies); - } - - xmlFreeDoc (buddy_xml); - - return buddies; -} - -static void -free_buddy_list (GList *blist) -{ - GList *l; - - for (l = blist; l != NULL; l = l->next) { - GaimBuddy *gb = l->data; - - g_free (gb->icon); - g_free (gb->alias); - g_free (gb->account_name); - g_free (gb->proto); - g_free (gb); - } - - g_list_free (l); -} - -static char * -get_node_text (xmlNodePtr node) -{ - if (node->children == NULL || node->children->content == NULL || - strcmp (node->children->name, "text")) - return NULL; - - return g_strdup (node->children->content); -} - -static char * -get_buddy_icon_from_setting (xmlNodePtr setting) -{ - char *icon = NULL; - - icon = get_node_text (setting); - if (icon [0] != '/') { - char *path; - - path = g_build_path ("/", getenv ("HOME"), ".gaim/icons", icon, NULL); - g_free (icon); - icon = path; - } - - - return icon; -} - -static void -parse_contact (xmlNodePtr contact, GList **buddies) -{ - xmlNodePtr child; - xmlNodePtr buddy = NULL; - GaimBuddy *gb; - - for (child = contact->children; child != NULL; child = child->next) { - if (! strcmp (child->name, "buddy")) { - buddy = child; - break; - } - } - - if (buddy == NULL) { - fprintf (stderr, "bbdb: Could not find buddy in contact. Malformed Gaim buddy list file.\n"); - return; - } - - gb = g_new0 (GaimBuddy, 1); - - gb->proto = e_xml_get_string_prop_by_name (buddy, "proto"); - - for (child = buddy->children; child != NULL; child = child->next) { - if (! strcmp (child->name, "setting")) { - char *setting_type; - setting_type = e_xml_get_string_prop_by_name (child, "name"); - - if (! strcmp (setting_type, "buddy_icon")) - gb->icon = get_buddy_icon_from_setting (child); - - g_free (setting_type); - } else if (! strcmp (child->name, "name")) - gb->account_name = get_node_text (child); - else if (! strcmp (child->name, "alias")) - gb->alias = get_node_text (child); - - } - - *buddies = g_list_prepend (*buddies, gb); -} - -static void -parse_buddy_group (xmlNodePtr group, GList **buddies) -{ - xmlNodePtr child; - - for (child = group->children; child != NULL; child = child->next) { - if (strcmp (child->name, "contact")) - continue; - - parse_contact (child, buddies); - } -} diff --git a/plugins/bbdb/org-gnome-evolution-bbdb.eplug.in b/plugins/bbdb/org-gnome-evolution-bbdb.eplug.in deleted file mode 100644 index 6b51599d3a..0000000000 --- a/plugins/bbdb/org-gnome-evolution-bbdb.eplug.in +++ /dev/null @@ -1,27 +0,0 @@ -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.bbdb" - name="Automatic contacts" - location="@PLUGINDIR@/liborg-gnome-evolution-bbdb.so"> - - <description>Automatically fills your addressbook with names and email addresses as you reply to mails. Also fills in IM contact information from your buddy lists.</description> - - <author name="Nat Friedman" email="nat@novell.com"/> - - <hook class="org.gnome.evolution.mail.events:1.0"> - <event - id="message.replying" - handle="bbdb_handle_reply" - target="message" - /> - </hook> - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="prefs"> - <item type="page" path="80.bbdb" label="BBDB" factory="bbdb_page_factory"/> - </group> - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/bbdb/test-evobuddy.c b/plugins/bbdb/test-evobuddy.c deleted file mode 100644 index 269999beb1..0000000000 --- a/plugins/bbdb/test-evobuddy.c +++ /dev/null @@ -1,15 +0,0 @@ -#include <stdio.h> - -void bbdb_sync_buddy_list (void); - -int -main (void) -{ - printf ("Syncing...\n"); - - bbdb_sync_buddy_list (); - - printf ("Done!\n"); - - return 0; -} diff --git a/plugins/calendar-file/.cvsignore b/plugins/calendar-file/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/calendar-file/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/calendar-file/ChangeLog b/plugins/calendar-file/ChangeLog deleted file mode 100644 index 204a726002..0000000000 --- a/plugins/calendar-file/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2005-01-06 JP Rosevear <jpr@novell.com> - - * Initial import of file properties plugin. diff --git a/plugins/calendar-file/Makefile.am b/plugins/calendar-file/Makefile.am deleted file mode 100644 index a064042290..0000000000 --- a/plugins/calendar-file/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - $(SOURCE_SEL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-calendar-file.eplug -plugin_LTLIBRARIES = liborg-gnome-calendar-file.la - - -liborg_gnome_calendar_file_la_SOURCES = calendar-file.c -liborg_gnome_calendar_file_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-calendar-file.eplug.in diff --git a/plugins/calendar-file/calendar-file.c b/plugins/calendar-file/calendar-file.c deleted file mode 100644 index f47ce2c8ac..0000000000 --- a/plugins/calendar-file/calendar-file.c +++ /dev/null @@ -1,57 +0,0 @@ -/* - * - * - * Copyright (C) 2004 David Trowbridge - * - * 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. - * - */ - -#include <gtk/gtklabel.h> -#include <gtk/gtkentry.h> -#include <gtk/gtktable.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkhbox.h> -#include <e-util/e-config.h> -#include <calendar/gui/e-cal-config.h> -#include <libedataserver/e-source.h> -#include <libedataserver/e-url.h> -#include <libgnome/gnome-i18n.h> -#include <string.h> - -GtkWidget *e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data); - -GtkWidget * -e_calendar_file_dummy (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - ESource *source = t->source; - char *uri_text; - - uri_text = e_source_get_uri (source); - if (strncmp (uri_text, "file", 4)) { - g_free (uri_text); - - return NULL; - } - - e_source_set_relative_uri (source, e_source_peek_uid (source)); - uri_text = e_source_get_uri (source); - - return NULL; -} diff --git a/plugins/calendar-file/org-gnome-calendar-file.eplug.in b/plugins/calendar-file/org-gnome-calendar-file.eplug.in deleted file mode 100644 index edb70947fc..0000000000 --- a/plugins/calendar-file/org-gnome-calendar-file.eplug.in +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - location="@PLUGINDIR@/liborg-gnome-calendar-file.so" - id="org.gnome.evolution.calendar.file" - name="Local Calendars"> - <hook class="org.gnome.evolution.calendar.config:1.0"> - <group - target="source" - id="org.gnome.evolution.calendar.calendarProperties"> - <item - type="item_table" - path="00.general/00.source/00.file_dummy" - factory="e_calendar_file_dummy"/> - </group> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/calendar-http/.cvsignore b/plugins/calendar-http/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/calendar-http/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/calendar-http/ChangeLog b/plugins/calendar-http/ChangeLog deleted file mode 100644 index 7140b2c21f..0000000000 --- a/plugins/calendar-http/ChangeLog +++ /dev/null @@ -1,29 +0,0 @@ -2005-01-06 JP Rosevear <jpr@novell.com> - - * Makefile.am: include top_srcdir - -2004-12-28 David Trowbridge <David.Trowbridge@Colorado.edu> - - * calendar-http.c (e_calendar_http_check): s/strcmp/strncmp. - - * org-gnome-calendar-http.eplug.in: fixed order of menus. - -2004-11-12 Diego Sevilla Ruiz <dsevilla@ditec.um.es> - - * calendar-http.c (e_calendar_http_check): Accept protocol-less - URIs. Fixes #68264. - (e_calendar_http_check): Fixed a memory leak. - (e_calendar_http_refresh): Another mem. leak fix. - (e_calendar_http_url): Fixed another more memory leak. - -2004-11-09 Rodney Dawes <dobey@novell.com> - - * Makefile.am: Add EXTRA_DIST variable for the eplug.in file - -2004-11-04 Not Zed <NotZed@Ximian.com> - - * Makefile.am: duh, add this to cvs, remove Makefile. - -2004-11-04 David Trowbridge <David.Trowbridge@Colorado.edu> - - * Initial import of webcal properties plugin. diff --git a/plugins/calendar-http/Makefile.am b/plugins/calendar-http/Makefile.am deleted file mode 100644 index efe8c01679..0000000000 --- a/plugins/calendar-http/Makefile.am +++ /dev/null @@ -1,16 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - $(SOURCE_SEL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-calendar-http.eplug -plugin_LTLIBRARIES = liborg-gnome-calendar-http.la - - -liborg_gnome_calendar_http_la_SOURCES = calendar-http.c -liborg_gnome_calendar_http_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-calendar-http.eplug.in diff --git a/plugins/calendar-http/calendar-http.c b/plugins/calendar-http/calendar-http.c deleted file mode 100644 index 988fd18929..0000000000 --- a/plugins/calendar-http/calendar-http.c +++ /dev/null @@ -1,314 +0,0 @@ -/* - * - * - * Copyright (C) 2004 David Trowbridge - * - * 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. - * - */ - -#include <gtk/gtklabel.h> -#include <gtk/gtkentry.h> -#include <gtk/gtktable.h> -#include <gtk/gtkspinbutton.h> -#include <gtk/gtkoptionmenu.h> -#include <gtk/gtkmenu.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkhbox.h> -#include <e-util/e-config.h> -#include <calendar/gui/e-cal-config.h> -#include <libedataserver/e-source.h> -#include <libedataserver/e-url.h> -#include <libgnome/gnome-i18n.h> -#include <string.h> - -GtkWidget *e_calendar_http_url (EPlugin *epl, EConfigHookItemFactoryData *data); -GtkWidget *e_calendar_http_refresh (EPlugin *epl, EConfigHookItemFactoryData *data); -gboolean e_calendar_http_check (EPlugin *epl, EConfigHookPageCheckData *data); - -static gchar * -print_uri_noproto (EUri *uri) -{ - gchar *uri_noproto; - - if (uri->port != 0) - uri_noproto = g_strdup_printf ( - "%s%s%s%s%s%s%s:%d%s%s%s", - uri->user ? uri->user : "", - uri->authmech ? ";auth=" : "", - uri->authmech ? uri->authmech : "", - uri->passwd ? ":" : "", - uri->passwd ? uri->passwd : "", - uri->user ? "@" : "", - uri->host ? uri->host : "", - uri->port, - uri->path ? uri->path : "", - uri->query ? "?" : "", - uri->query ? uri->query : ""); - else - uri_noproto = g_strdup_printf ( - "%s%s%s%s%s%s%s%s%s%s", - uri->user ? uri->user : "", - uri->authmech ? ";auth=" : "", - uri->authmech ? uri->authmech : "", - uri->passwd ? ":" : "", - uri->passwd ? uri->passwd : "", - uri->user ? "@" : "", - uri->host ? uri->host : "", - uri->path ? uri->path : "", - uri->query ? "?" : "", - uri->query ? uri->query : ""); - return uri_noproto; -} - -static void -url_changed (GtkEntry *entry, ESource *source) -{ - EUri *uri; - char *relative_uri; - - uri = e_uri_new (gtk_entry_get_text (GTK_ENTRY (entry))); - relative_uri = print_uri_noproto (uri); - e_source_set_relative_uri (source, relative_uri); - g_free (relative_uri); - e_uri_free (uri); -} - -GtkWidget * -e_calendar_http_url (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - static GtkWidget *label; - GtkWidget *entry, *parent; - int row; - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - EUri *uri; - char *uri_text; - static GtkWidget *hidden = NULL; - - if (!hidden) - hidden = gtk_label_new (""); - - if (data->old) - gtk_widget_destroy (label); - - uri_text = e_source_get_uri (t->source); - uri = e_uri_new (uri_text); - if ((strcmp (uri->protocol, "http") && - strcmp (uri->protocol, "webcal"))) { - e_uri_free (uri); - g_free (uri_text); - return hidden; - } - e_uri_free (uri); - - parent = data->parent; - - row = ((GtkTable*)parent)->nrows; - - label = gtk_label_new_with_mnemonic (_("_URL:")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0); - - entry = gtk_entry_new (); - gtk_widget_show (entry); - gtk_entry_set_text (GTK_ENTRY (entry), uri_text); - gtk_table_attach (GTK_TABLE (parent), entry, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), entry); - g_signal_connect (G_OBJECT (entry), "changed", G_CALLBACK (url_changed), t->source); - - g_free (uri_text); - return entry; -} - -static void -set_refresh_time (ESource *source, GtkWidget *spin, GtkWidget *option) -{ - int time; - int item_num = 0; - const char *refresh_str = e_source_get_property (source, "refresh"); - time = refresh_str ? atoi (refresh_str) : 30; - - if (time && !(time % 10080)) { - /* weeks */ - item_num = 3; - time /= 10080; - } else if (time && !(time % 1440)) { - /* days */ - item_num = 2; - time /= 1440; - } else if (time && !(time % 60)) { - /* hours */ - item_num = 1; - time /= 60; - } - gtk_option_menu_set_history (GTK_OPTION_MENU (option), item_num); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time); -} - -static char * -get_refresh_minutes (GtkWidget *spin, GtkWidget *option) -{ - int setting = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)); - switch (gtk_option_menu_get_history (GTK_OPTION_MENU (option))) { - case 0: - /* minutes */ - break; - case 1: - /* hours */ - setting *= 60; - break; - case 2: - /* days */ - setting *= 1440; - break; - case 3: - /* weeks - is this *really* necessary? */ - setting *= 10080; - break; - default: - g_warning ("Time unit out of range"); - break; - } - - return g_strdup_printf ("%d", setting); -} - -static void -spin_changed (GtkSpinButton *spin, ECalConfigTargetSource *t) -{ - char *refresh_str; - GtkWidget *option; - - option = g_object_get_data (G_OBJECT (spin), "option"); - - refresh_str = get_refresh_minutes ((GtkWidget *) spin, option); - e_source_set_property (t->source, "refresh", refresh_str); - g_free (refresh_str); -} - -static void -option_changed (GtkOptionMenu *option, ECalConfigTargetSource *t) -{ - char *refresh_str; - GtkWidget *spin; - - spin = g_object_get_data (G_OBJECT (option), "spin"); - - refresh_str = get_refresh_minutes (spin, (GtkWidget *) option); - e_source_set_property (t->source, "refresh", refresh_str); - g_free (refresh_str); -} - -GtkWidget * -e_calendar_http_refresh (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - static GtkWidget *label; - GtkWidget *option, *spin, *menu, *hbox, *parent; - GtkWidget *times[4]; - int row, i; - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - ESource *source = t->source; - EUri *uri; - char* uri_text; - static GtkWidget *hidden = NULL; - - if (!hidden) - hidden = gtk_label_new (""); - - if (data->old) - gtk_widget_destroy (label); - - uri_text = e_source_get_uri (t->source); - uri = e_uri_new (uri_text); - g_free (uri_text); - if ((strcmp (uri->protocol, "http") && - strcmp (uri->protocol, "webcal"))) { - e_uri_free (uri); - return hidden; - } - e_uri_free (uri); - - parent = data->parent; - - row = ((GtkTable*)parent)->nrows; - - label = gtk_label_new_with_mnemonic (_("_Refresh:")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0); - - hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox); - - spin = gtk_spin_button_new_with_range (0, 100, 1); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin); - gtk_widget_show (spin); - gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, TRUE, 0); - - option = gtk_option_menu_new (); - gtk_widget_show (option); - times[0] = gtk_menu_item_new_with_label (_("minutes")); - times[1] = gtk_menu_item_new_with_label (_("hours")); - times[2] = gtk_menu_item_new_with_label (_("days")); - times[3] = gtk_menu_item_new_with_label (_("weeks")); - menu = gtk_menu_new (); - gtk_widget_show (menu); - for (i = 0; i < 4; i++) { - gtk_widget_show (times[i]); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), times[i]); - } - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - set_refresh_time (source, spin, option); - gtk_box_pack_start (GTK_BOX (hbox), option, FALSE, TRUE, 0); - - g_object_set_data (G_OBJECT (option), "spin", spin); - g_signal_connect (G_OBJECT (option), "changed", G_CALLBACK (option_changed), t); - g_object_set_data (G_OBJECT (spin), "option", option); - g_signal_connect (G_OBJECT (spin), "value-changed", G_CALLBACK (spin_changed), t); - - gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - - return hbox; -} - -gboolean -e_calendar_http_check (EPlugin *epl, EConfigHookPageCheckData *data) -{ - /* FIXME - check pageid */ - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - EUri *uri; - gboolean ok = FALSE; - ESourceGroup *group = e_source_peek_group (t->source); - char *uri_text; - - if (strncmp (e_source_group_peek_base_uri (group), "webcal", 6)) - return TRUE; - - uri_text = e_source_get_uri (t->source); - if (!strncmp (uri_text, "file:", 5)) { - g_free (uri_text); - return FALSE; - } - - uri = e_uri_new (uri_text); - ok = ((!strcmp (uri->protocol, "webcal")) || - (!strcmp (uri->protocol, "http")) || - (!strcmp (uri->protocol, "file")) ); - e_uri_free (uri); - g_free (uri_text); - - return ok; -} diff --git a/plugins/calendar-http/org-gnome-calendar-http.eplug.in b/plugins/calendar-http/org-gnome-calendar-http.eplug.in deleted file mode 100644 index 3ffe2783c4..0000000000 --- a/plugins/calendar-http/org-gnome-calendar-http.eplug.in +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - location="@PLUGINDIR@/liborg-gnome-calendar-http.so" - id="org.gnome.evolution.calendar.http" - name="HTTP Calendars"> - <hook class="org.gnome.evolution.calendar.config:1.0"> - <group - target="source" - id="org.gnome.evolution.calendar.calendarProperties" - check="e_calendar_http_check"> - <item - type="item_table" - path="00.general/00.source/40.url" - factory="e_calendar_http_url"/> - <item - type="item_table" - path="00.general/00.source/50.refresh" - factory="e_calendar_http_refresh"/> - </group> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/calendar-weather/.cvsignore b/plugins/calendar-weather/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/calendar-weather/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/calendar-weather/ChangeLog b/plugins/calendar-weather/ChangeLog deleted file mode 100644 index f7a0045ea5..0000000000 --- a/plugins/calendar-weather/ChangeLog +++ /dev/null @@ -1,46 +0,0 @@ -2005-02-02 Rodney Dawes <dobey@novell.com> - - * Makefile.am (INCLUDES): Use $(weatherdir) instead of duplicating the - define for it below - (weatherdir): Fix to use the correct versioned directory - -2005-01-26 David Trowbridge <trowbrds@cs.colorado.edu> - - * org-gnome-calendar-weather.eplug.in: fix typo - -2005-01-25 Rodrigo Moya <rodrigo@novell.com> - - * calendar-weather.c (e_plugin_lib_enable): set all new categories to - not searchable. - -2005-01-12 David Trowbridge <trowbrds@cs.colorado.edu> - - * calendar-weather.c (e_calendar_weather_units): fix spelling - -2005-01-12 David Trowbridge <trowbrds@cs.colorado.edu> - - * calendar-weather.c, org-gnome-calendar-weather.eplug.in: use - a single setting for metric/imperial rather than separate - temperature and snowfall settings - -2005-01-10 Rodrigo Moya <rodrigo@novell.com> - - * calendar-weather.c (create_source_selected): use HIG-compliant - button order. - -2005-01-07 Rodrigo Moya <rodrigo@novell.com> - - * Makefile.am: define EDS's datadir, needed to get to the - Locations.xml file. - - * calendar-weather.c (load_locations): use EDS's datadir for the - Locations.xml file full path. - -2005-01-07 Rodrigo Moya <rodrigo@novell.com> - - * Makefile.am: define weatherdatadir here, no need to use e-d-s's one, - use evolution's instead. - -2005-01-06 David Trowbridge <trowbrds@cs.colorado.edu> - - * Initial import of weather properties plugin diff --git a/plugins/calendar-weather/Makefile.am b/plugins/calendar-weather/Makefile.am deleted file mode 100644 index 67fe1bfb6a..0000000000 --- a/plugins/calendar-weather/Makefile.am +++ /dev/null @@ -1,33 +0,0 @@ -eds_datadir = `pkg-config --variable=privdatadir evolution-data-server-1.2` - -INCLUDES = \ - -I$(top_srcdir)/shell \ - $(EVOLUTION_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - $(SOURCE_SEL_CFLAGS) \ - -DWEATHER_DATADIR=\""$(weatherdir)"\" \ - -DWEATHER_EDS_DATADIR=\""$(eds_datadir)/weather"\" - -@EVO_PLUGIN_RULE@ - -# These will actually install into the e-d-s share directory, but -# if the plugin is disabled, we aren't going to be needing them. -weatherdatadir = $(datadir)/evolution/$(BASE_VERSION)/weather -weatherdata_DATA = \ - category_weather_cloudy_16.png \ - category_weather_fog_16.png \ - category_weather_partly_cloudy_16.png \ - category_weather_rain_16.png \ - category_weather_snow_16.png \ - category_weather_sun_16.png \ - category_weather_tstorm_16.png - -plugin_DATA = org-gnome-calendar-weather.eplug -plugin_LTLIBRARIES = liborg-gnome-calendar-weather.la - -liborg_gnome_calendar_weather_la_SOURCES = calendar-weather.c -liborg_gnome_calendar_weather_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = \ - org-gnome-calendar-weather.eplug.in \ - $(weatherdata_DATA) diff --git a/plugins/calendar-weather/calendar-weather.c b/plugins/calendar-weather/calendar-weather.c deleted file mode 100644 index 976c204d01..0000000000 --- a/plugins/calendar-weather/calendar-weather.c +++ /dev/null @@ -1,698 +0,0 @@ -/* - * Authors: David Trowbridge <trowbrds@cs.colorado.edu> - * - * Copyright (C) 2005 Novell, Inc. (www.novell.com) - * - * 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. - * - */ - -#include <gtk/gtk.h> -#include <e-util/e-config.h> -#include <calendar/gui/e-cal-config.h> -#include <calendar/gui/e-cal-event.h> -#include <calendar/gui/calendar-component.h> -#include <libedataserver/e-source.h> -#include <libedataserver/e-url.h> -#include <libedataserver/e-categories.h> -#include <libgnome/gnome-i18n.h> -#include <libxml/parser.h> -#include <libxml/tree.h> -#include <string.h> - -GtkWidget *e_calendar_weather_location (EPlugin *epl, EConfigHookItemFactoryData *data); -GtkWidget *e_calendar_weather_refresh (EPlugin *epl, EConfigHookItemFactoryData *data); -GtkWidget *e_calendar_weather_units (EPlugin *epl, EConfigHookItemFactoryData *data); -gboolean e_calendar_weather_check (EPlugin *epl, EConfigHookPageCheckData *data); -void e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetComponent *data); -int e_plugin_lib_enable (EPluginLib *epl, int enable); - -static GtkTreeStore *store = NULL; - -#define WEATHER_BASE_URI "weather://" - -int -e_plugin_lib_enable (EPluginLib *epl, int enable) -{ - GList *l; - gboolean found = FALSE; - - /* Add the categories icons if we don't have them. */ - for (l = e_categories_get_list (); l; l = g_list_next (l)) { - if (!strcmp (l->data, _("Weather: Cloudy"))) { - found = TRUE; - break; - } - } - if (!found) { - e_categories_add (_("Weather: Cloudy"), NULL, WEATHER_DATADIR "/category_weather_cloudy_16.png", FALSE); - e_categories_add (_("Weather: Fog"), NULL, WEATHER_DATADIR "/category_weather_fog_16.png", FALSE); - e_categories_add (_("Weather: Partly Cloudy"), NULL, WEATHER_DATADIR "/category_weather_partly_cloudy_16.png", FALSE); - e_categories_add (_("Weather: Rain"), NULL, WEATHER_DATADIR "/category_weather_rain_16.png", FALSE); - e_categories_add (_("Weather: Snow"), NULL, WEATHER_DATADIR "/category_weather_snow_16.png", FALSE); - e_categories_add (_("Weather: Sunny"), NULL, WEATHER_DATADIR "/category_weather_sun_16.png", FALSE); - e_categories_add (_("Weather: Thunderstorms"), NULL, WEATHER_DATADIR "/category_weather_tstorm_16.png", FALSE); - } - - return 0; -} - -void -e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetComponent *data) -{ - /* Perform a migration step here. This allows us to keep the weather calendar completely - * separate from evolution. If the plugin isn't built, the weather source group won't - * show up in the user's evolution. If it is, this will create it if it doesn't exist */ - CalendarComponent *component; - ESourceList *source_list; - ESourceGroup *group; - GSList *groups; - ESourceGroup *weather = NULL; - - component = data->component; - source_list = calendar_component_peek_source_list (component); - - groups = e_source_list_peek_groups (source_list); - if (groups) { - /* groups are already there, we need to search */ - GSList *g; - - for (g = groups; g; g = g_slist_next (g)) { - group = E_SOURCE_GROUP (g->data); - if (!weather && !strcmp (WEATHER_BASE_URI, e_source_group_peek_base_uri (group))) - weather = g_object_ref (group); - } - } - - if (!weather) { - group = e_source_group_new (_("Weather"), WEATHER_BASE_URI); - e_source_list_add_group (source_list, group, -1); - - weather = group; - } - - if (weather) - g_object_unref (weather); - - e_source_list_sync (source_list, NULL); - return 0; -} - -static void -parse_subtree (GtkTreeIter *parent, xmlNode *node) -{ - GtkTreeIter iter; - xmlNode *child; - - if (node->type == XML_ELEMENT_NODE) { - gtk_tree_store_append (store, &iter, parent); - if (strcmp (node->name, "location") == 0) { - xmlAttr *attr; - - child = node->children; - g_assert (child->type == XML_TEXT_NODE); - gtk_tree_store_set (store, &iter, 0, child->content, -1); - - for (attr = node->properties; attr; attr = attr->next) { - if (strcmp (attr->name, "code") == 0) - gtk_tree_store_set (store, &iter, 1, attr->children->content, -1); - else if (strcmp (attr->name, "url") == 0) - gtk_tree_store_set (store, &iter, 2, attr->children->content, -1); - else if (strcmp (attr->name, "type") == 0) - gtk_tree_store_set (store, &iter, 3, attr->children->content, -1); - } - } else { - xmlAttr *attr; - - for (child = node->children; child; child = child->next) - parse_subtree (&iter, child); - - for (attr = node->properties; attr; attr = attr->next) - if (strcmp (attr->name, "name") == 0) - gtk_tree_store_set (store, &iter, 0, attr->children->content, -1); - } - } -} - -static void -load_locations () -{ - xmlDoc *doc; - xmlNode *root, *child; - - LIBXML_TEST_VERSION - - doc = xmlParseFile (WEATHER_EDS_DATADIR "/Locations.xml"); - if (doc == NULL) { - g_warning ("failed to read locations file"); - return; - } - - if (store == NULL) - store = gtk_tree_store_new (4, - G_TYPE_STRING, /* name */ - G_TYPE_STRING, /* code */ - G_TYPE_STRING, /* URL */ - G_TYPE_STRING); /* type */ - - root = xmlDocGetRootElement (doc); - for (child = root->children; child; child = child->next) - parse_subtree (NULL, child); - xmlFreeDoc (doc); -} - -static void -selection_changed (GtkTreeSelection *selection, GtkDialog *dialog) -{ - GtkTreeModel *model; - GtkTreeIter iter; - - if (gtk_tree_selection_get_selected (selection, &model, &iter)) { - gchar *code = NULL; - gtk_tree_model_get (model, &iter, 1, &code, -1); - if (code != NULL) { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, TRUE); - } else { - GtkTreeView *view = gtk_tree_selection_get_tree_view (selection); - GtkTreePath *path; - path = gtk_tree_model_get_path (model, &iter); - gtk_tree_view_expand_row (view, path, FALSE); - gtk_tree_path_free (path); - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - } - } else { - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - } -} - -static struct -{ - gchar **ids; - GtkTreeIter *result; -} find_data; - -static gboolean -find_location_func (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *node, gpointer data) -{ - gchar *type, *code, *name; - gtk_tree_model_get (model, node, 0, &name, 1, &code, 3, &type, -1); - if (name == NULL || code == NULL || type == NULL) - return FALSE; - if ((!strcmp (type, find_data.ids[0])) && - (!strcmp (code, find_data.ids[1])) && - (!strcmp (name, find_data.ids[2]))) { - find_data.result = gtk_tree_iter_copy (node); - return TRUE; - } - return FALSE; -} - -static GtkTreeIter * -find_location (gchar *relative_url) -{ - /* type/code/name */ - find_data.ids = g_strsplit (relative_url, "/", -1); - find_data.result = NULL; - gtk_tree_model_foreach (GTK_TREE_MODEL (store), (GtkTreeModelForeachFunc) find_location_func, NULL); - - g_strfreev (find_data.ids); - return find_data.result; -} - -static gboolean -treeview_clicked (GtkTreeView *treeview, GdkEventButton *event, GtkDialog *dialog) -{ - if (event->type == GDK_2BUTTON_PRESS) { - GtkTreeSelection *selection = gtk_tree_view_get_selection (treeview); - GtkTreeModel *model; - GtkTreeIter iter; - - if (gtk_tree_selection_get_selected (selection, &model, &iter)) { - gchar *code = NULL; - gtk_tree_model_get (model, &iter, 1, &code, -1); - if (code != NULL) { - gtk_dialog_response (dialog, GTK_RESPONSE_OK); - return TRUE; - } - } - } - return FALSE; -} - -static GtkDialog * -create_source_selector (ESource *source) -{ - GtkWidget *dialog, *treeview, *scrolledwindow; - GtkCellRenderer *text; - GtkTreeSelection *selection; - gchar *uri_text; - EUri *uri; - - /* FIXME - should show an error here if it fails*/ - if (store == NULL) - return NULL; - - dialog = gtk_dialog_new_with_buttons ( - _("Select a location"), - NULL, GTK_DIALOG_MODAL, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_OK, GTK_RESPONSE_OK, - NULL); - gtk_container_set_border_width (GTK_CONTAINER (dialog), 6); - - scrolledwindow = gtk_scrolled_window_new (NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow), GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC); - gtk_widget_show (scrolledwindow); - treeview = gtk_tree_view_new_with_model (GTK_TREE_MODEL (store)); - gtk_tree_view_set_headers_visible (GTK_TREE_VIEW (treeview), FALSE); - gtk_widget_show (treeview); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (scrolledwindow), treeview); - gtk_widget_add_events (treeview, GDK_BUTTON_PRESS); - g_signal_connect (G_OBJECT (treeview), "button-press-event", G_CALLBACK (treeview_clicked), dialog); - selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (treeview)); - gtk_tree_selection_set_mode (selection, GTK_SELECTION_BROWSE); - - uri_text = e_source_get_uri (source); - uri = e_uri_new (uri_text); - if (uri->path && strlen (uri->path)) { - GtkTreeIter *iter = find_location (uri_text + 10); - GtkTreePath *path = gtk_tree_model_get_path (GTK_TREE_MODEL (store), iter); - gtk_tree_view_expand_to_path (GTK_TREE_VIEW (treeview), path); - gtk_tree_selection_select_path (selection, path); - gtk_tree_path_free (path); - } - g_free (uri_text); - e_uri_free (uri); - - g_signal_connect (G_OBJECT (selection), "changed", G_CALLBACK (selection_changed), dialog); - g_object_set_data (G_OBJECT (dialog), "treeview", treeview); - - text = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes (GTK_TREE_VIEW (treeview), -1, "location", text, "text", 0, NULL); - - gtk_container_add (GTK_CONTAINER (GTK_DIALOG (dialog)->vbox), scrolledwindow); - gtk_container_set_border_width (GTK_CONTAINER (scrolledwindow), 6); - gtk_box_set_spacing (GTK_BOX (GTK_DIALOG (dialog)->vbox), 6); - - gtk_dialog_set_response_sensitive (GTK_DIALOG (dialog), GTK_RESPONSE_OK, FALSE); - gtk_window_set_default_size (GTK_WINDOW (dialog), 420, 340); - - return GTK_DIALOG (dialog); -} - -static gchar * -build_location_path (GtkTreeIter *iter) -{ - GtkTreeIter parent; - gchar *path, *temp1, *temp2; - - gtk_tree_model_get (GTK_TREE_MODEL (store), iter, 0, &temp1, -1); - path = g_strdup (temp1); - - while (gtk_tree_model_iter_parent (GTK_TREE_MODEL (store), &parent, iter)) { - gtk_tree_model_get (GTK_TREE_MODEL (store), &parent, 0, &temp1, -1); - temp2 = g_strdup_printf ("%s : %s", temp1, path); - g_free (path); - path = temp2; - iter = gtk_tree_iter_copy (&parent); - } - return path; -} - -static void -location_clicked (GtkButton *button, ESource *source) -{ - GtkDialog *dialog = create_source_selector (source); - gint response; - - if (dialog == NULL) - return; - - response = gtk_dialog_run (dialog); - - if (response == GTK_RESPONSE_OK) { - GtkTreeView *view = GTK_TREE_VIEW (g_object_get_data (G_OBJECT (dialog), "treeview")); - GtkTreeSelection *selection = gtk_tree_view_get_selection (view); - GtkTreeModel *model; - GtkTreeIter iter; - GtkWidget *label; - gchar *type, *code, *name; - gchar *path, *uri; - - gtk_tree_selection_get_selected (selection, &model, &iter); - gtk_tree_model_get (model, &iter, 0, &name, 1, &code, 3, &type, -1); - path = build_location_path (&iter); - - label = gtk_bin_get_child (GTK_BIN (button)); - gtk_label_set_text (GTK_LABEL (label), path); - - uri = g_strdup_printf ("%s/%s/%s", type, code, name); - /* FIXME - url_encode (&uri); */ - e_source_set_relative_uri (source, uri); - g_free (uri); - } else { - GtkWidget *label; - const gchar *text; - - label = GTK_WIDGET (gtk_bin_get_child (GTK_BIN (button))); - text = gtk_label_get_text (GTK_LABEL (label)); - if (strcmp (text, _("None")) == 0) - e_source_set_relative_uri (source, ""); - } - - gtk_widget_destroy (GTK_WIDGET (dialog)); -} - -GtkWidget * -e_calendar_weather_location (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - static GtkWidget *label; - GtkWidget *button, *parent, *text; - int row; - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - ESource *source = t->source; - EUri *uri; - char *uri_text; - static GtkWidget *hidden; - - if (store == NULL) - load_locations (); - - if (!hidden) - hidden = gtk_label_new (""); - - if (data->old) - gtk_widget_destroy (label); - - uri_text = e_source_get_uri (t->source); - uri = e_uri_new (uri_text); - if (strcmp (uri->protocol, "weather")) { - e_uri_free (uri); - return hidden; - } - - parent = data->parent; - - row = ((GtkTable*)parent)->nrows; - - label = gtk_label_new_with_mnemonic (_("_Location:")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0); - - button = gtk_button_new (); - g_signal_connect (G_OBJECT (button), "clicked", G_CALLBACK (location_clicked), source); - gtk_widget_show (button); - - if (uri->path && strlen (uri->path)) { - GtkTreeIter *iter = find_location (uri_text + 10); - gchar *location = build_location_path (iter); - text = gtk_label_new (location); - g_free (location); - } else - text = gtk_label_new (_("None")); - gtk_widget_show (text); -#if (GTK_CHECK_VERSION(2, 6, 0)) - gtk_label_set_ellipsize (GTK_LABEL (text), PANGO_ELLIPSIZE_START); -#endif - gtk_container_add (GTK_CONTAINER (button), text); - e_uri_free (uri); - g_free (uri_text); - - gtk_table_attach (GTK_TABLE (parent), button, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - - return button; -} - -static void -set_refresh_time (ESource *source, GtkWidget *spin, GtkWidget *option) -{ - int time; - int item_num = 0; - const char *refresh_str = e_source_get_property (source, "refresh"); - time = refresh_str ? atoi (refresh_str) : 30; - - if (time && !(time % 10080)) { - /* weeks */ - item_num = 3; - time /= 10080; - } else if (time && !(time % 1440)) { - /* days */ - item_num = 2; - time /= 1440; - } else if (time && !(time % 60)) { - /* hours */ - item_num = 1; - time /= 60; - } - gtk_option_menu_set_history (GTK_OPTION_MENU (option), item_num); - gtk_spin_button_set_value (GTK_SPIN_BUTTON (spin), time); -} - -static char * -get_refresh_minutes (GtkWidget *spin, GtkWidget *option) -{ - int setting = gtk_spin_button_get_value_as_int (GTK_SPIN_BUTTON (spin)); - switch (gtk_option_menu_get_history (GTK_OPTION_MENU (option))) { - case 0: - /* minutes */ - break; - case 1: - /* hours */ - setting *= 60; - break; - case 2: - /* days */ - setting *= 1440; - break; - case 3: - /* weeks - is this *really* necessary? */ - setting *= 10080; - break; - default: - g_warning ("Time unit out of range"); - break; - } - return g_strdup_printf ("%d", setting); -} - -static void -spin_changed (GtkSpinButton *spin, ECalConfigTargetSource *t) -{ - char *refresh_str; - GtkWidget *option; - - option = g_object_get_data (G_OBJECT (spin), "option"); - - refresh_str = get_refresh_minutes ((GtkWidget *) spin, option); - e_source_set_property (t->source, "refresh", refresh_str); - g_free (refresh_str); -} - -static void -option_changed (GtkOptionMenu *option, ECalConfigTargetSource *t) -{ - char *refresh_str; - GtkWidget *spin; - - spin = g_object_get_data (G_OBJECT (option), "spin"); - - refresh_str = get_refresh_minutes (spin, (GtkWidget *) option); - e_source_set_property (t->source, "refresh", refresh_str); - g_free (refresh_str); -} - -GtkWidget * -e_calendar_weather_refresh (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - static GtkWidget *label; - GtkWidget *option, *spin, *menu, *hbox, *parent; - GtkWidget *times[4]; - int row, i; - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - ESource *source = t->source; - EUri *uri; - char *uri_text; - static GtkWidget *hidden = NULL; - - if (!hidden) - hidden = gtk_label_new (""); - - if (data->old) - gtk_widget_destroy (label); - - uri_text = e_source_get_uri (t->source); - uri = e_uri_new (uri_text); - g_free (uri_text); - if (strcmp (uri->protocol, "weather")) { - e_uri_free (uri); - return hidden; - } - e_uri_free (uri); - - parent = data->parent; - - row = ((GtkTable*)parent)->nrows; - - label = gtk_label_new_with_mnemonic (_("_Refresh:")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0); - - hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox); - - spin = gtk_spin_button_new_with_range (0, 100, 1); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), spin); - gtk_widget_show (spin); - gtk_box_pack_start (GTK_BOX (hbox), spin, FALSE, TRUE, 0); - - option = gtk_option_menu_new (); - gtk_widget_show (option); - times[0] = gtk_menu_item_new_with_label (_("minutes")); - times[1] = gtk_menu_item_new_with_label (_("hours")); - times[2] = gtk_menu_item_new_with_label (_("days")); - times[3] = gtk_menu_item_new_with_label (_("weeks")); - menu = gtk_menu_new (); - gtk_widget_show (menu); - for (i = 0; i < 4; i++) { - gtk_widget_show (times[i]); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), times[i]); - } - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - set_refresh_time (source, spin, option); - gtk_box_pack_start (GTK_BOX (hbox), option, FALSE, TRUE, 0); - - g_object_set_data (G_OBJECT (option), "spin", spin); - g_signal_connect (G_OBJECT (option), "changed", G_CALLBACK (option_changed), t); - g_object_set_data (G_OBJECT (spin), "option", option); - g_signal_connect (G_OBJECT (spin), "value-changed", G_CALLBACK (spin_changed), t); - - gtk_table_attach (GTK_TABLE (parent), hbox, 1, 2, row, row+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - - return hbox; -} - -static void -set_units (ESource *source, GtkWidget *option) -{ - const char *format = e_source_get_property (source, "units"); - if (format == NULL) { - format = e_source_get_property (source, "temperature"); - if (format == NULL) { - e_source_set_property (source, "units", "metric"); - gtk_option_menu_set_history (GTK_OPTION_MENU (option), 0); - } else if (strcmp (format, "fahrenheit") == 0) { - /* old format, convert */ - e_source_set_property (source, "units", "imperial"); - gtk_option_menu_set_history (GTK_OPTION_MENU (option), 1); - } else { - e_source_set_property (source, "units", "metric"); - gtk_option_menu_set_history (GTK_OPTION_MENU (option), 0); - } - } else { - if (strcmp (format, "metric") == 0) - gtk_option_menu_set_history (GTK_OPTION_MENU (option), 0); - else - gtk_option_menu_set_history (GTK_OPTION_MENU (option), 1); - } -} - -static void -units_changed (GtkOptionMenu *option, ECalConfigTargetSource *t) -{ - int choice = gtk_option_menu_get_history (GTK_OPTION_MENU (option)); - if (choice == 0) - e_source_set_property (t->source, "units", "metric"); - else - e_source_set_property (t->source, "units", "imperial"); -} - -GtkWidget * -e_calendar_weather_units (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - static GtkWidget *label; - GtkWidget *option, *menu, *parent; - GtkWidget *formats[2]; - int row, i; - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - ESource *source = t->source; - EUri *uri; - char *uri_text; - static GtkWidget *hidden = NULL; - - if (!hidden) - hidden = gtk_label_new (""); - - if (data->old) - gtk_widget_destroy (label); - - uri_text = e_source_get_uri (t->source); - uri = e_uri_new (uri_text); - g_free (uri_text); - if (strcmp (uri->protocol, "weather")) { - e_uri_free (uri); - return hidden; - } - e_uri_free (uri); - - parent = data->parent; - - row = ((GtkTable*)parent)->nrows; - - label = gtk_label_new_with_mnemonic (_("_Units:")); - gtk_widget_show (label); - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); - gtk_table_attach (GTK_TABLE (parent), label, 0, 1, row, row+1, GTK_FILL, 0, 0, 0); - - option = gtk_option_menu_new (); - gtk_widget_show (option); - formats[0] = gtk_menu_item_new_with_label (_("Metric (Celsius, cm, etc)")); - formats[1] = gtk_menu_item_new_with_label (_("Imperial (Fahrenheit, inches, etc)")); - menu = gtk_menu_new (); - gtk_widget_show (menu); - for (i = 0; i < 2; i++) { - gtk_widget_show (formats[i]); - gtk_menu_shell_append (GTK_MENU_SHELL (menu), formats[i]); - } - gtk_option_menu_set_menu (GTK_OPTION_MENU (option), menu); - set_units (source, option); - gtk_label_set_mnemonic_widget (GTK_LABEL (label), option); - g_signal_connect (G_OBJECT (option), "changed", G_CALLBACK (units_changed), t); - gtk_table_attach (GTK_TABLE (parent), option, 1, 2, row, row+1, GTK_FILL, 0, 0, 0); - - return option; -} - -gboolean -e_calendar_weather_check (EPlugin *epl, EConfigHookPageCheckData *data) -{ - /* FIXME - check pageid */ - ECalConfigTargetSource *t = (ECalConfigTargetSource *) data->target; - EUri *uri; - gboolean ok = FALSE; - ESourceGroup *group = e_source_peek_group (t->source); - - /* always return TRUE if this isn't a weather source */ - if (strncmp (e_source_group_peek_base_uri (group), "weather", 7)) - return TRUE; - - uri = e_uri_new (e_source_get_uri (t->source)); - /* make sure that the protocol is weather:// and that the path isn't empty */ - ok = (uri->path && strlen (uri->path)); - e_uri_free (uri); - - return ok; -} diff --git a/plugins/calendar-weather/category_weather_cloudy_16.png b/plugins/calendar-weather/category_weather_cloudy_16.png Binary files differdeleted file mode 100644 index ddb3ba7c59..0000000000 --- a/plugins/calendar-weather/category_weather_cloudy_16.png +++ /dev/null diff --git a/plugins/calendar-weather/category_weather_fog_16.png b/plugins/calendar-weather/category_weather_fog_16.png Binary files differdeleted file mode 100644 index 23e4e2f1d4..0000000000 --- a/plugins/calendar-weather/category_weather_fog_16.png +++ /dev/null diff --git a/plugins/calendar-weather/category_weather_partly_cloudy_16.png b/plugins/calendar-weather/category_weather_partly_cloudy_16.png Binary files differdeleted file mode 100644 index 472feaa654..0000000000 --- a/plugins/calendar-weather/category_weather_partly_cloudy_16.png +++ /dev/null diff --git a/plugins/calendar-weather/category_weather_rain_16.png b/plugins/calendar-weather/category_weather_rain_16.png Binary files differdeleted file mode 100644 index e00d5e1c82..0000000000 --- a/plugins/calendar-weather/category_weather_rain_16.png +++ /dev/null diff --git a/plugins/calendar-weather/category_weather_snow_16.png b/plugins/calendar-weather/category_weather_snow_16.png Binary files differdeleted file mode 100644 index 5e95985f5f..0000000000 --- a/plugins/calendar-weather/category_weather_snow_16.png +++ /dev/null diff --git a/plugins/calendar-weather/category_weather_sun_16.png b/plugins/calendar-weather/category_weather_sun_16.png Binary files differdeleted file mode 100644 index 780c61c23c..0000000000 --- a/plugins/calendar-weather/category_weather_sun_16.png +++ /dev/null diff --git a/plugins/calendar-weather/category_weather_tstorm_16.png b/plugins/calendar-weather/category_weather_tstorm_16.png Binary files differdeleted file mode 100644 index b2af092b53..0000000000 --- a/plugins/calendar-weather/category_weather_tstorm_16.png +++ /dev/null diff --git a/plugins/calendar-weather/org-gnome-calendar-weather.eplug.in b/plugins/calendar-weather/org-gnome-calendar-weather.eplug.in deleted file mode 100644 index 2ce03a29bd..0000000000 --- a/plugins/calendar-weather/org-gnome-calendar-weather.eplug.in +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - location="@PLUGINDIR@/liborg-gnome-calendar-weather.so" - id="org.gnome.evolution.calendar.weather" - name="Weather Calendars"> - <description>Provides core functionality for weather calendars</description> - <author name="David Trowbridge" email="trowbrds@cs.colorado.edu"/> - <hook class="org.gnome.evolution.calendar.config:1.0"> - <group - target="source" - id="org.gnome.evolution.calendar.calendarProperties" - check="e_calendar_weather_check"> - <item - type="item_table" - path="00.general/00.source/40.location" - factory="e_calendar_weather_location"/> - <item - type="item_table" - path="00.general/00.source/50.units" - factory="e_calendar_weather_units"/> - <item - type="item_table" - path="00.general/00.source/60.refresh" - factory="e_calendar_weather_refresh"/> - </group> - </hook> - <hook class="org.gnome.evolution.calendar.events:1.0"> - <event target="component" id="component.migration" handle="e_calendar_weather_migrate"/> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/copy-tool/.cvsignore b/plugins/copy-tool/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/copy-tool/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/copy-tool/ChangeLog b/plugins/copy-tool/ChangeLog deleted file mode 100644 index 761df6d9fe..0000000000 --- a/plugins/copy-tool/ChangeLog +++ /dev/null @@ -1,21 +0,0 @@ -2004-11-03 Not Zed <NotZed@Ximian.com> - - * org-gnome-copy-tool.eplug.in: gave it a better name and fixed - the description and author tags. - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-28 Not Zed <NotZed@Ximian.com> - - * org-gnome-copy-tool.eplug.in: fix folderview popup hook id. - -2004-10-21 JP Rosevear <jpr@novell.com> - - * org-gnome-copy-tool.eplug.in: s/image/icon/ - -2004-10-20 Not Zed <NotZed@Ximian.com> - - * implemented a copy-utils plugin. - diff --git a/plugins/copy-tool/Makefile.am b/plugins/copy-tool/Makefile.am deleted file mode 100644 index 73092c3d20..0000000000 --- a/plugins/copy-tool/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-copy-tool.eplug -plugin_LTLIBRARIES = liborg-gnome-copy-tool.la - -liborg_gnome_copy_tool_la_SOURCES = copy-tool.c -liborg_gnome_copy_tool_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-copy-tool.eplug.in
\ No newline at end of file diff --git a/plugins/copy-tool/copy-tool.c b/plugins/copy-tool/copy-tool.c deleted file mode 100644 index 5571ba25c1..0000000000 --- a/plugins/copy-tool/copy-tool.c +++ /dev/null @@ -1,100 +0,0 @@ - -/* Copyright (C) 2004 Michael Zucchi */ - -/* This file is licensed under the GNU GPL v2 or later */ - -/* Add 'copy to clipboard' things to various menu's. - - Uh, so far only to copy mail addresses from mail content */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib/gi18n-lib.h> -#include <string.h> -#include <stdio.h> - -#include "mail/em-popup.h" - -#include <gtk/gtkmain.h> -#include <gtk/gtkinvisible.h> -#include <gtk/gtkselection.h> - -#include "camel/camel-internet-address.h" -#include "camel/camel-url.h" - -static GtkWidget *invisible; -static char *address_uri; - -void org_gnome_copy_tool_copy_address(void *ep, EMPopupTargetURI *t); - -void -org_gnome_copy_tool_copy_address(void *ep, EMPopupTargetURI *t) -{ - g_free(address_uri); - address_uri = g_strdup(t->uri); - - printf("copying address '%s'\n", address_uri); - - gtk_selection_owner_set(invisible, GDK_SELECTION_PRIMARY, gtk_get_current_event_time()); - gtk_selection_owner_set(invisible, GDK_SELECTION_CLIPBOARD, gtk_get_current_event_time()); -} - -static void -ct_selection_get(GtkWidget *widget, GtkSelectionData *data, guint info, guint time_stamp, void *dummy) -{ - printf("get selection, address is '%s'\n", address_uri); - - if (address_uri == NULL) - return; - - if (strncmp (address_uri, "mailto:", 7) == 0) { - CamelInternetAddress *cia = camel_internet_address_new(); - CamelURL *curl; - char *addr; - const char *tmp; - - curl = camel_url_new(address_uri, NULL); - camel_address_decode((CamelAddress *)cia, curl->path); - /* should it perhaps use address format? */ - addr = camel_address_encode((CamelAddress *)cia); - tmp = addr && addr[0] ? addr : address_uri + 7; - printf("get selection, setting to' %s'\n", tmp); - - gtk_selection_data_set(data, data->target, 8, tmp, strlen(tmp)); - g_free(addr); - camel_url_free(curl); - camel_object_unref(cia); - } -} - -static void -ct_selection_clear_event(GtkWidget *widget, GdkEventSelection *event, void *dummy) -{ - printf("selection clear event\n"); - - g_free(address_uri); - address_uri = NULL; -} - -int e_plugin_lib_enable(EPluginLib *ep, int enable); - -int -e_plugin_lib_enable(EPluginLib *ep, int enable) -{ - if (enable) { - invisible = gtk_invisible_new(); - g_signal_connect(invisible, "selection_get", G_CALLBACK(ct_selection_get), NULL); - g_signal_connect(invisible, "selection_clear_event", G_CALLBACK(ct_selection_clear_event), NULL); - gtk_selection_add_target(invisible, GDK_SELECTION_PRIMARY, GDK_SELECTION_TYPE_STRING, 0); - gtk_selection_add_target(invisible, GDK_SELECTION_CLIPBOARD, GDK_SELECTION_TYPE_STRING, 1); - } else { - g_free(address_uri); - address_uri = NULL; - gtk_widget_destroy(invisible); - invisible = NULL; - } - - return 0; -} diff --git a/plugins/copy-tool/org-gnome-copy-tool.eplug.in b/plugins/copy-tool/org-gnome-copy-tool.eplug.in deleted file mode 100644 index 10c2a5d6be..0000000000 --- a/plugins/copy-tool/org-gnome-copy-tool.eplug.in +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.copyTool" - location="@PLUGINDIR@/liborg-gnome-copy-tool.so" - name="Copy tool"> - <description>A test plugin which demonstrates a popup menu plugin which lets you copy things to the clipboard</description> - <author name="Michael Zucchi" email="notzed@ximian.com"/> - - <!-- hook into the uri popup menu --> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.folderview.popup" target="uri"> - <item - type="item" - path="80.test" - icon="gtk-copy" - label="Copy _Email Address" - visible="mailto" - activate="org_gnome_copy_tool_copy_address"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/default-source/ChangeLog b/plugins/default-source/ChangeLog deleted file mode 100644 index d8a42cd5e2..0000000000 --- a/plugins/default-source/ChangeLog +++ /dev/null @@ -1,3 +0,0 @@ -2005-01-21 Sivaiah Nallagatla <snallagatla@novell.com> - - * initil commit diff --git a/plugins/default-source/Makefile.am b/plugins/default-source/Makefile.am deleted file mode 100644 index 077164c578..0000000000 --- a/plugins/default-source/Makefile.am +++ /dev/null @@ -1,17 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) \ - $(SOURCE_SEL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-default-source.eplug -plugin_LTLIBRARIES = liborg-gnome-default-source.la - - -liborg_gnome_default_source_la_SOURCES = default-source.c -liborg_gnome_default_source_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-default-source.eplug.in diff --git a/plugins/default-source/default-source.c b/plugins/default-source/default-source.c deleted file mode 100644 index ff506b13ff..0000000000 --- a/plugins/default-source/default-source.c +++ /dev/null @@ -1,123 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Copyright (C) 2004 D - * - * 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. - * - */ - -#include <gtk/gtk.h> - -#include <e-util/e-config.h> -#include <calendar/gui/e-cal-config.h> -#include <libedataserver/e-source.h> -#include <addressbook/gui/widgets/eab-config.h> -#include <libebook/e-book.h> -#include <libecal/e-cal.h> -#include <libedataserver/e-source.h> -#include <libgnome/gnome-i18n.h> -#include <string.h> -GtkWidget* org_gnome_default_book (EPlugin *epl, EConfigHookItemFactoryData *data); -void commit_default_calendar (EPlugin *epl, EConfigTarget *target); -void commit_default_book (EPlugin *epl, EConfigTarget *target); -void -commit_default_calendar (EPlugin *epl, EConfigTarget *target) -{ - ECalConfigTargetSource *cal_target; - ESource *source; - - cal_target = (ECalConfigTargetSource *) target; - source = cal_target->source; - if (e_source_get_property (source, "default")) - if (!e_cal_set_default_source (source, E_CAL_SOURCE_TYPE_EVENT, NULL)) - e_cal_set_default_source (source, E_CAL_SOURCE_TYPE_TODO, NULL); -} - -void -commit_default_book (EPlugin *epl, EConfigTarget *target) -{ - EABConfigTargetSource *book_target; - ESource *source; - - book_target = (EABConfigTargetSource *) target; - source = book_target->source; - if (e_source_get_property (source, "default")) - e_book_set_default_source (source, NULL); - - -} - -static void -default_source_changed (GtkWidget *check_box, ESource *source) -{ - - if (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (check_box))) - e_source_set_property (source, "default", "true"); - else - e_source_set_property (source, "default", NULL); -} - - -GtkWidget * -org_gnome_default_book (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - GtkWidget *widget; - ESource *source; - EABConfigTargetSource *book_target; - - if (data->old) - return data->old; - widget = gtk_check_button_new_with_label (_("Mark as default folder")); - book_target = (EABConfigTargetSource *) data->target; - source = book_target->source; - - if (e_source_get_property (source, "default")) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - gtk_container_add (GTK_CONTAINER (data->parent), widget); - - g_signal_connect (GTK_TOGGLE_BUTTON (widget), "toggled", G_CALLBACK (default_source_changed), source); - gtk_widget_show (widget); - return widget; -} - - -GtkWidget * -org_gnome_default_cal (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - GtkWidget *widget; - ESource *source; - ECalConfigTargetSource *cal_target; - int i; - - if (data->old) - return data->old; - widget = gtk_check_button_new_with_label (_("Mark as default folder")); - cal_target = (ECalConfigTargetSource *) data->target; - source = cal_target->source; - - if (e_source_get_property (source, "default")) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (widget), FALSE); - - i = ((GtkTable *)data->parent)->nrows; - gtk_table_attach((GtkTable *)data->parent, widget, 1, 2, i, i+1, GTK_EXPAND | GTK_FILL, 0, 0, 0); - - g_signal_connect (GTK_TOGGLE_BUTTON (widget), "toggled", G_CALLBACK (default_source_changed), source); - gtk_widget_show (widget); - return widget; -} diff --git a/plugins/default-source/org-gnome-default-source.eplug.in b/plugins/default-source/org-gnome-default-source.eplug.in deleted file mode 100644 index 127f16c78e..0000000000 --- a/plugins/default-source/org-gnome-default-source.eplug.in +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - location="@PLUGINDIR@/liborg-gnome-default-source.so" - id="org.gnome.evolution.plugin.default-source" - name="Default Sources"> - <hook class="org.gnome.evolution.calendar.config:1.0"> - <group - target="source" - id="org.gnome.evolution.calendar.calendarProperties" - commit="commit_default_calendar" - > - <item - type="item_table" - path="00.general/00.source/40.default" - factory="org_gnome_default_cal"/> - </group> - </hook> - <hook class="org.gnome.evolution.addressbook.config:1.0"> - <group - target="source" - id="com.novell.evolution.addressbook.config.accountEditor" - commit="commit_default_book" - > - <item - type="item" - path="00.general/10.display/30.default" - factory="org_gnome_default_book"/> - </group> - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/exchange-account-setup/ChangeLog b/plugins/exchange-account-setup/ChangeLog deleted file mode 100644 index 8ea9c9ac26..0000000000 --- a/plugins/exchange-account-setup/ChangeLog +++ /dev/null @@ -1,150 +0,0 @@ -2005-01-28 Not Zed <NotZed@Ximian.com> - - ** related to bug #71520. - - * exchange-account-setup.c: All but re-written. - Fixed the license of the file. - Fixed a translation string. - Modified return condition check. - Fixed problem over writing current account with the old data. - Removed duplicated code. - Removed the hack for handling NULL hostname, now using - CAMEL_URL_HIDDEN_HOST url flag in the provider. - Using E_ACCOUNT_SOURCE_SAVE_PASSWD for remember password. - Removed the way owa url entry was added to table in config section, - Now econfig supports tables. - - * exchange-ask-password.c: removed, functionality moved to - exchange-account-setup.c. - -2005-01-25 Sushma Rai <rsushma@novell.com> - - * exchange-account-setup.c (create_page): Fixed empty - string being marked for translation problem. #71644 - -2005-01-23 Sushma Rai <rsushma@novell.com> - - * org-gnome-exchange-account-setup.eplug.in: Added plugins - for handling hiding auth type section in druid. - - * exchange-account-setup.c (add_owa_entry_to_editor): Changed the - button label to "Authenticate" from OK - - * exchange-ask-password.c (add_owa_entry): Changed the button label - to Authenticate. - (org_gnome_exchange_handle_auth): Hiding Auth section in receive page. - (org_gnome_exchange_handle_send_auth_option): Hiding the Auth section - in send page - -2005-01-22 Sushma Rai <rsushma@novell.com> - - * org-gnome-exchange-account-setup.eplug.in: Added - org_gnome_exchange_check_options plugin. - - * exchange-ask-password.c (org_gnome_exchange_check_options): - Reads OWA URL value and sets use_ssl and owa_url values for source - account url. - - * exchange-account-setup.c (org_gnome_exchange_set_url) - (add_owa_entry_to_editor): Reading owa url value from gconf and setting - owa url value in the account editor. Fixes #71378 - -2005-01-19 Sushma Rai <rsushma@novell.com> - - * exchange-ask-password.c (validate_exchange_user): Fix for remembering - password if user has selected that option, while creating the account. - -2005-01-18 Sushma Rai <rsushma@novell.com> - - * exchange-ask-password.c (validate_exchange_user): Reading the return - value of user validation function. Fixes #71385 - -2005-01-18 Sushma Rai <rsushma@novell.com> - - * exchange-ask-password.c (validate_exchange_user): Filling up - user name so that page check doesn't fail. Fixes #71384 - -2005-01-18 Sushma Rai <rsushma@novell.com> - - * exchange-ask-password.c (org_gnome_exchange_read_url): - Setting dummy host name, which will be reset to proper - hostname once the user is authenticated. - -2005-01-18 Sushma Rai <rsushma@novell.com> - - * org-gnome-exchange-account-setup.eplug.in: Moved two account - editor plugins unser same hook class. - - * exchange-ask-password.c: Reorganized the code. - Used accessor functions to read and set EAccount values. - Removed editor specific factory function add_owa_entry_to_editor() - from here. - - * exchange-account-setup.c: Reorganized the code. - Moved add_owa_entry_to_editor() and it's sub functions into this file. - (org_gnome_exchange_account_setup): Reading source url and transport - url values stored in gconf and filling up the EAccount structure. - This fixes the problem of page check failure, as improper source url - and transport url values, as we don't read host name in the editor. - (org_gnome_exchange_set_url): Similar. - -2005-01-17 Sushma Rai <rsushma@novell.com> - - * Makefile.am: Linking to camel libs. Fixes plugin loading problem - due to undefined camel symbol, during evolution startup. - -2005-01-13 Sushma Rai <rsushma@novell.com> - - * org-gnome-exchange-account-setup.eplug.in: Combined - all the plugins into one. - -2005-01-12 Sushma Rai <rsushma@novell.com> - - * exchange-ask-password.c: (validate_exchange_user): - Added one more error condition check. - -2005-01-12 Sushma Rai <rsushma@novell.com> - - * org-gnome-exchange-account-setup.eplug.in: Factory - method to add owa url entry to account editor. - - * exchange-ask-password.c: (org_gnome_exchange_set_url) - (add_owa_entry_to_editor): Adds owa url entry to the - account editor for Exchange account. - (validate_exchange_user): Using the CamelProvider private - function defined by Exchange camel provider. - -2005-01-11 Sushma Rai <rsushma@novell.com> - - * org-gnome-exchange-account-setup.eplug.in: Removed page check plugin - - * exchange-ask-password.c: Added a button to prompt for password - instead of listening on page next signal - -2005-01-11 Not Zed <NotZed@Ximian.com> - - * Makefile.am: fix LDFLAGS variable name. - -2005-01-10 Sushma Rai <rsushma@novell.com> - - * exchange-ask-password.c: (validate_exchange_user): - Corrected argument order. - -2005-01-10 Sushma Rai <rsushma@novell.com> - - * org-gnome-exchange-account-setup.eplug.in: Added plugin to read - OWA url entry to the account set up druid. - - * exchange-ask-password.c: Create a entry for OWA URL and reads the - URL value. - -2005-01-09 Sushma Rai <rsushma@novell.com> - - * exchange-ask-password.c: Pops up password dialog and validates - user credentials once owa url and user name are entered. - - * org-gnome-exchange-account-setup.eplug.in: Added page check plugin. - -2005-01-09 Sushma Rai <rsushma@novell.com> - - * Intial ckeckin, Plugin for Exchange account specific settings diff --git a/plugins/exchange-account-setup/Makefile.am b/plugins/exchange-account-setup/Makefile.am deleted file mode 100644 index c0ecbca72b..0000000000 --- a/plugins/exchange-account-setup/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -INCLUDES = -I . \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(CAMEL_CFLAGS) \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-exchange-account-setup.eplug -plugin_LTLIBRARIES = liborg-gnome-exchange-account-settings.la - -liborg_gnome_exchange_account_settings_la_SOURCES = \ - exchange-account-setup.c - -liborg_gnome_exchange_account_settings_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/misc/libemiscwidgets.la \ - $(CAMEL_LIBS) - -liborg_gnome_exchange_account_settings_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-exchange-account-setup.eplug.in diff --git a/plugins/exchange-account-setup/exchange-account-setup.c b/plugins/exchange-account-setup/exchange-account-setup.c deleted file mode 100644 index b1bfd959cf..0000000000 --- a/plugins/exchange-account-setup/exchange-account-setup.c +++ /dev/null @@ -1,356 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Sushma Rai <rsushma@novell.com> - * Copyright (C) 2004 Novell, 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 Street #330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <string.h> -#include <glib/gi18n.h> -#include <glade/glade.h> -#include <gtk/gtk.h> -#include <gtk/gtkdialog.h> -#include <gconf/gconf-client.h> -#include <camel/camel-provider.h> -#include <camel/camel-url.h> -#include "mail/em-account-editor.h" -#include "mail/em-config.h" -#include "e-util/e-account.h" - -GtkWidget* org_gnome_exchange_settings(EPlugin *epl, EConfigHookItemFactoryData *data); -GtkWidget *org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data); -gboolean org_gnome_exchange_check_options(EPlugin *epl, EConfigHookPageCheckData *data); - -/* NB: This should be given a better name, it is NOT a camel service, it is only a camel-exchange one */ -typedef gboolean (CamelProviderValidateUserFunc) (CamelURL *camel_url, const char *url, gboolean *remember_password, CamelException *ex); -typedef struct { - CamelProviderValidateUserFunc *validate_user; -}CamelProviderValidate; - -/* only used in editor */ -GtkWidget * -org_gnome_exchange_settings(EPlugin *epl, EConfigHookItemFactoryData *data) -{ - EMConfigTargetAccount *target_account; - const char *source_url; - CamelURL *url; - GtkWidget *oof_page; - GtkWidget *oof_table; - GtkWidget *oof_description, *label_status, *label_empty; - GtkWidget *radiobutton_inoff, *radiobutton_oof; - GtkWidget *vbox_oof, *vbox_oof_message; - GtkWidget *oof_frame; - GtkWidget *scrolledwindow_oof; - GtkWidget *textview_oof; - char *txt; - - target_account = (EMConfigTargetAccount *)data->config->target; - source_url = e_account_get_string (target_account->account, E_ACCOUNT_SOURCE_URL); - url = camel_url_new(source_url, NULL); - if (url == NULL - || strcmp(url->protocol, "exchange") != 0) { - if (url) - camel_url_free(url); - return NULL; - } - - if (data->old) { - camel_url_free(url); - return data->old; - } - - /* FIXME: This out of office data never goes anywhere */ - - oof_page = gtk_vbox_new (FALSE, 6); - gtk_container_set_border_width (GTK_CONTAINER (oof_page), 12); - - /* Description section */ - - oof_description = gtk_label_new (_("The message specified below will be automatically sent to \neach person who sends mail to you while you are out of the office.")); - gtk_label_set_justify (GTK_LABEL (oof_description), GTK_JUSTIFY_LEFT); - gtk_label_set_line_wrap (GTK_LABEL (oof_description), TRUE); - gtk_misc_set_alignment (GTK_MISC (oof_description), 0.5, 0.5); - gtk_misc_set_padding (GTK_MISC (oof_description), 0, 18); - - gtk_box_pack_start (GTK_BOX (oof_page), oof_description, FALSE, TRUE, 0); - - /* Table with out of office radio buttons */ - - oof_table = gtk_table_new (2, 2, FALSE); - gtk_table_set_col_spacings (GTK_TABLE (oof_table), 6); - gtk_table_set_row_spacings (GTK_TABLE (oof_table), 6); - gtk_box_pack_start (GTK_BOX (oof_page), oof_table, FALSE, FALSE, 0); - - /* translators: exchange out of office status header */ - txt = g_strdup_printf("<b>%s</b>", _("Status:")); - label_status = gtk_label_new (txt); - g_free(txt); - gtk_label_set_justify (GTK_LABEL (label_status), GTK_JUSTIFY_CENTER); - gtk_misc_set_alignment (GTK_MISC (label_status), 0, 0.5); - gtk_misc_set_padding (GTK_MISC (label_status), 0, 0); - gtk_label_set_use_markup (GTK_LABEL (label_status), TRUE); - gtk_table_attach (GTK_TABLE (oof_table), label_status, 0, 1, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - - radiobutton_inoff = gtk_radio_button_new_with_label (NULL, - _("I am in the office")); - gtk_table_attach (GTK_TABLE (oof_table), radiobutton_inoff, 1, 2, 0, 1, - GTK_FILL, GTK_FILL, 0, 0); - - label_empty = gtk_label_new (""); - gtk_label_set_justify (GTK_LABEL (label_empty), GTK_JUSTIFY_LEFT); - gtk_misc_set_alignment (GTK_MISC (label_empty), 0, 0.5); - gtk_misc_set_padding (GTK_MISC (label_empty), 0, 0); - gtk_label_set_use_markup (GTK_LABEL (label_empty), FALSE); - gtk_table_attach (GTK_TABLE (oof_table), label_empty, 0, 1, 1, 2, - GTK_FILL, GTK_FILL, 0, 0); - - radiobutton_oof = gtk_radio_button_new_with_label_from_widget ( - GTK_RADIO_BUTTON (radiobutton_inoff), - _("I am out of the office")); - - - gtk_table_attach (GTK_TABLE (oof_table), radiobutton_oof, 1, 2, 1, 2, - GTK_FILL, GTK_FILL, 0, 0); - - /* frame containg oof message text box */ - - vbox_oof = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (oof_page), vbox_oof, FALSE, FALSE, 0); - - oof_frame = gtk_frame_new (""); - gtk_container_set_border_width (GTK_CONTAINER (oof_frame), 1); - gtk_frame_set_shadow_type (GTK_FRAME (oof_frame), GTK_SHADOW_ETCHED_IN); - gtk_frame_set_label (GTK_FRAME (oof_frame), _("Out of office Message:")); - gtk_box_pack_start (GTK_BOX (vbox_oof), oof_frame, FALSE, FALSE, 0); - - vbox_oof_message = gtk_vbox_new (FALSE, 6); - gtk_container_add (GTK_CONTAINER (oof_frame), vbox_oof_message); - - scrolledwindow_oof = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwindow_oof), - GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type ( - GTK_SCROLLED_WINDOW (scrolledwindow_oof), - GTK_SHADOW_IN); - gtk_box_pack_start (GTK_BOX (vbox_oof_message), - scrolledwindow_oof, TRUE, TRUE, 0); - - textview_oof = gtk_text_view_new(); - gtk_text_view_set_justification (GTK_TEXT_VIEW (textview_oof), - GTK_JUSTIFY_LEFT); - gtk_text_view_set_wrap_mode (GTK_TEXT_VIEW (textview_oof), - GTK_WRAP_WORD); - gtk_text_view_set_editable (GTK_TEXT_VIEW (textview_oof), TRUE); - gtk_container_add (GTK_CONTAINER (scrolledwindow_oof), textview_oof); - gtk_widget_show_all (scrolledwindow_oof); - - gtk_widget_show_all (oof_page); - - gtk_notebook_insert_page (GTK_NOTEBOOK (data->parent), oof_page, gtk_label_new(_("Exchange Settings")), 4); - - return oof_page; -} - -static void -owa_authenticate_user(GtkWidget *button, EConfig *config) -{ - EMConfigTargetAccount *target_account = (EMConfigTargetAccount *)config->target; - CamelProviderValidate *validate; - CamelURL *url=NULL; - CamelProvider *provider = NULL; - gboolean remember_password; - char *url_string; - const char *source_url, *id_name; - char *at, *user; - - source_url = e_account_get_string (target_account->account, E_ACCOUNT_SOURCE_URL); - provider = camel_provider_get (source_url, NULL); - if (!provider || provider->priv == NULL) { - /* can't happen? */ - return; - } - - url = camel_url_new(source_url, NULL); - validate = provider->priv; - if (url->user == NULL) { - id_name = e_account_get_string (target_account->account, E_ACCOUNT_ID_ADDRESS); - if (id_name) { - at = strchr(id_name, '@'); - user = g_alloca(at-id_name+1); - memcpy(user, id_name, at-id_name); - user[at-id_name] = 0; - camel_url_set_user (url, user); - } - } - - /* validate_user() CALLS GTK!!! - - THIS IS TOTALLY UNNACCEPTABLE!!!!!!!! - - It must use camel_session_ask_password, and it should return an exception for any problem, - which should then be shown using e-error */ - - if (validate->validate_user(url, camel_url_get_param(url, "owa_url"), &remember_password, NULL)) { - url_string = camel_url_to_string (url, 0); - e_account_set_string(target_account->account, E_ACCOUNT_SOURCE_URL, url_string); - e_account_set_string(target_account->account, E_ACCOUNT_TRANSPORT_URL, url_string); - e_account_set_bool(target_account->account, E_ACCOUNT_SOURCE_SAVE_PASSWD, remember_password); - g_free(url_string); - } - - camel_url_free (url); -} - -static void -owa_editor_entry_changed(GtkWidget *entry, EConfig *config) -{ - const char *uri, *ssl = NULL; - CamelURL *url, *owaurl = NULL; - char *url_string; - EMConfigTargetAccount *target = (EMConfigTargetAccount *)config->target; - GtkWidget *button = g_object_get_data((GObject *)entry, "authenticate-button"); - int active = FALSE; - - /* NB: we set the button active only if we have a parsable uri entered */ - - url = camel_url_new(e_account_get_string(target->account, E_ACCOUNT_SOURCE_URL), NULL); - uri = gtk_entry_get_text((GtkEntry *)entry); - if (uri && uri[0]) { - camel_url_set_param(url, "owa_url", uri); - owaurl = camel_url_new(uri, NULL); - if (owaurl) { - active = TRUE; - - /* i'm not sure why we need this, "ssl connection mode" is redundant - since we have it in the owa-url protocol */ - if (!strcmp(owaurl->protocol, "https")) - ssl = "always"; - camel_url_free(owaurl); - } - } else { - camel_url_set_param(url, "owa_url", NULL); - } - - camel_url_set_param(url, "use_ssl", ssl); - gtk_widget_set_sensitive(button, active); - - url_string = camel_url_to_string(url, 0); - e_account_set_string(target->account, E_ACCOUNT_SOURCE_URL, url_string); - g_free(url_string); -} - -static void -destroy_label(GtkWidget *old, GtkWidget *label) -{ - gtk_widget_destroy(label); -} - -/* used by editor and druid - same code */ -GtkWidget * -org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) -{ - EMConfigTargetAccount *target_account; - const char *source_url, *owa_url; - GtkWidget *owa_entry; - CamelURL *url; - int row; - GtkWidget *hbox, *label, *button; - - target_account = (EMConfigTargetAccount *)data->config->target; - source_url = e_account_get_string (target_account->account, E_ACCOUNT_SOURCE_URL); - url = camel_url_new(source_url, NULL); - if (url == NULL - || strcmp(url->protocol, "exchange") != 0) { - if (url) - camel_url_free(url); - - if (data->old - && (label = g_object_get_data((GObject *)data->old, "authenticate-label"))) - gtk_widget_destroy(label); - - /* TODO: we could remove 'owa-url' from the url, - but that will lose it if we come back. Maybe a commit callback could do it */ - - return NULL; - } - - if (data->old) { - camel_url_free(url); - return data->old; - } - - owa_url = camel_url_get_param(url, "owa_url"); - - row = ((GtkTable *)data->parent)->nrows; - - hbox = gtk_hbox_new (FALSE, 6); - label = gtk_label_new_with_mnemonic(_("_OWA Url:")); - gtk_widget_show(label); - - owa_entry = gtk_entry_new(); - if (owa_url) - gtk_entry_set_text(GTK_ENTRY (owa_entry), owa_url); - gtk_label_set_mnemonic_widget((GtkLabel *)label, owa_entry); - - button = gtk_button_new_with_mnemonic (_("A_uthenticate")); - gtk_widget_set_sensitive (button, owa_url && owa_url[0]); - - gtk_box_pack_start (GTK_BOX (hbox), owa_entry, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (hbox), button, FALSE, FALSE, 0); - gtk_widget_show_all(hbox); - - gtk_table_attach (GTK_TABLE (data->parent), label, 0, 1, row, row+1, 0, 0, 0, 0); - gtk_table_attach (GTK_TABLE (data->parent), hbox, 1, 2, row, row+1, GTK_FILL|GTK_EXPAND, GTK_FILL, 0, 0); - - g_signal_connect (owa_entry, "changed", G_CALLBACK(owa_editor_entry_changed), data->config); - g_object_set_data((GObject *)owa_entry, "authenticate-button", button); - g_signal_connect (button, "clicked", G_CALLBACK(owa_authenticate_user), data->config); - - /* Track the authenticate label, so we can destroy it if e-config is to destroy the hbox */ - g_object_set_data((GObject *)hbox, "authenticate-label", label); - - return hbox; -} - -gboolean -org_gnome_exchange_check_options(EPlugin *epl, EConfigHookPageCheckData *data) -{ - EMConfigTargetAccount *target = (EMConfigTargetAccount *)data->config->target; - int status = TRUE; - - /* We assume that if the host is set, then the setting is valid. - The host gets set when the provider validate() call is made */ - if (data->pageid == NULL || strcmp(data->pageid, "20.receive_options") == 0) { - CamelURL *url; - - url = camel_url_new(e_account_get_string(target->account, E_ACCOUNT_SOURCE_URL), NULL); - /* Note: we only care about exchange url's, we WILL get called on all other url's too. */ - if (url != NULL - && strcmp(url->protocol, "exchange") == 0 - && (url->host == NULL || url->host[0] == 0)) - status = FALSE; - - if (url) - camel_url_free(url); - } - - return status; -} diff --git a/plugins/exchange-account-setup/exchange-ask-password.c b/plugins/exchange-account-setup/exchange-ask-password.c deleted file mode 100644 index c21bd67c07..0000000000 --- a/plugins/exchange-account-setup/exchange-ask-password.c +++ /dev/null @@ -1,357 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Sushma Rai <rsushma@novell.com> - * Copyright (C) 2004 Novell, Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - -#include <string.h> -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <gtk/gtk.h> -#include <gtk/gtkdialog.h> -#include <camel/camel-provider.h> -#include <camel/camel-url.h> -#include "mail/em-account-editor.h" -#include "mail/em-config.h" -#include "e-util/e-account.h" -#include "e-util/e-passwords.h" -#include "e-util/e-config.h" - -int e_plugin_lib_enable (EPluginLib *ep, int enable); -void exchange_options_commit (EPlugin *epl, EConfigHookItemFactoryData *data); -GtkWidget *org_gnome_exchange_read_url (EPlugin *epl, EConfigHookItemFactoryData *data); -gboolean org_gnome_exchange_check_options (EPlugin *epl, EConfigHookPageCheckData *data); - -const char *owa_entry_text = NULL; - -typedef gboolean (CamelProviderValidateUserFunc) (CamelURL *camel_url, const char *url, gboolean *remember_password, CamelException *ex); - -typedef struct { - CamelProviderValidateUserFunc *validate_user; -}CamelProviderValidate; - -int -e_plugin_lib_enable (EPluginLib *ep, int enable) -{ - if (enable) { - } - return 0; -} - -void -exchange_options_commit (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - return; -} - -static gboolean -validate_exchange_user (void *data) -{ - EMConfigTargetAccount *target_account = data; - CamelProviderValidate *validate; - CamelURL *url=NULL; - CamelProvider *provider = NULL; - gboolean valid = FALSE, *remember_password; - char *account_url, *url_string; - const char *source_url, *id_name; - static int count = 0; - char *at, *user; - - if (count) - return valid; - - source_url = e_account_get_string (target_account->account, - E_ACCOUNT_SOURCE_URL); - account_url = g_strdup (source_url); - provider = camel_provider_get (account_url, NULL); - if (!provider) { - return FALSE; /* This should never happen */ - } - url = camel_url_new_with_base (NULL, account_url); - validate = provider->priv; - if (validate) { - - if (url->user == NULL) { - id_name = e_account_get_string (target_account->account, - E_ACCOUNT_ID_ADDRESS); - if (id_name) { - at = strchr(id_name, '@'); - user = g_alloca(at-id_name+1); - memcpy(user, id_name, at-id_name); - user[at-id_name] = 0; - - camel_url_set_user (url, user); - } - } - valid = validate->validate_user (url, owa_entry_text, - remember_password, NULL); - } - - /* FIXME: need to check for return value */ - if (valid) { - count ++; - url_string = camel_url_to_string (url, 0); - e_account_set_string (target_account->account, - E_ACCOUNT_SOURCE_URL, url_string); - e_account_set_string (target_account->account, - E_ACCOUNT_TRANSPORT_URL, url_string); - target_account->account->source->save_passwd = *remember_password; - } - - camel_url_free (url); - g_free (account_url); - return valid; -} - -static void -ok_button_clicked (GtkWidget *button, void *data) -{ - gboolean valid = FALSE; - - valid = validate_exchange_user (data); // FIXME: return value -} - -static void -owa_entry_changed (GtkWidget *entry, void *data) -{ - GtkWidget *button = data; - - /* FIXME: return owa_entry_text instead of making it global */ - owa_entry_text = gtk_entry_get_text (GTK_ENTRY (entry)); - if (owa_entry_text) - gtk_widget_set_sensitive (button, TRUE); -} - -static GtkWidget * -add_owa_entry (GtkWidget *parent, - EConfig *config, - EMConfigTargetAccount *target_account) -{ - GtkWidget *section, *owa_entry; - GtkWidget *hbox, *hbox_inner, *label, *button; - GList *container_list, *l; - GValue rows = { 0, }; - GValue cols = { 0, }; - gint n_rows, n_cols; - - /* Since configure section in the receive page is not plugin enabled - * traversing through the container hierarchy to get the reference - * to the table, to which owa_url entry has to be added. - * This needs to be changed once we can access configure section from - * the plugin. - */ - - container_list = gtk_container_get_children (GTK_CONTAINER (parent)); - l = g_list_nth (container_list, 1); /* vboxsourceborder */ - container_list = gtk_container_get_children (GTK_CONTAINER (l->data)); - l = g_list_nth (container_list, 0); /* sourcevbox */ - container_list = gtk_container_get_children (GTK_CONTAINER (l->data)); - l = g_list_nth (container_list, 2); /* source frame */ - container_list = gtk_container_get_children (GTK_CONTAINER (l->data)); - l = g_list_nth (container_list, 1); /* hbox173 */ - container_list = gtk_container_get_children (GTK_CONTAINER (l->data)); - l = g_list_nth (container_list, 1); /* table 13 */ - container_list = gtk_container_get_children (GTK_CONTAINER (l->data)); - l = g_list_nth (container_list, 0); /* table 4*/ - - g_value_init (&rows, G_TYPE_INT); - g_value_init (&cols, G_TYPE_INT); - g_object_get_property (G_OBJECT (l->data), "n-rows", &rows); - g_object_get_property (G_OBJECT (l->data), "n-columns", &cols); - n_rows = g_value_get_int (&rows); - n_cols = g_value_get_int (&cols); - - hbox = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox); - - hbox_inner = gtk_hbox_new (FALSE, 6); - gtk_widget_show (hbox_inner); - - owa_entry = gtk_entry_new (); - gtk_widget_show (owa_entry); - - button = gtk_button_new_with_mnemonic (_("A_uthenticate")); - gtk_widget_set_sensitive (button, FALSE); - gtk_widget_show (button); - - gtk_box_pack_start (GTK_BOX (hbox_inner), owa_entry, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (hbox_inner), button, TRUE, TRUE, 0); - - label = gtk_label_new_with_mnemonic(_("_OWA Url:")); - gtk_label_set_use_markup (GTK_LABEL (label), TRUE); - gtk_label_set_justify (GTK_LABEL (label), GTK_JUSTIFY_LEFT); - gtk_widget_show (label); - - gtk_box_pack_start (GTK_BOX (hbox), hbox_inner, TRUE, TRUE, 0); - - gtk_table_attach (GTK_TABLE (l->data), label, 0, n_cols-1, n_rows, n_rows+1, GTK_FILL, GTK_FILL, 0, 0); - gtk_table_attach (GTK_TABLE (l->data), hbox, n_cols-1, n_cols, n_rows, n_rows+1, GTK_FILL, GTK_FILL, 0, 0); - - gtk_widget_show (GTK_WIDGET (l->data)); - - g_signal_connect (owa_entry, "changed", - G_CALLBACK (owa_entry_changed), button); - g_signal_connect (button, "clicked", - G_CALLBACK (ok_button_clicked), target_account); - - section = gtk_vbox_new (FALSE, 0); - gtk_widget_hide (section); - return section; /* FIXME: return entry */ -} - -GtkWidget * -org_gnome_exchange_read_url (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - EMConfigTargetAccount *target_account; - EConfig *config; - char *account_url = NULL, *exchange_url = NULL; - const char *source_url; - GtkWidget *owa_entry = NULL, *parent; - - config = data->config; - target_account = (EMConfigTargetAccount *)data->config->target; - - source_url = e_account_get_string (target_account->account, - E_ACCOUNT_SOURCE_URL); - account_url = g_strdup (source_url); - exchange_url = g_strrstr (account_url, "exchange"); - - if (exchange_url) { - if (data->old) - return data->old; - - parent = data->parent; - owa_entry = add_owa_entry (parent, config, target_account); - } - g_free (account_url); - return owa_entry; -} - - -GtkWidget * -org_gnome_exchange_handle_auth (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - EMConfigTargetAccount *target_account; - EConfig *config; - char *account_url = NULL, *exchange_url = NULL, *url_string; - const char *source_url; - char *auth_type; - GtkWidget *auth_section=NULL, *parent, *section; - - config = data->config; - target_account = (EMConfigTargetAccount *)data->config->target; - - source_url = e_account_get_string (target_account->account, - E_ACCOUNT_SOURCE_URL); - account_url = g_strdup (source_url); - exchange_url = g_strrstr (account_url, "exchange"); - - if (exchange_url) { - parent = data->parent; - - /* We don't need auth section while creating the account. But - * we need that in the Editor. And since we get the child vbox - * from the plugin, we are finding the parent section and - * hiding it. This is a temporary fix and this needs to be handled - * in the proper way. */ - section = gtk_widget_get_parent (gtk_widget_get_parent (parent)); - gtk_widget_hide (section); - } - auth_section = gtk_entry_new (); - gtk_widget_hide (auth_section); - return auth_section; -} - -GtkWidget * -org_gnome_exchange_handle_send_auth_option (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - EMConfigTargetAccount *target_account; - EConfig *config; - char *account_url = NULL, *exchange_url = NULL, *url_string; - const char *source_url; - char *auth_type; - GtkWidget *auth_section=NULL, *parent, *section; - - config = data->config; - target_account = (EMConfigTargetAccount *)data->config->target; - - source_url = e_account_get_string (target_account->account, - E_ACCOUNT_SOURCE_URL); - account_url = g_strdup (source_url); - exchange_url = g_strrstr (account_url, "exchange"); - - if (exchange_url) { - parent = data->parent; - /* We don't need auth section while creating the account. But - * we need that in the Editor. And since we get the child vbox - * from the plugin, we are finding the parent section and - * hiding it. This is a temporary fix and this needs to be handled - * in the proper way. */ - section = gtk_widget_get_parent ( - gtk_widget_get_parent (gtk_widget_get_parent(parent))); - gtk_widget_hide (section); - } - auth_section = gtk_entry_new (); - gtk_widget_hide (auth_section); - return auth_section; -} - -gboolean -org_gnome_exchange_check_options (EPlugin *epl, EConfigHookPageCheckData *data) -{ - EMConfigTargetAccount *target_account; - EConfig *config; - char *account_url = NULL, *exchange_url = NULL, *url_string; - char *use_ssl = NULL; - static int page_check_count = 0; - CamelURL *url; - - if ((strcmp (data->pageid, "20.receive_options")) || page_check_count) - return TRUE; - - config = data->config; - target_account = (EMConfigTargetAccount *)data->config->target; - account_url = g_strdup (target_account->account->source->url); - exchange_url = g_strrstr (account_url, "exchange"); - - if (exchange_url) { - page_check_count ++; - - if (owa_entry_text){ - if (!strncmp (owa_entry_text, "https:", 6)) - use_ssl = "always"; - - url = camel_url_new_with_base (NULL, account_url); - - if (use_ssl) - camel_url_set_param (url, "use_ssl", use_ssl); - camel_url_set_param (url, "owa_url", owa_entry_text); - - url_string = camel_url_to_string (url, 0); - e_account_set_string (target_account->account, - E_ACCOUNT_SOURCE_URL, url_string); - camel_url_free (url); - } - } - return TRUE; -} diff --git a/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in b/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in deleted file mode 100644 index ab56919037..0000000000 --- a/plugins/exchange-account-setup/org-gnome-exchange-account-setup.eplug.in +++ /dev/null @@ -1,36 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.exchange-account-settings" - location="@PLUGINDIR@/liborg-gnome-exchange-account-settings.so" - load-on-startup="true" - name="Exchange Account Setup" - description="A pluign for Exchange account specific settings"> - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group - target="account" - id="org.gnome.evolution.mail.config.accountEditor" - check="org_gnome_exchange_check_options"> - <item type="page" - path="40.oof" - label="Exchange Settings" - factory="org_gnome_exchange_settings"/> - <item type="item_table" - path="10.receive/10.config/20.owa" - factory="org_gnome_exchange_owa_url"/> - </group> - - <group - target="account" - id="org.gnome.evolution.mail.config.accountDruid" - check="org_gnome_exchange_check_options"> - <item type="item_table" - path="10.receive/10.config/20.owa" - factory="org_gnome_exchange_owa_url"/> - </group> - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/folder-unsubscribe/.cvsignore b/plugins/folder-unsubscribe/.cvsignore deleted file mode 100644 index 0ead335993..0000000000 --- a/plugins/folder-unsubscribe/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile.in -Makefile -org-gnome-mail-folder-unsubscribe.eplug diff --git a/plugins/folder-unsubscribe/ChangeLog b/plugins/folder-unsubscribe/ChangeLog deleted file mode 100644 index a0434fc52a..0000000000 --- a/plugins/folder-unsubscribe/ChangeLog +++ /dev/null @@ -1,8 +0,0 @@ -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-28 Not Zed <NotZed@Ximian.com> - - * org-gnome-mail-folder-unsubscribe.eplug.in: fix hook id - diff --git a/plugins/folder-unsubscribe/Makefile.am b/plugins/folder-unsubscribe/Makefile.am deleted file mode 100644 index ca805d45d9..0000000000 --- a/plugins/folder-unsubscribe/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-mail-folder-unsubscribe.eplug -plugin_LTLIBRARIES = liborg-gnome-mail-folder-unsubscribe.la - -liborg_gnome_mail_folder_unsubscribe_la_SOURCES = folder-unsubscribe.c -liborg_gnome_mail_folder_unsubscribe_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-mail-folder-unsubscribe.eplug.in
\ No newline at end of file diff --git a/plugins/folder-unsubscribe/folder-unsubscribe.c b/plugins/folder-unsubscribe/folder-unsubscribe.c deleted file mode 100644 index b1900142f9..0000000000 --- a/plugins/folder-unsubscribe/folder-unsubscribe.c +++ /dev/null @@ -1,112 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Jeffrey Stedfast <fejj@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 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 Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <glib/gi18n.h> - -#include <string.h> - -#include <camel/camel-session.h> -#include <camel/camel-store.h> -#include <camel/camel-url.h> - -#include "mail/em-popup.h" -#include "mail/mail-mt.h" -#include "mail/mail-ops.h" - - -void org_gnome_mail_folder_unsubscribe (EPlugin *plug, EMPopupTargetFolder *target); - - - -struct _folder_unsub_t { - struct _mail_msg msg; - - char *uri; -}; - -static char * -folder_unsubscribe__desc (struct _mail_msg *mm, int done) -{ - struct _folder_unsub_t *unsub = (struct _folder_unsub_t *) mm; - - return g_strdup_printf (_("Unsubscribing from folder \"%s\""), unsub->uri); -} - -static void -folder_unsubscribe__unsub (struct _mail_msg *mm) -{ - struct _folder_unsub_t *unsub = (struct _folder_unsub_t *) mm; - extern CamelSession *session; - const char *path = NULL; - CamelStore *store; - CamelURL *url; - - if (!(store = camel_session_get_store (session, unsub->uri, &mm->ex))) - return; - - url = camel_url_new (unsub->uri, NULL); - if (((CamelService *) store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) - path = url->fragment; - else if (url->path && url->path[0]) - path = url->path + 1; - - if (path != NULL) - camel_store_unsubscribe_folder (store, path, &mm->ex); - - camel_url_free (url); -} - -static void -folder_unsubscribe__free (struct _mail_msg *mm) -{ - struct _folder_unsub_t *unsub = (struct _folder_unsub_t *) mm; - - g_free (unsub->uri); -} - -static struct _mail_msg_op unsubscribe_op = { - folder_unsubscribe__desc, - folder_unsubscribe__unsub, - NULL, - folder_unsubscribe__free, -}; - - -void -org_gnome_mail_folder_unsubscribe (EPlugin *plug, EMPopupTargetFolder *target) -{ - struct _folder_unsub_t *unsub; - - if (target->uri == NULL) - return; - - unsub = mail_msg_new (&unsubscribe_op, NULL, sizeof (struct _folder_unsub_t)); - unsub->uri = g_strdup (target->uri); - - e_thread_put (mail_thread_new, (EMsg *) unsub); -} diff --git a/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.in b/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.in deleted file mode 100644 index 5fd793a8a3..0000000000 --- a/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.in +++ /dev/null @@ -1,16 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin id="org.gnome.mail.folder.unsubscribe" - type="shlib" domain="evolution" name="Unsubscribe Folders" - location="@PLUGINDIR@/liborg-gnome-mail-folder-unsubscribe.so"> - <description>Allows unsubscribing folders in the folder tree context menu</description> - <author name="Jeffrey Stedfast" email="fejj@novell.com"/> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder"> - <item type="item" path="20.emc.03" label="_Unsubscribe" - activate="org_gnome_mail_folder_unsubscribe" - enable="delete" visible="delete"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/groupwise-account-setup/ChangeLog b/plugins/groupwise-account-setup/ChangeLog deleted file mode 100644 index 117d263206..0000000000 --- a/plugins/groupwise-account-setup/ChangeLog +++ /dev/null @@ -1,44 +0,0 @@ -2005-01-28 Sivaiah Nallagatla <snallagatla@novell.com> - - * camel-gw-listner.c (get_address_book_names_from_server) - : Remove leading "%s" in the message. Similar to - #36137 - -2005-01-23 Sivaiah Nallagatla <snalagatla@novell.com> - - * camel-gw-listener.c (add_esource) - (modify_esource) (add_addressbook_sources) : - Don't set offline_sync value taken from camel url - instead set "1" or "0" depending upon offline is enabled - or not - -2005-01-21 Sivaiah Nallagatla <snallagtla@novell.com> - - * org-gnome-gw-account-setup.eplug.in : changed - the item type from "item" to "item_table". avoids - some debug spew on the console - -2005-01-20 Sivaiah Nallagatla <snallagatla@novell.com> - - * camel-gw-listener.c: (add_calendar_tasks_sources): - Assiged value to URL. - -2005-01-15 Sivaiah Nallagatla <snallagatla@novell.com> - - * camel-gw-listner.c : use url->host instead of reading "poa" - parameter everywhere. use "use_ssl" param instead of soap_ssl - We not longer have separate settings for soap as we use soap for mail - now - -2004-12-17 Sivaiah Nallagatla <snallagatla@novell.com> - - * camel-gw-listner.c (add_esource) : read "soap_ssl" from - the camel url instead of "use_ssl" - -2004-12-15 Rodney Dawes <dobey@novell.com> - - * Makefile.am: Add camel-gw-listener.h to SOURCES - -2004-12-03 Sivaiah Nallagatla <snallagatla@novell.com> - - * initial check in diff --git a/plugins/groupwise-account-setup/Makefile.am b/plugins/groupwise-account-setup/Makefile.am deleted file mode 100644 index 62a52db90b..0000000000 --- a/plugins/groupwise-account-setup/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -INCLUDES = -I . \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(CAMEL_GROUPWISE_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-gw-account-setup.eplug -plugin_LTLIBRARIES = liborg-gnome-gw-account-setup.la - -liborg_gnome_gw_account_setup_la_SOURCES = \ - groupwise-account-setup.c \ - camel-gw-listener.c \ - camel-gw-listener.h - -liborg_gnome_gw_account_setup_la_LIBADD = \ - $(CAMEL_GROUPWISE_LIBS) \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/misc/libemiscwidgets.la - -liborg_gnome_gw_account_setup_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-gw-account-setup.eplug.in diff --git a/plugins/groupwise-account-setup/camel-gw-listener.c b/plugins/groupwise-account-setup/camel-gw-listener.c deleted file mode 100644 index 70b720d506..0000000000 --- a/plugins/groupwise-account-setup/camel-gw-listener.c +++ /dev/null @@ -1,898 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors : - * - * Sivaiah Nallagatla <snallagatla@novell.com> - * - * Copyright 2003, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include "camel-gw-listener.h" -#include <string.h> -#include <camel/camel-i18n.h> -#include <e-gw-connection.h> -#include <e-util/e-passwords.h> -#include "widgets/misc/e-error.h" - -/*stores some info about all currently existing groupwise accounts - list of GwAccountInfo structures */ - -static GList *groupwise_accounts = NULL; - -struct _CamelGwListenerPrivate { - GConfClient *gconf_client; - /* we get notification about mail account changes form this object */ - EAccountList *account_list; -}; - -struct _GwAccountInfo { - char *uid; - char *name; - char *source_url; -}; - -typedef struct _GwAccountInfo GwAccountInfo; - -#define GROUPWISE_URI_PREFIX "groupwise://" -#define GROUPWISE_PREFIX_LENGTH 12 - -#define PARENT_TYPE G_TYPE_OBJECT - -static GObjectClass *parent_class = NULL; - -static void dispose (GObject *object); -static void finalize (GObject *object); - - -static void -camel_gw_listener_class_init (CamelGwListenerClass *class) -{ - GObjectClass *object_class; - - parent_class = g_type_class_ref (PARENT_TYPE); - object_class = G_OBJECT_CLASS (class); - - /* virtual method override */ - object_class->dispose = dispose; - object_class->finalize = finalize; -} - -static void -camel_gw_listener_init (CamelGwListener *config_listener, CamelGwListenerClass *class) -{ - config_listener->priv = g_new0 (CamelGwListenerPrivate, 1); -} - -static void -dispose (GObject *object) -{ - CamelGwListener *config_listener = CAMEL_GW_LISTENER (object); - - g_object_unref (config_listener->priv->gconf_client); - g_object_unref (config_listener->priv->account_list); - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -finalize (GObject *object) -{ - CamelGwListener *config_listener = CAMEL_GW_LISTENER (object); - GList *list; - GwAccountInfo *info; - - if (config_listener->priv) { - g_free (config_listener->priv); - } - - for ( list = g_list_first (groupwise_accounts); list ; list = g_list_next (list) ) { - - info = (GwAccountInfo *) (list->data); - - if (info) { - - g_free (info->uid); - g_free (info->name); - g_free (info->source_url); - g_free (info); - } - } - - g_list_free (groupwise_accounts); -} - -/*determines whehter the passed in account is groupwise or not by looking at source url */ - -static gboolean -is_groupwise_account (EAccount *account) -{ - if (account->source->url != NULL) { - return (strncmp (account->source->url, GROUPWISE_URI_PREFIX, GROUPWISE_PREFIX_LENGTH ) == 0); - } else { - return FALSE; - } -} - -/* looks up for an existing groupwise account info in the groupwise_accounts list based on uid */ - -static GwAccountInfo* -lookup_account_info (const char *key) -{ - GList *list; - GwAccountInfo *info ; - int found = 0; - - if (!key) - return NULL; - - info = NULL; - - for (list = g_list_first (groupwise_accounts); list; list = g_list_next (list)) { - info = (GwAccountInfo *) (list->data); - found = (strcmp (info->uid, key) == 0); - if (found) - break; - } - if (found) - return info; - return NULL; -} - -#define CALENDAR_SOURCES "/apps/evolution/calendar/sources" -#define TASKS_SOURCES "/apps/evolution/tasks/sources" -#define SELECTED_CALENDARS "/apps/evolution/calendar/display/selected_calendars" -#define SELECTED_TASKS "/apps/evolution/calendar/tasks/selected_tasks" - -static void -add_esource (const char *conf_key, const char *group_name, const char *source_name, CamelURL *url) -{ - ESourceList *source_list; - ESourceGroup *group; - ESource *source; - GConfClient* client; - GSList *ids, *temp ; - char *source_selection_key; - char *relative_uri; - const char *soap_port; - const char * use_ssl; - const char *poa_address; - const char *offline_sync; - - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - soap_port = camel_url_get_param (url, "soap_port"); - - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - - use_ssl = camel_url_get_param (url, "use_ssl"); - - - offline_sync = camel_url_get_param (url, "offline_sync"); - - client = gconf_client_get_default(); - source_list = e_source_list_new_for_gconf (client, conf_key); - - group = e_source_group_new (group_name, GROUPWISE_URI_PREFIX); - if (!e_source_list_add_group (source_list, group, -1)) - return; - relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address); - - source = e_source_new (source_name, relative_uri); - e_source_set_property (source, "auth", "1"); - e_source_set_property (source, "username", url->user); - e_source_set_property (source, "port", camel_url_get_param (url, "soap_port")); - e_source_set_property (source, "auth-domain", "Groupwise"); - e_source_set_property (source, "use_ssl", use_ssl); - e_source_set_property (source, "offline_sync", offline_sync ? "1" : "0" ); - e_source_group_add_source (group, source, -1); - e_source_list_sync (source_list, NULL); - - if (!strcmp (conf_key, CALENDAR_SOURCES)) - source_selection_key = SELECTED_CALENDARS; - else if (!strcmp (conf_key, TASKS_SOURCES)) - source_selection_key = SELECTED_TASKS; - else source_selection_key = NULL; - if (source_selection_key) { - ids = gconf_client_get_list (client, source_selection_key , GCONF_VALUE_STRING, NULL); - ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source))); - gconf_client_set_list (client, source_selection_key, GCONF_VALUE_STRING, ids, NULL); - temp = ids; - for (; temp != NULL; temp = g_slist_next (temp)) - g_free (temp->data); - g_slist_free (ids); - } - - g_object_unref (source); - g_object_unref (group); - g_object_unref (source_list); - g_object_unref (client); - g_free (relative_uri); -} - - -static void -remove_esource (const char *conf_key, const char *group_name, char* source_name, const char* relative_uri) -{ - ESourceList *list; - ESourceGroup *group; - ESource *source; - GSList *groups; - GSList *sources; - gboolean found_group; - GConfClient* client; - GSList *ids; - GSList *node_tobe_deleted; - char *source_selection_key; - - client = gconf_client_get_default(); - list = e_source_list_new_for_gconf (client, conf_key); - groups = e_source_list_peek_groups (list); - - found_group = FALSE; - - for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); - - if (strcmp (e_source_group_peek_name (group), group_name) == 0 && - strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX ) == 0) { - - sources = e_source_group_peek_sources (group); - - for( ; sources != NULL; sources = g_slist_next (sources)) { - - source = E_SOURCE (sources->data); - - if (strcmp (e_source_peek_relative_uri (source), relative_uri) == 0) { - - if (!strcmp (conf_key, CALENDAR_SOURCES)) - source_selection_key = SELECTED_CALENDARS; - else if (!strcmp (conf_key, TASKS_SOURCES)) - source_selection_key = SELECTED_TASKS; - else source_selection_key = NULL; - if (source_selection_key) { - ids = gconf_client_get_list (client, source_selection_key , - GCONF_VALUE_STRING, NULL); - node_tobe_deleted = g_slist_find_custom (ids, e_source_peek_uid (source), (GCompareFunc) strcmp); - if (node_tobe_deleted) { - g_free (node_tobe_deleted->data); - ids = g_slist_delete_link (ids, node_tobe_deleted); - } - gconf_client_set_list (client, source_selection_key, - GCONF_VALUE_STRING, ids, NULL); - - } - e_source_list_remove_group (list, group); - e_source_list_sync (list, NULL); - found_group = TRUE; - break; - - } - } - - } - - - } - - g_object_unref (list); - g_object_unref (client); - -} - -/* looks up for e-source with having same info as old_account_info and changes its values passed in new values */ - -static void -modify_esource (const char* conf_key, GwAccountInfo *old_account_info, const char* new_group_name, CamelURL *new_url) -{ - ESourceList *list; - ESourceGroup *group; - ESource *source; - GSList *groups; - GSList *sources; - char *old_relative_uri; - CamelURL *url; - gboolean found_group; - GConfClient* client; - const char *poa_address; - char *new_relative_uri; - const char *new_poa_address; - - url = camel_url_new (old_account_info->source_url, NULL); - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - new_poa_address = new_url->host; - - old_relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address); - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, conf_key); - groups = e_source_list_peek_groups (list); - - found_group = FALSE; - - for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); - - if (strcmp (e_source_group_peek_name (group), old_account_info->name) == 0 && - strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX) == 0) { - - sources = e_source_group_peek_sources (group); - - for ( ; sources != NULL; sources = g_slist_next (sources)) { - - source = E_SOURCE (sources->data); - - if (strcmp (e_source_peek_relative_uri (source), old_relative_uri) == 0) { - - new_relative_uri = g_strdup_printf ("%s@%s/", new_url->user, new_poa_address); - e_source_group_set_name (group, new_group_name); - e_source_set_relative_uri (source, new_relative_uri); - e_source_set_property (source, "username", new_url->user); - e_source_set_property (source, "port", camel_url_get_param (new_url,"soap_port")); - e_source_set_property (source, "use_ssl", camel_url_get_param (url, "use_ssl")); - e_source_set_property (source, "offline_sync", camel_url_get_param (url, "offline_sync") ? "1" : "0"); - e_source_list_sync (list, NULL); - found_group = TRUE; - g_free (new_relative_uri); - break; - } - } - } - } - - g_object_unref (list); - g_object_unref (client); - camel_url_free (url); - g_free (old_relative_uri); - - -} -/* add sources for calendar and tasks if the account added is groupwise account - adds the new account info to groupwise_accounts list */ - -static void -add_calendar_tasks_sources (GwAccountInfo *info) -{ - CamelURL *url; - - url = camel_url_new (info->source_url, NULL); - add_esource ("/apps/evolution/calendar/sources", info->name, _("Calendar"), url); - add_esource ("/apps/evolution/tasks/sources", info->name, _("Tasks"), url); - - camel_url_free (url); - - -} - -/* removes calendar and tasks sources if the account removed is groupwise account - removes the the account info from groupwise_account list */ - -static void -remove_calendar_tasks_sources (GwAccountInfo *info) -{ - CamelURL *url; - char *relative_uri; - const char *soap_port; - const char *poa_address; - - url = camel_url_new (info->source_url, NULL); - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - - relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address); - remove_esource ("/apps/evolution/calendar/sources", info->name, _("Calendar"), relative_uri); - remove_esource ("/apps/evolution/tasks/sources", info->name, _("Checklist"), relative_uri); - camel_url_free (url); - g_free (relative_uri); - -} - -static GList* -get_addressbook_names_from_server (char *source_url) -{ - char *key; - EGwConnection *cnc; - char *password; - GList *book_list; - int status; - const char *soap_port; - CamelURL *url; - gboolean remember; - char *failed_auth; - char *prompt; - char *password_prompt; - char *uri; - const char *use_ssl; - const char *poa_address; - guint32 flags = E_PASSWORDS_REMEMBER_FOREVER; - - url = camel_url_new (source_url, NULL); - if (url == NULL) { - return NULL; - } - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return NULL; - - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - use_ssl = camel_url_get_param (url, "use_ssl"); - - key = g_strdup_printf ("groupwise://%s@%s/", url->user, poa_address); - - if (!g_str_equal (use_ssl, "never")) - uri = g_strdup_printf ("https://%s:%s/soap", poa_address, soap_port); - else - uri = g_strdup_printf ("http://%s:%s/soap", poa_address, soap_port); - - failed_auth = ""; - cnc = NULL; - do { - password_prompt = g_strdup_printf (_("Enter password for %s (user %s)"), - poa_address, url->user); - prompt = g_strconcat (failed_auth, password_prompt, NULL); - g_free (password_prompt); - password = e_passwords_ask_password (prompt, "Groupwise", key, prompt, - E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET, &remember, - NULL); - g_free (prompt); - - if (!password) - break; - cnc = e_gw_connection_new (uri, url->user, password); - if (!E_IS_GW_CONNECTION(cnc) && use_ssl && g_str_equal (use_ssl, "when-possible")) { - char *http_uri = g_strconcat ("http://", uri + 8, NULL); - cnc = e_gw_connection_new (http_uri, url->user, password); - g_free (http_uri); - } - failed_auth = _("Failed to authenticate.\n"); - flags |= E_PASSWORDS_REPROMPT; - } while (cnc == NULL); - - if (E_IS_GW_CONNECTION(cnc)) { - book_list = NULL; - status = e_gw_connection_get_address_book_list (cnc, &book_list); - if (status == E_GW_CONNECTION_STATUS_OK) - return book_list; - - - } - e_error_run (NULL, "mail:gw-accountsetup-error", poa_address, NULL); - return NULL; -} - - -static gboolean -add_addressbook_sources (EAccount *account) -{ - CamelURL *url; - ESourceList *list; - ESourceGroup *group; - ESource *source; - char *base_uri; - const char *soap_port; - GList *books_list, *temp_list; - GConfClient* client; - const char* use_ssl; - const char *poa_address; - - - url = camel_url_new (account->source->url, NULL); - if (url == NULL) { - return FALSE; - } - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return FALSE; - - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - use_ssl = camel_url_get_param (url, "use_ssl"); - base_uri = g_strdup_printf ("groupwise://%s@%s", url->user, poa_address); - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, "/apps/evolution/addressbook/sources" ); - group = e_source_group_new (account->name, base_uri); - books_list = get_addressbook_names_from_server (account->source->url); - temp_list = books_list; - if (!temp_list) - return FALSE; - for (; temp_list != NULL; temp_list = g_list_next (temp_list)) { - const char *book_name = e_gw_container_get_name (E_GW_CONTAINER(temp_list->data)); - source = e_source_new (book_name, g_strconcat (";",book_name, NULL)); - e_source_set_property (source, "auth", "plain/password"); - e_source_set_property (source, "auth-domain", "Groupwise"); - e_source_set_property (source, "port", soap_port); - e_source_set_property(source, "user", url->user); - e_source_set_property (source, "offline_sync", camel_url_get_param (url, "offline_sync") ? "1" : "0"); - if (!e_gw_container_get_is_writable (E_GW_CONTAINER(temp_list->data))) - e_source_set_property (source, "completion", "true"); - if (e_gw_container_get_is_frequent_contacts (E_GW_CONTAINER(temp_list->data))) - e_source_set_property (source, "completion", "true"); - e_source_set_property (source, "use_ssl", use_ssl); - e_source_group_add_source (group, source, -1); - g_object_unref (source); - g_object_unref (E_GW_CONTAINER(temp_list->data)); - - } - - g_list_free (books_list); - - - e_source_list_add_group (list, group, -1); - e_source_list_sync (list, NULL); - g_object_unref (group); - g_object_unref (list); - g_object_unref (client); - g_free (base_uri); - - return TRUE; -} - -static void -modify_addressbook_sources ( EAccount *account, GwAccountInfo *existing_account_info ) -{ - CamelURL *url; - ESourceList *list; - ESourceGroup *group; - GSList *groups; - gboolean found_group; - gboolean delete_group; - char *old_base_uri; - char *new_base_uri; - const char *soap_port; - const char *use_ssl; - GSList *sources; - ESource *source; - GConfClient *client; - const char *poa_address; - - - url = camel_url_new (existing_account_info->source_url, NULL); - if (url == NULL) { - return; - } - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - - old_base_uri = g_strdup_printf ("groupwise://%s@%s", url->user, poa_address); - camel_url_free (url); - - url = camel_url_new (account->source->url, NULL); - if (url == NULL) - return ; - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - new_base_uri = g_strdup_printf ("groupwise://%s@%s", url->user, poa_address); - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - use_ssl = camel_url_get_param (url, "use_ssl"); - - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, "/apps/evolution/addressbook/sources" ); - groups = e_source_list_peek_groups (list); - delete_group = FALSE; - if (strcmp (old_base_uri, new_base_uri) != 0) - delete_group = TRUE; - group = NULL; - found_group = FALSE; - for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); - if ( strcmp ( e_source_group_peek_base_uri(group), old_base_uri) == 0 && strcmp (e_source_group_peek_name (group), existing_account_info->name) == 0) { - found_group = TRUE; - if (!delete_group) { - e_source_group_set_name (group, account->name); - sources = e_source_group_peek_sources (group); - for (; sources != NULL; sources = g_slist_next (sources)) { - source = E_SOURCE (sources->data); - e_source_set_property (source, "port", soap_port); - e_source_set_property (source, "use_ssl", use_ssl); - } - - e_source_list_sync (list, NULL); - } - - } - } - if (found_group && delete_group) { - e_source_list_remove_group (list, group); - e_source_list_sync (list, NULL); - g_object_unref (list); - list = NULL; - add_addressbook_sources (account); - } - g_free (old_base_uri); - if (list) - g_object_unref (list); - camel_url_free (url); - g_object_unref (client); - - -} - -static void -remove_addressbook_sources (GwAccountInfo *existing_account_info) -{ - ESourceList *list; - ESourceGroup *group; - GSList *groups; - gboolean found_group; - CamelURL *url; - char *base_uri; - const char *soap_port; - GConfClient *client; - const char *poa_address; - - url = camel_url_new (existing_account_info->source_url, NULL); - if (url == NULL) { - return; - } - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - base_uri = g_strdup_printf ("groupwise://%s@%s", url->user, poa_address); - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, "/apps/evolution/addressbook/sources" ); - groups = e_source_list_peek_groups (list); - - found_group = FALSE; - - for ( ; groups != NULL && !found_group; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); - if ( strcmp ( e_source_group_peek_base_uri (group), base_uri) == 0 && strcmp (e_source_group_peek_name (group), existing_account_info->name) == 0) { - - e_source_list_remove_group (list, group); - e_source_list_sync (list, NULL); - found_group = TRUE; - - } - } - g_object_unref (list); - g_object_unref (client); - g_free (base_uri); - camel_url_free (url); - - -} - - - -static void -account_added (EAccountList *account_listener, EAccount *account) -{ - - GwAccountInfo *info; - gboolean status; - - if (!is_groupwise_account (account)) - return; - - info = g_new0 (GwAccountInfo, 1); - info->uid = g_strdup (account->uid); - info->name = g_strdup (account->name); - info->source_url = g_strdup (account->source->url); - status = add_addressbook_sources (account); - if (status) - add_calendar_tasks_sources (info); - groupwise_accounts = g_list_append (groupwise_accounts, info); - -} - -static void -account_removed (EAccountList *account_listener, EAccount *account) -{ - GwAccountInfo *info; - - if (!is_groupwise_account (account)) - return; - - info = lookup_account_info (account->uid); - if (info == NULL) { - return; - } - - remove_calendar_tasks_sources (info); - remove_addressbook_sources (info); - groupwise_accounts = g_list_remove (groupwise_accounts, info); - g_free (info->uid); - g_free (info->name); - g_free (info->source_url); - g_free (info); - - -} - - -static void -account_changed (EAccountList *account_listener, EAccount *account) -{ - gboolean is_gw_account; - CamelURL *old_url, *new_url; - const char *old_soap_port, *new_soap_port; - GwAccountInfo *existing_account_info; - const char *old_use_ssl, *new_use_ssl; - const char *old_poa_address, *new_poa_address; - - is_gw_account = is_groupwise_account (account); - - existing_account_info = lookup_account_info (account->uid); - - if (existing_account_info == NULL && is_gw_account) { - - if (!account->enabled) - return; - - /* some account of other type is changed to Groupwise */ - account_added (account_listener, account); - - } else if ( existing_account_info != NULL && !is_gw_account) { - - /*Groupwise account is changed to some other type */ - remove_calendar_tasks_sources (existing_account_info); - remove_addressbook_sources (existing_account_info); - groupwise_accounts = g_list_remove (groupwise_accounts, existing_account_info); - g_free (existing_account_info->uid); - g_free (existing_account_info->name); - g_free (existing_account_info->source_url); - g_free (existing_account_info); - - } else if ( existing_account_info != NULL && is_gw_account ) { - - if (!account->enabled) { - account_removed (account_listener, account); - return; - } - - /* some info of groupwise account is changed . update the sources with new info if required */ - old_url = camel_url_new (existing_account_info->source_url, NULL); - old_poa_address = old_url->host; - old_soap_port = camel_url_get_param (old_url, "soap_port"); - old_use_ssl = camel_url_get_param (old_url, "use_ssl"); - new_url = camel_url_new (account->source->url, NULL); - new_poa_address = new_url->host; - if (!new_poa_address || strlen (new_poa_address) ==0) - return; - new_soap_port = camel_url_get_param (new_url, "soap_port"); - if (!new_soap_port || strlen (new_soap_port) == 0) - new_soap_port = "7191"; - - new_use_ssl = camel_url_get_param (new_url, "use_ssl"); - - - if ((old_poa_address && strcmp (old_poa_address, new_poa_address)) - || (old_soap_port && strcmp (old_soap_port, new_soap_port)) - || strcmp (old_url->user, new_url->user) - || strcmp (old_use_ssl, new_use_ssl)) { - - account_removed (account_listener, account); - account_added (account_listener, account); - } else if (strcmp (existing_account_info->name, account->name)) { - - modify_esource ("/apps/evolution/calendar/sources", existing_account_info, account->name, new_url); - modify_esource ("/apps/evolution/tasks/sources", existing_account_info, account->name, new_url); - modify_addressbook_sources (account, existing_account_info); - - } - - g_free (existing_account_info->name); - g_free (existing_account_info->source_url); - existing_account_info->name = g_strdup (account->name); - existing_account_info->source_url = g_strdup (account->source->url); - camel_url_free (old_url); - camel_url_free (new_url); - } - - -} - - - -static void -camel_gw_listener_construct (CamelGwListener *config_listener) -{ - EIterator *iter; - EAccount *account; - GwAccountInfo *info ; - - config_listener->priv->account_list = e_account_list_new (config_listener->priv->gconf_client); - - for ( iter = e_list_get_iterator (E_LIST ( config_listener->priv->account_list) ) ; e_iterator_is_valid (iter); e_iterator_next (iter) ) { - - account = E_ACCOUNT (e_iterator_get (iter)); - if ( is_groupwise_account (account) && account->enabled) { - - info = g_new0 (GwAccountInfo, 1); - info->uid = g_strdup (account->uid); - info->name = g_strdup (account->name); - info->source_url = g_strdup (account->source->url); - groupwise_accounts = g_list_append (groupwise_accounts, info); - - } - - } - g_signal_connect (config_listener->priv->account_list, "account_added", G_CALLBACK (account_added), NULL); - g_signal_connect (config_listener->priv->account_list, "account_changed", G_CALLBACK (account_changed), NULL); - g_signal_connect (config_listener->priv->account_list, "account_removed", G_CALLBACK (account_removed), NULL); - - -} - -GType -camel_gw_listener_get_type (void) -{ - static GType camel_gw_listener_type = 0; - - if (!camel_gw_listener_type) { - static GTypeInfo info = { - sizeof (CamelGwListenerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) camel_gw_listener_class_init, - NULL, NULL, - sizeof (CamelGwListener), - 0, - (GInstanceInitFunc) camel_gw_listener_init - }; - camel_gw_listener_type = g_type_register_static (PARENT_TYPE, "CamelGwListener", &info, 0); - } - - return camel_gw_listener_type; -} - -CamelGwListener* -camel_gw_listener_new () -{ - CamelGwListener *config_listener; - - config_listener = g_object_new (CAMEL_TYPE_GW_LISTENER, NULL); - config_listener->priv->gconf_client = gconf_client_get_default(); - - camel_gw_listener_construct (config_listener); - - return config_listener; - -} - - diff --git a/plugins/groupwise-account-setup/camel-gw-listener.h b/plugins/groupwise-account-setup/camel-gw-listener.h deleted file mode 100644 index bf1df856a6..0000000000 --- a/plugins/groupwise-account-setup/camel-gw-listener.h +++ /dev/null @@ -1,63 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors : - * - * Sivaiah Nallagatla <snallagatla@novell.com> - * - * Copyright 2003, 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., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - - -#ifndef CAMEL_GW_LISTENER_H -#define CAMEL_GW_LISTENER_H - - -#include <libedataserver/e-account-list.h> -#include<libedataserver/e-source.h> -#include<libedataserver/e-source-list.h> -#include <camel/camel-url.h> - -G_BEGIN_DECLS - -#define CAMEL_TYPE_GW_LISTENER (camel_gw_listener_get_type ()) -#define CAMEL_GW_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAMEL_TYPE_GW_LISTENER, CamelGwListener)) -#define CAMEL_GW_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAMEL_TYPE_GW_LISTENER, CamelGWListenerClass)) -#define CAMEL_IS_GWLISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAMEL_TYPE_GW_LISTENER)) -#define CAMEL_IS_GW_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CAMEL_TYPE_GW_LISTENER)) - -typedef struct _CamelGwListener CamelGwListener; -typedef struct _CamelGwListenerClass CamelGwListenerClass; -typedef struct _CamelGwListenerPrivate CamelGwListenerPrivate; -struct _CamelGwListener { - GObject parent; - - CamelGwListenerPrivate *priv; -}; - -struct _CamelGwListenerClass { - GObjectClass parent_class; - - -}; - -GType camel_gw_listener_get_type (void); -CamelGwListener *camel_gw_listener_new (void); - -G_END_DECLS - -#endif - diff --git a/plugins/groupwise-account-setup/groupwise-account-setup.c b/plugins/groupwise-account-setup/groupwise-account-setup.c deleted file mode 100644 index 930585e74d..0000000000 --- a/plugins/groupwise-account-setup/groupwise-account-setup.c +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Sivaiah Nallagatla <snallagatla@novell.com> - * Copyright (C) 2004 Novell, Inc. - * - * Permission is hereby granted, free of charge, to any person - * obtaining a copy of this software and associated documentation - * files (the "Software"), to deal in the Software without - * restriction, including without limitation the rights to use, copy, - * modify, merge, publish, distribute, sublicense, and/or sell copies - * of the Software, and to permit persons to whom the Software is - * furnished to do so, subject to the following conditions: - * - * The above copyright notice and this permission notice shall be - * included in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, - * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND - * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT - * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, - * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, - * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER - * DEALINGS IN THE SOFTWARE. - */ - - -#include "camel-gw-listener.h" -#include <gtk/gtk.h> -#include "mail/em-config.h" - -static CamelGwListener *config_listener = NULL; - -int e_plugin_lib_enable (EPluginLib *ep, int enable); -GtkWidget* org_gnome_gw_account_setup(struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); - -static void -free_groupwise_listener ( void ) -{ - g_object_unref (config_listener); -} - -int -e_plugin_lib_enable (EPluginLib *ep, int enable) -{ - if (!config_listener) { - config_listener = camel_gw_listener_new (); - g_atexit ( free_groupwise_listener ); - } - - return 0; -} - - -GtkWidget * -org_gnome_gw_account_setup(struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data) -{ - GtkWidget *w; - - if (data->old) - return data->old; - /* FIXME, with new soap camel provider we don't need extra settings in receiving options page, Remove them - from camel-groupwise-provider.c once soap provider is ready and add any groupwise sepcific settings like "add contacts automatically to Frequent contacts folder" here*/ - - w = gtk_invisible_new (); - return w; -} diff --git a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.in b/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.in deleted file mode 100644 index 33994fc620..0000000000 --- a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.in +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.gw-account-setup" - location="@PLUGINDIR@/liborg-gnome-gw-account-setup.so" - load-on-startup="true" - name="Groupwise Account Setup" - description="A pluign to setup groupwise calendar and contacts sources"> - - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountDruid"> - <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_gw_account_setup"/> - </group> - </hook> - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountEditor"> - <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_gw_account_setup"/> - </group> - </hook> - - - </e-plugin> -</e-plugin-list> diff --git a/plugins/groupwise-send-options/ChangeLog b/plugins/groupwise-send-options/ChangeLog deleted file mode 100755 index f005c16cd6..0000000000 --- a/plugins/groupwise-send-options/ChangeLog +++ /dev/null @@ -1,13 +0,0 @@ -2005-02-03 Chenthill Palanisamy <pchenthill@novell.com> - - * send-options.c: (add_day_to_time), (send_options_commit), - (org_gnome_compose_send_options):Added functions to destroy - the dialog when the composer is destroyed to solve the crash. - Removed the return statement so that the send options gets - added to the composer headers. Made modification in setting - the values for some headers. - Changing the file name from Changelog to ChangeLog. - -2005-01-10 Parthasarathi@novell.com <sparthasarathi@novell.com> - - * initial check in for groupwise send options diff --git a/plugins/groupwise-send-options/Makefile.am b/plugins/groupwise-send-options/Makefile.am deleted file mode 100644 index b30ce1f03e..0000000000 --- a/plugins/groupwise-send-options/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-compose-send-options.eplug org-gnome-compose-send-options.xml -plugin_LTLIBRARIES = liborg-gnome-compose-send-options.la - -liborg_gnome_compose_send_options_la_SOURCES = send-options.c send-options.h -liborg_gnome_compose_send_options_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = \ - org-gnome-compose-send-options.eplug.in \ - org-gnome-compose-send-options.xml diff --git a/plugins/groupwise-send-options/org-gnome-compose-send-options.eplug.in b/plugins/groupwise-send-options/org-gnome-compose-send-options.eplug.in deleted file mode 100644 index 2fc06d389e..0000000000 --- a/plugins/groupwise-send-options/org-gnome-compose-send-options.eplug.in +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.compose.sendoptions" - location="@PLUGINDIR@/liborg-gnome-compose-send-options.so" - name="Send options in compose for GW"> - <description>Lets you have the send options menu item in the composer window for groupwise mails</description> - <author name="Parthasarathi Susarla" email="sparthasarathi@novell.com"/> - - <!-- hook into the popup menu --> - <hook class="org.gnome.evolution.mail.bonobomenu:1.0"> - <menu id="org.gnome.evolution.mail.composer" target="select"> - <ui file="@PLUGINDIR@/org-gnome-compose-send-options.xml"/> - <item - type="item" - verb="EPSOSendOptions" - path="/commands/EPSOSendOptions" - enable="one" - activate="org_gnome_compose_send_options"/> - </menu> - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/groupwise-send-options/org-gnome-compose-send-options.xml b/plugins/groupwise-send-options/org-gnome-compose-send-options.xml deleted file mode 100644 index c5947c6a33..0000000000 --- a/plugins/groupwise-send-options/org-gnome-compose-send-options.xml +++ /dev/null @@ -1,17 +0,0 @@ -<Root> - <commands> - <cmd name="EPSOSendOptions" _label="Send Options" - _tip="Add Send Options to groupwise messages"/> - </commands> - - <menu> - <submenu name="Insert"> - <placeholder name="Component"> - <separator f="" name="sendoptions1"/> - <menuitem name="EPSOSendOptions" verb=""/> - <separator f="" name="sendoptions2"/> - </placeholder> - </submenu> - - </menu> -</Root> diff --git a/plugins/groupwise-send-options/send-options.c b/plugins/groupwise-send-options/send-options.c deleted file mode 100644 index 7e8d71d610..0000000000 --- a/plugins/groupwise-send-options/send-options.c +++ /dev/null @@ -1,144 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Parthasarathi Susarla <sparthasarathi@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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> -#include <stdio.h> - -#include <glib.h> -#include <glib/gi18n.h> - -#include "send-options.h" - -#include "mail/em-menu.h" -#include "mail/em-utils.h" - -#include "composer/e-msg-composer.h" -#include "e-util/e-account.h" - -#include "widgets/misc/e-send-options.h" - -static ESendOptionsDialog * dialog = NULL ; - -void org_gnome_compose_send_options (EPlugin *ep, EMMenuTargetWidget *t); - -static time_t -add_day_to_time (time_t time, int days) -{ - struct tm *tm; - - tm = localtime (&time); - tm->tm_mday += days; - tm->tm_isdst = -1; - - return mktime (tm); -} - -static void -send_options_commit (EMsgComposer *comp, gpointer user_data) -{ - if (!user_data && !E_IS_SENDOPTIONS_DIALOG (user_data)) - return; - - if (dialog) { - g_object_unref (dialog); - dialog = NULL; - } -} - -void -org_gnome_compose_send_options (EPlugin *ep, EMMenuTargetWidget *t) -{ - struct _EMenuTarget menu = t->target ; - EMsgComposer *comp = (struct _EMsgComposer *)menu.widget ; - EAccount *account = NULL; - char *temp = NULL; - char *url; - char value [100]; - - account = e_msg_composer_get_preferred_account (comp) ; - url = g_strdup (account->transport->url) ; - temp = strstr (url, "groupwise") ; - if (!temp) { - g_print ("Sorry send options only available for a groupwise account\n") ; - } - g_free (temp) ; - /*disply the send options dialog*/ - if (!dialog) { - g_print ("New dialog\n\n") ; - dialog = e_sendoptions_dialog_new () ; - } - - e_sendoptions_dialog_run (dialog, menu.widget, E_ITEM_MAIL) ; - - if (dialog->data->gopts->reply_enabled) { - if (dialog->data->gopts->reply_convenient) - e_msg_composer_add_header (comp, X_REPLY_CONVENIENT ,"1" ) ; - else if (dialog->data->gopts->reply_within) { - time_t t; - t = add_day_to_time (time (NULL), dialog->data->gopts->reply_convenient); - strftime (value, 17, "%Y%m%dT%H%M%SZ", gmtime (&t)); - e_msg_composer_add_header (comp, X_REPLY_WITHIN , value) ; - } - } - - if (dialog->data->gopts->expiration_enabled) { - if (dialog->data->gopts->expire_after != 0) { - time_t t; - t = add_day_to_time (time (NULL), dialog->data->gopts->expire_after); - strftime (value, 17, "%Y%m%dT%H%M%SZ", gmtime (&t)); - e_msg_composer_add_header (comp, X_EXPIRE_AFTER, value) ; - } - } - if (dialog->data->gopts->delay_enabled) { - strftime (value, 17, "%Y%m%dT%H%M%SZ", gmtime (&dialog->data->gopts->delay_until)); - e_msg_composer_add_header (comp, X_DELAY_UNTIL, value) ; - } - - /*Status Tracking Options*/ - if (dialog->data->sopts->tracking_enabled) { - temp = g_strdup_printf ("%d",dialog->data->sopts->track_when) ; - e_msg_composer_add_header (comp, X_TRACK_WHEN, temp) ; - g_free (temp) ; - } - - if (dialog->data->sopts->autodelete) { - e_msg_composer_add_header (comp, X_AUTODELETE, "1") ; - } - if (dialog->data->sopts->opened) { - temp = g_strdup_printf ("%d",dialog->data->sopts->opened) ; - e_msg_composer_add_header (comp, X_RETURN_NOTIFY_OPEN, temp) ; - g_free (temp) ; - } - if (dialog->data->sopts->declined) { - temp = g_strdup_printf ("%d",dialog->data->sopts->declined) ; - e_msg_composer_add_header (comp, X_RETURN_NOTIFY_DECLINE, temp) ; - g_free (temp) ; - } - - g_signal_connect (GTK_WIDGET (comp), "destroy", - G_CALLBACK (send_options_commit), dialog); -} - - diff --git a/plugins/groupwise-send-options/send-options.h b/plugins/groupwise-send-options/send-options.h deleted file mode 100644 index 76c79a2a00..0000000000 --- a/plugins/groupwise-send-options/send-options.h +++ /dev/null @@ -1,40 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Parthasarathi Susarla <sparthasarathi@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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifndef __GW_SEND_OPTIONS__ -#define __GW_SEND_OPTIONS__ - -/*Headers for send options*/ -#define X_SEND_OPTIONS "X-gw-send-options" -/*General Options*/ -#define X_SEND_OPT_PRIORITY "X-gw-send-opt-priority" -#define X_REPLY_CONVENIENT "X-reply-convenient" -#define X_REPLY_WITHIN "X-reply-within" -#define X_EXPIRE_AFTER "X-expire-after" -#define X_DELAY_UNTIL "X-delay-until" - -/*Status Tracking Options*/ -#define X_TRACK_WHEN "X-track-when" -#define X_AUTODELETE "X-auto-delete" -#define X_RETURN_NOTIFY_OPEN "X-return-notify-open" -#define X_RETURN_NOTIFY_DECLINE "X-return-notify-decline" - -#endif /*__GW_SEND_OPTIONS__*/ diff --git a/plugins/groupwise-status-tracking/Changelog b/plugins/groupwise-status-tracking/Changelog deleted file mode 100644 index 48d92a1184..0000000000 --- a/plugins/groupwise-status-tracking/Changelog +++ /dev/null @@ -1,3 +0,0 @@ -2005-01-20 Parthasarathi Susarla <sparthasarathi@novell.com> Chenthill Palanisamy <pchenthill@novell.com> - - * first commit of the status tracking plugin diff --git a/plugins/groupwise-status-tracking/Makefile.am b/plugins/groupwise-status-tracking/Makefile.am deleted file mode 100644 index cc1aeac51c..0000000000 --- a/plugins/groupwise-status-tracking/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(CAMEL_GROUPWISE_CFLAGS) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-status-track.eplug -plugin_LTLIBRARIES = liborg-gnome-status-track.la - -liborg_gnome_status_track_la_SOURCES = status-track.c -liborg_gnome_status_track_la_LIBADD = $(CAMEL_GROUPWISE_LIBS) -liborg_gnome_status_track_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-status-track.eplug.in diff --git a/plugins/groupwise-status-tracking/org-gnome-status-track.eplug.in b/plugins/groupwise-status-tracking/org-gnome-status-track.eplug.in deleted file mode 100644 index a2d3d4bee4..0000000000 --- a/plugins/groupwise-status-tracking/org-gnome-status-track.eplug.in +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.status.track" - location="@PLUGINDIR@/liborg-gnome-status-track.so" - name="Track status of a sent mail in a groupwise account"> - <description>A plugin which allows status tracking. This is applicable for groupwise mailboxes only</description> - <author name="Parthasarathi Susarla" email="sparthasarathi@novell.com"/> - - <!-- hook into the uri popup menu --> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.folderview.popup" target="select"> - <item - type="item" - path="21.gw_status_tracking" - label="Track Message Status" - enable="one" - visible="one" - activate="org_gnome_track_status"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> - diff --git a/plugins/groupwise-status-tracking/status-track.c b/plugins/groupwise-status-tracking/status-track.c deleted file mode 100644 index e4b208a812..0000000000 --- a/plugins/groupwise-status-tracking/status-track.c +++ /dev/null @@ -1,237 +0,0 @@ -/* - * Copyright (C) 2004 Novell, Inc. - * - * Author(s): Chenthill Palanisamy <pchenthill@novell.com> - * Parthasarathi Susarla <sparthasarathi@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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib/gi18n-lib.h> -#include <string.h> -#include <stdio.h> -#include <time.h> -#include <gtk/gtk.h> - -#include "camel/camel-folder.h" -#include "camel/camel-medium.h" -#include "camel/camel-mime-message.h" -#include "mail/em-popup.h" - -#include <e-gw-connection.h> - - -void org_gnome_track_status (void *ep, EMPopupTargetSelect *t) ; -void add_recipient (GtkTable *table, char *recp, int row) ; -int add_detail (GtkTable *table, char *label, char *value, int row) ; - -void -add_recipient (GtkTable *table, char *recp, int row) -{ - GtkWidget *widget ; - - widget = gtk_label_new (recp) ; - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); -} - -int -add_detail (GtkTable *table, char *label, char *value, int row) -{ - GtkWidget *widget ; - time_t time = e_gw_connection_get_date_from_string (value) ; - char *str = ctime (&time) ; - - str [strlen(str)-1] = '\0' ; - - widget = gtk_label_new (label); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0); - widget = gtk_label_new (str); - gtk_table_attach (table, widget , 2, 3, row, row + 1, GTK_FILL, 0, 0, 0); - row++; - return row ; -} -/* - * The format for the options is: - * 0 1 2 3 4 5 6 7 8 9 - * X-gw-status-opt: /TO/CC/BCC;name;email;delivered;opened;accepted;deleted;declined;completed;undelivered:: - */ -void org_gnome_track_status (void *ep, EMPopupTargetSelect *t) -{ - CamelMimeMessage *msg = NULL ; - const CamelInternetAddress *from ; - const char *namep, *addp ; - - GtkDialog *d ; - GtkTable *table ; - GtkWidget *widget; - GtkScrolledWindow *win; - GtkVBox *vbox; - - time_t time ; - char *time_str ; - - const char *status = NULL ; - char **temp1 = NULL, **temp2 = NULL , **ptr = NULL, *str = NULL ; - - int row = 0; - - /*check if it is a groupwise account*/ - str = strstr (t->uri, "groupwise") ; - if (!str) { - g_warning ("Status tracking available for groupwise account only") ; - return ; - } - str = strstr (t->uri, "Sent Items") ; - if (!str) { - g_warning ("Status tracking available for a sent folder only") ; - return ; - } - - /*Get message*/ - msg = camel_folder_get_message (t->folder, g_ptr_array_index (t->uids, 0), NULL); - if (!msg) { - g_print ("Error!! No message\n") ; - return ; - } - status = camel_medium_get_header ( CAMEL_MEDIUM(msg), "X-gw-status-opt") ; - if (!status) { - g_print ("Error!! No header\n") ; - return ; - } - - /*Create the dialog*/ - d = (GtkDialog *) gtk_dialog_new (); - gtk_dialog_add_button (d, GTK_STOCK_OK, GTK_RESPONSE_OK); - gtk_window_set_title (GTK_WINDOW (d), "Message Status"); - - table = (GtkTable *) gtk_table_new (1, 2, FALSE); - win = (GtkScrolledWindow *) gtk_scrolled_window_new (NULL, NULL); - gtk_container_add (GTK_CONTAINER (GTK_DIALOG(d)->vbox), GTK_WIDGET (win)); - vbox = (GtkVBox *) gtk_vbox_new (FALSE, 12); - gtk_scrolled_window_add_with_viewport (win, GTK_WIDGET(vbox)); - gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, TRUE, 0); - gtk_scrolled_window_set_policy (win, GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - gtk_table_set_col_spacings (table ,12); - gtk_table_set_row_spacings (table, 6); - - /*Subject*/ - widget = gtk_label_new ("<b>Subject</b> :"); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); - gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - widget = gtk_label_new (camel_mime_message_get_subject(msg)); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0); - row++; - - /*From*/ - from = camel_mime_message_get_from (msg) ; - camel_internet_address_get (from, 0, &namep, &addp) ; - widget = gtk_label_new ("<b>From</b> :"); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); - gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - widget = gtk_label_new (namep); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0); - row++; - - /*creation date*/ - time = camel_mime_message_get_date (msg, NULL) ; - time_str = ctime (&time) ; - time_str[strlen(time_str)-1] = '\0' ; - widget = gtk_label_new ("<b>Creation date</b> :"); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); - gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - widget = gtk_label_new (time_str); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0); - row++; - - /*spacing*/ - widget = gtk_label_new (""); - gtk_table_attach (table, widget, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - row++; - - /*Table headers*/ - row = 0; - table = (GtkTable *) gtk_table_new (1, 3, FALSE); - gtk_table_set_col_spacings (table ,12); - gtk_table_set_row_spacings (table, 6); - gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, TRUE, 0); - widget = gtk_label_new ("<b>Recipients </b>"); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); - gtk_table_attach (table, widget , 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); - widget = gtk_label_new ("<b>Action</b>"); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); - gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0); - widget = gtk_label_new ("<b>Date and Time</b>"); - gtk_misc_set_alignment (GTK_MISC (widget), 0.0, 0.5); - gtk_label_set_use_markup (GTK_LABEL (widget), TRUE); - gtk_table_attach (table, widget , 2, 3, row, row + 1, GTK_FILL, 0, 0, 0); - row++; - - - temp1 = g_strsplit (status, "::", -1) ; - ptr = temp1 ; - str = *ptr ; - while (str) { - temp2 = g_strsplit (str, ";", -1) ; - if (*temp2) { - if (strlen(temp2[0])); - if (strlen(temp2[1])) - add_recipient (table, temp2[1], row) ; - if (strlen(temp2[2])); - if (strlen(temp2[3])) - row = add_detail (table,"delivered" , temp2[3], row) ; - if (strlen(temp2[4])) - row = add_detail (table,"opened" , temp2[3], row) ; - if (strlen(temp2[5])) - row = add_detail (table,"accepted" , temp2[3], row) ; - if (strlen(temp2[6])) - row = add_detail (table,"deleted" , temp2[3], row) ; - if (strlen(temp2[7])) - row = add_detail (table,"declined" , temp2[3], row) ; - if (strlen(temp2[8])) - row = add_detail (table,"completed" , temp2[3], row) ; - if (strlen(temp2[9])) - row = add_detail (table,"undelivered" , temp2[3], row) ; - } - str = *(++ptr) ; - g_strfreev (temp2) ; - } - - /*set size and display the dialog*/ - gtk_widget_set_usize (GTK_WIDGET (win), 400, 300); - gtk_widget_show_all (GTK_WIDGET (d)); - if (gtk_dialog_run (d) == GTK_RESPONSE_OK) - gtk_widget_destroy (GTK_WIDGET (d)); - else - gtk_widget_destroy (GTK_WIDGET (d)); - - - g_strfreev (temp1) ; - -} diff --git a/plugins/itip-formatter/.cvsignore b/plugins/itip-formatter/.cvsignore deleted file mode 100644 index 12b8e0db22..0000000000 --- a/plugins/itip-formatter/.cvsignore +++ /dev/null @@ -1,6 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug -org-gnome-itip-formatter-errors.xml.h diff --git a/plugins/itip-formatter/ChangeLog b/plugins/itip-formatter/ChangeLog deleted file mode 100644 index b30de7136d..0000000000 --- a/plugins/itip-formatter/ChangeLog +++ /dev/null @@ -1,339 +0,0 @@ -2005-03-03 Rodney Dawes <dobey@novell.com> - - * itip-view.c (itip_view_init): Set the spacing for ourself to 12 - to be HIG compliant as we are a GtkHBox derivative - Align the icon at 0.5 in the X direction to be HIG compliant - Set the spacing between table rows/columns to be HIG compliant - Fix the spacing/padding for all the boxes and packing calls to be - HIG compliant - - Fixes #41235 - -2005-02-02 Chenthill Palanisamy <pchenthill@novell.com> - - reviewed by Harish Krishnaswamy <kharish@novell.com> - - Fixes #71460 - * itip-formatter.c: (view_response_cb): If the my_address - is not set. Set it from the backend. - -2005-01-27 JP Rosevear <jpr@novell.com> - - * itip-view.c (format_date_and_time_x): make tomorrow and this - week strings work properly - -2005-01-27 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (find_cal_opened_cb): remove debug test - -442005-01-27 JP Rosevear <jpr@novell.com> - - * itip-formatter.c: add some debugging spew - -2005-01-27 Rodrigo Moya <rodrigo@novell.com> - - * itip-formatter.c (update_attendee_status): deal with the itip - message having an individual instance. - -2005-01-26 JP Rosevear <jpr@novell.com> - - Fixes #71485 - - * itip-formatter.c (update_attendee_status): fix message paste-o - - * itip-view.c (format_date_and_time_x): improve translator - comments - -2005-01-25 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (pitip_free): actually destroy the client - hashes so the signals get cleaned up - (format_itip): create a proper unique classid for the pobject - -2005-01-14 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (extract_itip_data): use - camel_data_wrapper_decode_to_stream instead of - camel_data_wrapper_write_to_stream - -2005-01-14 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (format_itip_object): handle UTC dtstart/dtend - properly - -2005-01-11 JP Rosevear <jpr@novell.com> - - Fixes #29985 - - * itip-formatter.c (view_response_cb): set the message flags to - answered if we send successfully - -2005-01-11 Harish Krishnaswamy <kharish@novell.com> - - * itip-formatter.c (update_item): Fixed a compiler warning. - -2005-01-10 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (update_item): set to the new items, duh - -2005-01-10 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (update_item): compare pointers instead of - content id - -2005-01-10 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (update_item): first crack at saving - attachments for the backend - (extract_itip_data): tell the user what to do for more than one - attachment - -2005-01-09 JP Rosevear <jpr@novell.com> - - * itip-view.h: remove error mode - - * itip-formatter.c (set_itip_error): show error information to the - user - (extract_itip_data): use above - (format_itip_object): no more "error" mode - -2005-01-09 JP Rosevear <jpr@novell.com> - - * itip-view.c (itip_view_set_delegator): accessor - (itip_view_get_delegator): ditto - - * itip-view.h: new protos - - * itip-formatter.c (extract_itip_data): put delegate sections back - in and handle default reminder - (format_itip_object): set the delegator for requests, find the - delegator calendar if necessary - -2005-01-09 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (idle_open_cb): launch an evolution window - pointing at the calendar date of the appointment - (view_response_cb): use it - -2005-01-09 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (find_cal_opened_cb): only check for conflicts - if the source has the conflict property - (initialize_selection): select the "conflict" sources in the - selector - (source_selection_changed): update the source properties - (itip_formatter_page_factory): include the source selector for - selecting conflict checking calendars - -2005-01-08 Harish Krishnaswamy <kharish@novell.com> - - * itip-formatter.c: (send_item), (view_response_cb): - update itip_send_comp calls with the new prototype. - -2005-01-07 JP Rosevear <jpr@novell.com> - - * itip-view.h: new protos - - * itip-view.c (set_tasklist_sender_text): task sender messages - (set_calendar_sender_text): calendar sender messages - (set_sender_text): select above as appropriate - (itip_view_set_item_type): accessor - (itip_view_get_item_type): ditto - - * itip-formatter.c (find_cal_opened_cb): messages for - meetings/tasks/journals - (send_item): ditto - (format_itip_object): ditto - (itip_formatter_page_factory): change page title - -2005-01-07 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (view_response_cb): ensure there is only one - attendee in the RSVP even if the user is duplicated - -2005-01-07 JP Rosevear <jpr@novell.com> - - * itip-view.h: protos - - * itip-view.c (rsvp_toggled_cb): set comment sensitivity - (itip_view_init): add comment entry - (itip_view_set_rsvp): make comment entry sensitive when rsvp is - (itip_view_set_rsvp_comment): accessor - (itip_view_get_rsvp_comment): ditto - - * itip-formatter.c (find_cal_opened_cb): set error message if we - can't find the item - (view_response_cb): add comment if the user sets one - -2005-01-07 JP Rosevear <jpr@novell.com> - - * itip-view.h: add protos - - * itip-view.c (set_sender_text): update descriptions better - (set_status_text): show/hide status - (set_comment_text): show/hide comment - (set_buttons): update buttons for add an refresh - (itip_view_destroy): free comment/status - (itip_view_init): add status/comment widgets - (itip_view_set_status): accessor - (itip_view_get_status): ditto - (itip_view_set_comment): ditto - (itip_view_get_comment): ditto - - * itip-formatter.c (find_cal_opened_cb): make sure rsvp is off for - publish - (format_itip_object): decline counter is sent by an organizer; set - status and comment when appropriate - -2005-01-05 Rodney Dawes <dobey@novell.com> - - * Makefile.am: Dist the errors data properly, and add the .eplug - output file to BUILT_SOURCES - -2005-01-03 Rodney Dawes <dobey@novell.com> - - * itip-formatter.c (format_itip_object): Don't do set_usize () - on the container - -2005-01-03 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (format_itip_object): load accounts - -2005-01-03 JP Rosevear <jpr@novell.com> - - * org-gnome-itip-formatter-errors.xml: remove unused message - - * itip-formatter.c (update_item): use info item, not e-error - -2005-01-03 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (view_response_cb): implement cancel - (update_item): add cancel info item - -2005-01-03 JP Rosevear <jpr@novell.com> - - * itip-view.c (itip_view_add_upper_info_item_printf): utility - routine to make it easier to add info items - (itip_view_add_lower_info_item_printf): ditto - - * itip-view.h: new protos - - * itip-formatter.c: use new printf routines everyhwere it makes - sense - -2005-01-03 JP Rosevear <jpr@novell.com> - - * itip-formatter.c (find_cal_opened_cb): move the adjust item work - here when we actually have the calendar - (pitip_free): implement a free function - (find_cal_opened_cb): check the methods instead of the show - selector member - (find_cal_opened_cb): default to true for the rsvp setting - -2005-01-03 JP Rosevear <jpr@novell.com> - - * itip-view.h: add response enums - - * itip-view.c (set_buttons): fiddle with button names and response enums - - * itip-formatter.c (find_server): don't include our uid in the - conflicts search - (update_attendee_status): update the status of the attendee and - save it out - (adjust_item): get relevant properties for items that might - contain them if sent from an attendee - (get_real_item): get the actual, current item - (send_item): send the item - (view_response_cb): handle REPLY and REFRESH requests - (format_itip_object): adjust the item if necessary and set the - attendee for reply/refresh; prevent crash if no description - (pitip_free): skeleton free function - (format_itip): load delete message setting - (delete_toggled_cb): set delete message setting based on toggle - (itip_formatter_page_factory): make the delete message check box - work - - * Makefile.am: install e-error messages - -2005-01-03 JP Rosevear <jpr@novell.com> - - * itip-view.h: new protos, signal - - * itip-view.c (set_info_items): be more generic so both upper and - lower setting can use it - (set_upper_info_items): set the upper info items - (set_lower_info_items): ditto for lower items - (itip_view_destroy): clear both sets of info items - (itip_view_class_init): add source selected signalo - (itip_view_init): add separate upper and lower info item areas and - a detail area - (itip_view_add_upper_info_item): add upper info item - (itip_view_remove_upper_info_item): remove a singal upper area - info item - (itip_view_clear_upper_info_items): clear them all - (itip_view_add_lower_info_item): as above - (itip_view_remove_lower_info_item): ditto - (itip_view_clear_lower_info_items): ditto - (source_selected_cb): emit the source selected signal when the - source in the option menu changes - (itip_view_set_source_list): take a source list and create an - e-source-option-menu if its non-null - (itip_view_get_source_list): get source list - (itip_view_set_source): set a specific source in the source option - menu - (itip_view_get_source): obtain that source - (itip_view_set_rsvp): get the rsvp status - (itip_view_get_rsvp): set it - (itip_view_set_show_rsvp): set visibility of rsvp check box - (itip_view_get_show_rsvp): get the visibility of rsvp check box - (itip_view_set_buttons_sensitive): set button sensitivity - (itip_view_get_buttons_sensitive): get button sensitivity - - * itip-formatter.c (find_my_address): find the user's address in - the list of attendees - (set_buttons_sensitive): set the action buttons sensitivity - appropriately - (cal_opened_cb): use above - (start_calendar_server): ditto - (start_calendar_server_by_uid): de-sensitize buttons to start - (source_selected_cb): ditto - (find_cal_opened_cb): check for conflicting appointments; set - informative info area items - (find_server): create the sexp for determining conflicts - (update_item): oset informative info area items - (view_response_cb): implement some of the responses, start on - implementing rsvp - (format_itip_object): load the source lists properly - -2004-12-29 JP Rosevear <jpr@novell.com> - - * itip-view.h: new protos - - * itip-view.c (format_date_and_time_x): don't draw the leading - zero in 12hr clock mode for the hour - (set_sender_text): make intro statements closer to the UI design - (set_description_text): display description - (set_info_items): show info items, messages with icons - (set_progress_text): show progress text item (for - loading/searching calendars) - (set_one_button): add a response button - (set_buttons): set response buttons based on mode - (itip_view_destroy): clear info items - (itip_view_class_init): add response signal - (itip_view_init): new areas for description, info items, buttons - (itip_view_set_description): accessor - (itip_view_get_description): ditto - (itip_view_add_info_item): add an info item to the display - (itip_view_clear_info_items): clear all items - (itip_view_set_progress): set the progress message - - * itip-formatter.c: move over calendar loading, searching code, - set more itip view properties - - * org-gnome-itip-formatter.eplug.in: add a config page item, - doesn't do much right now - -2004-12-22 JP Rosevear <jpr@novell.com> - - * Initial checkin of new itip formatter - diff --git a/plugins/itip-formatter/Makefile.am b/plugins/itip-formatter/Makefile.am deleted file mode 100644 index def2a59f4a..0000000000 --- a/plugins/itip-formatter/Makefile.am +++ /dev/null @@ -1,23 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-itip-formatter.eplug -plugin_LTLIBRARIES = liborg-gnome-itip-formatter.la - -liborg_gnome_itip_formatter_la_SOURCES = itip-formatter.c itip-view.c itip-view.h -liborg_gnome_itip_formatter_la_LDFLAGS = -module -avoid-version - -error_DATA = org-gnome-itip-formatter-errors.xml -error_i18n = $(error_DATA:.xml=.xml.h) -errordir = $(privdatadir)/errors -%.xml.h: %.xml - $(top_builddir)/e-util/e-error-tool $^ - -BUILT_SOURCES = $(plugin_DATA) $(error_i18n) - -EXTRA_DIST = $(error_DATA) $(error_i18n) org-gnome-itip-formatter.eplug.in - diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c deleted file mode 100644 index d1954a8cb9..0000000000 --- a/plugins/itip-formatter/itip-formatter.c +++ /dev/null @@ -1,1732 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: JP Rosevear <jpr@novell.com> - * - * Copyright 2004 Novell, 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 Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include <gconf/gconf-client.h> -#include <camel/camel-stream.h> -#include <camel/camel-stream-mem.h> -#include <camel/camel-medium.h> -#include <camel/camel-mime-message.h> -#include <camel/camel-folder.h> -#include <camel/camel-multipart.h> -#include <libecal/e-cal.h> -#include <libecal/e-cal-time-util.h> -#include <libedataserverui/e-source-option-menu.h> -#include <libedataserverui/e-source-selector.h> -#include <gtkhtml/gtkhtml-embedded.h> -#include <mail/em-format-hook.h> -#include <mail/em-config.h> -#include <mail/em-format-html.h> -#include <mail/em-utils.h> -#include <e-util/e-account-list.h> -#include <e-util/e-icon-factory.h> -#include <widgets/misc/e-error.h> -#include <calendar/gui/calendar-config.h> -#include <calendar/gui/itip-utils.h> -#include <calendar/common/authentication.h> -#include "itip-view.h" - -#define CLASSID "itip://" -#define GCONF_KEY_DELETE "/apps/evolution/itip/delete_processed" - -#define d(x) x - -void format_itip (EPlugin *ep, EMFormatHookTarget *target); -GtkWidget *itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); - -typedef struct { - EMFormatHTMLPObject pobject; - - GtkWidget *view; - - ESourceList *source_lists[E_CAL_SOURCE_TYPE_LAST]; - GHashTable *ecals[E_CAL_SOURCE_TYPE_LAST]; - - ECal *current_ecal; - ECalSourceType type; - - char *vcalendar; - ECalComponent *comp; - icalcomponent *main_comp; - icalcomponent *ical_comp; - icalcomponent *top_level; - icalcompiter iter; - icalproperty_method method; - time_t start_time; - time_t end_time; - - int current; - int total; - - gchar *calendar_uid; - - EAccountList *accounts; - - gchar *from_address; - gchar *delegator_address; - gchar *delegator_name; - gchar *my_address; - gint view_only; - - guint progress_info_id; - - gboolean delete_message; -} FormatItipPObject; - -typedef struct { - FormatItipPObject *pitip; - char *uid; - - char *sexp; - - int count; -} FormatItipFindData; - -typedef void (* FormatItipOpenFunc) (ECal *ecal, ECalendarStatus status, gpointer data); - -static void -find_my_address (FormatItipPObject *pitip, icalcomponent *ical_comp, icalparameter_partstat *status) -{ - icalproperty *prop; - char *my_alt_address = NULL; - - for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY); - prop != NULL; - prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY)) { - icalvalue *value; - icalparameter *param; - const char *attendee, *name; - char *attendee_clean, *name_clean; - EIterator *it; - - value = icalproperty_get_value (prop); - if (value != NULL) { - attendee = icalvalue_get_string (value); - attendee_clean = g_strdup (itip_strip_mailto (attendee)); - attendee_clean = g_strstrip (attendee_clean); - } else { - attendee = NULL; - attendee_clean = NULL; - } - - param = icalproperty_get_first_parameter (prop, ICAL_CN_PARAMETER); - if (param != NULL) { - name = icalparameter_get_cn (param); - name_clean = g_strdup (name); - name_clean = g_strstrip (name_clean); - } else { - name = NULL; - name_clean = NULL; - } - - if (pitip->delegator_address) { - char *delegator_clean; - - delegator_clean = g_strdup (itip_strip_mailto (attendee)); - delegator_clean = g_strstrip (delegator_clean); - - /* If the mailer told us the address to use, use that */ - if (delegator_clean != NULL - && !g_ascii_strcasecmp (attendee_clean, delegator_clean)) { - pitip->my_address = g_strdup (itip_strip_mailto (pitip->delegator_address)); - pitip->my_address = g_strstrip (pitip->my_address); - - if (status) { - param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER); - *status = param ? icalparameter_get_partstat (param) : ICAL_PARTSTAT_NEEDSACTION; - } - } - - g_free (delegator_clean); - } else { - it = e_list_get_iterator((EList *)pitip->accounts); - while (e_iterator_is_valid(it)) { - const EAccount *account = e_iterator_get(it); - - /* Check for a matching address */ - if (attendee_clean != NULL - && !g_ascii_strcasecmp (account->id->address, attendee_clean)) { - pitip->my_address = g_strdup (account->id->address); - if (status) { - param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER); - *status = param ? icalparameter_get_partstat (param) : ICAL_PARTSTAT_NEEDSACTION; - } - g_free (attendee_clean); - g_free (name_clean); - g_free (my_alt_address); - g_object_unref(it); - return; - } - - /* Check for a matching cname to fall back on */ - if (name_clean != NULL - && !g_ascii_strcasecmp (account->id->name, name_clean)) - my_alt_address = g_strdup (attendee_clean); - - e_iterator_next(it); - } - g_object_unref(it); - } - - g_free (attendee_clean); - g_free (name_clean); - } - - pitip->my_address = my_alt_address; - if (status) - *status = ICAL_PARTSTAT_NEEDSACTION; -} - -static ECalComponent * -get_real_item (FormatItipPObject *pitip) -{ - ECalComponent *comp; - icalcomponent *icalcomp; - gboolean found = FALSE; - const char *uid; - - e_cal_component_get_uid (pitip->comp, &uid); - - found = e_cal_get_object (pitip->current_ecal, uid, NULL, &icalcomp, NULL); - if (!found) - return NULL; - - comp = e_cal_component_new (); - if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { - g_object_unref (comp); - icalcomponent_free (icalcomp); - return NULL; - } - - return comp; -} - -static void -adjust_item (FormatItipPObject *pitip, ECalComponent *comp) -{ - ECalComponent *real_comp; - - real_comp = get_real_item (pitip); - if (real_comp != NULL) { - ECalComponentText text; - const char *string; - GSList *l; - - e_cal_component_get_summary (real_comp, &text); - e_cal_component_set_summary (comp, &text); - e_cal_component_get_location (real_comp, &string); - e_cal_component_set_location (comp, string); - e_cal_component_get_description_list (real_comp, &l); - e_cal_component_set_description_list (comp, l); - e_cal_component_free_text_list (l); - - g_object_unref (real_comp); - } else { - ECalComponentText text = {_("Unknown"), NULL}; - - e_cal_component_set_summary (comp, &text); - } -} - -static void -set_buttons_sensitive (FormatItipPObject *pitip) -{ - gboolean read_only = TRUE; - - if (pitip->current_ecal) - e_cal_is_read_only (pitip->current_ecal, &read_only, NULL); - - itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), pitip->current_ecal != NULL && !read_only); -} - - -static void -cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) -{ - FormatItipPObject *pitip = data; - ESource *source; - ECalSourceType source_type; - icaltimezone *zone; - - source_type = e_cal_get_source_type (ecal); - source = e_cal_get_source (ecal); - - g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, cal_opened_cb, NULL); - - if (status != E_CALENDAR_STATUS_OK) { - d(printf ("Failed opening itip formatter calendar '%s' during non-search opening\n", e_source_peek_name (source))); - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - "Failed to load the calendar '%s'", e_source_peek_name (source)); - - g_hash_table_remove (pitip->ecals[source_type], e_source_peek_uid (source)); - - return; - } - - zone = calendar_config_get_icaltimezone (); - e_cal_set_default_timezone (ecal, zone, NULL); - - pitip->current_ecal = ecal; - - set_buttons_sensitive (pitip); -} - -static ECal * -start_calendar_server (FormatItipPObject *pitip, ESource *source, ECalSourceType type, FormatItipOpenFunc func, gpointer data) -{ - ECal *ecal; - - ecal = g_hash_table_lookup (pitip->ecals[type], e_source_peek_uid (source)); - if (ecal) { - pitip->current_ecal = ecal; - - itip_view_remove_lower_info_item (ITIP_VIEW (pitip->view), pitip->progress_info_id); - pitip->progress_info_id = 0; - - set_buttons_sensitive (pitip); - - return ecal; - } - - ecal = auth_new_cal_from_source (source, type); - g_signal_connect (G_OBJECT (ecal), "cal_opened", G_CALLBACK (func), data); - - g_hash_table_insert (pitip->ecals[type], g_strdup (e_source_peek_uid (source)), ecal); - - e_cal_open_async (ecal, TRUE); - - return ecal; -} - -static ECal * -start_calendar_server_by_uid (FormatItipPObject *pitip, const char *uid, ECalSourceType type) -{ - int i; - - itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE); - - for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) { - ESource *source; - - source = e_source_list_peek_source_by_uid (pitip->source_lists[i], uid); - if (source) - return start_calendar_server (pitip, source, type, cal_opened_cb, pitip); - } - - return NULL; -} - -static void -source_selected_cb (ItipView *view, ESource *source, gpointer data) -{ - FormatItipPObject *pitip = data; - - itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE); - - start_calendar_server (pitip, source, pitip->type, cal_opened_cb, pitip); -} - -static void -find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) -{ - FormatItipFindData *fd = data; - FormatItipPObject *pitip = fd->pitip; - ESource *source; - ECalSourceType source_type; - icalcomponent *icalcomp; - icaltimezone *zone; - GList *objects = NULL; - - source_type = e_cal_get_source_type (ecal); - source = e_cal_get_source (ecal); - - fd->count--; - - g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, find_cal_opened_cb, NULL); - - if (status != E_CALENDAR_STATUS_OK) { - /* FIXME Do we really want to warn here? If we fail - * to find the item, this won't be cleared but the - * selector might be shown */ - d(printf ("Failed opening itip formatter calendar '%s' during search opening... ", e_source_peek_name (source))); - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - "Failed to load the calendar '%s'", e_source_peek_name (source)); - - g_hash_table_remove (pitip->ecals[source_type], e_source_peek_uid (source)); - - goto cleanup; - } - - /* Check for conflicts */ - /* If the query fails, we'll just ignore it */ - /* FIXME What happens for recurring conflicts? */ - if (pitip->type == E_CAL_SOURCE_TYPE_EVENT - && e_source_get_property (E_SOURCE (source), "conflict") - && !g_ascii_strcasecmp (e_source_get_property (E_SOURCE (source), "conflict"), "true") - && e_cal_get_object_list (ecal, fd->sexp, &objects, NULL) - && g_list_length (objects) > 0) { - itip_view_add_upper_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - "An appointment in the calendar '%s' conflicts with this meeting", e_source_peek_name (source)); - - e_cal_free_object_list (objects); - } - - if (e_cal_get_object (ecal, fd->uid, NULL, &icalcomp, NULL)) { - icalcomponent_free (icalcomp); - - pitip->current_ecal = ecal; - - /* Provide extra info, since its not in the component */ - /* FIXME Check sequence number of meeting? */ - /* FIXME Do we need to adjust elsewhere for the delegated calendar item? */ - /* FIXME Need to update the fields in the view now */ - if (pitip->method == ICAL_METHOD_REPLY || pitip->method == ICAL_METHOD_REFRESH) - adjust_item (pitip, pitip->comp); - - /* We clear everything because we don't really care - * about any other info/warnings now we found an - * existing versions */ - itip_view_clear_lower_info_items (ITIP_VIEW (pitip->view)); - pitip->progress_info_id = 0; - - /* FIXME Check read only state of calendar? */ - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, - "Found the appointment in the calendar '%s'", e_source_peek_name (source)); - - set_buttons_sensitive (pitip); - } - - zone = calendar_config_get_icaltimezone (); - e_cal_set_default_timezone (ecal, zone, NULL); - - cleanup: - d(printf ("Decreasing itip formatter search count to %d\n", fd->count)); - - if (fd->count == 0) { - itip_view_remove_lower_info_item (ITIP_VIEW (pitip->view), pitip->progress_info_id); - pitip->progress_info_id = 0; - - if ((pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST) - && !pitip->current_ecal) { - ESource *source = NULL; - char *uid; - - switch (pitip->type) { - case E_CAL_SOURCE_TYPE_EVENT: - uid = calendar_config_get_primary_calendar (); - break; - case E_CAL_SOURCE_TYPE_TODO: - uid = calendar_config_get_primary_tasks (); - break; - default: - uid = NULL; - g_assert_not_reached (); - } - - if (uid) { - source = e_source_list_peek_source_by_uid (pitip->source_lists[pitip->type], uid); - g_free (uid); - } - - /* Try to create a default if there isn't one */ - if (!source) - source = e_source_list_peek_source_any (pitip->source_lists[pitip->type]); - - itip_view_set_source_list (ITIP_VIEW (pitip->view), pitip->source_lists[pitip->type]); - g_signal_connect (pitip->view, "source_selected", G_CALLBACK (source_selected_cb), pitip); - - /* The only method that RSVP makes sense for is REQUEST */ - /* FIXME Default to the suggestion for RSVP for my attendee */ - itip_view_set_rsvp (ITIP_VIEW (pitip->view), pitip->method == ICAL_METHOD_REQUEST ? TRUE : FALSE); - itip_view_set_show_rsvp (ITIP_VIEW (pitip->view), pitip->method == ICAL_METHOD_REQUEST ? TRUE : FALSE); - - if (source) { - itip_view_set_source (ITIP_VIEW (pitip->view), source); - - /* FIXME Shouldn't the buttons be sensitized here? */ - } else { - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to find any calendars"); - itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE); - } - } else if (!pitip->current_ecal) { - switch (pitip->type) { - case E_CAL_SOURCE_TYPE_EVENT: - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - "Unable to find this meeting in any calendar"); - break; - case E_CAL_SOURCE_TYPE_TODO: - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - "Unable to find this task in any task list"); - break; - case E_CAL_SOURCE_TYPE_JOURNAL: - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - "Unable to find this journal entry in any journal"); - break; - default: - g_assert_not_reached (); - break; - } - } - - g_free (fd->uid); - g_free (fd); - } -} - -static void -find_server (FormatItipPObject *pitip, ECalComponent *comp) -{ - FormatItipFindData *fd = NULL; - GSList *groups, *l; - const char *uid; - - e_cal_component_get_uid (comp, &uid); - - pitip->progress_info_id = itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_PROGRESS, - "Searching for an existing version of this appointment"); - - itip_view_set_buttons_sensitive (ITIP_VIEW (pitip->view), FALSE); - - groups = e_source_list_peek_groups (pitip->source_lists[pitip->type]); - for (l = groups; l; l = l->next) { - ESourceGroup *group; - GSList *sources, *m; - - group = l->data; - - sources = e_source_group_peek_sources (group); - for (m = sources; m; m = m->next) { - ESource *source; - ECal *ecal; - - source = m->data; - - if (!fd) { - char *start = NULL, *end = NULL; - - fd = g_new0 (FormatItipFindData, 1); - fd->pitip = pitip; - fd->uid = g_strdup (uid); - - if (pitip->start_time && pitip->end_time) { - start = isodate_from_time_t (pitip->start_time); - end = isodate_from_time_t (pitip->end_time); - - fd->sexp = g_strdup_printf ("(and (occur-in-time-range? (make-time \"%s\") (make-time \"%s\")) (not (uid? \"%s\")))", - start, end, icalcomponent_get_uid (pitip->ical_comp)); - } - - g_free (start); - g_free (end); - } - fd->count++; - d(printf ("Increasing itip formatter search count to %d\n", fd->count)); - - ecal = start_calendar_server (pitip, source, pitip->type, find_cal_opened_cb, fd); - } - } -} - -static void -cleanup_ecal (gpointer data) -{ - ECal *ecal = data; - - /* Clean up any signals */ - g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, cal_opened_cb, NULL); - g_signal_handlers_disconnect_matched (ecal, G_SIGNAL_MATCH_FUNC, 0, 0, NULL, find_cal_opened_cb, NULL); - - g_object_unref (ecal); -} - -static icalproperty * -find_attendee (icalcomponent *ical_comp, const char *address) -{ - icalproperty *prop; - - if (address == NULL) - return NULL; - - for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY); - prop != NULL; - prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY)) { - icalvalue *value; - const char *attendee; - char *text; - - value = icalproperty_get_value (prop); - if (!value) - continue; - - attendee = icalvalue_get_string (value); - - text = g_strdup (itip_strip_mailto (attendee)); - text = g_strstrip (text); - if (!g_strcasecmp (address, text)) { - g_free (text); - break; - } - g_free (text); - } - - return prop; -} - -static gboolean -change_status (icalcomponent *ical_comp, const char *address, icalparameter_partstat status) -{ - icalproperty *prop; - - prop = find_attendee (ical_comp, address); - if (prop) { - icalparameter *param; - - icalproperty_remove_parameter (prop, ICAL_PARTSTAT_PARAMETER); - param = icalparameter_new_partstat (status); - icalproperty_add_parameter (prop, param); - } else { - icalparameter *param; - - if (address != NULL) { - prop = icalproperty_new_attendee (address); - icalcomponent_add_property (ical_comp, prop); - - param = icalparameter_new_role (ICAL_ROLE_OPTPARTICIPANT); - icalproperty_add_parameter (prop, param); - - param = icalparameter_new_partstat (status); - icalproperty_add_parameter (prop, param); - } else { - EAccount *a; - - a = itip_addresses_get_default (); - - prop = icalproperty_new_attendee (a->id->address); - icalcomponent_add_property (ical_comp, prop); - - param = icalparameter_new_cn (a->id->name); - icalproperty_add_parameter (prop, param); - - param = icalparameter_new_role (ICAL_ROLE_REQPARTICIPANT); - icalproperty_add_parameter (prop, param); - - param = icalparameter_new_partstat (status); - icalproperty_add_parameter (prop, param); - } - } - - return TRUE; -} - -static void -message_foreach_part (CamelMimePart *part, GSList **part_list) -{ - CamelDataWrapper *containee; - int parts, i; - int go = TRUE; - - *part_list = g_slist_append (*part_list, part); - - containee = camel_medium_get_content_object (CAMEL_MEDIUM (part)); - - if (containee == NULL) - return; - - /* using the object types is more accurate than using the mime/types */ - if (CAMEL_IS_MULTIPART (containee)) { - parts = camel_multipart_get_number (CAMEL_MULTIPART (containee)); - for (i = 0; go && i < parts; i++) { - CamelMimePart *part = camel_multipart_get_part (CAMEL_MULTIPART (containee), i); - - message_foreach_part (part, part_list); - } - } else if (CAMEL_IS_MIME_MESSAGE (containee)) { - message_foreach_part ((CamelMimePart *)containee, part_list); - } -} - -static void -update_item (FormatItipPObject *pitip, ItipViewResponse response) -{ - struct icaltimetype stamp; - icalproperty *prop; - icalcomponent *clone; - ECalComponent *clone_comp; - ESource *source; - GError *error = NULL; - - /* Set X-MICROSOFT-CDO-REPLYTIME to record the time at which - * the user accepted/declined the request. (Outlook ignores - * SEQUENCE in REPLY reponses and instead requires that each - * updated response have a later REPLYTIME than the previous - * one.) This also ends up getting saved in our own copy of - * the meeting, though there's currently no way to see that - * information (unless it's being saved to an Exchange folder - * and you then look at it in Outlook). - */ - stamp = icaltime_current_time_with_zone (icaltimezone_get_utc_timezone ()); - prop = icalproperty_new_x (icaltime_as_ical_string (stamp)); - icalproperty_set_x_name (prop, "X-MICROSOFT-CDO-REPLYTIME"); - icalcomponent_add_property (pitip->ical_comp, prop); - - clone = icalcomponent_new_clone (pitip->ical_comp); - icalcomponent_add_component (pitip->top_level, clone); - icalcomponent_set_method (pitip->top_level, pitip->method); - - clone_comp = e_cal_component_new (); - if (!e_cal_component_set_icalcomponent (clone_comp, clone)) { - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, _("Unable to parse item")); - goto cleanup; - } - source = e_cal_get_source (pitip->current_ecal); - - if ((response != ITIP_VIEW_RESPONSE_CANCEL) - && (response != ITIP_VIEW_RESPONSE_DECLINE)){ - GSList *attachments = NULL, *new_attachments = NULL, *l; - CamelMimeMessage *msg = ((EMFormat *) pitip->pobject.format)->message; - - e_cal_component_get_attachment_list (clone_comp, &attachments); - g_message ("Number of attachments is %d", g_slist_length (attachments)); - - for (l = attachments; l; l = l->next) { - GSList *parts = NULL, *m; - char *uri, *new_uri; - CamelMimePart *part; - - uri = l->data; - - if (!g_ascii_strncasecmp (uri, "cid:...", 7)) { - message_foreach_part ((CamelMimePart *) msg, &parts); - - for (m = parts; m; m = m->next) { - part = m->data; - - /* Skip the actual message and the text/calendar part */ - /* FIXME Do we need to skip anything else? */ - if (part == (CamelMimePart *) msg || part == pitip->pobject.part) - continue; - - new_uri = em_utils_temp_save_part (NULL, part); - g_message ("DEBUG: the uri obtained was %s\n", new_uri); - new_attachments = g_slist_append (new_attachments, new_uri); - } - - g_slist_free (parts); - - } else if (!g_ascii_strncasecmp (uri, "cid:", 4)) { - part = camel_mime_message_get_part_by_content_id (msg, uri); - new_uri = em_utils_temp_save_part (NULL, part); - new_attachments = g_slist_append (new_attachments, new_uri); - } else { - /* Preserve existing non-cid ones */ - new_attachments = g_slist_append (new_attachments, g_strdup (uri)); - } - } - - e_cal_component_set_attachment_list (clone_comp, new_attachments); - } - - if (!e_cal_receive_objects (pitip->current_ecal, pitip->top_level, &error)) { - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Unable to send item to calendar '%s'. %s"), - e_source_peek_name (source), error->message); - g_error_free (error); - } else { - itip_view_set_source_list (ITIP_VIEW (pitip->view), NULL); - - itip_view_clear_lower_info_items (ITIP_VIEW (pitip->view)); - - switch (response) { - case ITIP_VIEW_RESPONSE_ACCEPT: - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Sent to calendar '%s' as accepted"), e_source_peek_name (source)); - break; - case ITIP_VIEW_RESPONSE_TENTATIVE: - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Sent to calendar '%s' as tentative"), e_source_peek_name (source)); - break; - case ITIP_VIEW_RESPONSE_DECLINE: - /* FIXME some calendars just might not save it at all, is this accurate? */ - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Sent to calendar '%s' as declined"), e_source_peek_name (source)); - break; - case ITIP_VIEW_RESPONSE_CANCEL: - /* FIXME some calendars just might not save it at all, is this accurate? */ - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, - _("Sent to calendar '%s' as cancelled"), e_source_peek_name (source)); - break; - default: - g_assert_not_reached (); - break; - } - - /* FIXME Should we hide or desensitize the buttons now? */ - } - - cleanup: - icalcomponent_remove_component (pitip->top_level, clone); - g_object_unref (clone_comp); -} - -static void -update_attendee_status (FormatItipPObject *pitip) -{ - ECalComponent *comp = NULL; - icalcomponent *icalcomp = NULL; - const char *uid, *rid; - GError *error; - - /* Obtain our version */ - e_cal_component_get_uid (pitip->comp, &uid); - rid = e_cal_component_get_recurid_as_string (pitip->comp); - if (e_cal_get_object (pitip->current_ecal, uid, rid, &icalcomp, NULL)) { - GSList *attendees; - - comp = e_cal_component_new (); - if (!e_cal_component_set_icalcomponent (comp, icalcomp)) { - icalcomponent_free (icalcomp); - - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "The meeting is invalid and cannot be updated"); - } else { - e_cal_component_get_attendee_list (pitip->comp, &attendees); - if (attendees != NULL) { - ECalComponentAttendee *a = attendees->data; - icalproperty *prop; - - prop = find_attendee (icalcomp, itip_strip_mailto (a->value)); - - if (prop == NULL) { - if (e_error_run (NULL, "org.gnome.itip-formatter:add-unknown-attendee", NULL) == GTK_RESPONSE_YES) { - change_status (icalcomp, itip_strip_mailto (a->value), a->status); - e_cal_component_rescan (comp); - } else { - goto cleanup; - } - } else if (a->status == ICAL_PARTSTAT_NONE || a->status == ICAL_PARTSTAT_X) { - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, - _("Attendee status could not be updated because the status is invalid")); - goto cleanup; - } else { - change_status (icalcomp, itip_strip_mailto (a->value), a->status); - e_cal_component_rescan (comp); - } - } - } - - if (!e_cal_modify_object (pitip->current_ecal, icalcomp, rid ? CALOBJ_MOD_THIS : CALOBJ_MOD_ALL, &error)) { - itip_view_add_lower_info_item_printf (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, - _("Unable to update attendee. %s"), error->message); - - g_error_free (error); - } else { - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, _("Attendee status updated")); - } - } else { - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - _("Attendee status can not be updated because the item no longer exists")); - } - - cleanup: - if (comp != NULL) - g_object_unref (comp); -} - -static void -send_item (FormatItipPObject *pitip) -{ - ECalComponent *comp; - - comp = get_real_item (pitip); - - if (comp != NULL) { - itip_send_comp (E_CAL_COMPONENT_METHOD_REQUEST, comp, pitip->current_ecal, NULL, NULL); - g_object_unref (comp); - - switch (pitip->type) { - case E_CAL_SOURCE_TYPE_EVENT: - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "Meeting information sent"); - break; - case E_CAL_SOURCE_TYPE_TODO: - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "Task information sent"); - break; - case E_CAL_SOURCE_TYPE_JOURNAL: - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "Journal entry information sent"); - break; - default: - g_assert_not_reached (); - break; - } - } else { - switch (pitip->type) { - case E_CAL_SOURCE_TYPE_EVENT: - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to send meeting information, the meeting does not exist"); - break; - case E_CAL_SOURCE_TYPE_TODO: - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to send task information, the task does not exist"); - break; - case E_CAL_SOURCE_TYPE_JOURNAL: - itip_view_add_lower_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_ERROR, "Unable to send journal entry information, the journal entry does not exist"); - break; - default: - g_assert_not_reached (); - break; - } - } -} - -static icalcomponent * -get_next (icalcompiter *iter) -{ - icalcomponent *ret = NULL; - icalcomponent_kind kind; - - do { - icalcompiter_next (iter); - ret = icalcompiter_deref (iter); - if (ret == NULL) - break; - kind = icalcomponent_isa (ret); - } while (ret != NULL - && kind != ICAL_VEVENT_COMPONENT - && kind != ICAL_VTODO_COMPONENT - && kind != ICAL_VFREEBUSY_COMPONENT); - - return ret; -} - -static void -set_itip_error (FormatItipPObject *pitip, GtkContainer *container, const char *primary, const char *secondary) -{ - GtkWidget *vbox, *label; - char *message; - - vbox = gtk_vbox_new (FALSE, 12); - gtk_widget_show (vbox); - - message = g_strdup_printf ("<b>%s</b>", primary); - label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - gtk_label_set_markup (GTK_LABEL (label), message); - g_free (message); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - - label = gtk_label_new (secondary); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); - - gtk_container_add (container, vbox); -} - -static gboolean -extract_itip_data (FormatItipPObject *pitip, GtkContainer *container) -{ - CamelDataWrapper *content; - CamelStream *mem; - icalproperty *prop; - icalcomponent_kind kind = ICAL_NO_COMPONENT; - icalcomponent *tz_comp; - icalcompiter tz_iter; - icalcomponent *alarm_comp; - icalcompiter alarm_iter; - - content = camel_medium_get_content_object ((CamelMedium *) pitip->pobject.part); - mem = camel_stream_mem_new (); - camel_data_wrapper_decode_to_stream (content, mem); - - pitip->vcalendar = g_strndup (((CamelStreamMem *) mem)->buffer->data, ((CamelStreamMem *) mem)->buffer->len); - - camel_object_unref (mem); - - pitip->top_level = e_cal_util_new_top_level (); - - pitip->main_comp = icalparser_parse_string (pitip->vcalendar); - if (pitip->main_comp == NULL) { - set_itip_error (pitip, container, - _("The calendar attached is not valid"), - _("The message claims to contain a calendar, but the calendar is not valid iCalendar.")); - - return FALSE; - } - - prop = icalcomponent_get_first_property (pitip->main_comp, ICAL_METHOD_PROPERTY); - if (prop == NULL) { - pitip->method = ICAL_METHOD_PUBLISH; - } else { - pitip->method = icalproperty_get_method (prop); - } - - tz_iter = icalcomponent_begin_component (pitip->main_comp, ICAL_VTIMEZONE_COMPONENT); - while ((tz_comp = icalcompiter_deref (&tz_iter)) != NULL) { - icalcomponent *clone; - - clone = icalcomponent_new_clone (tz_comp); - icalcomponent_add_component (pitip->top_level, clone); - - icalcompiter_next (&tz_iter); - } - - pitip->iter = icalcomponent_begin_component (pitip->main_comp, ICAL_ANY_COMPONENT); - pitip->ical_comp = icalcompiter_deref (&pitip->iter); - if (pitip->ical_comp != NULL) { - kind = icalcomponent_isa (pitip->ical_comp); - if (kind != ICAL_VEVENT_COMPONENT - && kind != ICAL_VTODO_COMPONENT - && kind != ICAL_VFREEBUSY_COMPONENT) - pitip->ical_comp = get_next (&pitip->iter); - } - - if (pitip->ical_comp == NULL) { - set_itip_error (pitip, container, - _("The item in the calendar is not valid"), - _("The message does contain a calendar, but the calendar contains no events, tasks or free/busy information")); - - return FALSE; - } - - pitip->total = icalcomponent_count_components (pitip->main_comp, ICAL_VEVENT_COMPONENT); - pitip->total += icalcomponent_count_components (pitip->main_comp, ICAL_VTODO_COMPONENT); - pitip->total += icalcomponent_count_components (pitip->main_comp, ICAL_VFREEBUSY_COMPONENT); - - if (pitip->total > 1) { - set_itip_error (pitip, container, - _("The calendar attached contains multiple items"), - _("To process all of these items, the file should be saved and the calendar imported")); - - return FALSE; - } if (pitip->total > 0) { - pitip->current = 1; - } else { - pitip->current = 0; - } - - /* Determine any delegate sections */ - prop = icalcomponent_get_first_property (pitip->ical_comp, ICAL_X_PROPERTY); - while (prop) { - const char *x_name, *x_val; - - x_name = icalproperty_get_x_name (prop); - x_val = icalproperty_get_x (prop); - - if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-CALENDAR-UID")) - pitip->calendar_uid = g_strdup (x_val); - else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-CALENDAR-URI")) - g_warning (G_STRLOC ": X-EVOLUTION-DELEGATOR-CALENDAR-URI used"); - else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-ADDRESS")) - pitip->delegator_address = g_strdup (x_val); - else if (!strcmp (x_name, "X-EVOLUTION-DELEGATOR-NAME")) - pitip->delegator_name = g_strdup (x_val); - - prop = icalcomponent_get_next_property (pitip->ical_comp, ICAL_X_PROPERTY); - } - - /* Strip out alarms for security purposes */ - alarm_iter = icalcomponent_begin_component (pitip->ical_comp, ICAL_VALARM_COMPONENT); - while ((alarm_comp = icalcompiter_deref (&alarm_iter)) != NULL) { - icalcomponent_remove_component (pitip->ical_comp, alarm_comp); - - icalcompiter_next (&alarm_iter); - } - - pitip->comp = e_cal_component_new (); - if (!e_cal_component_set_icalcomponent (pitip->comp, pitip->ical_comp)) { - g_object_unref (pitip->comp); - pitip->comp = NULL; - - set_itip_error (pitip, container, - _("The item in the calendar is not valid"), - _("The message does contain a calendar, but the calendar contains no events, tasks or free/busy information")); - - return FALSE; - }; - - /* Add default reminder if the config says so */ - if (calendar_config_get_use_default_reminder ()) { - ECalComponentAlarm *acomp; - int interval; - CalUnits units; - ECalComponentAlarmTrigger trigger; - - interval = calendar_config_get_default_reminder_interval (); - units = calendar_config_get_default_reminder_units (); - - acomp = e_cal_component_alarm_new (); - - e_cal_component_alarm_set_action (acomp, E_CAL_COMPONENT_ALARM_DISPLAY); - - trigger.type = E_CAL_COMPONENT_ALARM_TRIGGER_RELATIVE_START; - memset (&trigger.u.rel_duration, 0, sizeof (trigger.u.rel_duration)); - - trigger.u.rel_duration.is_neg = TRUE; - - switch (units) { - case CAL_MINUTES: - trigger.u.rel_duration.minutes = interval; - break; - case CAL_HOURS: - trigger.u.rel_duration.hours = interval; - break; - case CAL_DAYS: - trigger.u.rel_duration.days = interval; - break; - default: - g_assert_not_reached (); - } - - e_cal_component_alarm_set_trigger (acomp, trigger); - e_cal_component_add_alarm (pitip->comp, acomp); - - e_cal_component_alarm_free (acomp); - } - - find_my_address (pitip, pitip->ical_comp, NULL); - - return TRUE; -} - -static gboolean -idle_open_cb (gpointer data) -{ - FormatItipPObject *pitip = data; - char *command; - - command = g_strdup_printf ("evolution-%s \"calendar://?startdate=%s&enddate=%s\"", BASE_VERSION, - isodate_from_time_t (pitip->start_time), isodate_from_time_t (pitip->end_time)); - if (!g_spawn_command_line_async (command, NULL)) { - g_warning ("Could not launch %s", command); - } - g_free (command); - - return FALSE; -} - -static void -view_response_cb (GtkWidget *widget, ItipViewResponse response, gpointer data) -{ - FormatItipPObject *pitip = data; - gboolean status = FALSE; - - if (!pitip->my_address && pitip->current_ecal != NULL) - e_cal_get_cal_address (pitip->current_ecal, &pitip->my_address, NULL); - - switch (response) { - case ITIP_VIEW_RESPONSE_ACCEPT: - status = change_status (pitip->ical_comp, pitip->my_address, - ICAL_PARTSTAT_ACCEPTED); - if (status) { - e_cal_component_rescan (pitip->comp); - update_item (pitip, response); - } - break; - case ITIP_VIEW_RESPONSE_TENTATIVE: - status = change_status (pitip->ical_comp, pitip->my_address, - ICAL_PARTSTAT_TENTATIVE); - if (status) { - e_cal_component_rescan (pitip->comp); - update_item (pitip, response); - } - break; - case ITIP_VIEW_RESPONSE_DECLINE: - status = change_status (pitip->ical_comp, pitip->my_address, - ICAL_PARTSTAT_DECLINED); - if (status) { - e_cal_component_rescan (pitip->comp); - update_item (pitip, response); - } - break; - case ITIP_VIEW_RESPONSE_UPDATE: - update_attendee_status (pitip); - break; - case ITIP_VIEW_RESPONSE_CANCEL: - update_item (pitip, response); - break; - case ITIP_VIEW_RESPONSE_REFRESH: - send_item (pitip); - break; - case ITIP_VIEW_RESPONSE_OPEN: - g_idle_add (idle_open_cb, pitip); - return; - default: - break; - } - - if (pitip->delete_message) { - g_message ("Deleting!"); - camel_folder_delete_message (((EMFormat *) pitip->pobject.format)->folder, ((EMFormat *) pitip->pobject.format)->uid); - } - - if (e_cal_get_save_schedules (pitip->current_ecal)) - return; - - if (itip_view_get_rsvp (ITIP_VIEW (pitip->view)) && status) { - ECalComponent *comp = NULL; - ECalComponentVType vtype; - icalcomponent *ical_comp; - icalproperty *prop; - icalvalue *value; - const char *attendee, *comment; - GSList *l, *list = NULL; - gboolean found; - - comp = e_cal_component_clone (pitip->comp); - if (comp == NULL) - return; - - vtype = e_cal_component_get_vtype (comp); - - if (pitip->my_address == NULL) - find_my_address (pitip, pitip->ical_comp, NULL); - g_assert (pitip->my_address != NULL); - - ical_comp = e_cal_component_get_icalcomponent (comp); - - /* Remove all attendees except the one we are responding as */ - found = FALSE; - for (prop = icalcomponent_get_first_property (ical_comp, ICAL_ATTENDEE_PROPERTY); - prop != NULL; - prop = icalcomponent_get_next_property (ical_comp, ICAL_ATTENDEE_PROPERTY)) - { - char *text; - - value = icalproperty_get_value (prop); - if (!value) - continue; - - attendee = icalvalue_get_string (value); - - text = g_strdup (itip_strip_mailto (attendee)); - text = g_strstrip (text); - - /* We do this to ensure there is at most one - * attendee in the response */ - if (found || g_strcasecmp (pitip->my_address, text)) - list = g_slist_prepend (list, prop); - else if (!g_strcasecmp (pitip->my_address, text)) - found = TRUE; - g_free (text); - } - - for (l = list; l; l = l->next) { - prop = l->data; - icalcomponent_remove_property (ical_comp, prop); - icalproperty_free (prop); - } - g_slist_free (list); - - /* Add a comment if there user set one */ - comment = itip_view_get_rsvp_comment (ITIP_VIEW (pitip->view)); - if (comment) { - GSList comments; - ECalComponentText text; - - text.value = comment; - text.altrep = NULL; - - comments.data = &text; - comments.next = NULL; - - e_cal_component_set_comment_list (comp, &comments); - } - - e_cal_component_rescan (comp); - if (itip_send_comp (E_CAL_COMPONENT_METHOD_REPLY, comp, pitip->current_ecal, pitip->top_level, NULL)) { - camel_folder_set_message_flags (((EMFormat *) pitip->pobject.format)->folder, ((EMFormat *) pitip->pobject.format)->uid, - CAMEL_MESSAGE_ANSWERED, CAMEL_MESSAGE_ANSWERED); - } - - g_object_unref (comp); - - } -} - -static gboolean -format_itip_object (EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPObject *pobject) -{ - FormatItipPObject *pitip = (FormatItipPObject *) pobject; - ECalComponentText text; - ECalComponentOrganizer organizer; - ECalComponentDateTime datetime; - icaltimezone *from_zone, *to_zone; - GString *gstring = NULL; - GSList *list, *l; - const char *string; - int i; - - /* Accounts */ - pitip->accounts = itip_addresses_get (); - - /* Source Lists and open ecal clients */ - for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) { - if (!e_cal_get_sources (&pitip->source_lists[i], i, NULL)) - /* FIXME More error handling? */ - pitip->source_lists[i] = NULL; - - /* Initialize the ecal hashes */ - pitip->ecals[i] = g_hash_table_new_full (g_str_hash, g_str_equal, g_free, cleanup_ecal); - } - - /* FIXME Handle multiple VEVENTS with the same UID, ie detached instances */ - if (!extract_itip_data (pitip, GTK_CONTAINER (eb))) - return TRUE; - - pitip->view = itip_view_new (); - gtk_container_add (GTK_CONTAINER (eb), pitip->view); - gtk_widget_show (pitip->view); - - switch (pitip->method) { - case ICAL_METHOD_PUBLISH: - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_PUBLISH); - break; - case ICAL_METHOD_REQUEST: - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_REQUEST); - break; - case ICAL_METHOD_REPLY: - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_REPLY); - break; - case ICAL_METHOD_ADD: - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_ADD); - break; - case ICAL_METHOD_CANCEL: - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_CANCEL); - break; - case ICAL_METHOD_REFRESH: - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_REFRESH); - break; - case ICAL_METHOD_COUNTER: - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_COUNTER); - break; - case ICAL_METHOD_DECLINECOUNTER: - itip_view_set_mode (ITIP_VIEW (pitip->view), ITIP_VIEW_MODE_DECLINECOUNTER); - break; - default: - g_assert_not_reached (); - break; - } - - itip_view_set_item_type (ITIP_VIEW (pitip->view), pitip->type); - - switch (pitip->method) { - case ICAL_METHOD_REQUEST: - /* FIXME What about the name? */ - itip_view_set_delegator (ITIP_VIEW (pitip->view), pitip->delegator_address); - case ICAL_METHOD_PUBLISH: - case ICAL_METHOD_ADD: - case ICAL_METHOD_CANCEL: - case ICAL_METHOD_DECLINECOUNTER: - /* An organizer sent this */ - e_cal_component_get_organizer (pitip->comp, &organizer); - itip_view_set_organizer (ITIP_VIEW (pitip->view), organizer.cn ? organizer.cn : itip_strip_mailto (organizer.value)); - /* FIXME, do i need to strip the sentby somehow? Maybe with camel? */ - itip_view_set_sentby (ITIP_VIEW (pitip->view), organizer.sentby); - - /* FIXME try and match sender with organizer/attendee/sentby? - pd->from_address = camel_address_encode - ((CamelAddress *)from); g_message ("Detected from address %s", - pd->from_address); - */ - break; - case ICAL_METHOD_REPLY: - case ICAL_METHOD_REFRESH: - case ICAL_METHOD_COUNTER: - /* An attendee sent this */ - e_cal_component_get_attendee_list (pitip->comp, &list); - if (list != NULL) { - ECalComponentAttendee *attendee; - - attendee = list->data; - - itip_view_set_attendee (ITIP_VIEW (pitip->view), attendee->cn ? attendee->cn : itip_strip_mailto (attendee->value)); - - e_cal_component_free_attendee_list (list); - } - break; - default: - g_assert_not_reached (); - break; - } - - e_cal_component_get_summary (pitip->comp, &text); - itip_view_set_summary (ITIP_VIEW (pitip->view), text.value ? text.value : _("None")); - - e_cal_component_get_location (pitip->comp, &string); - itip_view_set_location (ITIP_VIEW (pitip->view), string); - - /* Status really only applies for REPLY */ - if (pitip->method == ICAL_METHOD_REPLY) { - e_cal_component_get_attendee_list (pitip->comp, &list); - if (list != NULL) { - ECalComponentAttendee *a = list->data; - - switch (a->status) { - case ICAL_PARTSTAT_ACCEPTED: - itip_view_set_status (ITIP_VIEW (pitip->view), _("Accepted")); - break; - case ICAL_PARTSTAT_TENTATIVE: - itip_view_set_status (ITIP_VIEW (pitip->view), _("Tentatively Accepted")); - break; - case ICAL_PARTSTAT_DECLINED: - itip_view_set_status (ITIP_VIEW (pitip->view), _("Declined")); - break; - default: - itip_view_set_status (ITIP_VIEW (pitip->view), _("Unknown")); - } - } - e_cal_component_free_attendee_list (list); - } - - if (pitip->method == ICAL_METHOD_REPLY - || pitip->method == ICAL_METHOD_COUNTER - || pitip->method == ICAL_METHOD_DECLINECOUNTER) { - /* FIXME Check spec to see if multiple comments are actually valid */ - /* Comments for ITIP are limited to one per object */ - e_cal_component_get_comment_list (pitip->comp, &list); - if (list) { - ECalComponentText *text = list->data; - - if (text->value) - itip_view_set_comment (ITIP_VIEW (pitip->view), text->value); - } - e_cal_component_free_text_list (list); - } - - e_cal_component_get_description_list (pitip->comp, &list); - for (l = list; l; l = l->next) { - ECalComponentText *text = l->data; - - if (!gstring && text->value) - gstring = g_string_new (text->value); - else if (text->value) - g_string_append_printf (gstring, "\n\n%s", text->value); - } - e_cal_component_free_text_list (list); - - if (gstring) { - itip_view_set_description (ITIP_VIEW (pitip->view), gstring->str); - g_string_free (gstring, TRUE); - } - - to_zone = calendar_config_get_icaltimezone (); - - e_cal_component_get_dtstart (pitip->comp, &datetime); - pitip->start_time = 0; - if (datetime.value) { - struct tm start_tm; - - /* If the timezone is not in the component, guess the local time */ - /* Should we guess if the timezone is an olsen name somehow? */ - if (datetime.value->is_utc) - from_zone = icaltimezone_get_utc_timezone (); - else if (!datetime.value->is_utc && datetime.tzid) - from_zone = icalcomponent_get_timezone (pitip->top_level, datetime.tzid); - else - from_zone = NULL; - - start_tm = icaltimetype_to_tm_with_zone (datetime.value, from_zone, to_zone); - - itip_view_set_start (ITIP_VIEW (pitip->view), &start_tm); - pitip->start_time = icaltime_as_timet_with_zone (*datetime.value, from_zone); - } - e_cal_component_free_datetime (&datetime); - - e_cal_component_get_dtend (pitip->comp, &datetime); - pitip->end_time = 0; - if (datetime.value) { - struct tm end_tm; - - /* If the timezone is not in the component, guess the local time */ - /* Should we guess if the timezone is an olsen name somehow? */ - if (datetime.value->is_utc) - from_zone = icaltimezone_get_utc_timezone (); - else if (!datetime.value->is_utc && datetime.tzid) - from_zone = icalcomponent_get_timezone (pitip->top_level, datetime.tzid); - else - from_zone = NULL; - - end_tm = icaltimetype_to_tm_with_zone (datetime.value, from_zone, to_zone); - - itip_view_set_end (ITIP_VIEW (pitip->view), &end_tm); - pitip->end_time = icaltime_as_timet_with_zone (*datetime.value, from_zone); - } - e_cal_component_free_datetime (&datetime); - - /* Recurrence info */ - /* FIXME Better recurring description */ - if (e_cal_component_has_recurrences (pitip->comp)) { - /* FIXME Tell the user we don't support recurring tasks */ - switch (pitip->type) { - case E_CAL_SOURCE_TYPE_EVENT: - itip_view_add_upper_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "This meeting recurs"); - break; - case E_CAL_SOURCE_TYPE_TODO: - itip_view_add_upper_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "This task recurs"); - break; - case E_CAL_SOURCE_TYPE_JOURNAL: - itip_view_add_upper_info_item (ITIP_VIEW (pitip->view), ITIP_VIEW_INFO_ITEM_TYPE_INFO, "This journal recurs"); - break; - default: - g_assert_not_reached (); - break; - } - } - - g_signal_connect (pitip->view, "response", G_CALLBACK (view_response_cb), pitip); - - if (pitip->calendar_uid) - pitip->current_ecal = start_calendar_server_by_uid (pitip, pitip->calendar_uid, pitip->type); - else - find_server (pitip, pitip->comp); - - return TRUE; -} - -static void -pitip_free (EMFormatHTMLPObject *pobject) -{ - FormatItipPObject *pitip = (FormatItipPObject *) pobject; - int i; - - for (i = 0; i < E_CAL_SOURCE_TYPE_LAST; i++) { - if (pitip->source_lists[i]) - g_object_unref (pitip->source_lists[i]); - pitip->source_lists[i] = NULL; - - g_hash_table_destroy (pitip->ecals[i]); - pitip->ecals[i] = NULL; - } - - g_free (pitip->vcalendar); - pitip->vcalendar = NULL; - - if (pitip->comp) { - g_object_unref (pitip->comp); - pitip->comp = NULL; - } - - if (pitip->top_level) { - icalcomponent_free (pitip->top_level); - pitip->top_level = NULL; - } - - if (pitip->main_comp) { - icalcomponent_free (pitip->main_comp); - pitip->main_comp = NULL; - } - pitip->ical_comp = NULL; - - g_free (pitip->calendar_uid); - pitip->calendar_uid = NULL; - - g_free (pitip->from_address); - pitip->from_address = NULL; - g_free (pitip->delegator_address); - pitip->delegator_address = NULL; - g_free (pitip->delegator_name); - pitip->delegator_name = NULL; - g_free (pitip->my_address); - pitip->my_address = NULL; -} - -void -format_itip (EPlugin *ep, EMFormatHookTarget *target) -{ - FormatItipPObject *pitip; - GConfClient *gconf; - char *classid; - - classid = g_strdup_printf("itip:///%s", ((EMFormat *) target->format)->part_id->str); - - pitip = (FormatItipPObject *) em_format_html_add_pobject ((EMFormatHTML *) target->format, sizeof (FormatItipPObject), classid, target->part, format_itip_object); - pitip->pobject.free = pitip_free; - - gconf = gconf_client_get_default (); - pitip->delete_message = gconf_client_get_bool (gconf, GCONF_KEY_DELETE, NULL); - g_object_unref (gconf); - - camel_stream_printf (target->stream, "<table border=0 width=\"100%%\" cellpadding=3><tr>"); - camel_stream_printf (target->stream, "<td valign=top><object classid=\"%s\"></object></td><td width=100%% valign=top>", classid); - camel_stream_printf (target->stream, "</td></tr></table>"); - - g_free (classid); -} - -static void -delete_toggled_cb (GtkWidget *widget, gpointer data) -{ - EMConfigTargetPrefs *target = data; - - gconf_client_set_bool (target->gconf, GCONF_KEY_DELETE, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)), NULL); -} - -static void -initialize_selection (ESourceSelector *selector, ESourceList *source_list) -{ - GSList *groups; - - for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) { - ESourceGroup *group = E_SOURCE_GROUP (groups->data); - GSList *sources; - for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) { - ESource *source = E_SOURCE (sources->data); - const char *completion = e_source_get_property (source, "conflict"); - if (completion && !g_ascii_strcasecmp (completion, "true")) - e_source_selector_select_source (selector, source); - } - } -} - -static void -source_selection_changed (ESourceSelector *selector, gpointer data) -{ - ESourceList *source_list = data; - GSList *selection; - GSList *l; - GSList *groups; - - /* first we clear all the completion flags from all sources */ - g_message ("Clearing selection"); - for (groups = e_source_list_peek_groups (source_list); groups; groups = groups->next) { - ESourceGroup *group = E_SOURCE_GROUP (groups->data); - GSList *sources; - for (sources = e_source_group_peek_sources (group); sources; sources = sources->next) { - ESource *source = E_SOURCE (sources->data); - - g_message ("Unsetting for %s", e_source_peek_name (source)); - e_source_set_property (source, "conflict", NULL); - } - } - - /* then we loop over the selector's selection, setting the - property on those sources */ - selection = e_source_selector_get_selection (selector); - for (l = selection; l; l = l->next) { - g_message ("Setting for %s", e_source_peek_name (E_SOURCE (l->data))); - e_source_set_property (E_SOURCE (l->data), "conflict", "true"); - } - e_source_selector_free_selection (selection); - - /* FIXME show an error if this fails? */ - e_source_list_sync (source_list, NULL); -} - -GtkWidget * -itip_formatter_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) -{ - EMConfigTargetPrefs *target = (EMConfigTargetPrefs *) hook_data->config->target; - GtkWidget *page; - GtkWidget *tab_label; - GtkWidget *frame; - GtkWidget *frame_label; - GtkWidget *padding_label; - GtkWidget *hbox; - GtkWidget *inner_vbox; - GtkWidget *check; - GtkWidget *label; - GtkWidget *ess; - GtkWidget *scrolledwin; - ESourceList *source_list; - - /* Create a new notebook page */ - page = gtk_vbox_new (FALSE, 0); - GTK_CONTAINER (page)->border_width = 12; - tab_label = gtk_label_new (_("Meetings and Tasks")); - gtk_notebook_append_page (GTK_NOTEBOOK (hook_data->parent), page, tab_label); - - /* Frame */ - frame = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (page), frame, FALSE, FALSE, 0); - - /* "General" */ - frame_label = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL (frame_label), _("<span weight=\"bold\">General</span>")); - GTK_MISC (frame_label)->xalign = 0.0; - gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0); - - /* Indent/padding */ - hbox = gtk_hbox_new (FALSE, 12); - gtk_box_pack_start (GTK_BOX (frame), hbox, FALSE, TRUE, 0); - padding_label = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0); - inner_vbox = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, FALSE, FALSE, 0); - - /* Delete message after acting */ - /* FIXME Need a schema for this */ - check = gtk_check_button_new_with_mnemonic (_("_Delete message after acting")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gconf_client_get_bool (target->gconf, GCONF_KEY_DELETE, NULL)); - g_signal_connect (GTK_TOGGLE_BUTTON (check), "toggled", G_CALLBACK (delete_toggled_cb), target); - gtk_box_pack_start (GTK_BOX (inner_vbox), check, FALSE, FALSE, 0); - - /* "Conflict searching" */ - frame = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (page), frame, TRUE, TRUE, 24); - - frame_label = gtk_label_new (""); - gtk_label_set_markup (GTK_LABEL (frame_label), _("<span weight=\"bold\">Conflict Search</span>")); - GTK_MISC (frame_label)->xalign = 0.0; - gtk_box_pack_start (GTK_BOX (frame), frame_label, FALSE, FALSE, 0); - - /* Indent/padding */ - hbox = gtk_hbox_new (FALSE, 12); - gtk_box_pack_start (GTK_BOX (frame), hbox, TRUE, TRUE, 0); - padding_label = gtk_label_new (""); - gtk_box_pack_start (GTK_BOX (hbox), padding_label, FALSE, FALSE, 0); - inner_vbox = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start (GTK_BOX (hbox), inner_vbox, TRUE, TRUE, 0); - - /* Source selector */ - label = gtk_label_new (_("Select the calendars to search for meeting conflicts")); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.5); - gtk_box_pack_start (GTK_BOX (inner_vbox), label, FALSE, FALSE, 0); - - if (!e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL)) - /* FIXME Error handling */; - - scrolledwin = gtk_scrolled_window_new (NULL, NULL); - - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (scrolledwin), - GTK_POLICY_AUTOMATIC, - GTK_POLICY_AUTOMATIC); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolledwin), - GTK_SHADOW_IN); - gtk_box_pack_start (GTK_BOX (inner_vbox), scrolledwin, TRUE, TRUE, 0); - - ess = e_source_selector_new (source_list); - gtk_container_add (GTK_CONTAINER (scrolledwin), ess); - - initialize_selection (E_SOURCE_SELECTOR (ess), source_list); - - g_signal_connect (ess, "selection_changed", G_CALLBACK (source_selection_changed), source_list); - g_object_weak_ref (G_OBJECT (page), (GWeakNotify) g_object_unref, source_list); - - gtk_widget_show_all (page); - - return page; -} - diff --git a/plugins/itip-formatter/itip-view.c b/plugins/itip-formatter/itip-view.c deleted file mode 100644 index 9403e7c4e2..0000000000 --- a/plugins/itip-formatter/itip-view.c +++ /dev/null @@ -1,1784 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: JP Rosevear <jpr@novell.com> - * - * Copyright 2004 Novell, 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 Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include <gconf/gconf-client.h> -#include <camel/camel-stream.h> -#include <camel/camel-stream-mem.h> -#include <camel/camel-medium.h> -#include <camel/camel-mime-message.h> -#include <libedataserver/e-time-utils.h> -#include <libedataserverui/e-source-option-menu.h> -#include <libecal/e-cal.h> -#include <gtkhtml/gtkhtml-embedded.h> -#include <mail/em-format-hook.h> -#include <mail/em-format-html.h> -#include <e-util/e-account-list.h> -#include <e-util/e-icon-factory.h> -#include <e-util/e-time-utils.h> -#include <e-util/e-gtk-utils.h> -#include <calendar/gui/itip-utils.h> -#include "itip-view.h" - -#define MEETING_ICON "stock_new-meeting" - -G_DEFINE_TYPE (ItipView, itip_view, GTK_TYPE_HBOX); - -typedef struct { - ItipViewInfoItemType type; - char *message; - - guint id; -} ItipViewInfoItem; - -struct _ItipViewPrivate { - ItipViewMode mode; - ECalSourceType type; - - GtkWidget *sender_label; - char *organizer; - char *sentby; - char *delegator; - char *attendee; - - GtkWidget *summary_label; - char *summary; - - GtkWidget *location_header; - GtkWidget *location_label; - char *location; - - GtkWidget *status_header; - GtkWidget *status_label; - char *status; - - GtkWidget *comment_header; - GtkWidget *comment_label; - char *comment; - - GtkWidget *start_header; - GtkWidget *start_label; - struct tm *start_tm; - - GtkWidget *end_header; - GtkWidget *end_label; - struct tm *end_tm; - - GtkWidget *upper_info_box; - GSList *upper_info_items; - - GtkWidget *lower_info_box; - GSList *lower_info_items; - - guint next_info_item_id; - - GtkWidget *description_label; - char *description; - - GtkWidget *selector_box; - GtkWidget *esom; - GtkWidget *esom_header; - ESourceList *source_list; - - GtkWidget *rsvp_box; - GtkWidget *rsvp_check; - GtkWidget *rsvp_comment_header; - GtkWidget *rsvp_comment_entry; - gboolean rsvp_show; - - GtkWidget *button_box; - gboolean buttons_sensitive; -}; - -/* Signal IDs */ -enum { - SOURCE_SELECTED, - RESPONSE, - LAST_SIGNAL -}; - -static guint signals[LAST_SIGNAL] = { 0 }; - -static void -format_date_and_time_x (struct tm *date_tm, - struct tm *current_tm, - gboolean use_24_hour_format, - gboolean show_midnight, - gboolean show_zero_seconds, - char *buffer, - int buffer_size) -{ - char *format; - struct tm tomorrow_tm, week_tm; - - /* Calculate a normalized "tomorrow" */ - tomorrow_tm = *current_tm; - if (tomorrow_tm.tm_mday == time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { - tomorrow_tm.tm_mday = 1; - if (tomorrow_tm.tm_mon == 11) { - tomorrow_tm.tm_mon = 1; - tomorrow_tm.tm_year++; - } else { - tomorrow_tm.tm_mon++; - } - } else { - tomorrow_tm.tm_mday++; - } - - /* Calculate a normalized "next seven days" */ - week_tm = *current_tm; - if (week_tm.tm_mday + 6 > time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon)) { - week_tm.tm_mday = (week_tm.tm_mday + 6) % time_days_in_month (date_tm->tm_year + 1900, date_tm->tm_mon); - if (week_tm.tm_mon == 11) { - week_tm.tm_mon = 1; - week_tm.tm_year++; - } else { - week_tm.tm_mon++; - } - } else { - week_tm.tm_mday += 6; - } - - /* Today */ - if (date_tm->tm_mday == current_tm->tm_mday && - date_tm->tm_mon == current_tm->tm_mon && - date_tm->tm_year == current_tm->tm_year) { - if (!show_midnight && date_tm->tm_hour == 0 - && date_tm->tm_min == 0 && date_tm->tm_sec == 0) { - /* strftime format of a weekday and a date. */ - format = _("Today"); - } else if (use_24_hour_format) { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a time, - in 24-hour format, without seconds. */ - format = _("Today %H:%M"); - else - /* strftime format of a time, - in 24-hour format. */ - format = _("Today %H:%M:%S"); - } else { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a time, - in 12-hour format, without seconds. */ - format = _("Today %l:%M %p"); - else - /* strftime format of a time, - in 12-hour format. */ - format = _("Today %l:%M:%S %p"); - } - - /* Tomorrow */ - } else if (date_tm->tm_mday == tomorrow_tm.tm_mday && - date_tm->tm_mon == tomorrow_tm.tm_mon && - date_tm->tm_year == tomorrow_tm.tm_year) { - if (!show_midnight && date_tm->tm_hour == 0 - && date_tm->tm_min == 0 && date_tm->tm_sec == 0) { - /* strftime format of a weekday and a date. */ - format = _("Tomorrow"); - } else if (use_24_hour_format) { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a time, - in 24-hour format, without seconds. */ - format = _("Tomorrow %H:%M"); - else - /* strftime format of a time, - in 24-hour format. */ - format = _("Tomorrow %H:%M:%S"); - } else { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a time, - in 12-hour format, without seconds. */ - format = _("Tomorrow %l:%M %p"); - else - /* strftime format of a time, - in 12-hour format. */ - format = _("Tomorrow %l:%M:%S %p"); - } - - /* Within 6 days */ - } else if ((date_tm->tm_year >= current_tm->tm_year && - date_tm->tm_mon >= current_tm->tm_mon && - date_tm->tm_mday >= current_tm->tm_mday) && - - (date_tm->tm_year < week_tm.tm_year || - - (date_tm->tm_year == week_tm.tm_year && - date_tm->tm_mon < week_tm.tm_mon) || - - (date_tm->tm_year == week_tm.tm_year && - date_tm->tm_mon == week_tm.tm_mon && - date_tm->tm_mday < week_tm.tm_mday))) { - if (!show_midnight && date_tm->tm_hour == 0 - && date_tm->tm_min == 0 && date_tm->tm_sec == 0) { - /* strftime format of a weekday. */ - format = _("%A"); - } else if (use_24_hour_format) { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a weekday and a - time, in 24-hour format, without seconds. */ - format = _("%A %H:%M"); - else - /* strftime format of a weekday and a - time, in 24-hour format. */ - format = _("%A %H:%M:%S"); - } else { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a weekday and a - time, in 12-hour format, without seconds. */ - format = _("%A %l:%M %p"); - else - /* strftime format of a weekday and a - time, in 12-hour format. */ - format = _("%A %l:%M:%S %p"); - } - - /* This Year */ - } else if (date_tm->tm_year == current_tm->tm_year) { - if (!show_midnight && date_tm->tm_hour == 0 - && date_tm->tm_min == 0 && date_tm->tm_sec == 0) { - /* strftime format of a weekday and a date - without a year. */ - format = _("%A, %B %e"); - } else if (use_24_hour_format) { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a weekday, a date - without a year and a time, - in 24-hour format, without seconds. */ - format = _("%A, %B %e %H:%M"); - else - /* strftime format of a weekday, a date without a year - and a time, in 24-hour format. */ - format = _("%A, %B %e %H:%M:%S"); - } else { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a weekday, a date without a year - and a time, in 12-hour format, without seconds. */ - format = _("%A, %B %e %l:%M %p"); - else - /* strftime format of a weekday, a date without a year - and a time, in 12-hour format. */ - format = _("%A, %B %e %l:%M:%S %p"); - } - } else { - if (!show_midnight && date_tm->tm_hour == 0 - && date_tm->tm_min == 0 && date_tm->tm_sec == 0) { - /* strftime format of a weekday and a date. */ - format = _("%A, %B %e, %Y"); - } else if (use_24_hour_format) { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a weekday, a date and a - time, in 24-hour format, without seconds. */ - format = _("%A, %B %e, %Y %H:%M"); - else - /* strftime format of a weekday, a date and a - time, in 24-hour format. */ - format = _("%A, %B %e, %Y %H:%M:%S"); - } else { - if (!show_zero_seconds && date_tm->tm_sec == 0) - /* strftime format of a weekday, a date and a - time, in 12-hour format, without seconds. */ - format = _("%A, %B %e, %Y %l:%M %p"); - else - /* strftime format of a weekday, a date and a - time, in 12-hour format. */ - format = _("%A, %B %e, %Y %l:%M:%S %p"); - } - } - - /* strftime returns 0 if the string doesn't fit, and leaves the buffer - undefined, so we set it to the empty string in that case. */ - if (e_utf8_strftime (buffer, buffer_size, format, date_tm) == 0) - buffer[0] = '\0'; -} - -static void -set_calendar_sender_text (ItipView *view) -{ - ItipViewPrivate *priv; - const char *organizer, *attendee; - char *sender = NULL; - - priv = view->priv; - - organizer = priv->organizer ? priv->organizer : _("An unknown person"); - attendee = priv->attendee ? priv->attendee : _("An unknown person"); - - switch (priv->mode) { - case ITIP_VIEW_MODE_PUBLISH: - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has published the following meeting information:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> has published the following meeting information:"), organizer); - break; - case ITIP_VIEW_MODE_REQUEST: - /* FIXME is the delegator stuff handled correctly here? */ - if (priv->delegator) { - sender = g_strdup_printf (_("<b>%s</b> requests the presence of %s at the following meeting:"), organizer, priv->delegator); - } else { - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s requests your presence at the following meeting:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> requests your presence at the following meeting:"), organizer); - } - break; - case ITIP_VIEW_MODE_ADD: - /* FIXME What text for this? */ - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s wishes to add to an existing meeting:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> wishes to add to an existing meeting:"), organizer); - break; - case ITIP_VIEW_MODE_REFRESH: - sender = g_strdup_printf (_("<b>%s</b> wishes to receive the latest information for the following meeting:"), attendee); - break; - case ITIP_VIEW_MODE_REPLY: - sender = g_strdup_printf (_("<b>%s</b> has sent back the following meeting response:"), attendee); - break; - case ITIP_VIEW_MODE_CANCEL: - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has cancelled the following meeting:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> has cancelled the following meeting."), organizer); - break; - case ITIP_VIEW_MODE_COUNTER: - sender = g_strdup_printf (_("<b>%s</b> has proposed the following meeting changes."), attendee); - break; - case ITIP_VIEW_MODE_DECLINECOUNTER: - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has declined the following meeting changes:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> has declined the following meeting changes."), organizer); - break; - default: - break; - } - - gtk_label_set_text (GTK_LABEL (priv->sender_label), sender); - gtk_label_set_use_markup (GTK_LABEL (priv->sender_label), TRUE); - - g_free (sender); -} - -static void -set_tasklist_sender_text (ItipView *view) -{ - ItipViewPrivate *priv; - const char *organizer, *attendee; - char *sender = NULL; - - priv = view->priv; - - organizer = priv->organizer ? priv->organizer : _("An unknown person"); - attendee = priv->attendee ? priv->attendee : _("An unknown person"); - - switch (priv->mode) { - case ITIP_VIEW_MODE_PUBLISH: - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has published the following task:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> has published the following task:"), organizer); - break; - case ITIP_VIEW_MODE_REQUEST: - /* FIXME is the delegator stuff handled correctly here? */ - if (priv->delegator) { - sender = g_strdup_printf (_("<b>%s</b> requests the assignment of %s to the following task:"), organizer, priv->delegator); - } else { - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has assigned you a task:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> has assigned you a task:"), organizer); - } - break; - case ITIP_VIEW_MODE_ADD: - /* FIXME What text for this? */ - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s wishes to add to an existing task:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> wishes to add to an existing task:"), organizer); - break; - case ITIP_VIEW_MODE_REFRESH: - sender = g_strdup_printf (_("<b>%s</b> wishes to receive the latest information for the following assigned task:"), attendee); - break; - case ITIP_VIEW_MODE_REPLY: - sender = g_strdup_printf (_("<b>%s</b> has sent back the following assigned task response:"), attendee); - break; - case ITIP_VIEW_MODE_CANCEL: - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has cancelled the following assigned task:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> has cancelled the following assigned task:"), organizer); - break; - case ITIP_VIEW_MODE_COUNTER: - sender = g_strdup_printf (_("<b>%s</b> has proposed the following task assignment changes:"), attendee); - break; - case ITIP_VIEW_MODE_DECLINECOUNTER: - if (priv->sentby) - sender = g_strdup_printf (_("<b>%s</b> through %s has declined the following assigned task:"), organizer, priv->sentby); - else - sender = g_strdup_printf (_("<b>%s</b> has declined the following assigned task:"), organizer); - break; - default: - break; - } - - gtk_label_set_text (GTK_LABEL (priv->sender_label), sender); - gtk_label_set_use_markup (GTK_LABEL (priv->sender_label), TRUE); - - g_free (sender); -} - -static void -set_sender_text (ItipView *view) -{ - ItipViewPrivate *priv; - - priv = view->priv; - - switch (priv->type) { - case E_CAL_SOURCE_TYPE_EVENT: - set_calendar_sender_text (view); - break; - case E_CAL_SOURCE_TYPE_TODO: - set_tasklist_sender_text (view); - break; - default: - break; - } -} - -static void -set_summary_text (ItipView *view) -{ - ItipViewPrivate *priv; - char *summary = NULL; - - priv = view->priv; - - summary = g_strdup_printf ("<b>%s</b>", priv->summary); - - gtk_label_set_text (GTK_LABEL (priv->summary_label), summary); - gtk_label_set_use_markup (GTK_LABEL (priv->summary_label), TRUE); - - g_free (summary); -} - -static void -set_location_text (ItipView *view) -{ - ItipViewPrivate *priv; - - priv = view->priv; - - gtk_label_set_text (GTK_LABEL (priv->location_label), priv->location); - - priv->location ? gtk_widget_show (priv->location_header) : gtk_widget_hide (priv->location_header); - priv->location ? gtk_widget_show (priv->location_label) : gtk_widget_hide (priv->location_label); -} - -static void -set_status_text (ItipView *view) -{ - ItipViewPrivate *priv; - - priv = view->priv; - - gtk_label_set_text (GTK_LABEL (priv->status_label), priv->status); - - priv->status ? gtk_widget_show (priv->status_header) : gtk_widget_hide (priv->status_header); - priv->status ? gtk_widget_show (priv->status_label) : gtk_widget_hide (priv->status_label); -} - -static void -set_comment_text (ItipView *view) -{ - ItipViewPrivate *priv; - - priv = view->priv; - - gtk_label_set_text (GTK_LABEL (priv->comment_label), priv->comment); - - priv->comment ? gtk_widget_show (priv->comment_header) : gtk_widget_hide (priv->comment_header); - priv->comment ? gtk_widget_show (priv->comment_label) : gtk_widget_hide (priv->comment_label); -} - -static void -set_description_text (ItipView *view) -{ - ItipViewPrivate *priv; - - priv = view->priv; - - gtk_label_set_text (GTK_LABEL (priv->description_label), priv->description); - - priv->description ? gtk_widget_show (priv->description_label) : gtk_widget_hide (priv->description_label); -} - -static void -set_start_text (ItipView *view) -{ - ItipViewPrivate *priv; - char buffer[256]; - time_t now; - struct tm *now_tm; - - priv = view->priv; - - now = time (NULL); - now_tm = localtime (&now); - - if (priv->start_tm) { - format_date_and_time_x (priv->start_tm, now_tm, FALSE, TRUE, FALSE, buffer, 256); - gtk_label_set_text (GTK_LABEL (priv->start_label), buffer); - } else { - gtk_label_set_text (GTK_LABEL (priv->start_label), NULL); - } - - priv->start_tm ? gtk_widget_show (priv->start_header) : gtk_widget_hide (priv->start_header); - priv->start_tm ? gtk_widget_show (priv->start_label) : gtk_widget_hide (priv->start_label); -} - -static void -set_end_text (ItipView *view) -{ - ItipViewPrivate *priv; - char buffer[256]; - time_t now; - struct tm *now_tm; - - priv = view->priv; - - now = time (NULL); - now_tm = localtime (&now); - - if (priv->end_tm) { - format_date_and_time_x (priv->end_tm, now_tm, FALSE, TRUE, FALSE, buffer, 256); - gtk_label_set_text (GTK_LABEL (priv->end_label), buffer); - } else { - gtk_label_set_text (GTK_LABEL (priv->end_label), NULL); - } - - priv->end_tm ? gtk_widget_show (priv->end_header) : gtk_widget_hide (priv->end_header); - priv->end_tm ? gtk_widget_show (priv->end_label) : gtk_widget_hide (priv->end_label); -} - -static void -set_info_items (GtkWidget *info_box, GSList *info_items) -{ - GSList *l; - - gtk_container_foreach (GTK_CONTAINER (info_box), (GtkCallback) gtk_widget_destroy, NULL); - - for (l = info_items; l; l = l->next) { - ItipViewInfoItem *item = l->data; - GtkWidget *hbox, *image, *label; - - hbox = gtk_hbox_new (FALSE, 0); - - switch (item->type) { - case ITIP_VIEW_INFO_ITEM_TYPE_INFO: - image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_INFO, GTK_ICON_SIZE_SMALL_TOOLBAR); - break; - case ITIP_VIEW_INFO_ITEM_TYPE_WARNING: - image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_WARNING, GTK_ICON_SIZE_SMALL_TOOLBAR); - break; - case ITIP_VIEW_INFO_ITEM_TYPE_ERROR: - image = gtk_image_new_from_stock (GTK_STOCK_DIALOG_ERROR, GTK_ICON_SIZE_SMALL_TOOLBAR); - break; - case ITIP_VIEW_INFO_ITEM_TYPE_PROGRESS: - image = e_icon_factory_get_image ("stock_animation", E_ICON_SIZE_BUTTON); - break; - case ITIP_VIEW_INFO_ITEM_TYPE_NONE: - default: - image = NULL; - } - - if (image) { - gtk_widget_show (image); - gtk_box_pack_start (GTK_BOX (hbox), image, FALSE, FALSE, 6); - } - - label = gtk_label_new (item->message); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); - - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (info_box), hbox, FALSE, FALSE, 6); - } -} - -static void -set_upper_info_items (ItipView *view) -{ - ItipViewPrivate *priv; - - priv = view->priv; - - set_info_items (priv->upper_info_box, priv->upper_info_items); -} - -static void -set_lower_info_items (ItipView *view) -{ - ItipViewPrivate *priv; - - priv = view->priv; - - set_info_items (priv->lower_info_box, priv->lower_info_items); -} - -#define DATA_RESPONSE_KEY "ItipView::button_response" - -static void -button_clicked_cb (GtkWidget *widget, gpointer data) -{ - ItipViewResponse response; - - response = GPOINTER_TO_INT (g_object_get_data (G_OBJECT (widget), DATA_RESPONSE_KEY)); - - g_message ("Response %d", response); - g_signal_emit (G_OBJECT (data), signals[RESPONSE], 0, response); -} - -static void -set_one_button (ItipView *view, char *label, char *stock_id, ItipViewResponse response) -{ - ItipViewPrivate *priv; - GtkWidget *button; - - priv = view->priv; - - button = e_gtk_button_new_with_icon (label, stock_id); - g_object_set_data (G_OBJECT (button), DATA_RESPONSE_KEY, GINT_TO_POINTER (response)); - gtk_widget_show (button); - gtk_container_add (GTK_CONTAINER (priv->button_box), button); - - g_signal_connect (button, "clicked", G_CALLBACK (button_clicked_cb), view); -} - -static void -set_buttons (ItipView *view) -{ - ItipViewPrivate *priv; - - priv = view->priv; - - gtk_container_foreach (GTK_CONTAINER (priv->button_box), (GtkCallback) gtk_widget_destroy, NULL); - - /* Everything gets the open button */ - set_one_button (view, "_Open Calendar", GTK_STOCK_JUMP_TO, ITIP_VIEW_RESPONSE_OPEN); - - switch (priv->mode) { - case ITIP_VIEW_MODE_PUBLISH: - /* FIXME Is this really the right button? */ - set_one_button (view, "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT); - break; - case ITIP_VIEW_MODE_REQUEST: - set_one_button (view, "_Decline", GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE); - set_one_button (view, "_Tentative", GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE); - set_one_button (view, "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT); - break; - case ITIP_VIEW_MODE_ADD: - set_one_button (view, "_Decline", GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE); - set_one_button (view, "_Tentative", GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE); - set_one_button (view, "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT); - break; - case ITIP_VIEW_MODE_REFRESH: - /* FIXME Is this really the right button? */ - set_one_button (view, "_Send Information", GTK_STOCK_REFRESH, ITIP_VIEW_RESPONSE_REFRESH); - break; - case ITIP_VIEW_MODE_REPLY: - /* FIXME Is this really the right button? */ - set_one_button (view, "_Update Attendee Status", GTK_STOCK_REFRESH, ITIP_VIEW_RESPONSE_UPDATE); - break; - case ITIP_VIEW_MODE_CANCEL: - set_one_button (view, "_Update", GTK_STOCK_REFRESH, ITIP_VIEW_RESPONSE_CANCEL); - break; - case ITIP_VIEW_MODE_COUNTER: - set_one_button (view, "_Decline", GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE); - set_one_button (view, "_Tentative", GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE); - set_one_button (view, "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT); - break; - case ITIP_VIEW_MODE_DECLINECOUNTER: - set_one_button (view, "_Decline", GTK_STOCK_CANCEL, ITIP_VIEW_RESPONSE_DECLINE); - set_one_button (view, "_Tentative", GTK_STOCK_DIALOG_QUESTION, ITIP_VIEW_RESPONSE_TENTATIVE); - set_one_button (view, "_Accept", GTK_STOCK_APPLY, ITIP_VIEW_RESPONSE_ACCEPT); - break; - default: - break; - } -} - -static void -itip_view_destroy (GtkObject *object) -{ - ItipView *view = ITIP_VIEW (object); - ItipViewPrivate *priv = view->priv; - - if (priv) { - g_free (priv->organizer); - g_free (priv->sentby); - g_free (priv->delegator); - g_free (priv->attendee); - g_free (priv->location); - g_free (priv->status); - g_free (priv->comment); - g_free (priv->start_tm); - g_free (priv->end_tm); - - itip_view_clear_upper_info_items (view); - itip_view_clear_lower_info_items (view); - - g_free (priv); - view->priv = NULL; - } - - GTK_OBJECT_CLASS (itip_view_parent_class)->destroy (object); -} - -static void -itip_view_class_init (ItipViewClass *klass) -{ - GObjectClass *object_class; - GtkObjectClass *gtkobject_class; - - object_class = G_OBJECT_CLASS (klass); - gtkobject_class = GTK_OBJECT_CLASS (klass); - - gtkobject_class->destroy = itip_view_destroy; - - signals[SOURCE_SELECTED] = - g_signal_new ("source_selected", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ItipViewClass, source_selected), - NULL, NULL, - gtk_marshal_NONE__POINTER, - G_TYPE_NONE, 1, G_TYPE_POINTER); - - signals[RESPONSE] = - g_signal_new ("response", - G_TYPE_FROM_CLASS (klass), - G_SIGNAL_RUN_LAST, - G_STRUCT_OFFSET (ItipViewClass, response), - NULL, NULL, - gtk_marshal_NONE__INT, - G_TYPE_NONE, 1, G_TYPE_INT); -} - -static void -rsvp_toggled_cb (GtkWidget *widget, gpointer data) -{ - ItipView *view = data; - ItipViewPrivate *priv; - gboolean rsvp; - - priv = view->priv; - - rsvp = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->rsvp_check)); - - gtk_widget_set_sensitive (priv->rsvp_comment_header, rsvp); - gtk_widget_set_sensitive (priv->rsvp_comment_entry, rsvp); -} - -static void -itip_view_init (ItipView *view) -{ - ItipViewPrivate *priv; - GtkWidget *icon, *vbox, *hbox, *separator, *table, *label; - - priv = g_new0 (ItipViewPrivate, 1); - view->priv = priv; - - priv->mode = ITIP_VIEW_MODE_NONE; - - gtk_box_set_spacing (GTK_BOX (view), 12); - - /* The meeting icon */ - icon = e_icon_factory_get_image (MEETING_ICON, E_ICON_SIZE_LARGE_TOOLBAR); - gtk_misc_set_alignment (GTK_MISC (icon), 0.5, 0); - gtk_widget_show (icon); - - gtk_box_pack_start (GTK_BOX (view), icon, FALSE, FALSE, 0); - - /* The RHS */ - vbox = gtk_vbox_new (FALSE, 12); - gtk_widget_show (vbox); - gtk_box_pack_start (GTK_BOX (view), vbox, FALSE, FALSE, 0); - - /* The first section listing the sender */ - /* FIXME What to do if the send and organizer do not match */ - priv->sender_label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (priv->sender_label), 0, 0.5); - gtk_widget_show (priv->sender_label); - gtk_box_pack_start (GTK_BOX (vbox), priv->sender_label, FALSE, FALSE, 0); - - separator = gtk_hseparator_new (); - gtk_widget_show (separator); - gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0); - - /* A table with information on the meeting and any extra info/warnings */ - table = gtk_table_new (4, 2, FALSE); - gtk_table_set_row_spacings (GTK_TABLE (table), 6); - gtk_table_set_col_spacings (GTK_TABLE (table), 6); - gtk_widget_show (table); - gtk_box_pack_start (GTK_BOX (vbox), table, FALSE, FALSE, 0); - - /* Summary */ - priv->summary_label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (priv->summary_label), 0, 0.5); - gtk_widget_show (priv->summary_label); - gtk_table_attach (GTK_TABLE (table), priv->summary_label, 0, 2, 0, 1, GTK_FILL, 0, 0, 0); - - /* Location */ - priv->location_header = gtk_label_new (_("Location:")); - priv->location_label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (priv->location_header), 0, 0.5); - gtk_misc_set_alignment (GTK_MISC (priv->location_label), 0, 0.5); - gtk_table_attach (GTK_TABLE (table), priv->location_header, 0, 1, 1, 2, GTK_FILL, 0, 0, 0); - gtk_table_attach (GTK_TABLE (table), priv->location_label, 1, 2, 1, 2, GTK_FILL, 0, 0, 0); - - /* Start time */ - priv->start_header = gtk_label_new (_("Start time:")); - priv->start_label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (priv->start_header), 0, 0.5); - gtk_misc_set_alignment (GTK_MISC (priv->start_label), 0, 0.5); - gtk_widget_show (priv->start_header); - gtk_table_attach (GTK_TABLE (table), priv->start_header, 0, 1, 2, 3, GTK_FILL, 0, 0, 0); - gtk_table_attach (GTK_TABLE (table), priv->start_label, 1, 2, 2, 3, GTK_FILL, 0, 0, 0); - - /* End time */ - priv->end_header = gtk_label_new (_("End time:")); - priv->end_label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (priv->end_header), 0, 0.5); - gtk_misc_set_alignment (GTK_MISC (priv->end_label), 0, 0.5); - gtk_table_attach (GTK_TABLE (table), priv->end_header, 0, 1, 3, 4, GTK_FILL, 0, 0, 0); - gtk_table_attach (GTK_TABLE (table), priv->end_label, 1, 2, 3, 4, GTK_FILL, 0, 0, 0); - - /* Status */ - priv->status_header = gtk_label_new (_("Status:")); - priv->status_label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (priv->status_header), 0, 0.5); - gtk_misc_set_alignment (GTK_MISC (priv->status_label), 0, 0.5); - gtk_table_attach (GTK_TABLE (table), priv->status_header, 0, 1, 4, 5, GTK_FILL, 0, 0, 0); - gtk_table_attach (GTK_TABLE (table), priv->status_label, 1, 2, 4, 5, GTK_FILL, 0, 0, 0); - - /* Comment */ - priv->comment_header = gtk_label_new (_("Comment:")); - priv->comment_label = gtk_label_new (NULL); - gtk_misc_set_alignment (GTK_MISC (priv->comment_header), 0, 0.5); - gtk_misc_set_alignment (GTK_MISC (priv->comment_label), 0, 0.5); - gtk_table_attach (GTK_TABLE (table), priv->comment_header, 0, 1, 5, 6, GTK_FILL, 0, 0, 0); - gtk_table_attach (GTK_TABLE (table), priv->comment_label, 1, 2, 5, 6, GTK_FILL, 0, 0, 0); - - /* Upper Info items */ - priv->upper_info_box = gtk_vbox_new (FALSE, 12); - gtk_widget_show (priv->upper_info_box); - gtk_box_pack_start (GTK_BOX (vbox), priv->upper_info_box, FALSE, FALSE, 0); - - /* Description */ - priv->description_label = gtk_label_new (NULL); - gtk_label_set_line_wrap (GTK_LABEL (priv->description_label), TRUE); - gtk_misc_set_alignment (GTK_MISC (priv->description_label), 0, 0.5); -// gtk_box_pack_start (GTK_BOX (vbox), priv->description_label, FALSE, FALSE, 0); - - separator = gtk_hseparator_new (); - gtk_widget_show (separator); - gtk_box_pack_start (GTK_BOX (vbox), separator, FALSE, FALSE, 0); - - /* Lower Info items */ - priv->lower_info_box = gtk_vbox_new (FALSE, 12); - gtk_widget_show (priv->lower_info_box); - gtk_box_pack_start (GTK_BOX (vbox), priv->lower_info_box, FALSE, FALSE, 0); - - /* Selector area */ - priv->selector_box = gtk_hbox_new (FALSE, 12); - gtk_widget_show (priv->selector_box); - gtk_box_pack_start (GTK_BOX (vbox), priv->selector_box, FALSE, FALSE, 0); - - /* RSVP area */ - priv->rsvp_box = gtk_vbox_new (FALSE, 12); - gtk_box_pack_start (GTK_BOX (vbox), priv->rsvp_box, FALSE, FALSE, 0); - - priv->rsvp_check = gtk_check_button_new_with_mnemonic ("Send _reply to sender"); - gtk_widget_show (priv->rsvp_check); - gtk_box_pack_start (GTK_BOX (priv->rsvp_box), priv->rsvp_check, FALSE, FALSE, 0); - - g_signal_connect (priv->rsvp_check, "toggled", G_CALLBACK (rsvp_toggled_cb), view); - - hbox = gtk_hbox_new (FALSE, 12); - gtk_widget_show (hbox); - gtk_box_pack_start (GTK_BOX (priv->rsvp_box), hbox, FALSE, FALSE, 0); - - label = gtk_label_new (NULL); - gtk_widget_show (label); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); - - priv->rsvp_comment_header = gtk_label_new (_("Comment:")); - gtk_widget_set_sensitive (priv->rsvp_comment_header, FALSE); - gtk_widget_show (priv->rsvp_comment_header); - gtk_box_pack_start (GTK_BOX (hbox), priv->rsvp_comment_header, FALSE, FALSE, 0); - - priv->rsvp_comment_entry = gtk_entry_new (); - gtk_widget_set_sensitive (priv->rsvp_comment_entry, FALSE); - gtk_widget_show (priv->rsvp_comment_entry); - gtk_box_pack_start (GTK_BOX (hbox), priv->rsvp_comment_entry, FALSE, TRUE, 0); - - /* The buttons for actions */ - priv->button_box = gtk_hbutton_box_new (); - gtk_button_box_set_layout (GTK_BUTTON_BOX (priv->button_box), GTK_BUTTONBOX_END); - gtk_box_set_spacing (GTK_BOX (priv->button_box), 12); - gtk_widget_show (priv->button_box); - gtk_box_pack_start (GTK_BOX (vbox), priv->button_box, FALSE, FALSE, 0); - - priv->buttons_sensitive = TRUE; -} - -GtkWidget * -itip_view_new (void) -{ - ItipView *itip_view = g_object_new (ITIP_TYPE_VIEW, "homogeneous", FALSE, "spacing", 6, NULL); - - return GTK_WIDGET (itip_view); -} - -void -itip_view_set_mode (ItipView *view, ItipViewMode mode) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - priv->mode = mode; - - set_sender_text (view); - set_buttons (view); -} - -ItipViewMode -itip_view_get_mode (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, ITIP_VIEW_MODE_NONE); - g_return_val_if_fail (ITIP_IS_VIEW (view), ITIP_VIEW_MODE_NONE); - - priv = view->priv; - - return priv->mode; -} - -void -itip_view_set_item_type (ItipView *view, ECalSourceType type) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - priv->type = type; - - set_sender_text (view); -} - -ECalSourceType -itip_view_get_item_type (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, ITIP_VIEW_MODE_NONE); - g_return_val_if_fail (ITIP_IS_VIEW (view), ITIP_VIEW_MODE_NONE); - - priv = view->priv; - - return priv->type; -} - - -void -itip_view_set_organizer (ItipView *view, const char *organizer) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->organizer) - g_free (priv->organizer); - - priv->organizer = g_strdup (organizer); - - set_sender_text (view); -} - -const char * -itip_view_get_organizer (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->organizer; -} - -void -itip_view_set_sentby (ItipView *view, const char *sentby) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->sentby) - g_free (priv->sentby); - - priv->sentby = g_strdup (sentby); - - set_sender_text (view); -} - -const char * -itip_view_get_sentby (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->sentby; -} - -void -itip_view_set_attendee (ItipView *view, const char *attendee) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->attendee) - g_free (priv->attendee); - - priv->attendee = g_strdup (attendee); - - set_sender_text (view); -} - -const char * -itip_view_get_attendee (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->attendee; -} - -void -itip_view_set_delegator (ItipView *view, const char *delegator) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->delegator) - g_free (priv->delegator); - - priv->delegator = g_strdup (delegator); - - set_sender_text (view); -} - -const char * -itip_view_get_delegator (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->delegator; -} - -void -itip_view_set_summary (ItipView *view, const char *summary) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->summary) - g_free (priv->summary); - - priv->summary = summary ? g_strstrip (g_strdup (summary)) : NULL; - - set_summary_text (view); -} - -const char * -itip_view_get_summary (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->summary; -} - -void -itip_view_set_location (ItipView *view, const char *location) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->location) - g_free (priv->location); - - priv->location = location ? g_strstrip (g_strdup (location)) : NULL; - - set_location_text (view); -} - -const char * -itip_view_get_location (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->location; -} - -void -itip_view_set_status (ItipView *view, const char *status) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->status) - g_free (priv->status); - - priv->status = status ? g_strstrip (g_strdup (status)) : NULL; - - set_status_text (view); -} - -const char * -itip_view_get_status (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->status; -} - -void -itip_view_set_comment (ItipView *view, const char *comment) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->comment) - g_free (priv->comment); - - priv->comment = comment ? g_strstrip (g_strdup (comment)) : NULL; - - set_comment_text (view); -} - -const char * -itip_view_get_comment (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->comment; -} - - -void -itip_view_set_description (ItipView *view, const char *description) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->description) - g_free (priv->description); - - priv->description = description ? g_strstrip (g_strdup (description)) : NULL; - - set_description_text (view); -} - -const char * -itip_view_get_description (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->description; -} - - -void -itip_view_set_start (ItipView *view, struct tm *start) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->start_tm && !start) { - g_free (priv->start_tm); - priv->start_tm = NULL; - } else if (start) { - if (!priv->start_tm) - priv->start_tm = g_new0 (struct tm, 1); - - *priv->start_tm = *start; - } - - set_start_text (view); -} - -const struct tm * -itip_view_get_start (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->start_tm; -} - -void -itip_view_set_end (ItipView *view, struct tm *end) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->end_tm && !end) { - g_free (priv->end_tm); - priv->end_tm = NULL; - } else if (end) { - if (!priv->end_tm) - priv->end_tm = g_new0 (struct tm, 1); - - *priv->end_tm = *end; - } - - set_end_text (view); -} - -const struct tm * -itip_view_get_end (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, NULL); - g_return_val_if_fail (ITIP_IS_VIEW (view), NULL); - - priv = view->priv; - - return priv->end_tm; -} - -guint -itip_view_add_upper_info_item (ItipView *view, ItipViewInfoItemType type, const char *message) -{ - ItipViewPrivate *priv; - ItipViewInfoItem *item; - - g_return_val_if_fail (view != NULL, 0); - g_return_val_if_fail (ITIP_IS_VIEW (view), 0); - - priv = view->priv; - - item = g_new0 (ItipViewInfoItem, 1); - - item->type = type; - item->message = g_strdup (message); - item->id = priv->next_info_item_id++; - - priv->upper_info_items = g_slist_append (priv->upper_info_items, item); - - set_upper_info_items (view); - - return item->id; -} - -guint -itip_view_add_upper_info_item_printf (ItipView *view, ItipViewInfoItemType type, const char *format, ...) -{ - ItipViewPrivate *priv; - va_list args; - char *message; - guint id; - - g_return_val_if_fail (view != NULL, 0); - g_return_val_if_fail (ITIP_IS_VIEW (view), 0); - - priv = view->priv; - - va_start (args, format); - message = g_strdup_vprintf (format, args); - va_end (args); - - id = itip_view_add_upper_info_item (view, type, message); - g_free (message); - - return id; -} - -void -itip_view_remove_upper_info_item (ItipView *view, guint id) -{ - ItipViewPrivate *priv; - GSList *l; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - for (l = priv->upper_info_items; l; l = l->next) { - ItipViewInfoItem *item = l->data; - - if (item->id == id) { - priv->upper_info_items = g_slist_remove (priv->upper_info_items, item); - - g_free (item->message); - g_free (item); - - set_upper_info_items (view); - - return; - } - } -} - -void -itip_view_clear_upper_info_items (ItipView *view) -{ - ItipViewPrivate *priv; - GSList *l; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - gtk_container_foreach (GTK_CONTAINER (priv->upper_info_box), (GtkCallback) gtk_widget_destroy, NULL); - - for (l = priv->upper_info_items; l; l = l->next) { - ItipViewInfoItem *item = l->data; - - g_free (item->message); - g_free (item); - } - - g_slist_free (priv->upper_info_items); - priv->upper_info_items = NULL; -} - -guint -itip_view_add_lower_info_item (ItipView *view, ItipViewInfoItemType type, const char *message) -{ - ItipViewPrivate *priv; - ItipViewInfoItem *item; - - g_return_val_if_fail (view != NULL, 0); - g_return_val_if_fail (ITIP_IS_VIEW (view), 0); - - priv = view->priv; - - item = g_new0 (ItipViewInfoItem, 1); - - item->type = type; - item->message = g_strdup (message); - item->id = priv->next_info_item_id++; - - priv->lower_info_items = g_slist_append (priv->lower_info_items, item); - - set_lower_info_items (view); - - return item->id; -} - -guint -itip_view_add_lower_info_item_printf (ItipView *view, ItipViewInfoItemType type, const char *format, ...) -{ - ItipViewPrivate *priv; - va_list args; - char *message; - guint id; - - g_return_val_if_fail (view != NULL, 0); - g_return_val_if_fail (ITIP_IS_VIEW (view), 0); - - priv = view->priv; - - va_start (args, format); - message = g_strdup_vprintf (format, args); - va_end (args); - - id = itip_view_add_lower_info_item (view, type, message); - g_free (message); - - return id; -} - -void -itip_view_remove_lower_info_item (ItipView *view, guint id) -{ - ItipViewPrivate *priv; - GSList *l; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - for (l = priv->lower_info_items; l; l = l->next) { - ItipViewInfoItem *item = l->data; - - if (item->id == id) { - priv->lower_info_items = g_slist_remove (priv->lower_info_items, item); - - g_free (item->message); - g_free (item); - - set_lower_info_items (view); - - return; - } - } -} - -void -itip_view_clear_lower_info_items (ItipView *view) -{ - ItipViewPrivate *priv; - GSList *l; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - gtk_container_foreach (GTK_CONTAINER (priv->lower_info_box), (GtkCallback) gtk_widget_destroy, NULL); - - for (l = priv->lower_info_items; l; l = l->next) { - ItipViewInfoItem *item = l->data; - - g_free (item->message); - g_free (item); - } - - g_slist_free (priv->lower_info_items); - priv->lower_info_items = NULL; -} - -static void -source_selected_cb (ESourceOptionMenu *esom, ESource *source, gpointer data) -{ - ItipView *view = data; - - g_signal_emit (view, signals[SOURCE_SELECTED], 0, source); -} - -void -itip_view_set_source_list (ItipView *view, ESourceList *source_list) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (priv->source_list) - g_object_unref (priv->source_list); - - if (priv->esom) - gtk_widget_destroy (priv->esom); - - if (!source_list) { - if (priv->esom_header) - gtk_widget_destroy (priv->esom_header); - - priv->source_list = NULL; - priv->esom = NULL; - priv->esom_header = NULL; - - return; - } - - priv->source_list = g_object_ref (source_list); - - priv->esom = e_source_option_menu_new (source_list); - gtk_widget_show (priv->esom); - g_signal_connect (priv->esom, "source_selected", G_CALLBACK (source_selected_cb), view); - - if (!priv->esom_header) { - priv->esom_header = gtk_label_new_with_mnemonic (_("_Calendar:")); - gtk_label_set_mnemonic_widget (GTK_LABEL (priv->esom_header), priv->esom); - gtk_widget_show (priv->esom_header); - } - - gtk_box_pack_start (GTK_BOX (priv->selector_box), priv->esom_header, FALSE, TRUE, 6); - gtk_box_pack_start (GTK_BOX (priv->selector_box), priv->esom, FALSE, TRUE, 0); -} - -ESourceList * -itip_view_get_source_list (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, FALSE); - g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE); - - priv = view->priv; - - return priv->source_list; -} - -void -itip_view_set_source (ItipView *view, ESource *source) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - if (!priv->esom) - return; - - e_source_option_menu_select (E_SOURCE_OPTION_MENU (priv->esom), source); -} - -ESource * -itip_view_get_source (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, FALSE); - g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE); - - priv = view->priv; - - if (!priv->esom) - return NULL; - - return e_source_option_menu_peek_selected (E_SOURCE_OPTION_MENU (priv->esom)); -} - -void -itip_view_set_rsvp (ItipView *view, gboolean rsvp) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (priv->rsvp_check), rsvp); - - gtk_widget_set_sensitive (priv->rsvp_comment_header, rsvp); - gtk_widget_set_sensitive (priv->rsvp_comment_entry, rsvp); -} - -gboolean -itip_view_get_rsvp (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, FALSE); - g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE); - - priv = view->priv; - - return gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (priv->rsvp_check)); -} - -void -itip_view_set_show_rsvp (ItipView *view, gboolean rsvp) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - priv->rsvp_show = rsvp; - - priv->rsvp_show ? gtk_widget_show (priv->rsvp_box) : gtk_widget_hide (priv->rsvp_box); -} - -gboolean -itip_view_get_show_rsvp (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, FALSE); - g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE); - - priv = view->priv; - - return priv->rsvp_show; -} - -void -itip_view_set_rsvp_comment (ItipView *view, const char *comment) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - gtk_entry_set_text (GTK_ENTRY (priv->rsvp_comment_entry), comment); -} - -const char * -itip_view_get_rsvp_comment (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, FALSE); - g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE); - - priv = view->priv; - - return gtk_entry_get_text (GTK_ENTRY (priv->rsvp_comment_entry)); -} - -void -itip_view_set_buttons_sensitive (ItipView *view, gboolean sensitive) -{ - ItipViewPrivate *priv; - - g_return_if_fail (view != NULL); - g_return_if_fail (ITIP_IS_VIEW (view)); - - priv = view->priv; - - priv->buttons_sensitive = sensitive; - - gtk_widget_set_sensitive (priv->button_box, priv->buttons_sensitive); -} - -gboolean -itip_view_get_buttons_sensitive (ItipView *view) -{ - ItipViewPrivate *priv; - - g_return_val_if_fail (view != NULL, FALSE); - g_return_val_if_fail (ITIP_IS_VIEW (view), FALSE); - - priv = view->priv; - - return priv->buttons_sensitive; -} - - diff --git a/plugins/itip-formatter/itip-view.h b/plugins/itip-formatter/itip-view.h deleted file mode 100644 index a8605a9564..0000000000 --- a/plugins/itip-formatter/itip-view.h +++ /dev/null @@ -1,164 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode: t; c-basic-offset: 8; tab-width: 8 -*- */ -/* itip-view.h - * - * 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., 59 Temple Place - Suite 330, - * Boston, MA 02111-1307, USA. - * - * Author: JP Rosevear - */ - -#ifndef _ITIP_VIEW_H_ -#define _ITIP_VIEW_H_ - -#include <stdarg.h> -#include <unistd.h> -#include <glib-object.h> -#include <gtk/gtkhbox.h> -#include <libedataserver/e-source-list.h> -#include <libecal/e-cal.h> - -G_BEGIN_DECLS - -#define ITIP_TYPE_VIEW (itip_view_get_type ()) -#define ITIP_VIEW(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), ITIP_TYPE_VIEW, ItipView)) -#define ITIP_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), ITIP_TYPE_VIEW, ItipViewClass)) -#define ITIP_IS_VIEW(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), ITIP_TYPE_VIEW)) -#define ITIP_IS_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), ITIP_TYPE_VIEW)) -#define ITIP_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), ITIP_TYPE_VIEW, ItipViewClass)) - -typedef struct _ItipView ItipView; -typedef struct _ItipViewPrivate ItipViewPrivate; -typedef struct _ItipViewClass ItipViewClass; - -typedef enum { - ITIP_VIEW_MODE_NONE, - ITIP_VIEW_MODE_PUBLISH, - ITIP_VIEW_MODE_REQUEST, - ITIP_VIEW_MODE_COUNTER, - ITIP_VIEW_MODE_DECLINECOUNTER, - ITIP_VIEW_MODE_ADD, - ITIP_VIEW_MODE_REPLY, - ITIP_VIEW_MODE_REFRESH, - ITIP_VIEW_MODE_CANCEL -} ItipViewMode; - -typedef enum { - ITIP_VIEW_RESPONSE_NONE, - ITIP_VIEW_RESPONSE_ACCEPT, - ITIP_VIEW_RESPONSE_TENTATIVE, - ITIP_VIEW_RESPONSE_DECLINE, - ITIP_VIEW_RESPONSE_UPDATE, - ITIP_VIEW_RESPONSE_CANCEL, - ITIP_VIEW_RESPONSE_REFRESH, - ITIP_VIEW_RESPONSE_OPEN -} ItipViewResponse; - -typedef enum { - ITIP_VIEW_INFO_ITEM_TYPE_NONE, - ITIP_VIEW_INFO_ITEM_TYPE_INFO, - ITIP_VIEW_INFO_ITEM_TYPE_WARNING, - ITIP_VIEW_INFO_ITEM_TYPE_ERROR, - ITIP_VIEW_INFO_ITEM_TYPE_PROGRESS -} ItipViewInfoItemType; - -struct _ItipView { - GtkHBox parent_instance; - - ItipViewPrivate *priv; - - GtkWidget *action_vbox; -}; - -struct _ItipViewClass { - GtkHBoxClass parent_class; - - void (* source_selected) (ItipView *view, ESource *selected_source); - void (* response) (ItipView *view, int response); -}; - -GType itip_view_get_type (void); -GtkWidget *itip_view_new (void); - -void itip_view_set_mode (ItipView *view, ItipViewMode mode); -ItipViewMode itip_view_get_mode (ItipView *view); - -void itip_view_set_item_type (ItipView *view, ECalSourceType type); -ECalSourceType itip_view_get_item_type (ItipView *view); - -void itip_view_set_organizer (ItipView *view, const char *organizer); -const char *itip_view_get_organizer (ItipView *view); - -void itip_view_set_sentby (ItipView *view, const char *sentby); -const char *itip_view_get_sentby (ItipView *view); - -void itip_view_set_attendee (ItipView *view, const char *attendee); -const char *itip_view_get_attendee (ItipView *view); - -void itip_view_set_delegator (ItipView *view, const char *delegator); -const char *itip_view_get_delegator (ItipView *view); - -void itip_view_set_summary (ItipView *view, const char *summary); -const char *itip_view_get_summary (ItipView *view); - -void itip_view_set_location (ItipView *view, const char *location); -const char *itip_view_get_location (ItipView *view); - -void itip_view_set_status (ItipView *view, const char *status); -const char *itip_view_get_status (ItipView *view); - -void itip_view_set_comment (ItipView *view, const char *comment); -const char *itip_view_get_comment (ItipView *view); - -void itip_view_set_description (ItipView *view, const char *description); -const char *itip_view_get_description (ItipView *view); - -void itip_view_set_start (ItipView *view, struct tm *start); -const struct tm *itip_view_get_start (ItipView *view); - -void itip_view_set_end (ItipView *view, struct tm *end); -const struct tm *itip_view_get_end (ItipView *view); - -guint itip_view_add_upper_info_item (ItipView *view, ItipViewInfoItemType type, const char *message); -guint itip_view_add_upper_info_item_printf (ItipView *view, ItipViewInfoItemType, const char *format, ...) G_GNUC_PRINTF (3, 4); -void itip_view_remove_upper_info_item (ItipView *view, guint id); -void itip_view_clear_upper_info_items (ItipView *view); - -guint itip_view_add_lower_info_item (ItipView *view, ItipViewInfoItemType type, const char *message); -guint itip_view_add_lower_info_item_printf (ItipView *view, ItipViewInfoItemType type, const char *format, ...) G_GNUC_PRINTF (3, 4); -void itip_view_remove_lower_info_item (ItipView *view, guint id); -void itip_view_clear_lower_info_items (ItipView *view); - -void itip_view_set_source_list (ItipView *view, ESourceList *source_list); -ESourceList *itip_view_get_source_list (ItipView *view); - -void itip_view_set_source (ItipView *view, ESource *source); -ESource *itip_view_get_source (ItipView *view); - -void itip_view_set_rsvp (ItipView *view, gboolean rsvp); -gboolean itip_view_get_rsvp (ItipView *view); - -void itip_view_set_show_rsvp (ItipView *view, gboolean rsvp); -gboolean itip_view_get_show_rsvp (ItipView *view); - -void itip_view_set_rsvp_comment (ItipView *view, const char *comment); -const char *itip_view_get_rsvp_comment (ItipView *view); - -void itip_view_set_buttons_sensitive (ItipView *view, gboolean sensitive); -gboolean itip_view_get_buttons_sensitive (ItipView *view); - -G_END_DECLS - -#endif diff --git a/plugins/itip-formatter/org-gnome-itip-formatter-errors.xml b/plugins/itip-formatter/org-gnome-itip-formatter-errors.xml deleted file mode 100644 index f8f462a1e8..0000000000 --- a/plugins/itip-formatter/org-gnome-itip-formatter-errors.xml +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<error-list domain="org.gnome.itip-formatter"> - - <error id="add-unknown-attendee" type="question"> - <primary>This response is not from a current attendee. Add the sender as an attendee?</primary> - </error> - -</error-list> diff --git a/plugins/itip-formatter/org-gnome-itip-formatter.eplug.in b/plugins/itip-formatter/org-gnome-itip-formatter.eplug.in deleted file mode 100644 index 2f47b3f4a4..0000000000 --- a/plugins/itip-formatter/org-gnome-itip-formatter.eplug.in +++ /dev/null @@ -1,20 +0,0 @@ -<e-plugin-list> - <e-plugin id="org.gnome.evolution.itip_formatter" type="shlib" name="Itip Formatter" description="Displays text/calendar parts in messages" - location="@PLUGINDIR@/liborg-gnome-itip-formatter.so"> - - <hook class="org.gnome.evolution.mail.format:1.0"> - <group id="EMFormatHTMLDisplay"> - <item mime_type="text/calendar" flags="inline_disposition" format="format_itip"/> - </group> - <group id="EMFormat"> - <item mime_type="text/calendar" flags="inline_disposition" format="format_itip"/> - </group> - </hook> - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="prefs"> - <item type="page" path="90.bbdb" label="BBDB" factory="itip_formatter_page_factory"/> - </group> - </hook> - </e-plugin> -</e-plugin-list>
\ No newline at end of file diff --git a/plugins/mail-to-meeting/.cvsignore b/plugins/mail-to-meeting/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/mail-to-meeting/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/mail-to-meeting/ChangeLog b/plugins/mail-to-meeting/ChangeLog deleted file mode 100644 index 5b88823004..0000000000 --- a/plugins/mail-to-meeting/ChangeLog +++ /dev/null @@ -1,21 +0,0 @@ -2004-11-04 Rodrigo Moya <rodrigo@novell.com> - - * org-gnome-mail-to-meeting.eplug.in: fixed description and added - author's info, to display correctly on the plugin manager. - -2004-11-03 Not Zed <NotZed@Ximian.com> - - * org-gnome-mail-to-meeting.eplug.in: fix the popup id. - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-29 Rodrigo Moya <rodrigo@novell.com> - - * org-gnome-mail-to-meeting.eplug.in: fix folder view popup id and - use stock icon for meetings. - -2004-10-29 Rodrigo Moya <rodrigo@novell.com> - - * added mail-to-meeting plugin, to convert mails to meetings. diff --git a/plugins/mail-to-meeting/Makefile.am b/plugins/mail-to-meeting/Makefile.am deleted file mode 100644 index 2646d59670..0000000000 --- a/plugins/mail-to-meeting/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-mail-to-meeting.eplug -plugin_LTLIBRARIES = liborg-gnome-mail-to-meeting.la - -liborg_gnome_mail_to_meeting_la_SOURCES = mail-to-meeting.c -liborg_gnome_mail_to_meeting_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-mail-to-meeting.eplug.in
\ No newline at end of file diff --git a/plugins/mail-to-meeting/mail-to-meeting.c b/plugins/mail-to-meeting/mail-to-meeting.c deleted file mode 100644 index 4c358fe61a..0000000000 --- a/plugins/mail-to-meeting/mail-to-meeting.c +++ /dev/null @@ -1,179 +0,0 @@ -/* Evolution - Mail To Meeting plugin - * - * Copyright (C) 2004 Ximian, Inc. - * - * Authors: Rodrigo Moya <rodrigo@ximian.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., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA. - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib/gi18n-lib.h> -#include <string.h> -#include <stdio.h> - -#include <gconf/gconf-client.h> -#include <libecal/e-cal.h> -#include <libedataserverui/e-source-selector-dialog.h> -#include "camel/camel-folder.h" -#include "camel/camel-mime-message.h" -#include "mail/em-popup.h" - -static void -add_attendee_cb (gpointer key, gpointer value, gpointer user_data) -{ - ECalComponentAttendee *ca; - const char *str, *name; - GList **attendees = user_data; - - if (!camel_internet_address_get (value, 0, &name, &str)) - return; - - ca = g_new0 (ECalComponentAttendee, 1); - ca->value = str; - ca->cn = name; - /* FIXME: missing many fields */ - - *attendees = g_slist_append (*attendees, ca); -} - -static void -set_attendees (ECalComponent *comp, CamelMimeMessage *message) -{ - GSList *attendees = NULL, *l; - - g_hash_table_foreach (message->recipients, (GHFunc) add_attendee_cb, &attendees); - e_cal_component_set_attendee_list (comp, attendees); - - for (l = attendees; l != NULL; l = l->next) - g_free (l->data); - g_slist_free (attendees); -} - -static void -set_organizer (ECalComponent *comp, CamelMimeMessage *message) -{ - const CamelInternetAddress *address; - const char *str, *name; - ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL}; - - if (message->reply_to) - address = message->reply_to; - else if (message->from) - address = message->from; - else - return; - - if (!camel_internet_address_get (address, 0, &name, &str)) - return; - - organizer.value = str; - organizer.cn = name; - e_cal_component_set_organizer (comp, &organizer); -} - -static void -do_mail_to_meeting (EMPopupTargetSelect *t, ESource *meeting_source) -{ - ECal *client; - - /* open the meeting client */ - client = e_cal_new (meeting_source, E_CAL_SOURCE_TYPE_EVENT); - if (e_cal_open (client, FALSE, NULL)) { - int i; - - for (i = 0; i < (t->uids ? t->uids->len : 0); i++) { - CamelMimeMessage *message; - ECalComponent *comp; - ECalComponentText text; - GSList sl; - char *str; - - /* retrieve the message from the CamelFolder */ - message = camel_folder_get_message (t->folder, g_ptr_array_index (t->uids, i), NULL); - if (!message) - continue; - - comp = e_cal_component_new (); - e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_EVENT); - e_cal_component_set_uid (comp, camel_mime_message_get_message_id (message)); - - /* set the meeting's summary */ - text.value = camel_mime_message_get_subject (message); - text.altrep = NULL; - e_cal_component_set_summary (comp, &text); - - /* FIXME: a better way to get the full body */ - str = camel_mime_message_build_mbox_from (message); - text.value = str; - sl.next = NULL; - sl.data = &text; - e_cal_component_set_description_list (comp, &sl); - - g_free (str); - - /* set the organizer, and the attendees */ - set_organizer (comp, message); - set_attendees (comp, message); - - /* save the meeting to the selected source */ - e_cal_create_object (client, e_cal_component_get_icalcomponent (comp), NULL, NULL); - - g_object_unref (comp); - } - } - - /* free memory */ - g_object_unref (client); -} - -void org_gnome_mail_to_meeting (void *ep, EMPopupTargetSelect *t); - -void -org_gnome_mail_to_meeting (void *ep, EMPopupTargetSelect *t) -{ - GtkWidget *dialog; - GConfClient *conf_client; - ESourceList *source_list; - - /* ask the user which meeting list to save to */ - conf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (conf_client, "/apps/evolution/calendar/sources"); - - dialog = e_source_selector_dialog_new (NULL, source_list); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - ESource *source; - - /* if a source has been selected, perform the mail2meeting operation */ - source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog)); - if (source) - do_mail_to_meeting (t, source); - } - - g_object_unref (conf_client); - g_object_unref (source_list); - gtk_widget_destroy (dialog); -} - -int e_plugin_lib_enable(EPluginLib *ep, int enable); - -int -e_plugin_lib_enable(EPluginLib *ep, int enable) -{ - return 0; -} diff --git a/plugins/mail-to-meeting/org-gnome-mail-to-meeting.eplug.in b/plugins/mail-to-meeting/org-gnome-mail-to-meeting.eplug.in deleted file mode 100644 index 5248409158..0000000000 --- a/plugins/mail-to-meeting/org-gnome-mail-to-meeting.eplug.in +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.mailToMeeting" - location="@PLUGINDIR@/liborg-gnome-mail-to-meeting.so" - name="Convert a mail message into a meeting"> - <description>A plugin which allows the creation of meetings from the contents of a mail message</description> - <author name="Rodrigo Moya" email="rodrigo@novell.com"/> - - <!-- hook into the uri popup menu --> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.folderview.popup" target="select"> - <item - type="item" - path="72.mail_to_meeting" - icon="stock_new-meeting" - label="Con_vert to Meeting" - enable="one" - visible="one" - activate="org_gnome_mail_to_meeting"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/mail-to-task/.cvsignore b/plugins/mail-to-task/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/mail-to-task/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/mail-to-task/ChangeLog b/plugins/mail-to-task/ChangeLog deleted file mode 100644 index ffe03944a7..0000000000 --- a/plugins/mail-to-task/ChangeLog +++ /dev/null @@ -1,45 +0,0 @@ -2005-01-14 Rodrigo Moya <rodrigo@novell.com> - - * mail-to-task.c (set_description): new function to correctly - retrieve the body of the message. - (do_mail_to_task): call set_description. - -2004-11-04 Rodrigo Moya <rodrigo@novell.com> - - * org-gnome-mail-to-task.eplug.in: fixed description and added - author's info, to display correctly on the plugin manager. - -2004-11-03 Not Zed <NotZed@Ximian.com> - - * org-gnome-mail-to-task.eplug.in: revert rodrigo's last fix, it should - actually work now, i hope. - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplugin.in file - -2004-10-29 Rodrigo Moya <rodrigo@novell.com> - - * org-gnome-mail-to-task.eplug.in: fix folder view popup id again. - -2004-10-28 Not Zed <NotZed@Ximian.com> - - * org-gnome-mail-to-task.eplug.in: fix folder view popup id. - -2004-10-21 Rodrigo Moya <rodrigo@novell.com> - - * mail-to-task.c (set_attendees, set_organizer): new functions. - (do_mail_to_task): set attendees and organizer on the task from the - recipients in the mail message. - - * org-gnome-mail-to-task.eplug.in: use correct icon. - -2004-10-21 Rodrigo Moya <rodrigo@novell.com> - - * org-gnome-mail-to-task.eplug.in: fixed to make the plugin show - up in the correct place. - -2004-10-21 Rodrigo Moya <rodrigo@novell.com> - - * mail-to-task.c: implemented plugin for converting selected - mails to tasks. diff --git a/plugins/mail-to-task/Makefile.am b/plugins/mail-to-task/Makefile.am deleted file mode 100644 index 182dcdf59f..0000000000 --- a/plugins/mail-to-task/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-mail-to-task.eplug -plugin_LTLIBRARIES = liborg-gnome-mail-to-task.la - -liborg_gnome_mail_to_task_la_SOURCES = mail-to-task.c -liborg_gnome_mail_to_task_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-mail-to-task.eplug.in
\ No newline at end of file diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c deleted file mode 100644 index d2c5f9eb71..0000000000 --- a/plugins/mail-to-task/mail-to-task.c +++ /dev/null @@ -1,190 +0,0 @@ - -/* Copyright (C) 2004 Novell, Inc */ -/* Authors: Michael Zucchi - Rodrigo Moya */ - -/* This file is licensed under the GNU GPL v2 or later */ - -/* Convert a mail message into a task */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib/gi18n-lib.h> -#include <string.h> -#include <stdio.h> - -#include <gconf/gconf-client.h> -#include <libecal/e-cal.h> -#include <libedataserverui/e-source-selector-dialog.h> -#include <camel/camel-folder.h> -#include <camel/camel-medium.h> -#include <camel/camel-mime-message.h> -#include <camel/camel-stream.h> -#include <camel/camel-stream-mem.h> -#include "mail/em-popup.h" - -static void -add_attendee_cb (gpointer key, gpointer value, gpointer user_data) -{ - ECalComponentAttendee *ca; - const char *str, *name; - GList **attendees = user_data; - - if (!camel_internet_address_get (value, 0, &name, &str)) - return; - - ca = g_new0 (ECalComponentAttendee, 1); - ca->value = str; - ca->cn = name; - /* FIXME: missing many fields */ - - *attendees = g_slist_append (*attendees, ca); -} - -static void -set_attendees (ECalComponent *comp, CamelMimeMessage *message) -{ - GSList *attendees = NULL, *l; - - g_hash_table_foreach (message->recipients, (GHFunc) add_attendee_cb, &attendees); - e_cal_component_set_attendee_list (comp, attendees); - - for (l = attendees; l != NULL; l = l->next) - g_free (l->data); - g_slist_free (attendees); -} - -static void -set_description (ECalComponent *comp, CamelMimeMessage *message) -{ - CamelDataWrapper *content; - CamelStream *mem; - ECalComponentText text; - GSList sl; - char *str; - - content = camel_medium_get_content_object ((CamelMedium *) message); - if (!content) - return; - - mem = camel_stream_mem_new (); - camel_data_wrapper_decode_to_stream (content, mem); - - str = g_strndup (((CamelStreamMem *) mem)->buffer->data, ((CamelStreamMem *) mem)->buffer->len); - camel_object_unref (mem); - - text.value = str; - text.altrep = NULL; - sl.next = NULL; - sl.data = &text; - - e_cal_component_set_description_list (comp, &sl); - - g_free (str); -} - -static void -set_organizer (ECalComponent *comp, CamelMimeMessage *message) -{ - const CamelInternetAddress *address; - const char *str, *name; - ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL}; - - if (message->reply_to) - address = message->reply_to; - else if (message->from) - address = message->from; - else - return; - - if (!camel_internet_address_get (address, 0, &name, &str)) - return; - - organizer.value = str; - organizer.cn = name; - e_cal_component_set_organizer (comp, &organizer); -} - -static void -do_mail_to_task (EMPopupTargetSelect *t, ESource *tasks_source) -{ - ECal *client; - - /* open the task client */ - client = e_cal_new (tasks_source, E_CAL_SOURCE_TYPE_TODO); - if (e_cal_open (client, FALSE, NULL)) { - int i; - - for (i = 0; i < (t->uids ? t->uids->len : 0); i++) { - CamelMimeMessage *message; - ECalComponent *comp; - ECalComponentText text; - - /* retrieve the message from the CamelFolder */ - message = camel_folder_get_message (t->folder, g_ptr_array_index (t->uids, i), NULL); - if (!message) - continue; - - comp = e_cal_component_new (); - e_cal_component_set_new_vtype (comp, E_CAL_COMPONENT_TODO); - e_cal_component_set_uid (comp, camel_mime_message_get_message_id (message)); - - /* set the task's summary */ - text.value = camel_mime_message_get_subject (message); - text.altrep = NULL; - e_cal_component_set_summary (comp, &text); - - /* set all fields */ - set_description (comp, message); - set_organizer (comp, message); - set_attendees (comp, message); - - /* save the task to the selected source */ - e_cal_create_object (client, e_cal_component_get_icalcomponent (comp), NULL, NULL); - - g_object_unref (comp); - } - } - - /* free memory */ - g_object_unref (client); -} - -void org_gnome_mail_to_task (void *ep, EMPopupTargetSelect *t); - -void -org_gnome_mail_to_task (void *ep, EMPopupTargetSelect *t) -{ - GtkWidget *dialog; - GConfClient *conf_client; - ESourceList *source_list; - - /* ask the user which tasks list to save to */ - conf_client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (conf_client, "/apps/evolution/tasks/sources"); - - dialog = e_source_selector_dialog_new (NULL, source_list); - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - ESource *source; - - /* if a source has been selected, perform the mail2task operation */ - source = e_source_selector_dialog_peek_primary_selection (E_SOURCE_SELECTOR_DIALOG (dialog)); - if (source) - do_mail_to_task (t, source); - } - - g_object_unref (conf_client); - g_object_unref (source_list); - gtk_widget_destroy (dialog); -} - -int e_plugin_lib_enable(EPluginLib *ep, int enable); - -int -e_plugin_lib_enable(EPluginLib *ep, int enable) -{ - return 0; -} diff --git a/plugins/mail-to-task/org-gnome-mail-to-task.eplug.in b/plugins/mail-to-task/org-gnome-mail-to-task.eplug.in deleted file mode 100644 index e1fe4dc6b3..0000000000 --- a/plugins/mail-to-task/org-gnome-mail-to-task.eplug.in +++ /dev/null @@ -1,25 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.mailToTask" - location="@PLUGINDIR@/liborg-gnome-mail-to-task.so" - name="Convert a mail message into a task"> - <description>A plugin which allows the creation of tasks from the contents of a mail message</description> - <author name="Rodrigo Moya" email="rodrigo@novell.com"/> - - <!-- hook into the uri popup menu --> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.folderview.popup" target="select"> - <item - type="item" - path="71.mail_to_task" - icon="stock_todo" - label="Con_vert to Task" - enable="one" - visible="one" - activate="org_gnome_mail_to_task"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/mailing-list-actions/.cvsignore b/plugins/mailing-list-actions/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/mailing-list-actions/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/mailing-list-actions/ChangeLog b/plugins/mailing-list-actions/ChangeLog deleted file mode 100644 index 6af314e08d..0000000000 --- a/plugins/mailing-list-actions/ChangeLog +++ /dev/null @@ -1,34 +0,0 @@ -2004-11-24 JP Rosevear <jpr@novell.com> - - * mailing-list-actions.c: make sure GETTEXT_PACKAGE is defined - -2004-11-04 Meilof Veeningen <meilof@wanadoo.nl> - - * org-gnome-mailing-list-actions.eplug.in: Added author tag, fixed - description, removed "plugin" from name, changed position of item - in popup menu, using "enable" rather than "visible" for bonobo menus - - * org-gnome-mailing-list-actions.xml: Now place menus in - MailMessageActions placeholder; moved label to <commands> section - - * org-gnome-mailing-list-actions-errors.xml: fixed button order: - "Cancel" now leftmost button; added e-mail address to send confirm - dialog - - * mailing-list-actions.c: account guessing now first based on message; - added e-mail address to send confirm dialog - -2004-11-09 Rodney Dawes <dobey@novell.com> - - * Makefile.am: Add org-gnome-mailing-list-actions.xml to EXTRA_DIST - -2004-11-09 Rodney Dawes <dobey@novell.com> - - * Makefile.am: Add the eplug.in file to EXTRA_DIST - -2004-11-05 JP Rosevear <jpr@novell.com> - - * mailing-list-actions.c: include <config.h> for GETTEXT_PACKAGE - - Added mailing list actions plugin from Meilof Veeningen <meilof@wanadoo.nl> - diff --git a/plugins/mailing-list-actions/Makefile.am b/plugins/mailing-list-actions/Makefile.am deleted file mode 100644 index 27704c46a5..0000000000 --- a/plugins/mailing-list-actions/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-mailing-list-actions.eplug org-gnome-mailing-list-actions.xml -plugin_LTLIBRARIES = liborg-gnome-mailing-list-actions.la - -liborg_gnome_mailing_list_actions_la_SOURCES = mailing-list-actions.c -liborg_gnome_mailing_list_actions_la_LDFLAGS = -module -avoid-version - -error_DATA = org-gnome-mailing-list-actions-errors.xml -error_i18n = $(error_DATA:.xml=.xml.h) -errordir = $(privdatadir)/errors -%.xml.h: %.xml - $(top_builddir)/e-util/e-error-tool $^ - -BUILT_SOURCES = $(error_i18n) -EXTRA_DIST = \ - $(error_DATA) \ - $(error_i18n) \ - org-gnome-mailing-list-actions.eplug.in \ - org-gnome-mailing-list-actions.xml diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c deleted file mode 100644 index e79db1fc55..0000000000 --- a/plugins/mailing-list-actions/mailing-list-actions.c +++ /dev/null @@ -1,217 +0,0 @@ -/* - * Copyright (C) 2004 Meilof Veeningen <meilof@wanadoo.nl> - * - * This file is licensed under the GNU GPL v2 or later - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib/gi18n-lib.h> -#include <stdio.h> -#include <string.h> -#include <gconf/gconf-client.h> -#include <gtk/gtkcombobox.h> -#include <gtk/gtkliststore.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtkcelllayout.h> -#include <gtk/gtktable.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkmenuitem.h> -#include <gtk/gtkdialog.h> -#include <libgnome/gnome-url.h> - -#include "camel/camel-multipart.h" -#include "camel/camel-mime-part.h" -#include "camel/camel-exception.h" -#include "camel/camel-folder.h" -#include "composer/e-msg-composer.h" -#include "mail/em-composer-utils.h" -#include "mail/em-format-hook.h" -#include "mail/em-format.h" -#include "mail/em-menu.h" -#include "mail/em-config.h" -#include "mail/mail-ops.h" -#include "mail/mail-mt.h" -#include "mail/mail-config.h" -#include "widgets/misc/e-error.h" - -typedef enum { - EMLA_ACTION_HELP, - EMLA_ACTION_UNSUBSCRIBE, - EMLA_ACTION_SUBSCRIBE, - EMLA_ACTION_POST, - EMLA_ACTION_OWNER, - EMLA_ACTION_ARCHIVE -} EmlaAction; - -typedef struct { - EmlaAction action; /* action enumeration */ - gboolean interactive; /* whether the user needs to edit a mailto: message (e.g. for post action) */ - const char* header; /* header representing the action */ -} EmlaActionHeader; - -const EmlaActionHeader emla_action_headers[] = { - { EMLA_ACTION_HELP, FALSE, "List-Help" }, - { EMLA_ACTION_UNSUBSCRIBE, TRUE, "List-Unsubscribe" }, - { EMLA_ACTION_SUBSCRIBE, FALSE, "List-Subscribe" }, - { EMLA_ACTION_POST, TRUE, "List-Post" }, - { EMLA_ACTION_OWNER, TRUE, "List-Owner" }, - { EMLA_ACTION_ARCHIVE, FALSE, "List-Archive" }, -}; - -const int emla_n_action_headers = sizeof(emla_action_headers) / sizeof(EmlaActionHeader); - -void emla_list_action (EPlugin *item, EMMenuTargetSelect* sel, EmlaAction action); -void emla_list_help (EPlugin *item, EMMenuTargetSelect* sel); -void emla_list_unsubscribe (EPlugin *item, EMMenuTargetSelect* sel); -void emla_list_subscribe (EPlugin *item, EMMenuTargetSelect* sel); -void emla_list_post (EPlugin *item, EMMenuTargetSelect* sel); -void emla_list_owner (EPlugin *item, EMMenuTargetSelect* sel); -void emla_list_archive (EPlugin *item, EMMenuTargetSelect* sel); - -void emla_list_action_do (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data); - -typedef struct { - EmlaAction action; - char* uri; -} emla_action_data; - -void emla_list_action (EPlugin *item, EMMenuTargetSelect* sel, EmlaAction action) -{ - emla_action_data *data; - - g_return_if_fail (sel->uids->len == 1); - - data = (emla_action_data *) malloc (sizeof (emla_action_data)); - data->action = action; - data->uri = strdup (sel->uri); - - mail_get_message (sel->folder, (const char*) g_ptr_array_index (sel->uids, 0), - emla_list_action_do, data, mail_thread_new); -} - -void emla_list_action_do (CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *data) -{ - emla_action_data *action_data = (emla_action_data *) data; - EmlaAction action = action_data->action; - const char* header = NULL, *headerpos; - char *end, *url = NULL; - int t; - GError *err; - EMsgComposer *composer; - int send_message_response; - EAccount *account; - - for (t = 0; t < emla_n_action_headers; t++) { - if (emla_action_headers[t].action == action && - (header = camel_medium_get_header (CAMEL_MEDIUM (msg), emla_action_headers[t].header)) != NULL) - break; - } - - if (!header) { - /* there was no header matching the action */ - e_error_run (NULL, "org.gnome.mailing-list-actions:no-header", NULL); - goto exit; - } - - headerpos = header; - - if (action == EMLA_ACTION_POST) { - while (*headerpos == ' ') headerpos++; - if (g_ascii_strcasecmp (headerpos, "NO") == 0) { - e_error_run (NULL, "org.gnome.mailing-list-actions:posting-not-allowed", NULL); - goto exit; - } - } - - /* parse the action value */ - while (*headerpos) { - /* skip whitespace */ - while (*headerpos == ' ') headerpos++; - if (*headerpos != '<' || (end = strchr (headerpos++, '>')) == NULL) { - e_error_run (NULL, "org.gnome.mailing-list-actions:malformed-header", emla_action_headers[t].header, header, NULL); - goto exit; - } - - /* get URL portion */ - url = (char *) malloc (end - headerpos); - strncpy (url, headerpos, end - headerpos); - url[end-headerpos] = '\0'; - - if (strncmp (url, "mailto:", 6) == 0) { - if (emla_action_headers[t].interactive) - send_message_response = GTK_RESPONSE_NO; - else - send_message_response = e_error_run (NULL, "org.gnome.mailing-list-actions:ask-send-message", url, NULL); - - if (send_message_response == GTK_RESPONSE_YES) { - /* directly send message */ - composer = e_msg_composer_new_from_url (url); - if ((account = mail_config_get_account_by_source_url (action_data->uri))) - e_msg_composer_hdrs_set_from_account ((EMsgComposerHdrs *) composer->hdrs, account->name); - em_utils_composer_send_cb (composer, NULL); - } else if (send_message_response == GTK_RESPONSE_NO) { - /* show composer */ - em_utils_compose_new_message_with_mailto (url, action_data->uri); - } - - goto exit; - } else { - err = NULL; - gnome_url_show (url, &err); - if (!err) - goto exit; - g_error_free (err); - } - free (url); - url = NULL; - headerpos = end++; - - /* ignore everything 'till next comma */ - headerpos = strchr (headerpos, ','); - if (!headerpos) - break; - headerpos++; - } - - /* if we got here, there's no valid action */ - e_error_run (NULL, "org.gnome.mailing-list-actions:no-action", header, NULL); - -exit: - free (action_data->uri); - free (action_data); - if (url) - free(url); -} - -void emla_list_help (EPlugin *item, EMMenuTargetSelect* sel) -{ - emla_list_action (item, sel, EMLA_ACTION_HELP); -} - -void emla_list_unsubscribe (EPlugin *item, EMMenuTargetSelect* sel) -{ - emla_list_action (item, sel, EMLA_ACTION_UNSUBSCRIBE); -} - -void emla_list_subscribe (EPlugin *item, EMMenuTargetSelect* sel) -{ - emla_list_action (item, sel, EMLA_ACTION_SUBSCRIBE); -} - -void emla_list_post (EPlugin *item, EMMenuTargetSelect* sel) -{ - emla_list_action (item, sel, EMLA_ACTION_POST); -} - -void emla_list_owner (EPlugin *item, EMMenuTargetSelect* sel) -{ - emla_list_action (item, sel, EMLA_ACTION_OWNER); -} - -void emla_list_archive (EPlugin *item, EMMenuTargetSelect* sel) -{ - emla_list_action (item, sel, EMLA_ACTION_ARCHIVE); -} diff --git a/plugins/mailing-list-actions/org-gnome-mailing-list-actions-errors.xml b/plugins/mailing-list-actions/org-gnome-mailing-list-actions-errors.xml deleted file mode 100644 index 69b20fa834..0000000000 --- a/plugins/mailing-list-actions/org-gnome-mailing-list-actions-errors.xml +++ /dev/null @@ -1,38 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<error-list domain="org.gnome.mailing-list-actions"> - - <error id="no-header" type="error"> - <primary>Action not available</primary> - <secondary>This message does not contain the header information required for this action.</secondary> - </error> - - <error id="posting-not-allowed" type="error"> - <primary>Posting not allowed</primary> - <secondary>Posting to this mailing list is not allowed. Possibly, this is a read-only mailing list. Contact the list owner for details.</secondary> - </error> - - <error id="ask-send-message" type="question" default="GTK_RESPONSE_YES"> - <primary>Send e-mail message to mailing list?</primary> - <secondary>An e-mail message will be sent to the URL "{0}". You can either send the message automatically, or see and change it first. - -You should receive an answer from the mailing list shortly after the message has been sent.</secondary> - <button label="_Send message" response="GTK_RESPONSE_YES"/> - <button label="_Edit message" response="GTK_RESPONSE_NO"/> - <button stock="gtk-cancel" response="GTK_RESPONSE_CANCEL"/> - </error> - - <error id="malformed-header" type="error"> - <primary>Malformed header</primary> - <secondary>The {0} header of this message is malformed and could not be processed. - -Header: {1}</secondary> - </error> - - <error id="no-action" type="error"> - <primary>No e-mail action</primary> - <secondary>The action could not be performed. This means the header for this action did not contain any action we could handle. - -Header: {0}</secondary> - </error> - -</error-list> diff --git a/plugins/mailing-list-actions/org-gnome-mailing-list-actions-errors.xml.h b/plugins/mailing-list-actions/org-gnome-mailing-list-actions-errors.xml.h deleted file mode 100644 index a5bbbbcc20..0000000000 --- a/plugins/mailing-list-actions/org-gnome-mailing-list-actions-errors.xml.h +++ /dev/null @@ -1,28 +0,0 @@ -/* org.gnome.mailing-list-actions:no-header primary */ -char *s = N_("Action not available"); -/* org.gnome.mailing-list-actions:no-header secondary */ -char *s = N_("This message does not contain the header information required for this action."); -/* org.gnome.mailing-list-actions:posting-not-allowed primary */ -char *s = N_("Posting not allowed"); -/* org.gnome.mailing-list-actions:posting-not-allowed secondary */ -char *s = N_("Posting to this mailing list is not allowed. Possibly, this is a read-only mailing list. Contact the list owner for details."); -/* org.gnome.mailing-list-actions:ask-send-message primary */ -char *s = N_("Send e-mail message to mailing list?"); -/* org.gnome.mailing-list-actions:ask-send-message secondary */ -char *s = N_("An e-mail message will be sent to the URL \"{0}\". You can either send the message automatically, or see and change it first.\n" - "\n" - "You should receive an answer from the mailing list shortly after the message has been sent."); -char *s = N_("_Send message"); -char *s = N_("_Edit message"); -/* org.gnome.mailing-list-actions:malformed-header primary */ -char *s = N_("Malformed header"); -/* org.gnome.mailing-list-actions:malformed-header secondary */ -char *s = N_("The {0} header of this message is malformed and could not be processed.\n" - "\n" - "Header: {1}"); -/* org.gnome.mailing-list-actions:no-action primary */ -char *s = N_("No e-mail action"); -/* org.gnome.mailing-list-actions:no-action secondary */ -char *s = N_("The action could not be performed. This means the header for this action did not contain any action we could handle.\n" - "\n" - "Header: {0}"); diff --git a/plugins/mailing-list-actions/org-gnome-mailing-list-actions.eplug.in b/plugins/mailing-list-actions/org-gnome-mailing-list-actions.eplug.in deleted file mode 100644 index 749bc9fdc3..0000000000 --- a/plugins/mailing-list-actions/org-gnome-mailing-list-actions.eplug.in +++ /dev/null @@ -1,43 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.plugin.mailing-list.actions" - domain="eplug-mailing-list-actions" - location="@PLUGINDIR@/liborg-gnome-mailing-list-actions.so" - name="Mailing List Actions plugin" - description="Provide actions for common mailing list commands (subscribe, unsubscribe, ...)"> - <hook class="org.gnome.evolution.mail.bonobomenu:1.0"> - <menu id="org.gnome.evolution.mail.browser" target="select"> - <ui file="@PLUGINDIR@/org-gnome-mailing-list-actions.xml"/> - <item type="item" verb="ListHelp" path="/commands/ListHelp" visible="mailing_list" activate="emla_list_help"/> - <item type="item" verb="ListSubscribe" path="/commands/ListSubscribe" visible="mailing_list" activate="emla_list_subscribe"/> - <item type="item" verb="ListUnsubscribe" path="/commands/ListUnsubscribe" visible="mailing_list" activate="emla_list_unsubscribe"/> - <item type="item" verb="ListPost" path="/commands/ListPost" visible="mailing_list" activate="emla_list_post"/> - <item type="item" verb="ListOwner" path="/commands/ListOwner" visible="mailing_list" activate="emla_list_owner"/> - <item type="item" verb="ListArchive" path="/commands/ListArchive" visible="mailing_list" activate="emla_list_archive"/> - </menu> - <menu id="org.gnome.evolution.mail.messagebrowser" target="select"> - <ui file="@PLUGINDIR@/org-gnome-mailing-list-actions.xml"/> - <item type="item" verb="ListHelp" path="/commands/ListHelp" visible="mailing_list" activate="emla_list_help"/> - <item type="item" verb="ListSubscribe" path="/commands/ListSubscribe" visible="mailing_list" activate="emla_list_subscribe"/> - <item type="item" verb="ListUnsubscribe" path="/commands/ListUnsubscribe" visible="mailing_list" activate="emla_list_unsubscribe"/> - <item type="item" verb="ListPost" path="/commands/ListPost" visible="mailing_list" activate="emla_list_post"/> - <item type="item" verb="ListOwner" path="/commands/ListOwner" visible="mailing_list" activate="emla_list_owner"/> - <item type="item" verb="ListArchive" path="/commands/ListArchive" visible="mailing_list" activate="emla_list_archive"/> - </menu> - </hook> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.mail.folderview.popup.select" target="select"> - <item type="bar" path="96.list" visible="mailing_list" activate=""/> - <item type="submenu" path="96.list.00" visible="mailing_list" activate="" label="Mailing _List"/> - <item type="item" verb="ListHelp" path="96.list.00/00.help" label="Get list _usage information" visible="mailing_list" activate="emla_list_help"/> - <item type="item" verb="ListSubscribe" path="96.list.00/10.subscribe" label="_Subscribe to list" visible="mailing_list" activate="emla_list_subscribe"/> - <item type="item" verb="ListUnsubscribe" path="96.list.00/20.unsubscribe" label="_Un-subscribe to list" visible="mailing_list" activate="emla_list_unsubscribe"/> - <item type="item" verb="ListPost" path="96.list.00/30.post" label="_Post message to list" visible="mailing_list" activate="emla_list_post"/> - <item type="item" verb="ListOwner" path="96.list.00/40.owner" label="Contact list _owner" visible="mailing_list" activate="emla_list_owner"/> - <item type="item" verb="ListArchive" path="96.list.00/50.archive" label="Get list _archive" visible="mailing_list" activate="emla_list_archive"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml b/plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml deleted file mode 100644 index 726a9dbaa8..0000000000 --- a/plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml +++ /dev/null @@ -1,23 +0,0 @@ -<Root> - <commands> - <cmd name="ListHelp" _tip="Get information about the usage of the list this message belongs to"/> - <cmd name="ListSubscribe" _tip="Subscribe to the mailing list this message belongs to"/> - <cmd name="ListUnsubscribe" _tip="Unsubscribe to the mailing list this message belongs to"/> - <cmd name="ListPost" _tip="Post a message to the mailing list this message belongs to"/> - <cmd name="ListOwner" _tip="Contact the owner of the mailing list this message belongs to"/> - <cmd name="ListArchive" _tip="Get an archive of the list this message belongs to"/> - </commands> - - <menu> - <submenu name="Actions"> - <submenu name="List" _label="Mailing _List"> - <menuitem verb="ListHelp" _label="Get list _usage information"/> - <menuitem verb="ListSubscribe" _label="_Subscribe to list"/> - <menuitem verb="ListUnsubscribe" _label="_Un-subscribe to list"/> - <menuitem verb="ListPost" _label="_Post message to list"/> - <menuitem verb="ListOwner" _label="Contact list _owner"/> - <menuitem verb="ListArchive" _label="Get list _archive"/> - </submenu> - </submenu> - </menu> -</Root> diff --git a/plugins/mark-calendar-offline/.cvsignore b/plugins/mark-calendar-offline/.cvsignore deleted file mode 100644 index 9d1a6b6468..0000000000 --- a/plugins/mark-calendar-offline/.cvsignore +++ /dev/null @@ -1,3 +0,0 @@ -Makefile -Makefile.in -org-gnome-mark-calendar-offline.eplug diff --git a/plugins/mark-calendar-offline/ChangeLog b/plugins/mark-calendar-offline/ChangeLog deleted file mode 100644 index e6b33adc38..0000000000 --- a/plugins/mark-calendar-offline/ChangeLog +++ /dev/null @@ -1,10 +0,0 @@ -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-22 Harish Krishnaswamy <kharish@novell.com> - - * mark-calendar-offline.c: implement a plugin that lets the user mark a - calendar to be available for off-line use, if it is not already set to be so - and vice versa - diff --git a/plugins/mark-calendar-offline/Makefile.am b/plugins/mark-calendar-offline/Makefile.am deleted file mode 100644 index bdd9fc46f3..0000000000 --- a/plugins/mark-calendar-offline/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_CALENDAR_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-mark-calendar-offline.eplug -plugin_LTLIBRARIES = liborg-gnome-mark-calendar-offline.la - -liborg_gnome_mark_calendar_offline_la_SOURCES = mark-calendar-offline.c -liborg_gnome_mark_calendar_offline_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-mark-calendar-offline.eplug.in
\ No newline at end of file diff --git a/plugins/mark-calendar-offline/mark-calendar-offline.c b/plugins/mark-calendar-offline/mark-calendar-offline.c deleted file mode 100644 index 95083c7ff2..0000000000 --- a/plugins/mark-calendar-offline/mark-calendar-offline.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Harish Krishnaswamy (kharish@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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -/* This is prototype code only, this may, or may not, use undocumented - * unstable or private internal function calls. - * This code has been derived from the source of the sample eplugin - * select_one_source. - */ - -#include <glib.h> -#include <glib/gi18n.h> -#include <libedataserver/e-source.h> -#include <libedataserverui/e-source-selector.h> -#include <calendar/gui/e-cal-popup.h> - -void org_gnome_mark_calendar_offline (EPlugin *ep, ECalPopupTargetSource *target); -void org_gnome_mark_calendar_no_offline (EPlugin *ep, ECalPopupTargetSource *target); - -void -org_gnome_mark_calendar_no_offline (EPlugin *ep, ECalPopupTargetSource *target) -{ - ESource *source; - - source = e_source_selector_peek_primary_selection (target->selector); - e_source_set_property (source, "offline", "0"); -} - -void -org_gnome_mark_calendar_offline (EPlugin *ep, ECalPopupTargetSource *target) -{ - ESource *source; - - source = e_source_selector_peek_primary_selection (target->selector); - e_source_set_property (source, "offline", "1"); -} - diff --git a/plugins/mark-calendar-offline/org-gnome-mark-calendar-offline.eplug.in b/plugins/mark-calendar-offline/org-gnome-mark-calendar-offline.eplug.in deleted file mode 100644 index 75b8b9c866..0000000000 --- a/plugins/mark-calendar-offline/org-gnome-mark-calendar-offline.eplug.in +++ /dev/null @@ -1,16 +0,0 @@ -<e-plugin-list> - <e-plugin id="org.gnome.evolution.mark_calendar_offline" type="shlib" name="Mark calendar offline" description="Marks the selected calendar for offline viewing" - location="@PLUGINDIR@/liborg-gnome-mark-calendar-offline.so"> - - <hook class="org.gnome.evolution.calendar.popup:1.0"> - <menu id="org.gnome.evolution.calendar.source.popup" target="source"> - <item type="item" path="28.mark_calendar_offline" label="_Mark Calendar for offline use" icon="stock_disconnect" visible="offline" activate="org_gnome_mark_calendar_offline"/> - </menu> - </hook> - <hook class="org.gnome.evolution.calendar.popup:1.0"> - <menu id="org.gnome.evolution.calendar.source.popup" target="source"> - <item type="item" path="28.mark_calendar_no_offline" label="_Do not make this available offline" icon="stock_connect" visible="no-offline" activate="org_gnome_mark_calendar_no_offline"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/new-mail-notify/ChangeLog b/plugins/new-mail-notify/ChangeLog deleted file mode 100644 index afe8bd29cb..0000000000 --- a/plugins/new-mail-notify/ChangeLog +++ /dev/null @@ -1,42 +0,0 @@ -2005-01-13 Not Zed <NotZed@Ximian.com> - - * new-mail-notify.c: added prototypes for exported functions, - re-arranged slightly to staticise internal functions. - - * new-mail-notify.h: removed. - -2005-01-12 Miguel Angel Lopez Hernandez <miguel@gulev.org.mx> - - * new-mail-notify.[ch]: Fix author's name, changes in code - to maintain coding style - (org_gnome_new_mail_notify): Now sends the dbus message using - the send_dbus_message function - (org_gnome_message_reading_notify): Added function, called when - a message.reading event is fired - (send_dbus_message): Added function, generic function to send - dbus messages - - * org-gnome-new-mail-notify.eplug.in: define the message reading - event - -2005-01-11 JP Rosevear <jpr@novell.com> - - * Makefile.am: add new-mail-notify.h so it gets disted - -2005-01-11 Not Zed <NotZed@Ximian.com> - - * new-mail-notify.c (org_gnome_new_mail_config) - (org_gnome_new_mail_notify): renamed slightly for - namespace/consistency. - (org_gnome_new_mail_notify): fixed signature. - (org_gnome_new_mail_notify): fixed some warnings & formatting. - -2004-12-30 Miguel Angel Lopez Hernandez <miguel@gulev.org.mx> - - * new-mail-notify.[ch]: Plugin implementation - - * org-gnome-new-mail-notify.eplug.in: define the - new mail notify plugin - - * Makefile.am: build the new mail notify plugin - diff --git a/plugins/new-mail-notify/Makefile.am b/plugins/new-mail-notify/Makefile.am deleted file mode 100644 index bef0fd41d1..0000000000 --- a/plugins/new-mail-notify/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -DDBUS_API_SUBJECT_TO_CHANGE=1 \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(NMN_CFLAGS) - -LIBS = \ - $(NMN_LIBS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-new-mail-notify.eplug -plugin_LTLIBRARIES = liborg-gnome-new-mail-notify.la - -liborg_gnome_new_mail_notify_la_SOURCES = new-mail-notify.c -liborg_gnome_new_mail_notify_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-new-mail-notify.eplug.in diff --git a/plugins/new-mail-notify/new-mail-notify.c b/plugins/new-mail-notify/new-mail-notify.c deleted file mode 100644 index e6147a1564..0000000000 --- a/plugins/new-mail-notify/new-mail-notify.c +++ /dev/null @@ -1,143 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Author: Miguel Angel Lopez Hernandez <miguel@gulev.org.mx> - * - * Copyright 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include <gconf/gconf-client.h> -#include <e-util/e-config.h> -#include <mail/em-config.h> -#include <mail/em-event.h> -#include <dbus/dbus-glib.h> -#include <dbus/dbus-glib-lowlevel.h> -#include <camel/camel-folder.h> - -#define GCONF_KEY "/apps/evolution/mail/notify/gen_dbus_msg" -#define DBUS_PATH "/org/gnome/evolution/mail/newmail" -#define DBUS_INTERFACE "org.gnome.evolution.mail.dbus.Signal" - -GtkWidget *org_gnome_new_mail_config (EPlugin *ep, EConfigHookItemFactoryData *hook_data); -void org_gnome_new_mail_notify (EPlugin *ep, EMEventTargetFolder *t); -void org_gnome_message_reading_notify (EPlugin *ep, EMEventTargetMessage *t); - -static void -toggled_cb (GtkWidget *widget, EConfig *config) -{ - EMConfigTargetPrefs *target = (EMConfigTargetPrefs *) config->target; - - /* Save the new setting to gconf */ - gconf_client_set_bool (target->gconf, - GCONF_KEY, - gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)), - NULL); -} - -GtkWidget * -org_gnome_new_mail_config (EPlugin *ep, EConfigHookItemFactoryData *hook_data) -{ - GtkWidget *notify; - - EMConfigTargetPrefs *target = (EMConfigTargetPrefs *) hook_data->config->target; - - /* Create the checkbox we will display, complete with mnemonic that is unique in the dialog */ - notify = gtk_check_button_new_with_mnemonic (_("_Generates a D-BUS message when new mail arrives")); - - /* Set the toggle button to the current gconf setting */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (notify), - gconf_client_get_bool (target->gconf, - GCONF_KEY, NULL)); - - /* Listen for the item being toggled on and off */ - g_signal_connect (GTK_TOGGLE_BUTTON (notify), - "toggled", - G_CALLBACK (toggled_cb), - hook_data->config); - - /* Pack the checkbox in the parent widget and show it */ - gtk_box_pack_start (GTK_BOX (hook_data->parent), notify, FALSE, FALSE, 0); - gtk_widget_show (notify); - - return notify; -} - -static void -send_dbus_message (const char *message_name, const char *data) -{ - GConfClient *client = gconf_client_get_default (); - - if (gconf_client_get_bool(client, GCONF_KEY, NULL)) { - DBusConnection *bus; - DBusError error; - DBusMessage *message; - - /* Get a connection to the session bus */ - dbus_error_init (&error); - bus = dbus_bus_get (DBUS_BUS_SESSION, - &error); - - if (!bus) { - printf ("Failed to connect to the D-BUS daemon: %s\n", error.message); - dbus_error_free (&error); - } - - /* Set up this connection to work in a GLib event loop */ - dbus_connection_setup_with_g_main (bus, NULL); - - /* Create a new message on the DBUS_INTERFACE */ - message = dbus_message_new_signal (DBUS_PATH, - DBUS_INTERFACE, - message_name); - - /* Appends the data as an argument to the message */ - dbus_message_append_args (message, - DBUS_TYPE_STRING, data, - DBUS_TYPE_INVALID); - - /* Sends the message */ - dbus_connection_send (bus, - message, - NULL); - - /* Frees the message */ - dbus_message_unref (message); - - /* printf("New message [%s] with arg [%s]!\n", message_name, data); */ - } - - g_object_unref (client); -} - -void -org_gnome_message_reading_notify (EPlugin *ep, EMEventTargetMessage *t) -{ - send_dbus_message ("MessageReading", t->folder->name); -} - -void -org_gnome_new_mail_notify (EPlugin *ep, EMEventTargetFolder *t) -{ - send_dbus_message ("Newmail", t->uri); -} diff --git a/plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.in b/plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.in deleted file mode 100644 index 89531415b8..0000000000 --- a/plugins/new-mail-notify/org-gnome-new-mail-notify.eplug.in +++ /dev/null @@ -1,33 +0,0 @@ -<e-plugin-list> - <e-plugin - id="org.gnome.evolution.new_mail_notify" - type="shlib" - name="New Mail Notification" - location="@PLUGINDIR@/liborg-gnome-new-mail-notify.so"> - - <description>Generates a D-BUS message when new mail arrives.</description> - <author name="Miguel Angel López Hernández" email="miguel@gulev.org.mx"/> - - <hook class="org.gnome.evolution.mail.events:1.0"> - <event id="folder.changed" - enable="newmail" - handle="org_gnome_new_mail_notify" - target="folder"/> - </hook> - - <hook class="org.gnome.evolution.mail.events:1.0"> - <event id="message.reading" - handle="org_gnome_message_reading_notify" - target="message"/> - </hook> - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="prefs"> - <item type="item" - path="00.general/30.notify/00.new_mail_notify" - label="New mail notify" - factory="org_gnome_new_mail_config"/> - </group> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/plugin-manager/.cvsignore b/plugins/plugin-manager/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/plugin-manager/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/plugin-manager/ChangeLog b/plugins/plugin-manager/ChangeLog deleted file mode 100644 index 982ce98ed1..0000000000 --- a/plugins/plugin-manager/ChangeLog +++ /dev/null @@ -1,12 +0,0 @@ -2004-11-09 Rodney Dawes <dobey@novell.com> - - * Makefile.am: Add the xml file to EXTRA_DIST - -2004-11-03 Not Zed <NotZed@Ximian.com> - - * Makefile.am: extra_dist the .eplug.in file. - -2004-10-20 Not Zed <NotZed@Ximian.com> - - * implemented a plugin manager plugin. - diff --git a/plugins/plugin-manager/Makefile.am b/plugins/plugin-manager/Makefile.am deleted file mode 100644 index 3056e036c9..0000000000 --- a/plugins/plugin-manager/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-plugin-manager.eplug org-gnome-plugin-manager.xml -plugin_LTLIBRARIES = liborg-gnome-plugin-manager.la - -liborg_gnome_plugin_manager_la_SOURCES = plugin-manager.c -liborg_gnome_plugin_manager_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = \ - org-gnome-plugin-manager.eplug.in \ - org-gnome-plugin-manager.xml diff --git a/plugins/plugin-manager/org-gnome-plugin-manager.eplug.in b/plugins/plugin-manager/org-gnome-plugin-manager.eplug.in deleted file mode 100644 index 6bdbcd74e5..0000000000 --- a/plugins/plugin-manager/org-gnome-plugin-manager.eplug.in +++ /dev/null @@ -1,22 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.manager" - location="@PLUGINDIR@/liborg-gnome-plugin-manager.so" - name="Plugin manager"> - <description>A plugin for managing which plugins are enabled or disabled.</description> - <author name="Michael Zucchi" email="notzed@ximian.com"/> - <hook class="org.gnome.evolution.shell.bonobomenu:1.0"> - <menu id="org.gnome.evolution.shell" target="shell"> - <!-- the path to the bonobo menu description --> - <ui file="@PLUGINDIR@/org-gnome-plugin-manager.xml"/> - <item - type="item" - verb="EPluginManagerManage" - path="/commands/EPluginManagerManage" - activate="org_gnome_plugin_manager_manage"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/plugin-manager/org-gnome-plugin-manager.xml b/plugins/plugin-manager/org-gnome-plugin-manager.xml deleted file mode 100644 index 53c465adef..0000000000 --- a/plugins/plugin-manager/org-gnome-plugin-manager.xml +++ /dev/null @@ -1,13 +0,0 @@ -<Root> - <commands> - <cmd name="EPluginManagerManage" _label="Manage Plugins..." - _tip="Enable and disable plugins"/> - </commands> - - <menu> - <submenu name="Tools"> - <placeholder name="ComponentPlaceholder"/> - <menuitem name="EPluginManagerManage" verb=""/> - </submenu> - </menu> -</Root> diff --git a/plugins/plugin-manager/plugin-manager.c b/plugins/plugin-manager/plugin-manager.c deleted file mode 100644 index 160783e856..0000000000 --- a/plugins/plugin-manager/plugin-manager.c +++ /dev/null @@ -1,289 +0,0 @@ - -/* Copyright (C) 2004 Novell Inc. - by Michael Zucchi <notzed@ximian.com> */ - -/* This file is licensed under the GNU GPL v2 or later */ - -/* A plugin manager ui */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib/gi18n-lib.h> -#include <string.h> -#include <stdio.h> - -#include <gtk/gtklabel.h> -#include <gtk/gtktreeview.h> -#include <gtk/gtktreeselection.h> -#include <gtk/gtkliststore.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkscrolledwindow.h> -#include <gtk/gtktable.h> -#include <gtk/gtkcellrenderertoggle.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtkstock.h> -#include <gtk/gtkhbox.h> - -#include "e-util/e-plugin.h" -#include "shell/es-menu.h" - -enum { - LABEL_NAME, - LABEL_AUTHOR, - LABEL_ID, - LABEL_PATH, - LABEL_DESCRIPTION, - LABEL_LAST -}; - -static struct { - const char *label; -} label_info[LABEL_LAST] = { - { N_("Name"), }, - { N_("Author(s)"), }, - { N_("Id"), }, - { N_("Path"), }, - { N_("Description"), }, -}; - -typedef struct _Manager Manager; -struct _Manager { - GtkDialog *dialog; - GtkTreeView *tree; - GtkListStore *model; - - GtkTable *table; - GtkLabel *labels[LABEL_LAST]; - GtkLabel *items[LABEL_LAST]; - - GSList *plugins; -}; - -/* for tracking if we're shown */ -static GtkDialog *dialog; - -void org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t); - -static void -eppm_set_label(GtkLabel *l, const char *v) -{ - gtk_label_set_label(l, v?v:_("Unknown")); -} - -static void -eppm_show_plugin(Manager *m, EPlugin *ep) -{ - if (ep) { - eppm_set_label(m->items[LABEL_NAME], ep->name); - if (ep->authors) { - GSList *l = ep->authors; - GString *out = g_string_new(""); - - for (;l;l = g_slist_next(l)) { - EPluginAuthor *epa = l->data; - - if (l != ep->authors) - g_string_append(out, ",\n"); - if (epa->name) - g_string_append(out, epa->name); - if (epa->email) { - g_string_append(out, " <"); - g_string_append(out, epa->email); - g_string_append(out, ">"); - } - } - gtk_label_set_label(m->items[LABEL_AUTHOR], out->str); - g_string_free(out, TRUE); - } else { - eppm_set_label(m->items[LABEL_AUTHOR], NULL); - } - - eppm_set_label(m->items[LABEL_ID], ep->id); - eppm_set_label(m->items[LABEL_PATH], ep->path); - eppm_set_label(m->items[LABEL_DESCRIPTION], ep->description); - gtk_widget_set_sensitive((GtkWidget *)m->table, TRUE); - } else { - int i; - - for (i=0;i<LABEL_LAST;i++) - gtk_label_set_label(m->items[i], ""); - gtk_widget_set_sensitive((GtkWidget *)m->table, FALSE); - } -} - -static void -eppm_selection_changed(GtkTreeSelection *selection, Manager *m) -{ - GtkTreeModel *model; - GtkTreeIter iter; - - if (gtk_tree_selection_get_selected(selection, &model, &iter)) { - EPlugin *ep; - - gtk_tree_model_get(model, &iter, 2, &ep, -1); - eppm_show_plugin(m, ep); - } else { - eppm_show_plugin(m, NULL); - } -} - -static void -eppm_enable_toggled(GtkCellRendererToggle *renderer, char *arg1, Manager *m) -{ - GtkTreeSelection *selection; - GtkTreePath *path; - GtkTreeIter iter; - EPlugin *plugin; - - path = gtk_tree_path_new_from_string(arg1); - selection = gtk_tree_view_get_selection(m->tree); - if (gtk_tree_model_get_iter((GtkTreeModel *)m->model, &iter, path)) { - gtk_tree_model_get((GtkTreeModel *)m->model, &iter, 2, &plugin, -1); - e_plugin_enable(plugin, !plugin->enabled); - gtk_list_store_set(m->model, &iter, 1, plugin->enabled, -1); - } - gtk_tree_path_free(path); -} - -static void -eppm_free(void *data) -{ - Manager *m = data; - GSList *l; - - for (l = m->plugins;l;l=g_slist_next(l)) - g_object_unref(l->data); - g_slist_free(m->plugins); - - g_free(m); -} - -static void -eppm_response(GtkDialog *w, int button, Manager *m) -{ - gtk_widget_destroy((GtkWidget*)w); - dialog = NULL; -} - -void -org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t) -{ - Manager *m; - int i; - GtkWidget *hbox, *w; - GtkTreeSelection *selection; - GtkCellRenderer *renderer; - GSList *l; - - if (dialog) { - gdk_window_raise(((GtkWidget *)dialog)->window); - return; - } - - m = g_malloc0(sizeof(*m)); - - /* Setup the ui */ - m->dialog = (GtkDialog *)gtk_dialog_new_with_buttons(_("Plugin Manager"), - (GtkWindow *)gtk_widget_get_toplevel(t->target.widget), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - /* this isn't actually big enough, but oh well, i'll work out resizing later */ - gtk_window_set_default_size((GtkWindow *)m->dialog, 640, 400); - g_object_set((GObject *)m->dialog, "has_separator", FALSE, NULL); - - hbox = gtk_hbox_new(FALSE, 0); - gtk_container_set_border_width((GtkContainer *)hbox, 12); - gtk_box_pack_start((GtkBox *)m->dialog->vbox, hbox, TRUE, TRUE, 0); - - w = g_object_new(gtk_label_get_type(), - "label", _("Note: Some changes will not take effect until restart"), - "wrap", TRUE, - NULL); - gtk_widget_show(w); - gtk_box_pack_start((GtkBox *)m->dialog->vbox, w, FALSE, TRUE, 6); - - m->tree = (GtkTreeView *)gtk_tree_view_new(); - - renderer = gtk_cell_renderer_text_new (); - gtk_tree_view_insert_column_with_attributes(m->tree, -1, _("Plugin"), renderer, "text", 0, NULL); - renderer = gtk_cell_renderer_toggle_new(); - /*g_object_set((GObject *)renderer, "activatable", TRUE, NULL);*/ - gtk_tree_view_insert_column_with_attributes(m->tree, -1, _("Enabled"), renderer, "active", 1, NULL); - g_signal_connect(renderer, "toggled", G_CALLBACK(eppm_enable_toggled), m); - - w = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy((GtkScrolledWindow *)w, GTK_POLICY_NEVER, GTK_POLICY_ALWAYS); - gtk_scrolled_window_set_shadow_type((GtkScrolledWindow *)w, GTK_SHADOW_IN); - gtk_container_add((GtkContainer *)w, (GtkWidget *)m->tree); - gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)w, FALSE, TRUE, 6); - - m->table = (GtkTable *)gtk_table_new(LABEL_LAST, 2, FALSE); - gtk_table_set_col_spacings(m->table, 6); - gtk_table_set_row_spacings(m->table, 6); - for (i=0;i<LABEL_LAST;i++) { - char *markup; - - markup = g_strdup_printf("<span weight=\"bold\">%s</span>", _(label_info[i].label)); - m->labels[i] = g_object_new(gtk_label_get_type(), - "label", markup, - "use_markup", TRUE, - "xalign", 1.0, - "yalign", 0.0, NULL); - g_free(markup); - gtk_table_attach(m->table, (GtkWidget *)m->labels[i], 0, 1, i, i+1, GTK_FILL, GTK_FILL, 0, 0); - m->items[i] = g_object_new(gtk_label_get_type(), - "wrap", TRUE, - "selectable", TRUE, - "xalign", 0.0, - "yalign", 0.0, NULL); - gtk_table_attach(m->table, (GtkWidget *)m->items[i], 1, 2, i, i+1, GTK_EXPAND|GTK_FILL, GTK_FILL, 0, 0); - } - - gtk_box_pack_start((GtkBox *)hbox, (GtkWidget *)m->table, TRUE, TRUE, 6); - gtk_widget_show_all(hbox); - - selection = gtk_tree_view_get_selection(m->tree); - gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - g_signal_connect(selection, "changed", G_CALLBACK(eppm_selection_changed), m); - - m->plugins = e_plugin_list_plugins(); - m->model = gtk_list_store_new(3, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_POINTER); - - for (l=m->plugins;l;l=g_slist_next(l)) { - EPlugin *ep = l->data; - GtkTreeIter iter; - - /* hide ourselves always */ - if (!strcmp(ep->id, "org.gnome.evolution.plugin.manager")) - continue; - - gtk_list_store_append(m->model, &iter); - gtk_list_store_set(m->model, &iter, - 0, ep->name?ep->name:ep->id, - 1, ep->enabled, - 2, ep, - -1); - } - gtk_tree_view_set_model(m->tree, (GtkTreeModel *)m->model); - - g_object_set_data_full((GObject *)m->dialog, "plugin-manager", m, eppm_free); - g_signal_connect(m->dialog, "response", G_CALLBACK(eppm_response), m); - - gtk_widget_show((GtkWidget *)m->dialog); -} - -int e_plugin_lib_enable(EPluginLib *ep, int enable); - -int -e_plugin_lib_enable(EPluginLib *ep, int enable) -{ - if (enable) { - } else { - /* This plugin can't be disabled ... */ - return -1; - } - - return 0; -} diff --git a/plugins/prefer-plain/.cvsignore b/plugins/prefer-plain/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/prefer-plain/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/prefer-plain/ChangeLog b/plugins/prefer-plain/ChangeLog deleted file mode 100644 index 3ee452f207..0000000000 --- a/plugins/prefer-plain/ChangeLog +++ /dev/null @@ -1,13 +0,0 @@ -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-21 Not Zed <NotZed@Ximian.com> - - * prefer-plain.c (e_plugin_lib_enable): setup the right plugin - init function. - -2004-10-20 Not Zed <NotZed@Ximian.com> - - * Imported prefer-plain plugin. - diff --git a/plugins/prefer-plain/Makefile.am b/plugins/prefer-plain/Makefile.am deleted file mode 100644 index 2ff15c7f7a..0000000000 --- a/plugins/prefer-plain/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-prefer-plain.eplug -plugin_LTLIBRARIES = liborg-gnome-prefer-plain.la - -liborg_gnome_prefer_plain_la_SOURCES = prefer-plain.c -liborg_gnome_prefer_plain_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-prefer-plain.eplug.in
\ No newline at end of file diff --git a/plugins/prefer-plain/org-gnome-prefer-plain.eplug.in b/plugins/prefer-plain/org-gnome-prefer-plain.eplug.in deleted file mode 100644 index 06218f7972..0000000000 --- a/plugins/prefer-plain/org-gnome-prefer-plain.eplug.in +++ /dev/null @@ -1,33 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.preferPlain" - location="@PLUGINDIR@/liborg-gnome-prefer-plain.so" - name="Prefer plain-text plugin" - description="A test plugin which demonstrates a formatter plugin which lets you choose to disable HTML mails"> - - <!-- hook into the 'html mail' preferences page --> - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="prefs" id="org.gnome.evolution.mail.prefs"> - <!-- we could also just insert our own items from a section factory, --> - <!-- but then we also need to create our own section frame --> - <item type="section_table" path="10.html/80.mode" label="Plain Text Mode"/> - <item type="item_table" path="10.html/80.mode/00.mode" factory="org_gnome_prefer_plain_config_mode"/> - </group> - </hook> - - <hook class="org.gnome.evolution.mail.format:1.0"> - <!-- need to override all formatters that override this type --> - <group id="EMFormatHTMLDisplay"> - <item mime_type="multipart/alternative" format="org_gnome_prefer_plain_multipart_alternative"/> - <item mime_type="text/html" format="org_gnome_prefer_plain_text_html"/> - </group> - <group id="EMFormat"> - <item mime_type="multipart/alternative" format="org_gnome_prefer_plain_multipart_alternative"/> - <item mime_type="text/html" format="org_gnome_prefer_plain_text_html"/> - </group> - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c deleted file mode 100644 index bad2990e56..0000000000 --- a/plugins/prefer-plain/prefer-plain.c +++ /dev/null @@ -1,191 +0,0 @@ - -/* Copyright (C) 2004 Michael Zucchi */ - -/* This file is licensed under the GNU GPL v2 or later */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib/gi18n-lib.h> -#include <string.h> -#include <stdio.h> - -#include "camel/camel-multipart.h" -#include "camel/camel-mime-part.h" -#include "mail/em-format-hook.h" -#include "mail/em-format.h" - -#include <gconf/gconf-client.h> -#include <gtk/gtkcombobox.h> -#include <gtk/gtkliststore.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtkcelllayout.h> -#include <gtk/gtktable.h> -#include <gtk/gtklabel.h> -#include "mail/em-config.h" - -void org_gnome_prefer_plain_multipart_alternative(void *ep, EMFormatHookTarget *t); -void org_gnome_prefer_plain_text_html(void *ep, EMFormatHookTarget *t); -GtkWidget *org_gnome_prefer_plain_config_mode(struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); - -enum { - EPP_NORMAL, - EPP_PREFER, - EPP_TEXT -}; - -static GConfClient *epp_gconf; -static int epp_mode; - -void -org_gnome_prefer_plain_text_html(void *ep, EMFormatHookTarget *t) -{ - /* In text-only mode, all html output is suppressed */ - if (epp_mode != EPP_TEXT) - t->item->handler.old->handler(t->format, t->stream, t->part, t->item->handler.old); - else - em_format_part_as(t->format, t->stream, t->part, NULL); -} - -void -org_gnome_prefer_plain_multipart_alternative(void *ep, EMFormatHookTarget *t) -{ - CamelMultipart *mp = (CamelMultipart *)camel_medium_get_content_object((CamelMedium *)t->part); - CamelMimePart *part, *display_part = NULL; - int i, nparts, partidlen, displayid = 0; - - if (epp_mode == EPP_NORMAL) { - t->item->handler.old->handler(t->format, t->stream, t->part, t->item->handler.old); - return; - } else if (!CAMEL_IS_MULTIPART(mp)) { - em_format_format_source(t->format, t->stream, t->part); - return; - } - - nparts = camel_multipart_get_number(mp); - for (i=0; i<nparts; i++) { - part = camel_multipart_get_part(mp, i); - if (camel_content_type_is(camel_mime_part_get_content_type(part), "text", "plain")) { - displayid = i; - display_part = part; - break; - } - } - - /* this part-id stuff is poking private data, needs api */ - partidlen = t->format->part_id->len; - - /* if we found a text part, show it */ - if (display_part) { - g_string_append_printf(t->format->part_id, ".alternative.%d", displayid); - em_format_part_as(t->format, t->stream, display_part, "text/plain"); - g_string_truncate(t->format->part_id, partidlen); - } - - /* all other parts are attachments */ - for (i=0;i<nparts; i++) { - part = camel_multipart_get_part(mp, i); - if (part != display_part) { - g_string_append_printf(t->format->part_id, ".alternative.%d", i); - - em_format_part_as(t->format, t->stream, t->part, NULL); - - g_string_truncate(t->format->part_id, partidlen); - } - } - - g_string_truncate(t->format->part_id, partidlen); -} - -static struct { - const char *label; - const char *key; -} epp_options[] = { - { N_("Show HTML if present"), "normal" }, - { N_("Prefer PLAIN"), "prefer_plain" }, - { N_("Only ever show PLAIN"), "only_plain" }, -}; - -static void -epp_mode_changed(GtkComboBox *dropdown, void *dummy) -{ - epp_mode = gtk_combo_box_get_active(dropdown); - if (epp_mode > 2) - epp_mode = 0; - - gconf_client_set_string(epp_gconf, "/apps/evolution/eplugin/prefer_plain/mode", epp_options[epp_mode].key, NULL); -} - -GtkWidget * -org_gnome_prefer_plain_config_mode(struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data) -{ - /*EMConfigTargetPrefs *ep = (EMConfigTargetPrefs *)data->target;*/ - GtkComboBox *dropdown; - GtkCellRenderer *cell; - GtkListStore *store; - GtkWidget *w; - int i; - GtkTreeIter iter; - - if (data->old) - return data->old; - - dropdown = (GtkComboBox *)gtk_combo_box_new(); - cell = gtk_cell_renderer_text_new(); - store = gtk_list_store_new(1, G_TYPE_STRING); - for (i=0;i<sizeof(epp_options)/sizeof(epp_options[0]);i++) { - gtk_list_store_append(store, &iter); - gtk_list_store_set(store, &iter, 0, _(epp_options[i].label), -1); - } - - gtk_cell_layout_pack_start((GtkCellLayout *)dropdown, cell, TRUE); - gtk_cell_layout_set_attributes((GtkCellLayout *)dropdown, cell, "text", 0, NULL); - gtk_combo_box_set_model(dropdown, (GtkTreeModel *)store); - /*gtk_combo_box_set_active(dropdown, -1);*/ - gtk_combo_box_set_active(dropdown, epp_mode); - g_signal_connect(dropdown, "changed", G_CALLBACK(epp_mode_changed), NULL); - gtk_widget_show((GtkWidget *)dropdown); - - w = gtk_label_new(_("HTML Mode")); - gtk_widget_show(w); - - i = ((GtkTable *)data->parent)->nrows; - gtk_table_attach((GtkTable *)data->parent, w, 0, 1, i, i+1, 0, 0, 0, 0); - gtk_table_attach((GtkTable *)data->parent, (GtkWidget *)dropdown, 1, 2, i, i+1, GTK_FILL|GTK_EXPAND, 0, 0, 0); - - /* since this isnt dynamic, we don't need to track each item */ - - return (GtkWidget *)dropdown; -} - -int e_plugin_lib_enable(EPluginLib *ep, int enable); - -int -e_plugin_lib_enable(EPluginLib *ep, int enable) -{ - char *key; - int i; - - if (enable) { - epp_gconf = gconf_client_get_default(); - key = gconf_client_get_string(epp_gconf, "/apps/evolution/eplugin/prefer_plain/mode", NULL); - if (key) { - for (i=0;i<sizeof(epp_options)/sizeof(epp_options[0]);i++) { - if (!strcmp(epp_options[i].key, key)) { - epp_mode = i; - break; - } - } - } else { - epp_mode = 0; - } - } else { - if (epp_gconf) { - g_object_unref(epp_gconf); - epp_gconf = 0; - } - } - - return 0; -} diff --git a/plugins/save-attachments/.cvsignore b/plugins/save-attachments/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/save-attachments/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/save-attachments/ChangeLog b/plugins/save-attachments/ChangeLog deleted file mode 100644 index 803d29a762..0000000000 --- a/plugins/save-attachments/ChangeLog +++ /dev/null @@ -1,20 +0,0 @@ -2005-01-04 Philip Van Hoof <pvanhoof@gnome.org> - - * save-attachments.c: Use standard error messages - -2004-12-27 Philip Van Hoof <pvanhoof@gnome.org> - - * save-attachments.c: Warning when overwriting file - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist xml menu file - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-20 Not Zed <NotZed@Ximian.com> - - * Imported save-attachments example plugin. - diff --git a/plugins/save-attachments/Makefile.am b/plugins/save-attachments/Makefile.am deleted file mode 100644 index ec09b11e2c..0000000000 --- a/plugins/save-attachments/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-save-attachments.eplug org-gnome-save-attachments.xml -plugin_LTLIBRARIES = liborg-gnome-save-attachments.la - -liborg_gnome_save_attachments_la_SOURCES = save-attachments.c -liborg_gnome_save_attachments_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = \ - org-gnome-save-attachments.eplug.in \ - org-gnome-save-attachments.xml
\ No newline at end of file diff --git a/plugins/save-attachments/org-gnome-save-attachments.eplug.in b/plugins/save-attachments/org-gnome-save-attachments.eplug.in deleted file mode 100644 index 0e162665bd..0000000000 --- a/plugins/save-attachments/org-gnome-save-attachments.eplug.in +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <!-- the path to the shared library --> - <e-plugin - id="org.gnome.plugin.attachments.save" - type="shlib" - location="@PLUGINDIR@/liborg-gnome-save-attachments.so" - name="Save attachments plugin" - description="A plugin for saving all attachments or parts of a message at once."> - <hook class="org.gnome.evolution.mail.bonobomenu:1.0"> - <menu id="org.gnome.evolution.mail.browser" target="select"> - <!-- the path to the bonobo menu description --> - <ui file="@PLUGINDIR@/org-gnome-save-attachments.xml"/> - <item - type="item" - verb="EPSASaveAttachments" - path="/commands/EPSASaveAttachments" - enable="one" - activate="org_gnome_save_attachments_save"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/save-attachments/org-gnome-save-attachments.xml b/plugins/save-attachments/org-gnome-save-attachments.xml deleted file mode 100644 index 449bd229c8..0000000000 --- a/plugins/save-attachments/org-gnome-save-attachments.xml +++ /dev/null @@ -1,19 +0,0 @@ -<Root> - <commands> - <cmd name="EPSASaveAttachments" _label="Save Attachments ..." - _tip="Save all attachments" - pixtype="stock" pixname="Save"/> - </commands> - - <menu> - <submenu name="Actions"> - <placeholder name="ComponentActionsPlaceholder"> - <placeholder name="MailMessageActions"> - <separator f="" name="emaillist5"/> - <menuitem name="EPSASaveAttachments" verb=""/> - </placeholder> - </placeholder> - </submenu> - - </menu> -</Root> diff --git a/plugins/save-attachments/save-attachments.c b/plugins/save-attachments/save-attachments.c deleted file mode 100644 index 9b6f4e6ebc..0000000000 --- a/plugins/save-attachments/save-attachments.c +++ /dev/null @@ -1,403 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Michael Zucchi <notzed@ximian.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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -/* This is prototype code only, this may, or may not, use undocumented - * unstable or private internal function calls. */ - -#include <sys/types.h> -#include <sys/stat.h> -#include <unistd.h> -#include <string.h> -#include <stdio.h> - -#include <glib.h> -#include <glib/gi18n.h> - -#include <gtk/gtkcheckbutton.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtktreestore.h> -#include <gtk/gtkcellrenderertext.h> -#include <gtk/gtkcellrenderertoggle.h> -#include <gtk/gtkbox.h> -#include <gtk/gtkstock.h> -#include <gtk/gtktreeview.h> -#include <gtk/gtkfilechooser.h> -#include <gtk/gtkframe.h> -#include <gtk/gtklabel.h> -#include <gtk/gtkalignment.h> -#include <gtk/gtkscrolledwindow.h> -#include <libgnomeui/gnome-file-entry.h> - -#include <camel/camel-folder.h> -#include <camel/camel-exception.h> -#include <camel/camel-mime-message.h> -#include <camel/camel-multipart.h> -#include <camel/camel-utf8.h> - -#include "widgets/misc/e-error.h" - -#include "mail/em-menu.h" -#include "mail/em-utils.h" - -/* these are sort of mail-internal */ -#include "mail/mail-mt.h" -#include "mail/mail-ops.h" - -void org_gnome_save_attachments_save(EPlugin *ep, EMMenuTargetSelect *target); - -struct _save_data { - CamelFolder *folder; - char *uid; - CamelMimeMessage *msg; - - char *path; - char *base; - - GtkWidget *entry; - GtkWidget *tree; - GtkTreeStore *model; -}; - -static void -free_data(struct _save_data *data) -{ - if (data->msg) - camel_object_unref(data->msg); - g_free(data->base); - g_free(data->path); - g_free(data->uid); - camel_object_unref(data->folder); - g_free(data); -} - -static char * -clean_name(const char *s) -{ - GString *out = g_string_new(""); - int c; - char *r; - - while ( (c = camel_utf8_getc((const unsigned char **)&s)) ) { - if (!g_unichar_isprint(c) || ( c < 0x7f && strchr(" /'\"`&();|<>$%{}!", c ))) - c = '_'; - g_string_append_u(out, c); - } - - r = g_strdup(out->str); - g_string_free(out, TRUE); - - return r; -} - -static void -fill_model_rec(CamelMimeMessage *msg, CamelMimePart *part, GtkTreeStore *model, GtkTreeIter *parent, GString *name) -{ - CamelDataWrapper *containee; - int parts, i; - char *type; - GtkTreeIter iter; - int len = name->len; - CamelContentType *mime; - - containee = camel_medium_get_content_object((CamelMedium *)part); - if (containee == NULL) - return; - - mime = ((CamelDataWrapper *)containee)->mime_type; - type = camel_content_type_simple(mime); - - if (CAMEL_IS_MULTIPART(containee)) { - gtk_tree_store_append(model, &iter, parent); - g_string_append_printf(name, ".multipart"); - gtk_tree_store_set(model, &iter, 0, FALSE, 1, type, 2, name->str, 3, name->str, 4, part, -1); - - parts = camel_multipart_get_number((CamelMultipart *)containee); - for (i = 0; i < parts; i++) { - CamelMimePart *mpart = camel_multipart_get_part((CamelMultipart *)containee, i); - - g_string_truncate(name, len); - g_string_append_printf(name, ".%d", i); - fill_model_rec(msg, mpart, model, &iter, name); - } - } else if (CAMEL_IS_MIME_MESSAGE(containee)) { - gtk_tree_store_append(model, &iter, parent); - g_string_append_printf(name, ".msg"); - gtk_tree_store_set(model, &iter, 0, FALSE, 1, type, 2, name->str, 3, name->str, 4, part, -1); - fill_model_rec(msg, (CamelMimePart *)containee, model, &iter, name); - } else { - char *filename = NULL; - const char *ext = NULL, *tmp; - int save = FALSE; - - gtk_tree_store_append(model, &iter, parent); - tmp = camel_mime_part_get_filename(part); - if (tmp) { - filename = clean_name(tmp); - ext = strrchr(filename, '.'); - } - tmp = camel_mime_part_get_disposition(part); - if (tmp && !strcmp(tmp, "attachment")) - save = TRUE; - - if (camel_content_type_is(mime, "text", "*")) { - if (ext == NULL) { - if ((ext = mime->subtype) == NULL || !strcmp(ext, "plain")) - ext = "text"; - } - } else if (camel_content_type_is(mime, "image", "*")) { - if (ext == NULL) { - if ((ext = mime->subtype) == NULL) - ext = "image"; - } - save = TRUE; - } - - g_string_append_printf(name, ".%s", ext); - gtk_tree_store_set(model, &iter, 0, save, 1, type, 2, filename?filename:name->str, 3, filename?NULL:name->str, 4, part, -1); - g_free(filename); - } - g_free(type); - - g_string_truncate(name, len); -} - -static void -fill_model(CamelMimeMessage *msg, GtkTreeStore *model) -{ - GString *name = g_string_new(""); - GtkTreeIter iter; - - gtk_tree_store_append(model, &iter, NULL); - gtk_tree_store_set(model, &iter, 0, FALSE, 1, "message/rfc822", 2, ".msg", 3, ".msg", 4, msg, -1); - fill_model_rec(msg, (CamelMimePart *)msg, model, &iter, name); - g_string_free(name, TRUE); -} - -static gboolean -save_part(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, void *d) -{ - struct _save_data *data = d; - char *filename, *ext, *save; - CamelMimePart *part; - gboolean doit; - - /* TODO: check for existing file */ - - gtk_tree_model_get(model, iter, 0, &doit, -1); - if (!doit) - return FALSE; - - gtk_tree_model_get(model, iter, 2, &filename, 3, &ext, 4, &part, -1); - if (ext == NULL) - save = g_build_filename(data->path, filename, NULL); - else - save = g_strdup_printf("%s%s", data->base, ext); - - /* FIXME: if part == data->msg then we need to save this - * differently, not using the envelope MimePart */ - - /* - * The underlying em_utils_save_part_to_file ain't using gnome-vfs. Therefor - * the POSIX access-call should suffice for checking the file existence. - */ - - if (access (save, F_OK)) - doit = e_error_run(NULL, E_ERROR_ASK_FILE_EXISTS_OVERWRITE, save, NULL) == GTK_RESPONSE_OK; - - if (doit) - em_utils_save_part_to_file(NULL, save, part); - - g_free(ext); - g_free(filename); - - return FALSE; -} - -static void -save_response(GtkWidget *d, int id, struct _save_data *data) -{ - if (id == GTK_RESPONSE_OK) { - char *tmp; - - data->base = gnome_file_entry_get_full_path((GnomeFileEntry *)data->entry, FALSE); - data->path = g_strdup(data->base); - tmp = strrchr(data->path, '/'); - if (tmp) - *tmp = 0; - gtk_tree_model_foreach((GtkTreeModel *)data->model, save_part, data); - } - - gtk_widget_destroy(d); - free_data(data); -} - -static gboolean -entry_changed_update(GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, void *d) -{ - const char *name = d; - char *filename, *ext; - - gtk_tree_model_get(model, iter, 3, &ext, -1); - if (ext) { - filename = g_strdup_printf("%s%s", name, ext); - gtk_tree_store_set((GtkTreeStore *)model, iter, 2, filename, -1); - g_free(filename); - g_free(ext); - } - - return FALSE; -} - -static void -entry_changed(GtkWidget *entry, struct _save_data *data) -{ - char *path; - const char *file; - struct stat st; - - path = gnome_file_entry_get_full_path((GnomeFileEntry *)data->entry, FALSE); - if (path == NULL - || (file = strrchr(path, '/')) == NULL - || file[1] == 0 - || (stat(path, &st) == 0 && S_ISDIR(st.st_mode))) - file = "attachment"; - else - file++; - - gtk_tree_model_foreach((GtkTreeModel *)data->model, entry_changed_update, (void *)file); - g_free(path); -} - -static void -toggle_changed(GtkWidget *entry, const char *spath, struct _save_data *data) -{ - GtkTreePath *path; - GtkTreeIter iter; - - path = gtk_tree_path_new_from_string(spath); - if (gtk_tree_model_get_iter((GtkTreeModel *)data->model, &iter, path)) { - gboolean on; - - gtk_tree_model_get((GtkTreeModel *)data->model, &iter, 0, &on, -1); - gtk_tree_store_set(data->model, &iter, 0, !on, -1); - } - - gtk_tree_path_free (path); -} - -static void -save_got_message(CamelFolder *folder, const char *uid, CamelMimeMessage *msg, void *d) -{ - struct _save_data *data = d; - GtkDialog *dialog; - GtkWidget *w, *tree; - GtkTreeStore *model; - GtkCellRenderer *renderer; - - /* not found, the mailer will show an error box for this */ - if (msg == NULL) { - free_data(data); - return; - } - - data->msg = msg; - camel_object_ref(msg); - - dialog = (GtkDialog *)gtk_dialog_new_with_buttons("Save attachments", - NULL, /* target->parent? */ - 0, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE, GTK_RESPONSE_OK, - NULL); - w = gnome_file_entry_new("save-attachments", _("Select save base name")); - data->entry = w; - g_object_set(w, "filechooser_action", GTK_FILE_CHOOSER_ACTION_SAVE, NULL); - gtk_widget_show(w); - gtk_box_pack_start((GtkBox *)dialog->vbox, w, FALSE, TRUE, 6); - - w = gnome_file_entry_gtk_entry((GnomeFileEntry *)data->entry); - g_signal_connect(w, "changed", G_CALLBACK(entry_changed), data); - - model = gtk_tree_store_new(5, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_STRING, G_TYPE_POINTER); - data->model = model; - fill_model(msg, model); - - tree = gtk_tree_view_new_with_model((GtkTreeModel *)model); - data->tree = tree; - gtk_widget_show(tree); - gtk_tree_view_expand_all((GtkTreeView *)tree); - - renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_insert_column_with_attributes((GtkTreeView *)tree, -1, - _("MIME Type"), renderer, "text", 1, NULL); - gtk_tree_view_set_expander_column((GtkTreeView *)tree, gtk_tree_view_get_column((GtkTreeView *)tree, 0)); - - renderer = gtk_cell_renderer_toggle_new(); - g_object_set(renderer, "activatable", TRUE, NULL); - g_signal_connect(renderer, "toggled", G_CALLBACK(toggle_changed), data); - - gtk_tree_view_insert_column_with_attributes((GtkTreeView *)tree, -1, - _("Save"), renderer, "active", 0, NULL); - renderer = gtk_cell_renderer_text_new(); - gtk_tree_view_insert_column_with_attributes((GtkTreeView *)tree, -1, - _("Name"), renderer, "text", 2, NULL); - - w = g_object_new(gtk_frame_get_type(), - "shadow_type", GTK_SHADOW_NONE, - "label_widget", g_object_new(gtk_label_get_type(), - "label", "<span weight=\"bold\">Attachments</span>", - "use_markup", TRUE, - "xalign", 0.0, NULL), - "child", g_object_new(gtk_alignment_get_type(), - "left_padding", 12, - "top_padding", 6, - "child", g_object_new(gtk_scrolled_window_get_type(), - "hscrollbar_policy", GTK_POLICY_AUTOMATIC, - "vscrollbar_policy", GTK_POLICY_AUTOMATIC, - "shadow_type", GTK_SHADOW_IN, - "child", tree, - NULL), - NULL), - NULL); - gtk_widget_show_all(w); - - gtk_box_pack_start((GtkBox *)dialog->vbox, w, TRUE, TRUE, 0); - g_signal_connect(dialog, "response", G_CALLBACK(save_response), data); - gtk_window_set_default_size((GtkWindow *)dialog, 500, 500); - gtk_widget_show((GtkWidget *)dialog); -} - -void -org_gnome_save_attachments_save(EPlugin *ep, EMMenuTargetSelect *target) -{ - struct _save_data *data; - - if (target->uids->len != 1) - return; - - data = g_malloc0(sizeof(*data)); - data->folder = target->folder; - camel_object_ref(data->folder); - data->uid = g_strdup(target->uids->pdata[0]); - - mail_get_message(data->folder, data->uid, save_got_message, data, mail_thread_new); -} diff --git a/plugins/save-calendar/.cvsignore b/plugins/save-calendar/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/save-calendar/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/save-calendar/ChangeLog b/plugins/save-calendar/ChangeLog deleted file mode 100644 index acfee8b0ca..0000000000 --- a/plugins/save-calendar/ChangeLog +++ /dev/null @@ -1,51 +0,0 @@ -2005-01-05 JP Rosevear <jpr@novell.com> - - * save-calendar.c (ask_destination_and_save): fix build for non - gtk file chooser case - -2005-01-04 Philip Van Hoof <pvanhoof@gnome.org> - - * csv-format.c, rdf-format.c: Use standard error messages - -2004-12-27 Philip Van Hoof <pvanhoof@gnome.org> - - * csv-format.c, rdf-format.c: Warning when overwriting file - -2004-12-22 JP Rosevear <jpr@novell.com> - - * Makefile.am: list format-handler.h as a source so it dists - -2004-12-20 Philip Van Hoof <pvanhoof@gnome.org> - - * Makefile.am: Code splitup, each format has it's own c-file - * csv-format.c: Added. Code splitup - * format-handler.h: Added. Code splitup - * ical-format.c: Added. Code splitup - * rdf-format.c: Added. Support for RDF files. Code splitup - * save-calendar.c: Support for RDF files. Code splitup - -2004-11-30 Philip Van Hoof <pvanhoof@gnome.org> - - * save-calendar.c: Support for CSV files - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-21 Rodrigo Moya <rodrigo@novell.com> - - * save-calendar.c (do_save_calendar): get error information in - e_cal_* calls, and display errors to the user. - -2004-10-21 JP Rosevear <jpr@novell.com> - - * save-calendar.c (do_save_calendar): compile if not using file - chooser - -2004-10-21 Rodrigo Moya <rodrigo@novell.com> - - * org-gnome-save-calendar.eplug.in: better menu items. - -2004-10-21 Rodrigo Moya <rodrigo@novell.com> - - * save-calendar.c: new plugin for saving a calendar to disk. diff --git a/plugins/save-calendar/Makefile.am b/plugins/save-calendar/Makefile.am deleted file mode 100644 index 5470974673..0000000000 --- a/plugins/save-calendar/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_CALENDAR_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-save-calendar.eplug -plugin_LTLIBRARIES = liborg-gnome-save-calendar.la - -liborg_gnome_save_calendar_la_SOURCES = \ - save-calendar.c \ - ical-format.c \ - csv-format.c \ - rdf-format.c \ - format-handler.h - -liborg_gnome_save_calendar_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-save-calendar.eplug.in diff --git a/plugins/save-calendar/csv-format.c b/plugins/save-calendar/csv-format.c deleted file mode 100644 index 80a32d2386..0000000000 --- a/plugins/save-calendar/csv-format.c +++ /dev/null @@ -1,576 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Philip Van Hoof <pvanhoof@gnome.org> - * - * 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <glib.h> -#include <glib/gi18n.h> -#ifdef USE_GTKFILECHOOSER -# include <gtk/gtkfilechooser.h> -# include <gtk/gtkfilechooserdialog.h> -#else -# include <gtk/gtkfilesel.h> -#endif -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkstock.h> -#include <gtk/gtk.h> -#include <libedataserver/e-source.h> -#include <libedataserverui/e-source-selector.h> -#include <libecal/e-cal.h> -#include <calendar/gui/e-cal-popup.h> -#include <libgnomevfs/gnome-vfs.h> -#include <string.h> - -#include "widgets/misc/e-error.h" - -#include "format-handler.h" - -typedef struct _CsvConfig CsvConfig; -struct _CsvConfig { - gchar *newline; - gchar *quote; - gchar *delimiter; - gboolean header; -}; - -static gboolean string_needsquotes (const char *value, CsvConfig *config); - -typedef struct _CsvPluginData CsvPluginData; -struct _CsvPluginData -{ - GtkWidget *delimiter_entry, *newline_entry, *quote_entry, *header_check; -}; - -static void -display_error_message (GtkWidget *parent, GError *error) -{ - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (GTK_WINDOW (parent), 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - error->message); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); -} - - -enum { /* CSV helper enum */ - ECALCOMPONENTTEXT, - ECALCOMPONENTATTENDEE, - CONSTCHAR -}; - - - -/* Some helpers for the csv stuff */ -static GString * -add_list_to_csv (GString *line, GSList *list_in, CsvConfig *config, gint type) -{ - - /* - * This one will write 'ECalComponentText' and 'const char' GSLists. It will - * put quotes around the complete written value if there's was only one value - * but it required having quotes and if there was more than one value (in which - * case delimiters are used to separate them, hence the need for the quotes). - */ - - if (list_in) { - gboolean needquotes = FALSE; - GSList *list = list_in; - GString *tmp = NULL; - gint cnt=0; - while (list) { - const char *str = NULL; - if (cnt == 0) - tmp = g_string_new (""); - if (cnt > 0) - needquotes = TRUE; - switch (type) { - case ECALCOMPONENTATTENDEE: - str = ((ECalComponentAttendee*)list->data)->value; - break; - case ECALCOMPONENTTEXT: - str = ((ECalComponentText*)list->data)->value; - break; - case CONSTCHAR: - default: - str = list->data; - break; - } - if (!needquotes) - needquotes = string_needsquotes (str, config); - if (str) - tmp = g_string_append (tmp, (const gchar*)str); - list = g_slist_next (list); cnt++; - if (list) - tmp = g_string_append (tmp, config->delimiter); - } - - if (needquotes) - line = g_string_append (line, config->quote); - line = g_string_append_len (line, tmp->str, tmp->len); - g_string_free (tmp, TRUE); - if (needquotes) - line = g_string_append (line, config->quote); - } - - line = g_string_append (line, config->delimiter); - return line; -} - -static GString * -add_nummeric_to_csv (GString *line, gint *nummeric, CsvConfig *config) -{ - - /* - * This one will write {-1}..{00}..{01}..{99} - * it prepends a 0 if it's < 10 and > -1 - */ - - if (nummeric) - g_string_append_printf (line, "%s%d", (*nummeric<10 && *nummeric>-1)?"0":"", *nummeric); - - line = g_string_append (line, config->delimiter); - return line; -} - -static GString * -add_time_to_csv (GString *line, icaltimetype *time, CsvConfig *config) -{ - /* - * Perhaps we should check for quotes, delimiter and newlines in the - * resulting string: The translators can put it there! - * - * Or perhaps we shouldn't make this translatable? - * Or perhaps there is a library-function to do this? - */ - - if (time) { - g_string_append_printf (line, _("%s%d/%s%d/%s%d %s%d:%s%d:%s%d"), - (time->month < 10)?"0":"", time->month, - (time->day < 10)?"0":"", time->day, - (time->year < 10)?"0":"", time->year, - (time->hour < 10)?"0":"", time->hour, - (time->minute < 10)?"0":"", time->minute, - (time->second < 10)?"0":"", time->second); - } - - line = g_string_append (line, config->delimiter); - return line; -} - -static gboolean -string_needsquotes (const char *value, CsvConfig *config) -{ - - /* This is the actual need for quotes-checker */ - - /* - * These are the simple substring-checks - * - * Example: {Mom, can you please do that for me?} - * Will be written as {"Mom, can you please do that for me?"} - */ - - gboolean needquotes = strstr (value, config->delimiter) ? TRUE:FALSE; - - if (!needquotes) { - needquotes = strstr (value, config->newline) ? TRUE:FALSE; - if (!needquotes) - needquotes = strstr (value, config->quote) ? TRUE:FALSE; - } - - - /* - * If the special-char is char+onespace (so like {, } {" }, {\n }) and it occurs - * the value that is going to be written - * - * In this case we don't trust the user . . . and are going to quote the string - * just to play save -- Quoting is always allowed in the CSV format. If you can - * avoid it, it's better to do so since a lot applications don't support CSV - * correctly! --. - * - * Example: {Mom,can you please do that for me?} - * This example will be written as {"Mom,can you please do that for me?"} because - * there's a {,} behind {Mom} and the delimiter is {, } (so we searched only the - * first character of {, } and didn't trust the user). - */ - - - if (!needquotes) { - gint len = strlen (config->delimiter); - if ((len == 2) && (config->delimiter[1] = ' ')) { - needquotes = strchr (value, config->delimiter[0])?TRUE:FALSE; - if (!needquotes) { - gint len = strlen (config->newline); - if ((len == 2) && (config->newline[1] = ' ')) { - needquotes = strchr (value, config->newline[0])?TRUE:FALSE; - if (!needquotes) { - gint len = strlen (config->quote); - if ((len == 2) && (config->quote[1] = ' ')) { - needquotes = strchr - (value, config->quote[0])?TRUE:FALSE; - } - } - } - } - } - } - - return needquotes; -} - -static GString * -add_string_to_csv (GString *line, const char *value, CsvConfig *config) -{ - /* Will add a string to the record and will check for the need for quotes */ - - if ((value) && (strlen(value)>0)) { - gboolean needquotes = string_needsquotes (value, config); - - if (needquotes) - line = g_string_append (line, config->quote); - line = g_string_append (line, (const gchar*)value); - if (needquotes) - line = g_string_append (line, config->quote); - } - line = g_string_append (line, config->delimiter); - return line; -} - -/* Convert what the user types to what he probably means */ -static gchar * -userstring_to_systemstring (const gchar *userstring) -{ - const gchar *text = userstring; - gint i=0, len = strlen(text); - GString *str = g_string_new (""); - gchar *retval = NULL; - - while (i < len) { - if (text[i] == '\\') { - switch (text[i+1]) { - case 'n': - str = g_string_append_c (str, '\n'); - i++; - break; - case '\\': - str = g_string_append_c (str, '\\'); - i++; - break; - case 'r': - str = g_string_append_c (str, '\r'); - i++; - break; - case 't': - str = g_string_append_c (str, '\t'); - i++; - break; - } - } else { - str = g_string_append_c (str, text[i]); - } - - i++; - } - - retval = str->str; - g_string_free (str, FALSE); - - return retval; -} - -static void -do_save_calendar_csv (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, char *dest_uri) -{ - - /* - * According to some documentation about CSV, newlines 'are' allowed - * in CSV-files. But you 'do' have to put the value between quotes. - * The helper 'string_needsquotes' will check for that - * - * http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm - * http://www.creativyst.com/cgi-bin/Prod/15/eg/csv2xml.pl - */ - - ESource *primary_source; - ECal *source_client; - GError *error = NULL; - GList *objects=NULL; - GnomeVFSResult result; - GnomeVFSHandle *handle; - GnomeVFSURI *uri; - GString *line = NULL; - CsvConfig *config = NULL; - CsvPluginData *d = handler->data; - const gchar *tmp = NULL; - gboolean doit = TRUE; - - if (!dest_uri) - return; - - primary_source = e_source_selector_peek_primary_selection (target->selector); - - /* open source client */ - source_client = e_cal_new (primary_source, type); - if (!e_cal_open (source_client, TRUE, &error)) { - display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error); - g_object_unref (source_client); - g_error_free (error); - return; - } - - config = g_new (CsvConfig, 1); - - tmp = gtk_entry_get_text (GTK_ENTRY(d->delimiter_entry)); - config->delimiter = userstring_to_systemstring (tmp?tmp:", "); - tmp = gtk_entry_get_text (GTK_ENTRY(d->newline_entry)); - config->newline = userstring_to_systemstring (tmp?tmp:"\\n"); - tmp = gtk_entry_get_text (GTK_ENTRY(d->quote_entry)); - config->quote = userstring_to_systemstring (tmp?tmp:"\""); - config->header = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (d->header_check)); - - uri = gnome_vfs_uri_new (dest_uri); - - result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_READ); - if (result == GNOME_VFS_OK) - doit = e_error_run(gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), - E_ERROR_ASK_FILE_EXISTS_OVERWRITE, dest_uri, NULL) == GTK_RESPONSE_OK; - - if (doit) { - result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_WRITE); - if (result != GNOME_VFS_OK) { - gnome_vfs_create (&handle, dest_uri, GNOME_VFS_OPEN_WRITE, TRUE, GNOME_VFS_PERM_USER_ALL); - result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_WRITE); - } - } - - if (result == GNOME_VFS_OK && doit && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) { - - if (config->header) { - line = g_string_new (""); - g_string_append_printf (line, _("Uid%sSummary%sDescription List%sCategories List%s" - "Comment List%sCompleted%sCreated%sContact List%s" - "Start%sEnd%sDue%sPercent Done%sPriority%sUrl%s" - "Attendees List%sLocation%sModified%s"), - config->delimiter, config->delimiter, config->delimiter, config->delimiter, - config->delimiter, config->delimiter, config->delimiter, config->delimiter, - config->delimiter, config->delimiter, config->delimiter, config->delimiter, - config->delimiter, config->delimiter, config->delimiter, config->delimiter, - config->newline); - - gnome_vfs_write (handle, line->str, line->len, NULL); - g_string_free (line, TRUE); - } - - - while (objects != NULL) { - ECalComponent *comp = objects->data; - gchar *delimiter_temp = NULL; - const char *temp_constchar; - GSList *temp_list; - ECalComponentDateTime temp_dt; - struct icaltimetype *temp_time; - int *temp_int; - ECalComponentText temp_comptext; - - line = g_string_new (""); - - /* Getting the stuff */ - e_cal_component_get_uid (comp, &temp_constchar); - line = add_string_to_csv (line, temp_constchar, config); - - e_cal_component_get_summary (comp, &temp_comptext); - line = add_string_to_csv (line, &temp_comptext?temp_comptext.value:NULL, config); - - e_cal_component_get_description_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, ECALCOMPONENTTEXT); - if (temp_list) - e_cal_component_free_text_list (temp_list); - - e_cal_component_get_categories_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, CONSTCHAR); - if (temp_list) - e_cal_component_free_categories_list (temp_list); - - e_cal_component_get_comment_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, ECALCOMPONENTTEXT); - if (temp_list) - e_cal_component_free_text_list (temp_list); - - e_cal_component_get_completed (comp, &temp_time); - line = add_time_to_csv (line, temp_time, config); - if (temp_time) - e_cal_component_free_icaltimetype (temp_time); - - e_cal_component_get_created (comp, &temp_time); - line = add_time_to_csv (line, temp_time, config); - if (temp_time) - e_cal_component_free_icaltimetype (temp_time); - - e_cal_component_get_contact_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, ECALCOMPONENTTEXT); - if (temp_list) - e_cal_component_free_text_list (temp_list); - - e_cal_component_get_dtstart (comp, &temp_dt); - line = add_time_to_csv (line, temp_dt.value ? temp_dt.value : NULL, config); - if (temp_dt.value) - e_cal_component_free_datetime (&temp_dt); - - e_cal_component_get_dtend (comp, &temp_dt); - line = add_time_to_csv (line, temp_dt.value ? temp_dt.value : NULL, config); - if (temp_dt.value) - e_cal_component_free_datetime (&temp_dt); - - e_cal_component_get_due (comp, &temp_dt); - line = add_time_to_csv (line, temp_dt.value ? temp_dt.value : NULL, config); - if (temp_dt.value) - e_cal_component_free_datetime (&temp_dt); - - e_cal_component_get_percent (comp, &temp_int); - line = add_nummeric_to_csv (line, temp_int, config); - - e_cal_component_get_priority (comp, &temp_int); - line = add_nummeric_to_csv (line, temp_int, config); - - e_cal_component_get_url (comp, &temp_constchar); - line = add_string_to_csv (line, temp_constchar, config); - - if (e_cal_component_has_attendees (comp)) { - e_cal_component_get_attendee_list (comp, &temp_list); - line = add_list_to_csv (line, temp_list, config, ECALCOMPONENTATTENDEE); - if (temp_list) - e_cal_component_free_attendee_list (temp_list); - } else { - line = add_list_to_csv (line, NULL, config, ECALCOMPONENTATTENDEE); - } - - e_cal_component_get_location (comp, &temp_constchar); - line = add_string_to_csv (line, temp_constchar, config); - - e_cal_component_get_last_modified (comp, &temp_time); - - /* Append a newline (record delimiter) */ - delimiter_temp = config->delimiter; - config->delimiter = config->newline; - - line = add_time_to_csv (line, temp_time, config); - - /* And restore for the next record */ - config->delimiter = delimiter_temp; - - /* Important note! - * The documentation is not requiring this! - * - * if (temp_time) e_cal_component_free_icaltimetype (temp_time); - * - * Please uncomment and fix documentation if untrue - * http://www.gnome.org/projects/evolution/developer-doc/libecal/ECalComponent.html - * #e-cal-component-get-last-modified - */ - gnome_vfs_write (handle, line->str, line->len, NULL); - - /* It's written, so we can free it */ - g_string_free (line, TRUE); - - objects = g_list_next (objects); - } - - gnome_vfs_close (handle); - } - - g_object_unref (source_client); - - g_free (config->delimiter); - g_free (config->quote); - g_free (config->newline); - g_free (config); - - return; -} - - - - - -static GtkWidget * -create_options_widget (FormatHandler *handler) -{ - GtkWidget *table = gtk_table_new (4, 2, FALSE), *label = NULL, - *csv_options = gtk_expander_new (_("Advanced options for the CSV format")), - *vbox = gtk_vbox_new (FALSE, 0); - CsvPluginData *d = handler->data; - - d->delimiter_entry = gtk_entry_new (); - d->newline_entry = gtk_entry_new (); - d->quote_entry = gtk_entry_new (); - d->header_check = gtk_check_button_new_with_label (_("Prepend a header")); - - /* Advanced CSV options */ - gtk_entry_set_text (GTK_ENTRY(d->delimiter_entry), ", "); - gtk_entry_set_text (GTK_ENTRY(d->quote_entry), "\""); - gtk_entry_set_text (GTK_ENTRY(d->newline_entry), "\\n"); - - gtk_table_set_row_spacings (GTK_TABLE (table), 5); - gtk_table_set_col_spacings (GTK_TABLE (table), 5); - label = gtk_label_new (_("Value delimiter:")); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 0, 1, - (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach (GTK_TABLE (table), d->delimiter_entry, 1, 2, 0, 1, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); - label = gtk_label_new (_("Record delimiter:")); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 1, 2, - (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach (GTK_TABLE (table), d->newline_entry, 1, 2, 1, 2, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); - label = gtk_label_new (_("Encapsulate values with:")); - gtk_misc_set_alignment (GTK_MISC (label), 0, 0.0); - gtk_table_attach (GTK_TABLE (table), label, 0, 1, 2, 3, - (GtkAttachOptions) (GTK_FILL), (GtkAttachOptions) (0), 0, 0); - gtk_table_attach (GTK_TABLE (table), d->quote_entry, 1, 2, 2, 3, - (GtkAttachOptions) (GTK_EXPAND | GTK_FILL), (GtkAttachOptions) (0), 0, 0); - - gtk_box_pack_start (GTK_BOX (vbox), d->header_check, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (vbox), table, TRUE, TRUE, 0); - gtk_widget_show_all (vbox); - - gtk_container_add (GTK_CONTAINER (csv_options), vbox); - - - return csv_options; -} - -FormatHandler *csv_format_handler_new (void) -{ - FormatHandler *handler = g_new (FormatHandler, 1); - - handler->isdefault = FALSE; - handler->combo_label = _("Comma separated value format (.csv)"); - handler->filename_ext = ".csv"; - handler->data = g_new (CsvPluginData, 1); - handler->options_widget = create_options_widget (handler); - handler->save = do_save_calendar_csv; - - return handler; -} diff --git a/plugins/save-calendar/format-handler.h b/plugins/save-calendar/format-handler.h deleted file mode 100644 index 9ff29a118d..0000000000 --- a/plugins/save-calendar/format-handler.h +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Philip Van Hoof <pvanhoof@gnome.org> - * - * 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <gtk/gtk.h> -#include <libedataserver/e-source.h> -#include <libedataserverui/e-source-selector.h> -#include <libecal/e-cal.h> -#include <calendar/gui/e-cal-popup.h> - -typedef struct _FormatHandler FormatHandler; - -struct _FormatHandler -{ - gboolean isdefault; - const gchar *combo_label; - const gchar *filename_ext; - GtkWidget *options_widget; - - gpointer data; - - void (*save) (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, char *dest_uri); -}; - -FormatHandler *csv_format_handler_new (void); -FormatHandler *ical_format_handler_new (void); -FormatHandler *rdf_format_handler_new (void); diff --git a/plugins/save-calendar/ical-format.c b/plugins/save-calendar/ical-format.c deleted file mode 100644 index 680885161c..0000000000 --- a/plugins/save-calendar/ical-format.c +++ /dev/null @@ -1,127 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Rodrigo Moya <rodrigo@novell.com> - * Philip Van Hoof <pvanhoof@gnome.org> - * - * 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <glib.h> -#include <glib/gi18n.h> -#ifdef USE_GTKFILECHOOSER -# include <gtk/gtkfilechooser.h> -# include <gtk/gtkfilechooserdialog.h> -#else -# include <gtk/gtkfilesel.h> -#endif -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkstock.h> -#include <gtk/gtk.h> -#include <libedataserver/e-source.h> -#include <libedataserverui/e-source-selector.h> -#include <libecal/e-cal.h> -#include <calendar/gui/e-cal-popup.h> -#include <libgnomevfs/gnome-vfs.h> -#include <string.h> - -#include "format-handler.h" - -static void -display_error_message (GtkWidget *parent, GError *error) -{ - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (GTK_WINDOW (parent), 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - error->message); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); -} - -static void -do_save_calendar_ical (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, char *dest_uri) -{ - ESource *primary_source; - ECal *source_client, *dest_client; - GError *error = NULL; - - primary_source = e_source_selector_peek_primary_selection (target->selector); - - if (!dest_uri) - return; - - /* open source client */ - source_client = e_cal_new (primary_source, type); - if (!e_cal_open (source_client, TRUE, &error)) { - display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error); - g_object_unref (source_client); - g_error_free (error); - return; - } - - /* open destination client */ - error = NULL; - dest_client = e_cal_new_from_uri (dest_uri, type); - if (e_cal_open (dest_client, FALSE, &error)) { - GList *objects; - - if (e_cal_get_object_list (source_client, "#t", &objects, NULL)) { - while (objects != NULL) { - icalcomponent *icalcomp = objects->data; - - /* FIXME: deal with additions/modifications */ - - /* FIXME: This stores a directory with one file in it, the user expects only a file */ - - /* FIXME: It would be nice if this ical-handler would use gnome-vfs rather than e_cal_* */ - - error = NULL; - if (!e_cal_create_object (dest_client, icalcomp, NULL, &error)) { - display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error); - g_error_free (error); - } - - /* remove item from the list */ - objects = g_list_remove (objects, icalcomp); - icalcomponent_free (icalcomp); - } - } - } else { - display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error); - g_error_free (error); - } - - /* terminate */ - g_object_unref (source_client); - g_object_unref (dest_client); -} - -FormatHandler *ical_format_handler_new (void) -{ - FormatHandler *handler = g_new (FormatHandler, 1); - - handler->isdefault = TRUE; - handler->combo_label = _("iCalendar format (.ics)"); - handler->filename_ext = ".ics"; - handler->options_widget = NULL; - handler->save = do_save_calendar_ical; - handler->data = NULL; - - return handler; -} diff --git a/plugins/save-calendar/org-gnome-save-calendar.eplug.in b/plugins/save-calendar/org-gnome-save-calendar.eplug.in deleted file mode 100644 index 39d1f3f382..0000000000 --- a/plugins/save-calendar/org-gnome-save-calendar.eplug.in +++ /dev/null @@ -1,14 +0,0 @@ -<e-plugin-list> - <e-plugin id="org.gnome.evolution.save_calendar" type="shlib" name="Save Selected Calendar or Tasks List" description="Saves selected calendar or tasks list to disk" - location="@PLUGINDIR@/liborg-gnome-save-calendar.so"> - - <hook class="org.gnome.evolution.calendar.popup:1.0"> - <menu id="org.gnome.evolution.tasks.source.popup" target="source"> - <item type="item" path="19.save_tasks" label="Save to _Disk" icon="stock_save" activate="org_gnome_save_tasks"/> - </menu> - <menu id="org.gnome.evolution.calendar.source.popup" target="source"> - <item type="item" path="19.save_calendar" label="Save to _Disk" icon="stock_save" activate="org_gnome_save_calendar"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list>
\ No newline at end of file diff --git a/plugins/save-calendar/rdf-format.c b/plugins/save-calendar/rdf-format.c deleted file mode 100644 index eb8154f782..0000000000 --- a/plugins/save-calendar/rdf-format.c +++ /dev/null @@ -1,396 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Philip Van Hoof <pvanhoof@gnome.org> - * - * 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <glib.h> -#include <glib/gi18n.h> -#ifdef USE_GTKFILECHOOSER -# include <gtk/gtkfilechooser.h> -# include <gtk/gtkfilechooserdialog.h> -#else -# include <gtk/gtkfilesel.h> -#endif -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkstock.h> -#include <gtk/gtk.h> -#include <libedataserver/e-source.h> -#include <libedataserverui/e-source-selector.h> -#include <libecal/e-cal.h> -#include <calendar/gui/e-cal-popup.h> -#include <libgnomevfs/gnome-vfs.h> -#include <libxml/xmlmemory.h> -#include <libxml/parser.h> -#include <libxml/tree.h> -#include <libxml/xmlIO.h> -#include <libxml/xpath.h> -#include <string.h> - -#include "widgets/misc/e-error.h" - -#include "format-handler.h" - -static void -add_string_to_rdf (xmlNodePtr node, const gchar *tag, const char *value); - -/* Use { */ - -/* #include <calendar/gui/calendar-config-keys.h> */ -/* #include <calendar/gui/calendar-config.h> */ - -/* } or { */ -#define CALENDAR_CONFIG_PREFIX "/apps/evolution/calendar" -#define CALENDAR_CONFIG_TIMEZONE CALENDAR_CONFIG_PREFIX "/display/timezone" - -GConfClient *config = NULL; - -static gchar * -calendar_config_get_timezone (void) -{ - gchar *retval = NULL; - - if (!config) - config = gconf_client_get_default (); - - retval = gconf_client_get_string (config, CALENDAR_CONFIG_TIMEZONE, NULL); - - if (!retval) - retval = g_strdup ("UTC"); - - return retval; -} -/* } */ - -enum { /* XML helper enum */ - ECALCOMPONENTTEXT, - ECALCOMPONENTATTENDEE, - CONSTCHAR -}; - -static void -display_error_message (GtkWidget *parent, GError *error) -{ - GtkWidget *dialog; - - dialog = gtk_message_dialog_new (GTK_WINDOW (parent), 0, GTK_MESSAGE_ERROR, GTK_BUTTONS_CLOSE, - error->message); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); -} - -/* Some helpers for the xml stuff */ -static void -add_list_to_rdf (xmlNodePtr node, const gchar *tag, GSList *list_in, gint type) -{ - if (list_in) { - GSList *list = list_in; - - while (list) { - const char *str = NULL; - - switch (type) { - case ECALCOMPONENTATTENDEE: - str = ((ECalComponentAttendee*)list->data)->value; - break; - case ECALCOMPONENTTEXT: - str = ((ECalComponentText*)list->data)->value; - break; - case CONSTCHAR: - default: - str = list->data; - break; - } - - add_string_to_rdf (node, tag, str); - - list = g_slist_next (list); - } - } -} - -static void -add_nummeric_to_rdf (xmlNodePtr node, const gchar *tag, gint *nummeric) -{ - if (nummeric) { - gchar *value = g_strdup_printf ("%d", *nummeric); - xmlNodePtr cur_node = xmlNewChild (node, NULL, tag, value); - xmlSetProp (cur_node, "rdf:datatype", "http://www.w3.org/2001/XMLSchema#integer"); - g_free (value); - } -} - -static void -add_time_to_rdf (xmlNodePtr node, const gchar *tag, icaltimetype *time) -{ - if (time) { - xmlNodePtr cur_node = NULL; - gchar *tmp = NULL; - gchar *str = g_strdup_printf ("%s%d-%s%d-%s%dT%s%d:%s%d:%s%d", - (time->year < 10)?"0":"", time->year, - (time->month < 10)?"0":"", time->month, - (time->day < 10)?"0":"", time->day, - (time->hour < 10)?"0":"", time->hour, - (time->minute < 10)?"0":"", time->minute, - (time->second < 10)?"0":"", time->second); - cur_node = xmlNewChild (node, NULL, tag, str); - - /* Not sure about this property */ - tmp = g_strdup_printf ("http://www.w3.org/2002/12/cal/tzd/%s#tz", calendar_config_get_timezone ()); - xmlSetProp (cur_node, "rdf:datatype", tmp); - g_free (tmp); - - g_free (str); - } -} - - -static void -add_string_to_rdf (xmlNodePtr node, const gchar *tag, const char *value) -{ - if (value) { - xmlNodePtr cur_node = NULL; - cur_node = xmlNewChild (node, NULL, tag, value); - xmlSetProp (cur_node, "rdf:datatype", "http://www.w3.org/2001/XMLSchema#string"); - } -} - - - - -static void -do_save_calendar_rdf (FormatHandler *handler, EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type, char *dest_uri) -{ - - /* - * According to some documentation about CSV, newlines 'are' allowed - * in CSV-files. But you 'do' have to put the value between quotes. - * The helper 'string_needsquotes' will check for that - * - * http://www.creativyst.com/Doc/Articles/CSV/CSV01.htm - * http://www.creativyst.com/cgi-bin/Prod/15/eg/csv2xml.pl - */ - - ESource *primary_source; - ECal *source_client; - GError *error = NULL; - GList *objects=NULL; - GnomeVFSResult result; - GnomeVFSHandle *handle; - GnomeVFSURI *uri; - gchar *temp = NULL; - gboolean doit = TRUE; - - if (!dest_uri) - return; - - primary_source = e_source_selector_peek_primary_selection (target->selector); - - /* open source client */ - source_client = e_cal_new (primary_source, type); - if (!e_cal_open (source_client, TRUE, &error)) { - display_error_message (gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), error); - g_object_unref (source_client); - g_error_free (error); - return; - } - - uri = gnome_vfs_uri_new (dest_uri); - - result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_READ); - if (result == GNOME_VFS_OK) - doit = e_error_run(gtk_widget_get_toplevel (GTK_WIDGET (target->selector)), - E_ERROR_ASK_FILE_EXISTS_OVERWRITE, dest_uri, NULL) == GTK_RESPONSE_OK; - - if (doit) { - result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_WRITE); - if (result != GNOME_VFS_OK) { - gnome_vfs_create (&handle, dest_uri, GNOME_VFS_OPEN_WRITE, TRUE, GNOME_VFS_PERM_USER_ALL); - result = gnome_vfs_open_uri (&handle, uri, GNOME_VFS_OPEN_WRITE); - } - } - - - if (result == GNOME_VFS_OK && doit && e_cal_get_object_list_as_comp (source_client, "#t", &objects, NULL)) { - xmlBufferPtr buffer=xmlBufferCreate(); - xmlDocPtr doc = xmlNewDoc((xmlChar *) "1.0"); - xmlNodePtr fnode = doc->children; - - doc->children = xmlNewDocNode (doc, NULL, "rdf:RDF", NULL); - xmlSetProp (doc->children, "xmlns:rdf", "http://www.w3.org/1999/02/22-rdf-syntax-ns#"); - xmlSetProp (doc->children, "xmlns", "http://www.w3.org/2002/12/cal/ical#"); - - fnode = xmlNewChild (doc->children, NULL, "Vcalendar", NULL); - - /* Should Evolution publicise these? */ - xmlSetProp (fnode, "xmlns:x-wr", "http://www.w3.org/2002/12/cal/prod/Apple_Comp_628d9d8459c556fa#"); - xmlSetProp (fnode, "xmlns:x-lic", "http://www.w3.org/2002/12/cal/prod/Apple_Comp_628d9d8459c556fa#"); - - /* Not sure if it's correct like this */ - xmlNewChild (fnode, NULL, "prodid", "-//" PACKAGE_STRING "//iCal 1.0//EN"); - - /* Assuming GREGORIAN is the only supported calendar scale */ - xmlNewChild (fnode, NULL, "calscale", "GREGORIAN"); - - temp = calendar_config_get_timezone (); - xmlNewChild (fnode, NULL, "x-wr:timezone", temp); - g_free (temp); - - xmlNewChild (fnode, NULL, "method", "PUBLISH"); - - xmlNewChild (fnode, NULL, "x-wr:relcalid", e_source_peek_uid (primary_source)); - - xmlNewChild (fnode, NULL, "x-wr:calname", e_source_peek_name (primary_source)); - - /* Version of this RDF-format */ - xmlNewChild (fnode, NULL, "version", "2.0"); - - while (objects != NULL) { - ECalComponent *comp = objects->data; - const char *temp_constchar; - gchar *tmp_str = NULL; - GSList *temp_list; - ECalComponentDateTime temp_dt; - struct icaltimetype *temp_time; - int *temp_int; - ECalComponentText temp_comptext; - xmlNodePtr c_node = xmlNewChild (fnode, NULL, "component", NULL); - xmlNodePtr node = xmlNewChild (c_node, NULL, "Vevent", NULL); - - /* Getting the stuff */ - e_cal_component_get_uid (comp, &temp_constchar); - tmp_str = g_strdup_printf ("#%s", temp_constchar); - xmlSetProp (node, "about", tmp_str); - g_free (tmp_str); - add_string_to_rdf (node, "uid",temp_constchar); - - e_cal_component_get_summary (comp, &temp_comptext); - add_string_to_rdf (node, "summary",&temp_comptext?temp_comptext.value:NULL); - - e_cal_component_get_description_list (comp, &temp_list); - add_list_to_rdf (node, "description", temp_list, ECALCOMPONENTTEXT); - if (temp_list) - e_cal_component_free_text_list (temp_list); - - e_cal_component_get_categories_list (comp, &temp_list); - add_list_to_rdf (node, "categories", temp_list, CONSTCHAR); - if (temp_list) - e_cal_component_free_categories_list (temp_list); - - e_cal_component_get_comment_list (comp, &temp_list); - add_list_to_rdf (node, "comment", temp_list, ECALCOMPONENTTEXT); - - if (temp_list) - e_cal_component_free_text_list (temp_list); - - e_cal_component_get_completed (comp, &temp_time); - add_time_to_rdf (node, "completed", temp_time); - if (temp_time) - e_cal_component_free_icaltimetype (temp_time); - - e_cal_component_get_created (comp, &temp_time); - add_time_to_rdf (node, "created", temp_time); - if (temp_time) - e_cal_component_free_icaltimetype (temp_time); - - e_cal_component_get_contact_list (comp, &temp_list); - add_list_to_rdf (node, "contact", temp_list, ECALCOMPONENTTEXT); - if (temp_list) - e_cal_component_free_text_list (temp_list); - - e_cal_component_get_dtstart (comp, &temp_dt); - add_time_to_rdf (node, "dtstart", temp_dt.value ? temp_dt.value : NULL); - if (temp_dt.value) - e_cal_component_free_datetime (&temp_dt); - - e_cal_component_get_dtend (comp, &temp_dt); - add_time_to_rdf (node, "dtend", temp_dt.value ? temp_dt.value : NULL); - if (temp_dt.value) - e_cal_component_free_datetime (&temp_dt); - - e_cal_component_get_due (comp, &temp_dt); - add_time_to_rdf (node, "due", temp_dt.value ? temp_dt.value : NULL); - if (temp_dt.value) - e_cal_component_free_datetime (&temp_dt); - - e_cal_component_get_percent (comp, &temp_int); - add_nummeric_to_rdf (node, "percentComplete", temp_int); - - e_cal_component_get_priority (comp, &temp_int); - add_nummeric_to_rdf (node, "priority", temp_int); - - e_cal_component_get_url (comp, &temp_constchar); - add_string_to_rdf (node, "URL", temp_constchar); - - if (e_cal_component_has_attendees (comp)) { - e_cal_component_get_attendee_list (comp, &temp_list); - add_list_to_rdf (node, "attendee", temp_list, ECALCOMPONENTATTENDEE); - if (temp_list) - e_cal_component_free_attendee_list (temp_list); - } - - e_cal_component_get_location (comp, &temp_constchar); - add_string_to_rdf (node, "location", temp_constchar); - - e_cal_component_get_last_modified (comp, &temp_time); - add_time_to_rdf (node, "lastModified",temp_time); - - - /* Important note! - * The documentation is not requiring this! - * - * if (temp_time) e_cal_component_free_icaltimetype (temp_time); - * - * Please uncomment and fix documentation if untrue - * http://www.gnome.org/projects/evolution/developer-doc/libecal/ECalComponent.html - * #e-cal-component-get-last-modified - */ - - objects = g_list_next (objects); - } - - /* I used a buffer rather than xmlDocDump: I want gnome-vfs support */ - xmlNodeDump (buffer, doc, doc->children, 2, 1); - - gnome_vfs_write (handle, xmlBufferContent (buffer), xmlBufferLength (buffer), NULL); - - xmlBufferFree (buffer); - xmlFreeDoc (doc); - gnome_vfs_close (handle); - } - - g_object_unref (source_client); - - return; -} - -FormatHandler *rdf_format_handler_new (void) -{ - FormatHandler *handler = g_new (FormatHandler, 1); - - handler->isdefault = FALSE; - handler->combo_label = _("RDF format (.rdf)"); - handler->filename_ext = ".rdf"; - handler->options_widget = NULL; - handler->save = do_save_calendar_rdf; - - return handler; -} diff --git a/plugins/save-calendar/save-calendar.c b/plugins/save-calendar/save-calendar.c deleted file mode 100644 index 48a0614704..0000000000 --- a/plugins/save-calendar/save-calendar.c +++ /dev/null @@ -1,260 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Rodrigo Moya <rodrigo@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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -/* This is prototype code only, this may, or may not, use undocumented - * unstable or private internal function calls. */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <glib/gi18n.h> -#ifdef USE_GTKFILECHOOSER -# include <gtk/gtkfilechooser.h> -# include <gtk/gtkfilechooserdialog.h> -#else -# include <gtk/gtkfilesel.h> -#endif -#include <gtk/gtkmessagedialog.h> -#include <gtk/gtkstock.h> -#include <gtk/gtk.h> -#include <libedataserver/e-source.h> -#include <libedataserverui/e-source-selector.h> -#include <libecal/e-cal.h> -#include <calendar/gui/e-cal-popup.h> -#include <libgnomevfs/gnome-vfs.h> -#include <string.h> - -#include "format-handler.h" - -enum { /* GtkComboBox enum */ - DEST_NAME_COLUMN, - DEST_HANDLER, - N_DEST_COLUMNS - -}; - -void org_gnome_save_calendar (EPlugin *ep, ECalPopupTargetSource *target); -void org_gnome_save_tasks (EPlugin *ep, ECalPopupTargetSource *target); - - -static void -extra_widget_foreach_hide (GtkWidget *widget, gpointer data) -{ - if (widget != data) - gtk_widget_hide (widget); -} - -static void -on_type_combobox_changed (GtkComboBox *combobox, gpointer data) -{ - FormatHandler *handler = NULL; - GtkWidget *extra_widget = data; - GtkTreeIter iter; - GtkTreeModel *model = gtk_combo_box_get_model (combobox); - - gtk_container_foreach (GTK_CONTAINER (extra_widget), - extra_widget_foreach_hide, combobox); - - gtk_combo_box_get_active_iter (combobox, &iter); - - gtk_tree_model_get (model, &iter, - DEST_HANDLER, &handler, -1); - - - if (handler->options_widget) - { - gtk_widget_show (handler->options_widget); - } - -} - -static void -format_handlers_foreach_free (gpointer data, gpointer user_data) -{ - FormatHandler *handler = data; - - if (handler->options_widget) - gtk_widget_destroy (handler->options_widget); - - if (handler->data) - g_free (handler->data); - - g_free (data); -} - -static void -ask_destination_and_save (EPlugin *ep, ECalPopupTargetSource *target, ECalSourceType type) -{ - FormatHandler *handler = NULL; - - GtkWidget *extra_widget = gtk_vbox_new (FALSE, 0); - GtkComboBox *combo = GTK_COMBO_BOX(gtk_combo_box_new ()); - GtkTreeModel *model = GTK_TREE_MODEL (gtk_list_store_new - (N_DEST_COLUMNS, G_TYPE_STRING, G_TYPE_POINTER)); - GtkCellRenderer *renderer=NULL; - GtkListStore *store = GTK_LIST_STORE (model); - GtkTreeIter iter; - GtkWidget *dialog = NULL; - char *dest_uri = NULL; - gboolean proceed = FALSE; - - GList *format_handlers = NULL; - - /* The available formathandlers */ - format_handlers = g_list_append (format_handlers, - ical_format_handler_new ()); - format_handlers = g_list_append (format_handlers, - csv_format_handler_new ()); - format_handlers = g_list_append (format_handlers, - rdf_format_handler_new ()); - - - /* The Type GtkComboBox */ - gtk_box_pack_start (GTK_BOX (extra_widget), GTK_WIDGET (combo), - TRUE, TRUE, 0); - gtk_combo_box_set_model (combo, model); - - gtk_list_store_clear (store); - renderer = gtk_cell_renderer_text_new (); - gtk_cell_layout_pack_start (GTK_CELL_LAYOUT (combo), renderer, TRUE); - gtk_cell_layout_set_attributes (GTK_CELL_LAYOUT (combo), - renderer, "text", DEST_NAME_COLUMN, NULL); - - while (format_handlers) { - FormatHandler *handler = format_handlers->data; - - gtk_list_store_append (store, &iter); - gtk_list_store_set (store, &iter, DEST_NAME_COLUMN, - handler->combo_label, -1); - gtk_list_store_set (store, &iter, DEST_HANDLER, handler, -1); - - if (handler->options_widget) { - gtk_box_pack_start (GTK_BOX (extra_widget), - GTK_WIDGET (handler->options_widget), TRUE, TRUE, 0); - gtk_widget_hide (handler->options_widget); - } - - if (handler->isdefault) { - gtk_combo_box_set_active_iter (combo, &iter); - if (handler->options_widget) - gtk_widget_show (handler->options_widget); - } - - format_handlers = g_list_next (format_handlers); - } - - - g_signal_connect (G_OBJECT(combo), "changed", - G_CALLBACK (on_type_combobox_changed), extra_widget); - -#ifdef USE_GTKFILECHOOSER - - dialog = gtk_file_chooser_dialog_new (_("Select destination file"), - NULL, - GTK_FILE_CHOOSER_ACTION_SAVE, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - GTK_STOCK_SAVE_AS, GTK_RESPONSE_OK, - NULL); - - gtk_dialog_set_default_response (GTK_DIALOG (dialog), GTK_RESPONSE_OK); - gtk_file_chooser_set_extra_widget (GTK_FILE_CHOOSER (dialog), extra_widget); -#else - dialog = gtk_file_selection_new (_("Select destination file")); - gtk_box_pack_start (GTK_BOX (GTK_FILE_SELECTION (dialog)->main_vbox), extra_widget, FALSE, TRUE, 0); -#endif - gtk_widget_show (GTK_WIDGET(combo)); - gtk_widget_show (extra_widget); - - - if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) { - char *tmp = NULL; - - gtk_combo_box_get_active_iter (combo, &iter); - gtk_tree_model_get (model, &iter, - DEST_HANDLER, &handler, -1); - -#ifdef USE_GTKFILECHOOSER - dest_uri = gtk_file_chooser_get_uri - (GTK_FILE_CHOOSER (dialog)); -#else - dest_uri = g_strdup (gtk_file_selection_get_filename - (GTK_FILE_SELECTION (dialog))); -#endif - - tmp = strstr (dest_uri, handler->filename_ext); - - if (tmp && *(tmp + strlen (handler->filename_ext)) == '\0') { - - proceed = TRUE; - - } else { - - GtkWidget *warning = - gtk_message_dialog_new (NULL, - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_MESSAGE_QUESTION, - GTK_BUTTONS_YES_NO, - _("The suggested filename extension of this filetype (%s)" - " is unused in the chosen filename. Do you want to " - "continue?"), handler->filename_ext); - - if (gtk_dialog_run (GTK_DIALOG (warning)) == GTK_RESPONSE_YES) - proceed = TRUE; - - gtk_widget_destroy (warning); - - } - - if (proceed) { - handler->save (handler, ep, target, type, dest_uri); - /* Free the handlers */ - g_list_foreach (format_handlers, format_handlers_foreach_free, NULL); - g_list_free (format_handlers); - - /* Now we can destroy it */ - gtk_widget_destroy (dialog); - g_free (dest_uri); - } - - } else { - /* Free the handlers */ - g_list_foreach (format_handlers, format_handlers_foreach_free, NULL); - g_list_free (format_handlers); - - /* Now we can destroy it */ - gtk_widget_destroy (dialog); - g_free (dest_uri); - } -} - -void -org_gnome_save_calendar (EPlugin *ep, ECalPopupTargetSource *target) -{ - ask_destination_and_save (ep, target, E_CAL_SOURCE_TYPE_EVENT); -} - -void -org_gnome_save_tasks (EPlugin *ep, ECalPopupTargetSource *target) -{ - ask_destination_and_save (ep, target, E_CAL_SOURCE_TYPE_TODO); -} diff --git a/plugins/select-one-source/.cvsignore b/plugins/select-one-source/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/select-one-source/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/select-one-source/ChangeLog b/plugins/select-one-source/ChangeLog deleted file mode 100644 index f5204d7710..0000000000 --- a/plugins/select-one-source/ChangeLog +++ /dev/null @@ -1,10 +0,0 @@ -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-20 JP Rosevear <jpr@novell.com> - - * select-one-source.c: implement a plugin that allows the user to - limit the displayed task lists or calendars to the current - calendar or task list - diff --git a/plugins/select-one-source/Makefile.am b/plugins/select-one-source/Makefile.am deleted file mode 100644 index 6b5b178e8d..0000000000 --- a/plugins/select-one-source/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_CALENDAR_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-select-one-source.eplug -plugin_LTLIBRARIES = liborg-gnome-select-one-source.la - -liborg_gnome_select_one_source_la_SOURCES = select-one-source.c -liborg_gnome_select_one_source_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-select-one-source.eplug.in
\ No newline at end of file diff --git a/plugins/select-one-source/mark-calendar-offline.c b/plugins/select-one-source/mark-calendar-offline.c deleted file mode 100644 index 95083c7ff2..0000000000 --- a/plugins/select-one-source/mark-calendar-offline.c +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Harish Krishnaswamy (kharish@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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -/* This is prototype code only, this may, or may not, use undocumented - * unstable or private internal function calls. - * This code has been derived from the source of the sample eplugin - * select_one_source. - */ - -#include <glib.h> -#include <glib/gi18n.h> -#include <libedataserver/e-source.h> -#include <libedataserverui/e-source-selector.h> -#include <calendar/gui/e-cal-popup.h> - -void org_gnome_mark_calendar_offline (EPlugin *ep, ECalPopupTargetSource *target); -void org_gnome_mark_calendar_no_offline (EPlugin *ep, ECalPopupTargetSource *target); - -void -org_gnome_mark_calendar_no_offline (EPlugin *ep, ECalPopupTargetSource *target) -{ - ESource *source; - - source = e_source_selector_peek_primary_selection (target->selector); - e_source_set_property (source, "offline", "0"); -} - -void -org_gnome_mark_calendar_offline (EPlugin *ep, ECalPopupTargetSource *target) -{ - ESource *source; - - source = e_source_selector_peek_primary_selection (target->selector); - e_source_set_property (source, "offline", "1"); -} - diff --git a/plugins/select-one-source/org-gnome-select-one-source.eplug.in b/plugins/select-one-source/org-gnome-select-one-source.eplug.in deleted file mode 100644 index c39a46964b..0000000000 --- a/plugins/select-one-source/org-gnome-select-one-source.eplug.in +++ /dev/null @@ -1,14 +0,0 @@ -<e-plugin-list> - <e-plugin id="org.gnome.evolution.select_one_source" type="shlib" name="Select one source" description="Selects a single calendar or task source for viewing" - location="@PLUGINDIR@/liborg-gnome-select-one-source.so"> - - <hook class="org.gnome.evolution.calendar.popup:1.0"> - <menu id="org.gnome.evolution.tasks.source.popup" target="source"> - <item type="item" path="25.select_one_source" label="_Show only this Task List" icon="stock_check-filled" activate="org_gnome_select_one_source"/> - </menu> - <menu id="org.gnome.evolution.calendar.source.popup" target="source"> - <item type="item" path="25.select_one_source" label="_Show only this Calendar" icon="stock_check-filled" activate="org_gnome_select_one_source"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list>
\ No newline at end of file diff --git a/plugins/select-one-source/select-one-source.c b/plugins/select-one-source/select-one-source.c deleted file mode 100644 index 7325e47dd8..0000000000 --- a/plugins/select-one-source/select-one-source.c +++ /dev/null @@ -1,52 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: JP Rosevear <jpr@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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -/* This is prototype code only, this may, or may not, use undocumented - * unstable or private internal function calls. */ - -#include <glib.h> -#include <glib/gi18n.h> -#include <libedataserver/e-source.h> -#include <libedataserverui/e-source-selector.h> -#include <calendar/gui/e-cal-popup.h> - -void org_gnome_select_one_source (EPlugin *ep, ECalPopupTargetSource *target); - -void -org_gnome_select_one_source (EPlugin *ep, ECalPopupTargetSource *target) -{ - GSList *selection, *l; - ESource *primary_source; - - selection = e_source_selector_get_selection (target->selector); - primary_source = e_source_selector_peek_primary_selection (target->selector); - - for (l = selection; l; l = l->next) { - ESource *source = l->data; - - if (source != primary_source) - e_source_selector_unselect_source (target->selector, source); - } - - e_source_selector_select_source (target->selector, primary_source); - - e_source_selector_free_selection (selection); -} diff --git a/plugins/send-options/ChangeLog b/plugins/send-options/ChangeLog deleted file mode 100644 index 1981fa78ec..0000000000 --- a/plugins/send-options/ChangeLog +++ /dev/null @@ -1,43 +0,0 @@ -2005-01-24 Chenthill Palanisamy <pchenthill@novell.com> - - - * org-gnome-send-options.eplug.in: Changed the item_type to - section instead of item. - * send-options.c (get_cnc): Made the necessary changes to get cnc - since some part of dependant code was changed in groupwise account - set up plugin. - (org_gnome_send_options): Changed the prototype of the function - to return the widget. - (send_options_commit): Added a warning message if the Modification - was not sent to the server. - -2005-01-12 Chenthill Palanisamy <pchenthill@novell.com> - - * Makefile.am: - * send-options.c: (get_cnc), (e_send_options_load_general_opts), - (e_sendoptions_clicked_cb), (org_gnome_send_options), - (e_send_options_copy_general_opts), - (e_send_options_copy_status_options), - (check_status_options_changed), (check_general_changed), - (send_options_copy_check_changed), (get_source), - (add_return_value), (put_options_in_source), - (add_send_options_to_source), (send_options_commit): Added some - functons to change the global send options. - -2005-01-10 Rodney Dawes <dobey@novell.com> - - * Makefile.am (INCLUDES): Clean up spacing - (liborg_gnome_send_options_la_LIBADD): Don't specify the path to - the la file directly, use the _LIBS variables that correspond with - those in INCLUDES to link to the correct libraries - -2005-01-10 Chenthill Palanisamy <pchenthill@novell.com> - - * MakeFile.am: - * org-gnome-send-options.eplug.in: Plugin file to add - the send options button in the account editor. - * send-options.c: Adds the send options button inside a frame - in the defaults page of the account editor for groupwise - accounts. Clicking on the button gets the settings from the - server and shows it in the send options dialog box. - diff --git a/plugins/send-options/Makefile.am b/plugins/send-options/Makefile.am deleted file mode 100644 index 41d478cad1..0000000000 --- a/plugins/send-options/Makefile.am +++ /dev/null @@ -1,19 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/camel \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - $(CAMEL_GROUPWISE_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-send-options.eplug -plugin_LTLIBRARIES = liborg-gnome-send-options.la - -liborg_gnome_send_options_la_SOURCES = send-options.c -liborg_gnome_send_options_la_LDFLAGS = -module -avoid-version -liborg_gnome_send_options_la_LIBADD = \ - $(EVOLUTION_MAIL_LIBS) \ - $(CAMEL_GROUPWISE_LIBS) - -EXTRA_DIST = org-gnome-send-options.eplug.in diff --git a/plugins/send-options/org-gnome-send-options.eplug.in b/plugins/send-options/org-gnome-send-options.eplug.in deleted file mode 100644 index 6e3b479f9b..0000000000 --- a/plugins/send-options/org-gnome-send-options.eplug.in +++ /dev/null @@ -1,14 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin id="org.gnome.evolution.send_options" type="shlib" name="send options" description="Creates an global send options page" - location="@PLUGINDIR@/liborg-gnome-send-options.so"> - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group id="org.gnome.evolution.mail.config.accountEditor" - target="account" check = "send_options_changed" commit = "send_options_commit" - abort = "send_options_abort"> - <item type="section" path="40.defaults/50.send_options" label="Send Options" factory="org_gnome_send_options" /> - </group> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/send-options/send-options.c b/plugins/send-options/send-options.c deleted file mode 100644 index 8fc18e1c40..0000000000 --- a/plugins/send-options/send-options.c +++ /dev/null @@ -1,546 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- - * - * Authors: Chenthill Palanisamy (pchenthill@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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <libgnome/gnome-i18n.h> -#include <glade/glade.h> -#include <gtk/gtk.h> -#include "mail/em-account-editor.h" -#include "mail/em-config.h" -#include "e-util/e-account.h" -#include <widgets/misc/e-send-options.h> -#include <mail/em-config.h> -#include <e-gw-connection.h> -#include <camel/camel-url.h> -#include "e-util/e-passwords.h" -#include <libecal/e-cal-time-util.h> -#include <libedataserver/e-source-list.h> - -ESendOptionsDialog *sod = NULL; -GtkWidget *parent; -EGwConnection *n_cnc; -EGwSendOptions *opts = NULL; -gboolean changed = FALSE; -EAccount *account; - -GtkWidget* org_gnome_send_options (EPlugin *epl, EConfigHookItemFactoryData *data); -void send_options_commit (EPlugin *epl, EConfigHookItemFactoryData *data); -void send_options_changed (EPlugin *epl, EConfigHookItemFactoryData *data); -void send_options_abort (EPlugin *epl, EConfigHookItemFactoryData *data); - -static EGwConnection * -get_cnc () -{ - EGwConnection *cnc; - char *uri, *failed_auth, *key, *prompt, *password = NULL; - CamelURL *url; - const char *poa_address, *use_ssl, *soap_port; - gboolean remember; - - url = camel_url_new (account->source->url, NULL); - if (url == NULL) - return NULL; - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return NULL; - - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - use_ssl = camel_url_get_param (url, "use_ssl"); - - key = g_strdup_printf ("groupwise://%s@%s/", url->user, poa_address); - - if (!g_str_equal (use_ssl, "never")) - uri = g_strdup_printf ("https://%s:%s/soap", poa_address, soap_port); - else - uri = g_strdup_printf ("http://%s:%s/soap", poa_address, soap_port); - - failed_auth = ""; - cnc = NULL; - - prompt = g_strdup_printf (_("%sEnter password for %s (user %s)"), - failed_auth, poa_address, url->user); - - password = e_passwords_get_password ("Groupwise", key); - if (!password) - password = e_passwords_ask_password (prompt, "Groupwise", key, prompt, - E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET, &remember, NULL); - g_free (prompt); - - cnc = e_gw_connection_new (uri, url->user, password); - if (!E_IS_GW_CONNECTION(cnc) && use_ssl && g_str_equal (use_ssl, "when-possible")) { - char *http_uri = g_strconcat ("http://", uri + 8, NULL); - cnc = e_gw_connection_new (http_uri, url->user, password); - g_free (http_uri); - } - - camel_url_free (url); - return cnc; -} - - -static void -e_send_options_load_general_opts (ESendOptionsGeneral *gopts, EGwSendOptionsGeneral *ggopts) -{ - time_t temp; - - temp = time (NULL); - - gopts->priority = ggopts->priority; - - gopts->reply_enabled = ggopts->reply_enabled; - gopts->reply_convenient = ggopts->reply_convenient; - gopts->reply_within = ggopts->reply_within; - - gopts->expiration_enabled = ggopts->expiration_enabled; - gopts->expire_after = ggopts->expire_after; - - gopts->delay_enabled = ggopts->delay_enabled; - - /* TODO convert int to timet comparing the current day */ - if (ggopts->delay_until) { - gopts->delay_until = time_add_day_with_zone (temp, ggopts->delay_until, NULL); - } else - gopts->delay_until = 0; -} - -static void -e_send_options_load_status_options (ESendOptionsStatusTracking *sopts, EGwSendOptionsStatusTracking *gsopts) -{ - sopts->tracking_enabled = gsopts->tracking_enabled; - sopts->track_when = gsopts->track_when; - - sopts->autodelete = gsopts->autodelete; - - sopts->opened = gsopts->opened; - sopts->accepted = gsopts->accepted; - sopts->declined = gsopts->declined; - sopts->completed = gsopts->completed; -} - -static void -e_send_options_load_default_data (EGwSendOptions *opts, ESendOptionsDialog *sod) -{ - EGwSendOptionsGeneral *ggopts; - EGwSendOptionsStatusTracking *gmopts; - EGwSendOptionsStatusTracking *gcopts; - EGwSendOptionsStatusTracking *gtopts; - - ggopts = e_gw_sendoptions_get_general_options (opts); - gmopts = e_gw_sendoptions_get_status_tracking_options (opts, "mail"); - gcopts = e_gw_sendoptions_get_status_tracking_options (opts, "calendar"); - gtopts = e_gw_sendoptions_get_status_tracking_options (opts, "task"); - - e_send_options_load_general_opts (sod->data->gopts, ggopts); - e_send_options_load_status_options (sod->data->mopts, gmopts); - e_send_options_load_status_options (sod->data->copts, gcopts); - e_send_options_load_status_options (sod->data->topts, gtopts); -} - -static void -e_sendoptions_clicked_cb (GtkWidget *button, gpointer data) -{ - account = (EAccount *) data; - if (!sod) { - sod = e_sendoptions_dialog_new (); - e_sendoptions_set_global (sod, TRUE); - if (!n_cnc) - n_cnc = get_cnc (); - - if (!n_cnc) { - g_warning ("Send Options: Could not get the connection to the server \n"); - return; - } - - e_gw_connection_get_settings (n_cnc, &opts); - e_send_options_load_default_data (opts, sod); - } - - if (n_cnc) - e_sendoptions_dialog_run (sod, parent ? parent : NULL, E_ITEM_NONE); - else - return; -} - -GtkWidget * -org_gnome_send_options (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - EMConfigTargetAccount *target_account; - GtkWidget *frame, *button, *label, *vbox; - - target_account = (EMConfigTargetAccount *)data->config->target; - account = target_account->account; - - if(!g_strrstr (account->source->url, "groupwise://")) - return NULL; - - vbox = gtk_vbox_new (FALSE, 0); - frame = gtk_frame_new (""); - label = gtk_frame_get_label_widget (GTK_FRAME (frame)); - gtk_label_set_markup (GTK_LABEL (label), "<b>Send Options</b>"); - button = gtk_button_new_with_label ("Advanced send options"); - gtk_widget_show (button); - - g_signal_connect(button, "clicked", - G_CALLBACK (e_sendoptions_clicked_cb), account); - - parent = gtk_widget_get_toplevel (GTK_WIDGET (data->parent)); - if (!GTK_WIDGET_TOPLEVEL (parent)) - parent = NULL; - - gtk_widget_set_size_request (button, 10, -1); - gtk_box_pack_start (GTK_BOX (vbox), frame, 0, 0, 0); - gtk_container_add (GTK_CONTAINER (frame), button); - gtk_frame_set_shadow_type (GTK_FRAME (frame), GTK_SHADOW_NONE); - gtk_widget_show (frame); - gtk_box_set_spacing (GTK_BOX (data->parent), 12); - gtk_box_pack_start (GTK_BOX (data->parent), vbox, FALSE, FALSE, 0); - - return vbox; -} - -static void -send_options_finalize () -{ - if (n_cnc) { - g_object_unref (n_cnc); - n_cnc = NULL; - } - - if (sod) { - g_object_unref (sod); - sod = NULL; - } - - if (opts) { - g_object_unref (opts); - opts = NULL; - } -} - -static void -e_send_options_copy_general_opts (ESendOptionsGeneral *gopts, EGwSendOptionsGeneral *ggopts) -{ - time_t temp; - - temp = time (NULL); - - ggopts->priority = gopts->priority; - - ggopts->reply_enabled = gopts->reply_enabled; - ggopts->reply_convenient = gopts->reply_convenient; - ggopts->reply_within = gopts->reply_within; - - ggopts->expire_after = gopts->expire_after; - - if (gopts->expire_after == 0) { - ggopts->expiration_enabled = FALSE; - gopts->expiration_enabled = FALSE; - } else - ggopts->expiration_enabled = gopts->expiration_enabled; - - ggopts->delay_enabled = gopts->delay_enabled; - - if (gopts->delay_until) { - int diff; - icaltimetype temp, current; - - temp = icaltime_from_timet (gopts->delay_until, 0); - current = icaltime_today (); - diff = temp.day - current.day; - ggopts->delay_until = diff; - } else - ggopts->delay_until = 0; -} - -static void -e_send_options_copy_status_options (ESendOptionsStatusTracking *sopts, EGwSendOptionsStatusTracking *gsopts) -{ - gsopts->tracking_enabled = sopts->tracking_enabled; - gsopts->track_when = sopts->track_when; - - gsopts->autodelete = sopts->autodelete; - - gsopts->opened = sopts->opened; - gsopts->accepted = sopts->accepted; - gsopts->declined = sopts->declined; - gsopts->completed = sopts->completed; -} - -static gboolean -check_status_options_changed (EGwSendOptionsStatusTracking *n_sopts, EGwSendOptionsStatusTracking *o_sopts) -{ - return (!(n_sopts->tracking_enabled == o_sopts->tracking_enabled - && n_sopts->track_when == o_sopts->track_when - && n_sopts->autodelete == o_sopts->autodelete - && n_sopts->opened == o_sopts->opened - && n_sopts->declined == o_sopts->declined - && n_sopts->accepted == o_sopts->accepted - && n_sopts->completed == o_sopts->completed)); - -} - -static gboolean -check_general_changed (EGwSendOptionsGeneral *n_gopts, EGwSendOptionsGeneral *o_gopts) -{ - return (!(n_gopts->priority == o_gopts->priority - && n_gopts->delay_enabled == o_gopts->delay_enabled - && n_gopts->delay_until == o_gopts->delay_until - && n_gopts->reply_enabled == o_gopts->reply_enabled - && n_gopts->reply_convenient == o_gopts->reply_convenient - && n_gopts->reply_within == o_gopts->reply_within - && n_gopts->expiration_enabled == o_gopts->expiration_enabled - && n_gopts->expire_after == o_gopts->expire_after)); -} - -static void -send_options_copy_check_changed (EGwSendOptions *n_opts) -{ - EGwSendOptionsGeneral *ggopts, *o_gopts; - EGwSendOptionsStatusTracking *gmopts, *o_gmopts ; - EGwSendOptionsStatusTracking *gcopts, *o_gcopts; - EGwSendOptionsStatusTracking *gtopts, *o_gtopts; - - ggopts = e_gw_sendoptions_get_general_options (n_opts); - gmopts = e_gw_sendoptions_get_status_tracking_options (n_opts, "mail"); - gcopts = e_gw_sendoptions_get_status_tracking_options (n_opts, "calendar"); - gtopts = e_gw_sendoptions_get_status_tracking_options (n_opts, "task"); - - o_gopts = e_gw_sendoptions_get_general_options (opts); - o_gmopts = e_gw_sendoptions_get_status_tracking_options (opts, "mail"); - o_gcopts = e_gw_sendoptions_get_status_tracking_options (opts, "calendar"); - o_gtopts = e_gw_sendoptions_get_status_tracking_options (opts, "task"); - - e_send_options_copy_general_opts (sod->data->gopts, ggopts); - e_send_options_copy_status_options (sod->data->mopts, gmopts); - e_send_options_copy_status_options (sod->data->copts, gcopts); - e_send_options_copy_status_options (sod->data->topts, gtopts); - - if (check_general_changed (ggopts, o_gopts)) - changed = TRUE; - if (check_status_options_changed (gmopts, o_gmopts)) - changed = TRUE; - if (check_status_options_changed (gcopts, o_gcopts)) - changed = TRUE; - if (check_status_options_changed (gtopts, o_gtopts)) - changed = TRUE; -} - -static ESource * -get_source (ESourceList *list) -{ - GSList *p, *l; - char **temp = g_strsplit (account->source->url, ";", -1); - char *uri = temp [0]; - - - l = e_source_list_peek_groups (list); - - for (p = l; p != NULL; p = p->next) { - char *so_uri; - GSList *r, *s; - ESourceGroup *group = E_SOURCE_GROUP (p->data); - - s = e_source_group_peek_sources (group); - for (r = s; r != NULL; r = r->next) { - ESource *so = E_SOURCE (r->data); - so_uri = e_source_get_uri (so); - - if (so_uri) { - if (!strcmp (so_uri, uri)) { - g_free (so_uri), so_uri = NULL; - return E_SOURCE (r->data); - } - g_free (so_uri), so_uri = NULL; - } - } - } - - g_strfreev (temp); - - return NULL; -} - -static void -add_return_value (EGwSendOptionsReturnNotify track, ESource *source, char *notify) -{ - char *value; - - switch (track) { - case E_GW_RETURN_NOTIFY_MAIL: - value = g_strdup ("mail"); - break; - default: - value = g_strdup ("none"); - } - - e_source_set_property (source, notify, value); - g_free (value), value = NULL; -} - -static void -put_options_in_source (ESource *source, EGwSendOptionsGeneral *gopts, EGwSendOptionsStatusTracking *sopts) -{ - char *value; - const char *val; - icaltimetype tt; - - if (gopts) { - /* priority */ - switch (gopts->priority) { - case E_GW_PRIORITY_HIGH: - value = g_strdup ("high"); - break; - case E_GW_PRIORITY_STANDARD: - value = g_strdup ("standard"); - break; - case E_GW_PRIORITY_LOW: - value = g_strdup ("low"); - break; - default: - value = g_strdup ("undefined"); - } - e_source_set_property (source, "priority", value); - g_free (value), value = NULL; - - /* Reply Requested */ - /*TODO Fill the value if it is not "convinient" */ - if (gopts->reply_enabled) { - if (gopts->reply_convenient) - value = g_strdup ("convinient"); - else - value = g_strdup_printf ("%d",gopts->reply_within); - } else - value = g_strdup ("none"); - e_source_set_property (source, "reply-requested", value); - g_free (value), value = NULL; - - /* Delay delivery */ - if (gopts->delay_enabled) { - tt = icaltime_today (); - icaltime_adjust (&tt, gopts->delay_until, 0, 0, 0); - val = icaltime_as_ical_string (tt); - } else - val = "none"; - e_source_set_property (source, "delay-delivery", val); - - /* Expiration date */ - if (gopts->expiration_enabled) - value = g_strdup_printf ("%d", gopts->expire_after); - else - value = g_strdup ("none"); - e_source_set_property (source, "expiration", value); - g_free (value), value = NULL; - } - - if (sopts) { - /* status tracking */ - if (sopts->tracking_enabled) { - switch (sopts->track_when) { - case E_GW_DELIVERED : - value = g_strdup ("delivered"); - break; - case E_GW_DELIVERED_OPENED: - value = g_strdup ("delivered-opened"); - break; - default: - value = g_strdup ("all"); - } - } else - value = g_strdup ("none"); - e_source_set_property (source, "status-tracking", value); - g_free (value), value = NULL; - - add_return_value (sopts->opened, source, "return-open"); - add_return_value (sopts->accepted, source, "return-accept"); - add_return_value (sopts->declined, source, "return-decline"); - add_return_value (sopts->completed, source, "return-complete"); - } -} - -static void -add_send_options_to_source (EGwSendOptions *n_opts) -{ - GConfClient *gconf = gconf_client_get_default (); - ESource *csource, *tsource; - ESourceList *list; - EGwSendOptionsGeneral *gopts; - EGwSendOptionsStatusTracking *topts, *mopts, *copts; - - list = e_source_list_new_for_gconf (gconf, "/apps/evolution/calendar/sources"); - csource = get_source (list); - - list = e_source_list_new_for_gconf (gconf, "/apps/evolution/tasks/sources"); - tsource = get_source (list); - - gopts = e_gw_sendoptions_get_general_options (n_opts); - mopts = e_gw_sendoptions_get_status_tracking_options (n_opts, "mail"); - copts = e_gw_sendoptions_get_status_tracking_options (n_opts, "calendar"); - topts = e_gw_sendoptions_get_status_tracking_options (n_opts, "task"); - - if (csource) - put_options_in_source (csource, gopts, copts); - - if (tsource) - put_options_in_source (tsource, gopts, topts); - - g_object_unref (gconf); -} - -void -send_options_commit (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - EGwSendOptions *n_opts; - EGwConnectionStatus status = E_GW_CONNECTION_STATUS_OK; - - if (sod) { - n_opts = e_gw_sendoptions_new (); - send_options_copy_check_changed (n_opts); - - if (changed) - status = e_gw_connection_modify_settings (n_cnc, n_opts); - - if (!changed || status != E_GW_CONNECTION_STATUS_OK) { - g_warning (G_STRLOC "Cannot modify Send Options: %s", e_gw_connection_get_error_message (status)); - g_object_unref (n_opts); - n_opts = NULL; - } else - add_send_options_to_source (n_opts); - } - - send_options_finalize (); -} - -void -send_options_changed (EPlugin *epl, EConfigHookItemFactoryData *data) -{ -} - -void -send_options_abort (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - send_options_finalize (); -} - - diff --git a/plugins/shared-folder/ChangeLog b/plugins/shared-folder/ChangeLog deleted file mode 100644 index 9a1eddfdab..0000000000 --- a/plugins/shared-folder/ChangeLog +++ /dev/null @@ -1,93 +0,0 @@ -2005-01-24 Vivek Jain <jvivek@novell.com> - *properties.glade : changed the layout of the widgets - *share-folder.[ch]: removed the checkbuttons for display of rights - : removed new_list, update_list and remove_list - added users_list - *share-folder.c : removed function (update_list_update) - (share_folder_construct) : added gtk_cell_renderer_toggle for - displaying rights - added one structure SharedUsers to have a single list instead of three - different lists. Made corresponding changes in all functions. - *share-folder-common.c : (new_folder_response): use - gtk_widget_reparent to pack the widget - added two files - *org-gnome-shared-folder-errors.xml - *org-gnome-shared-folder-errors.xml.h : to display error message - *Makefile.am : included error data - - - -2005-01-19 Vivek Jain <jvivek@novell.com> - *install-shared.c - (org_gnome_popup_wizard): fixed a crash, caused by g_free - (install_folder_response): free the memory - -2005-01-18 Vivek Jain <jvivek@novell.com> - *install-shared.c - (org_gnome_popup_wizard): removed unnecessary stuff for the display of - wizard - -2005-01-18 Parthasarathi Susarla <sparthasarathi@novell.com> - - *install-shared.c - (org_gnome_popup_wizard): displays the message without the - mime headers - -2005-01-17 Vivek Jain <jvivek@novell.com> - *install-shared.c : (org_gnome_popup_wizard): included a condition - (null check) to fix a crash - * shared-folder-common.c :(org_gnome_shared_folder_factory): some - condition checks to avoid the possible crashes - (get_container_id): included code to return top level container id if - folder name is passed as null - -2005-01-13 Vivek Jain <jvivek@novell.com> - * share-folder.c :changed the function find_node to return user node - corresponding to the mail address given. - (add_clicked): added a condition so that user can't share folder to itself. - (user_selected): modified to display proper rights when owner is selected. - * share-folder-common.c : calling share_folder with a cnc in it. - -2005-01-11 Vivek Jain <jvivek@novell.com> - killed compile time warnings by including suitable definitions - and type casting widgets - -2005-01-10 Vivek Jain <jvivek@novell.com> Included - - * install-shared.c : opens up a wizard on reading a shared folder - notification and installs shared folder at the recepient end. - * share-folder-common.c : added - (refresh_folder_tree) : to refresh the folder tree when a folder is shared or - a shared folder is created so that different icons are displayed - (get_cnc): to get a connection - (get_container_id):to get the container id of the folder user selects - * share-folder.c : minor changes to fix the crash - * Makefile.am : including install-shared.c in sources - * org-gnome-shared-folder.eplug.in : added a plugin to the e-plugin list for - the message-read event - -2004-12-15 Vivek Jain <jvivek@novell.com> - - Added (Create a shared folder) functionality in the plugin - * org-gnome-shared-folder.eplug.in : added a plugin in the plugin list - * share-folder-common.c : included functions to create a shared folder - -2004-12-15 Vivek Jain <jvivek@novell.com> - - * shared-folder-common.c : (org_gnome_shared_folder_factory) - * shared-folder.c : some whitespace changes, typecasting widgets, - in (on_add_clicked) removed assigning the rights portion - - 2004-12-08 Vivek Jain <jvivek@novell.com> - - The following files are added as an initial check in for the plugin that - implements shared-folder functionality in the groupwise folders - * share-folder.c - * share-folder.h - * share-folder-common.c - * properties.glade - * Makefile.am - * org-gnome-shared-folder.eplug.in - - - diff --git a/plugins/shared-folder/Makefile.am b/plugins/shared-folder/Makefile.am deleted file mode 100644 index 08d1f0b29a..0000000000 --- a/plugins/shared-folder/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)\ - -I$(top_srcdir)/camel \ - $(EVOLUTION_MAIL_CFLAGS)\ - $(CAMEL_GROUPWISE_CFLAGS)\ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-shared-folder.eplug -plugin_LTLIBRARIES = liborg-gnome-shared-folder.la - -liborg_gnome_shared_folder_la_SOURCES = share-folder-common.c share-folder.c install-shared.c share-folder.h -liborg_gnome_shared_folder_la_LIBADD= $(CAMEL_GROUPWISE_LIBS) - - -liborg_gnome_shared_folder_la_LDFLAGS = -module -avoid-version - -glade_DATA =properties.glade - -error_DATA = org-gnome-shared-folder-errors.xml -error_i18n = $(error_DATA:.xml=.xml.h) -errordir = $(privdatadir)/errors -%.xml.h: %.xml - $(top_builddir)/e-util/e-error-tool $^ - -BUILT_SOURCES = $(error_i18n) -EXTRA_DIST = \ - $(error_DATA) \ - $(error_i18n) \ - $(glade_DATA) \ - org-gnome-shared-folder.eplug.in diff --git a/plugins/shared-folder/install-shared.c b/plugins/shared-folder/install-shared.c deleted file mode 100644 index d92e926764..0000000000 --- a/plugins/shared-folder/install-shared.c +++ /dev/null @@ -1,221 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Vivek Jain <jvivek@novell.com> - * - * Copyright 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <glib.h> -#include <gnome.h> -#include <gtk/gtk.h> -#include <libgnomeui/libgnomeui.h> -#include <libgnome/gnome-i18n.h> -#include <gconf/gconf-client.h> -#include <e-util/e-config.h> -#include <mail/em-config.h> -#include <mail/em-event.h> -#include <mail/mail-component.h> -#include <camel/camel-mime-message.h> -#include <camel/camel-stream.h> -#include <camel/camel-session.h> -#include <camel/camel-stream-mem.h> -#include <camel/camel-data-wrapper.h> -#include <camel/camel-multipart.h> -#include <mail/em-folder-tree.h> -#include <mail/mail-config.h> -#include <mail/em-folder-selector.h> -#include <camel/camel-medium.h> -#include <e-gw-connection.h> -#include <share-folder.h> - -extern CamelSession *session; -struct AcceptData { - const char *item_id; - EMFolderTreeModel *model; -}; - - -void org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target); - -static void -install_folder_response (EMFolderSelector *emfs, int response, gpointer *data) -{ - struct AcceptData *accept_data = (struct AcceptData *)data; - EMFolderTreeModel *model; - const char *uri, *path; - int parts = 0; - gchar **names; - gchar *folder_name; - gchar *parent_name; - gchar *container_id,*item_id; - CamelException ex; - CamelStore *store; - EAccount *account; - CamelProvider *provider; - EGwConnection *cnc; - - if (response == GTK_RESPONSE_CANCEL){ - gtk_widget_destroy (GTK_WIDGET (emfs)); - } else { - model = accept_data->model; - item_id = accept_data->item_id; - uri = em_folder_selector_get_selected_uri (emfs); - path = em_folder_selector_get_selected_path (emfs); - names = g_strsplit (path, "/", -1); - if(names == NULL){ - folder_name = (gchar *)path; - parent_name = NULL; - } else { - while (names [parts]) - parts++; - folder_name = names[parts -1]; - if (parts >= 2) - parent_name = names[parts -2]; - else - parent_name = NULL; - } - camel_exception_init (&ex); - if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) { - camel_exception_clear (&ex); - return; - } - - cnc = get_cnc (store); - if(E_IS_GW_CONNECTION (cnc)) { - container_id = get_container_id (cnc, parent_name); - - if(e_gw_connection_accept_shared_folder (cnc, folder_name, container_id, item_id, NULL) == E_GW_CONNECTION_STATUS_OK) { - - uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL); - account = mail_config_get_account_by_source_url (uri); - uri = account->source->url; - em_folder_tree_model_remove_store (model, store); - camel_exception_init (&ex); - if (!(provider = camel_provider_get(uri, &ex))) { - camel_exception_clear (&ex); - return; - } - - /* make sure the new store belongs in the tree */ - if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) - return; - - em_folder_tree_model_add_store (model, store, account->name); - camel_object_unref (store); - } - } - - g_strfreev(names); - gtk_widget_destroy ((GtkWidget *)emfs); - } - -} - -static void -accept_clicked(GnomeDruidPage *page, GtkWidget *druid, const char *id) -{ - EMFolderTreeModel *model; - EMFolderTree *folder_tree; - GtkWidget *dialog ; - struct AcceptData *accept_data; - char *uri; - accept_data = g_new0(struct AcceptData, 1); - model = mail_component_peek_tree_model (mail_component_peek ()); - folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); - dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); - uri = em_folder_tree_get_selected_uri(folder_tree); - em_folder_selector_set_selected ((EMFolderSelector *) dialog, uri); - g_free(uri); - accept_data->item_id = id; - accept_data->model = model; - g_signal_connect (dialog, "response", G_CALLBACK (install_folder_response), accept_data); - gtk_window_set_title (GTK_WINDOW (dialog), "Install Shared Folder"); - gtk_widget_destroy (druid); - gtk_widget_show (dialog); - -} - -void -org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target) -{ - const CamelInternetAddress *from_addr = NULL; - const char *name, *item_id; - const char *email; - GtkWidget *window; - GnomeDruid *wizard; - GnomeDruidPageEdge *title_page; - CamelMimeMessage *msg = (CamelMimeMessage *) target->message ; - CamelStreamMem *content ; - CamelDataWrapper *dw ; - CamelMimePart *mime_part ; - CamelMultipart *mp ; - char *notification; - char *start_message; - char *buffer = NULL; - - if (!msg) - return ; - - mime_part = CAMEL_MIME_PART(msg) ; - notification = (char *)camel_medium_get_header (CAMEL_MEDIUM(msg),"X-notification") ; - if (!notification) { - return ; - - } else { - mp = (CamelMultipart *) camel_medium_get_content_object (CAMEL_MEDIUM (msg)) ; - dw = camel_data_wrapper_new () ; - content = (CamelStreamMem *)camel_stream_mem_new(); - if (!mp) - return ; - - if (CAMEL_IS_MULTIPART (mp)) { - mime_part = camel_multipart_get_part (mp, 0) ; - dw = camel_medium_get_content_object (CAMEL_MEDIUM (mime_part)) ; - camel_data_wrapper_write_to_stream(dw, (CamelStream *)content) ; - buffer = g_malloc0 (content->buffer->len+1) ; - buffer = memcpy (buffer, content->buffer->data, content->buffer->len) ; - - } else { - dw = camel_medium_get_content_object (CAMEL_MEDIUM (msg)) ; - camel_data_wrapper_write_to_stream(dw, (CamelStream *)content) ; - buffer = g_malloc0 (content->buffer->len+1) ; - buffer = memcpy (buffer, content->buffer->data, content->buffer->len) ; - } - - from_addr = camel_mime_message_get_from ((CamelMimeMessage *)target->message); - if (camel_internet_address_get (from_addr,0, &name, &email)) { - start_message = g_strconcat (" The User ", "'", name, "'" ," has shared a folder with you\n\n", " Message from ", "'" , name, "'\n\n\n", buffer, "\n\n\n", "Click 'Forward' to install the shared folder\n\n",NULL); - title_page = GNOME_DRUID_PAGE_EDGE (gnome_druid_page_edge_new_with_vals(GNOME_EDGE_START, TRUE, "Install the shared folder", start_message, NULL, NULL, NULL)); - wizard = GNOME_DRUID (gnome_druid_new_with_window ("Shared Folder Installation", NULL, TRUE, (GtkWidget**)(&window))); - gtk_window_set_position (GTK_WINDOW (window) , GTK_WIN_POS_CENTER_ALWAYS); - gnome_druid_append_page(wizard, GNOME_DRUID_PAGE(title_page)); - gtk_widget_show_all (GTK_WIDGET (title_page)); - item_id = camel_mime_message_get_message_id (msg); - g_signal_connect (title_page, "next", G_CALLBACK(accept_clicked), item_id); - } else - g_warning ("Could not get the sender name"); - - g_free (buffer) ; - g_free (start_message) ; - } -} - diff --git a/plugins/shared-folder/org-gnome-shared-folder-errors.xml b/plugins/shared-folder/org-gnome-shared-folder-errors.xml deleted file mode 100644 index 6a1339210f..0000000000 --- a/plugins/shared-folder/org-gnome-shared-folder-errors.xml +++ /dev/null @@ -1,19 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<error-list domain="org.gnome.evolution.mail_shared_folder"> -<error id="invalid-user" type="error"> -<primary>Invalid user</primary> -<secondary> -You cannot share folder with specified user "{0}" -</secondary> -</error> - -<error id="no-user" type="error"> -<primary>Specify User</primary> -<secondary> - You have to specify a user name whom you want to add to the list -</secondary> -</error> - - -</error-list> - diff --git a/plugins/shared-folder/org-gnome-shared-folder-errors.xml.h b/plugins/shared-folder/org-gnome-shared-folder-errors.xml.h deleted file mode 100644 index 7069f413b3..0000000000 --- a/plugins/shared-folder/org-gnome-shared-folder-errors.xml.h +++ /dev/null @@ -1,11 +0,0 @@ -/* org.gnome.evolution.mail_shared_folder:invalid-user primary */ -char *s = N_("Invalid user"); -/* org.gnome.evolution.mail_shared_folder:invalid-user secondary */ -char *s = N_("\n" - "You cannot share folder with specified user \"{0}\" \n" - ""); -/* org.gnome.evolution.mail_shared_folder:no-user primary */ -char *s = N_("Specify User"); -/* org.gnome.evolution.mail_shared_folder:no-user secondary */ -char *s = N_("\n" - "\tYou have to specify a user name whom you want to add to the list \n"); diff --git a/plugins/shared-folder/org-gnome-shared-folder.eplug.in b/plugins/shared-folder/org-gnome-shared-folder.eplug.in deleted file mode 100644 index b91ccf7b5a..0000000000 --- a/plugins/shared-folder/org-gnome-shared-folder.eplug.in +++ /dev/null @@ -1,41 +0,0 @@ -<e-plugin-list> - <e-plugin id="org.gnome.evolution.mail_shared_folder" type="shlib" name="Shared folder" description="shared folder properties " - location="@PLUGINDIR@/liborg-gnome-shared-folder.so"> - <hook class="org.gnome.evolution.mail.config:1.0"> - <group - id="org.gnome.evolution.mail.folderConfig" - target="folder" - check="shared_folder_check" - commit="shared_folder_commit" - abort="shared_folder_abort"> - <item type="page" path="10.shared" label="Shared" factory="org_gnome_shared_folder_factory"/> - </group> - </hook> - </e-plugin> - <e-plugin id="org.gnome.evolution.mail_view" type="shlib" name="mail view" description="viewing the mail" - location="@PLUGINDIR@/liborg-gnome-shared-folder.so"> - -<hook class="org.gnome.evolution.mail.events:1.0"> -<event - target="message" - id="message.reading" - type="pass" - handle="org_gnome_popup_wizard"/> -</hook> -</e-plugin> - - <e-plugin id="org.gnome.mail.folder.create_option" - type="shlib" domain="evolution" name="CREATE Folders" - location="@PLUGINDIR@/liborg-gnome-shared-folder.so"> - <description>Allows creating shared folders in the folder tree context menu</description> - <author name="Vivek Jain" email="jvivek@novell.com"/> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder"> - <item type="item" path="20.emc.00" label="_New Shared Folder" - activate="org_gnome_create_option" - enable="delete" visible="delete"/> - </menu> - </hook> - </e-plugin> - -</e-plugin-list> diff --git a/plugins/shared-folder/properties.glade b/plugins/shared-folder/properties.glade deleted file mode 100644 index e2fce0be65..0000000000 --- a/plugins/shared-folder/properties.glade +++ /dev/null @@ -1,860 +0,0 @@ -<?xml version="1.0" standalone="no"?> <!--*- mode: xml -*--> -<!DOCTYPE glade-interface SYSTEM "http://glade.gnome.org/glade-2.0.dtd"> - -<glade-interface> -<requires lib="gnome"/> - -<widget class="GtkWindow" id="main_page"> - <property name="title" translatable="yes">Folder Properties</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_NONE</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkNotebook" id="sharing_props"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="show_tabs">True</property> - <property name="show_border">True</property> - <property name="tab_pos">GTK_POS_TOP</property> - <property name="scrollable">False</property> - <property name="enable_popup">False</property> - - <child> - <widget class="GtkVBox" id="vboxSharing"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkVBox" id="vboxSharingOptions"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkHBox" id="hbox186"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label539"> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox190"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkRadioButton" id="radNotShared"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Not Shared</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkRadioButton" id="radShared"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="label" translatable="yes">_Shared With ...</property> - <property name="use_underline">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <property name="active">False</property> - <property name="inconsistent">False</property> - <property name="draw_indicator">True</property> - <property name="group">radNotShared</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox194"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkHBox" id="hbox226"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkVBox" id="vbox195"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkHBox" id="hbox227"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label557"> - <property name="visible">True</property> - <property name="label" translatable="yes">Name:</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry4"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="users"> - <property name="visible">True</property> - <property name="label" translatable="yes"><b>Users :</b></property> - <property name="use_underline">False</property> - <property name="use_markup">True</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">6</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow4"> - <property name="width_request">282</property> - <property name="height_request">150</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <placeholder/> - </child> - </widget> - <packing> - <property name="padding">6</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkVBox" id="vbox196"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="Address"> - <property name="width_request">96</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment6"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox232"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image5"> - <property name="visible">True</property> - <property name="stock">gtk-jump-to</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label563"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Contacts...</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="Add"> - <property name="width_request">61</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment4"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox229"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image3"> - <property name="visible">True</property> - <property name="stock">gtk-add</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label561"> - <property name="width_request">29</property> - <property name="visible">True</property> - <property name="label" translatable="yes">_Add</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkButton" id="Remove"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment5"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox230"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image4"> - <property name="visible">True</property> - <property name="stock">gtk-remove</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label562"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Remove</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <placeholder/> - </child> - - <child> - <widget class="GtkButton" id="Notification"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - - <child> - <widget class="GtkAlignment" id="alignment7"> - <property name="visible">True</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xscale">0</property> - <property name="yscale">0</property> - <property name="top_padding">0</property> - <property name="bottom_padding">0</property> - <property name="left_padding">0</property> - <property name="right_padding">0</property> - - <child> - <widget class="GtkHBox" id="hbox233"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">2</property> - - <child> - <widget class="GtkImage" id="image6"> - <property name="visible">True</property> - <property name="stock">gnome-stock-mail-new</property> - <property name="icon_size">4</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label564"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Cutomize notification message</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - </child> - </widget> - </child> - </widget> - <packing> - <property name="padding">11</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - </widget> - <packing> - <property name="tab_expand">False</property> - <property name="tab_fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="lblSharing"> - <property name="visible">True</property> - <property name="label" translatable="yes">_Sharing</property> - <property name="use_underline">True</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="type">tab</property> - </packing> - </child> - </widget> - </child> -</widget> - -<widget class="GtkWindow" id="window1"> - <property name="visible">True</property> - <property name="title" translatable="yes">Shared Folder Notification</property> - <property name="type">GTK_WINDOW_TOPLEVEL</property> - <property name="window_position">GTK_WIN_POS_CENTER</property> - <property name="modal">False</property> - <property name="resizable">True</property> - <property name="destroy_with_parent">False</property> - <property name="decorated">True</property> - <property name="skip_taskbar_hint">False</property> - <property name="skip_pager_hint">False</property> - <property name="type_hint">GDK_WINDOW_TYPE_HINT_NORMAL</property> - <property name="gravity">GDK_GRAVITY_NORTH_WEST</property> - - <child> - <widget class="GtkVBox" id="vbox191"> - <property name="border_width">12</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkLabel" id="label551"> - <property name="visible">True</property> - <property name="label" translatable="yes">The participants will receive the following notification. -</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.66</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">1</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox223"> - <property name="height_request">309</property> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">12</property> - - <child> - <widget class="GtkVBox" id="vbox193"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">5</property> - - <child> - <widget class="GtkLabel" id="label553"> - <property name="visible">True</property> - <property name="label" translatable="yes">Subject</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkEntry" id="entry3"> - <property name="width_request">158</property> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="visibility">True</property> - <property name="max_length">0</property> - <property name="text" translatable="yes"></property> - <property name="has_frame">True</property> - <property name="invisible_char" translatable="yes">*</property> - <property name="activates_default">False</property> - </widget> - <packing> - <property name="padding">6</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkLabel" id="label554"> - <property name="visible">True</property> - <property name="label" translatable="yes">Message</property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_CENTER</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.5</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkScrolledWindow" id="scrolledwindow3"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="hscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="vscrollbar_policy">GTK_POLICY_ALWAYS</property> - <property name="shadow_type">GTK_SHADOW_NONE</property> - <property name="window_placement">GTK_CORNER_TOP_LEFT</property> - - <child> - <widget class="GtkTextView" id="textview1"> - <property name="visible">True</property> - <property name="can_focus">True</property> - <property name="editable">True</property> - <property name="overwrite">False</property> - <property name="accepts_tab">True</property> - <property name="justification">GTK_JUSTIFY_LEFT</property> - <property name="wrap_mode">GTK_WRAP_NONE</property> - <property name="cursor_visible">True</property> - <property name="pixels_above_lines">0</property> - <property name="pixels_below_lines">0</property> - <property name="pixels_inside_wrap">0</property> - <property name="left_margin">0</property> - <property name="right_margin">0</property> - <property name="indent">0</property> - <property name="text" translatable="yes"></property> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - - <child> - <widget class="GtkHBox" id="hbox224"> - <property name="visible">True</property> - <property name="homogeneous">False</property> - <property name="spacing">0</property> - - <child> - <widget class="GtkLabel" id="label555"> - <property name="width_request">248</property> - <property name="visible">True</property> - <property name="label" translatable="yes"></property> - <property name="use_underline">False</property> - <property name="use_markup">False</property> - <property name="justify">GTK_JUSTIFY_LEFT</property> - <property name="wrap">False</property> - <property name="selectable">False</property> - <property name="xalign">0.52</property> - <property name="yalign">0.5</property> - <property name="xpad">0</property> - <property name="ypad">0</property> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">False</property> - <property name="fill">False</property> - </packing> - </child> - - <child> - <widget class="GtkHButtonBox" id="hbuttonbox2"> - <property name="visible">True</property> - <property name="layout_style">GTK_BUTTONBOX_END</property> - <property name="spacing">6</property> - - <child> - <widget class="GtkButton" id="nCancel"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-cancel</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_nCancel_clicked" last_modification_time="Tue, 23 Nov 2004 10:56:42 GMT"/> - </widget> - </child> - - <child> - <widget class="GtkButton" id="nOK"> - <property name="visible">True</property> - <property name="can_default">True</property> - <property name="can_focus">True</property> - <property name="label">gtk-ok</property> - <property name="use_stock">True</property> - <property name="relief">GTK_RELIEF_NORMAL</property> - <property name="focus_on_click">True</property> - <signal name="clicked" handler="on_nOK_clicked" last_modification_time="Tue, 23 Nov 2004 10:57:50 GMT"/> - </widget> - </child> - </widget> - <packing> - <property name="padding">0</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - <packing> - <property name="padding">42</property> - <property name="expand">True</property> - <property name="fill">True</property> - </packing> - </child> - </widget> - </child> -</widget> - -</glade-interface> diff --git a/plugins/shared-folder/share-folder-common.c b/plugins/shared-folder/share-folder-common.c deleted file mode 100644 index 3a107ac2b3..0000000000 --- a/plugins/shared-folder/share-folder-common.c +++ /dev/null @@ -1,468 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Vivek Jain <jvivek@novell.com> - * - * Copyright 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include <e-util/e-config.h> -#include <mail/em-config.h> -#include <mail/em-popup.h> -#include <mail/em-folder-properties.h> -#include <mail/em-folder-tree.h> -#include <mail/em-folder-selector.h> -#include <mail/mail-mt.h> -#include <mail/mail-component.h> -#include <mail/mail-config.h> -#include <mail/em-vfolder-rule.h> -#include <filter/filter-rule.h> -#include <camel/camel-store.h> -#include <camel/camel-session.h> -#include <camel/camel-store.h> -#include <camel/camel-vee-store.h> -#include <camel/camel-folder.h> -#include <e-gw-container.h> -#include <e-gw-connection.h> -#include <glade/glade.h> -#include <libgnomeui/libgnomeui.h> -#include "share-folder.h" -#define d(x) - -ShareFolder *common = NULL; -extern CamelSession *session; -struct ShareInfo { - GtkWidget *d; - ShareFolder *sf; - EMFolderTreeModel *model; - EMFolderSelector *emfs; -}; - -GtkWidget * org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); -void org_gnome_create_option(EPlugin *ep, EMPopupTargetFolder *target); -void shared_folder_commit (EPlugin *ep, EConfigTarget *tget); -void shared_folder_abort (EPlugin *ep, EConfigTarget *target); - -static void refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store); - -static void -refresh_folder_tree (EMFolderTreeModel *model, CamelStore *store) -{ - gchar *uri; - EAccount *account; - CamelException ex; - CamelProvider *provider; - - uri = camel_url_to_string (((CamelService *) store)->url, CAMEL_URL_HIDE_ALL); - account = mail_config_get_account_by_source_url (uri); - uri = account->source->url; - em_folder_tree_model_remove_store (model, store); - - camel_exception_init (&ex); - if (!(provider = camel_provider_get(uri, &ex))) { - camel_exception_clear (&ex); - return; - } - if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) - return; - em_folder_tree_model_add_store (model, store, account->name); - //camel_object_unref (store); -} - -void -shared_folder_commit (EPlugin *ep, EConfigTarget *tget) -{ - EMConfigTargetFolder *target = (EMConfigTargetFolder *)tget->config->target; - CamelFolder *folder = target->folder; - CamelStore *store = folder->parent_store; - EMFolderTreeModel *model = mail_component_peek_tree_model (mail_component_peek ()); - if (common) { - share_folder (common); - refresh_folder_tree (model, store); - g_object_run_dispose ((GObject *)common); - common = NULL; - } -} - -void -shared_folder_abort (EPlugin *ep, EConfigTarget *target) -{ - if (common) { - g_object_run_dispose ((GObject *)common); - common = NULL; - } -} - -struct _EMCreateFolder { - struct _mail_msg msg; - - /* input data */ - CamelStore *store; - char *full_name; - char *parent; - char *name; - - /* output data */ - CamelFolderInfo *fi; - - /* callback data */ - void (* done) (struct _EMCreateFolder *m, void *user_data); - void *user_data; -}; - -static char * -create_folder__desc (struct _mail_msg *mm, int done) -{ - struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - - return g_strdup_printf (_("Creating folder `%s'"), m->full_name); -} - -static void -create_folder__create (struct _mail_msg *mm) -{ - struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - - d(printf ("creating folder parent='%s' name='%s' full_name='%s'\n", m->parent, m->name, m->full_name)); - - if ((m->fi = camel_store_create_folder (m->store, m->parent, m->name, &mm->ex))) { - if (camel_store_supports_subscriptions (m->store)) - camel_store_subscribe_folder (m->store, m->full_name, &mm->ex); - } -} - -static void -create_folder__created (struct _mail_msg *mm) -{ - struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - struct ShareInfo *ssi = (struct ShareInfo *) m->user_data; - CamelStore *store = CAMEL_STORE (m->store) ; - EGwConnection *ccnc; - - if (m->done) { - ccnc = get_cnc (store); - if(E_IS_GW_CONNECTION (ccnc)) { - (ssi->sf)->cnc = ccnc; - - (ssi->sf)->container_id = g_strdup (get_container_id ((ssi->sf)->cnc, m->name)); - share_folder(ssi->sf); - } - - m->done (m, m->user_data); - } -} - -static void -create_folder__free (struct _mail_msg *mm) -{ - struct _EMCreateFolder *m = (struct _EMCreateFolder *) mm; - - camel_store_free_folder_info (m->store, m->fi); - camel_object_unref (m->store); - g_free (m->full_name); - g_free (m->parent); - g_free (m->name); -} - -static struct _mail_msg_op create_folder_op = { - create_folder__desc, - create_folder__create, - create_folder__created, - create_folder__free, -}; - -static void -new_folder_created_cb (struct _EMCreateFolder *m, void *user_data) -{ - struct ShareInfo *ssi = (struct ShareInfo *) user_data; - EMFolderSelector *emfs = ssi->emfs; - if (m->fi){ - refresh_folder_tree (ssi->model, m->store); - gtk_widget_destroy ((GtkWidget *) emfs); - gtk_widget_destroy ((GtkWidget *) ssi->d); - } - - g_object_unref (emfs); -} - -static int -create_folder (CamelStore *store, const char *full_name, void (* done) (struct _EMCreateFolder *m, void *user_data), void *user_data) -{ - char *name, *namebuf = NULL; - struct _EMCreateFolder *m; - const char *parent; - int id; - - namebuf = g_strdup (full_name); - if (!(name = strrchr (namebuf, '/'))) { - name = namebuf; - parent = ""; - } else { - *name++ = '\0'; - parent = namebuf; - } - - m = mail_msg_new (&create_folder_op, NULL, sizeof (struct _EMCreateFolder)); - camel_object_ref (store); - m->store = store; - m->full_name = g_strdup (full_name); - m->parent = g_strdup (parent); - m->name = g_strdup (name); - m->user_data = (struct ShareInfo *) user_data; - m->done = done; - g_free (namebuf); - id = m->msg.seq; - e_thread_put (mail_thread_new, (EMsg *) m); - - return id; -} - -static void -users_dialog_response(GtkWidget *dialog, int response, struct ShareInfo *ssi) -{ - struct _EMFolderTreeModelStoreInfo *si; - EMFolderSelector *emfs = ssi->emfs; - const char *uri, *path; - CamelException ex; - CamelStore *store; - - if (response != GTK_RESPONSE_OK) { - gtk_widget_destroy ((GtkWidget *) emfs); - gtk_widget_destroy(dialog); - return; - } - - uri = em_folder_selector_get_selected_uri (emfs); - path = em_folder_selector_get_selected_path (emfs); - - d(printf ("Creating new folder: %s (%s)\n", path, uri)); - - camel_exception_init (&ex); - if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) { - camel_exception_clear (&ex); - return; - } - - if (!(si = g_hash_table_lookup ((ssi->model)->store_hash, store))) { - g_assert_not_reached (); - camel_object_unref (store); - return; - } - - if (CAMEL_IS_VEE_STORE(store)) { - EMVFolderRule *rule; - - rule = em_vfolder_rule_new(); - filter_rule_set_name((FilterRule *)rule, path); - vfolder_gui_add_rule(rule); - gtk_widget_destroy((GtkWidget *)emfs); - } else { - g_object_ref (emfs); - ssi->d = dialog; - create_folder (si->store, path, new_folder_created_cb, ssi); - - } - camel_object_unref (store); -} - -static void -new_folder_response (EMFolderSelector *emfs, int response, EMFolderTreeModel *model) -{ - GtkWidget *users_dialog; - GtkWidget *w; - struct ShareInfo *ssi; - const char *uri; - EGwConnection *cnc; - CamelException ex; - CamelStore *store; - - ssi = g_new0(struct ShareInfo, 1); - if (response != GTK_RESPONSE_OK) { - gtk_widget_destroy ((GtkWidget *) emfs); - return; - } - - /* i want store at this point to get cnc not sure proper or not*/ - uri = em_folder_selector_get_selected_uri (emfs); - camel_exception_init (&ex); - if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) { - camel_exception_clear (&ex); - return; - } - - cnc = get_cnc (store); - users_dialog = gtk_dialog_new_with_buttons ( - _("Users"), NULL, GTK_DIALOG_DESTROY_WITH_PARENT | GTK_DIALOG_NO_SEPARATOR, GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL,GTK_STOCK_OK, GTK_RESPONSE_OK, NULL); - w = gtk_label_new_with_mnemonic (_("Enter the users and set permissions")); - gtk_widget_show(w); - gtk_box_pack_start(GTK_BOX (GTK_DIALOG (users_dialog)->vbox), (GtkWidget *) w, TRUE, TRUE, 6); - ssi->sf = share_folder_new (cnc, NULL); - gtk_widget_set_sensitive (GTK_WIDGET ((ssi->sf)->table), TRUE); - ssi->model = model; - ssi->emfs = emfs; - gtk_widget_reparent (GTK_WIDGET ((ssi->sf)->table), GTK_DIALOG (users_dialog)->vbox); - gtk_widget_hide((GtkWidget*) emfs); - gtk_window_resize (GTK_WINDOW (users_dialog), 350, 300); - gtk_widget_show(users_dialog); - g_signal_connect (users_dialog, "response", G_CALLBACK (users_dialog_response), ssi); - - camel_object_unref (store); - return ; - -} - -void -org_gnome_create_option(EPlugin *ep, EMPopupTargetFolder *target) -{ - - EMFolderTreeModel *model; - EMFolderTree *folder_tree; - GtkWidget *dialog ; - char *uri; - - model = mail_component_peek_tree_model (mail_component_peek ()); - folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); - dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); - uri = em_folder_tree_get_selected_uri(folder_tree); - em_folder_selector_set_selected ((EMFolderSelector *) dialog, uri); - g_free(uri); - g_signal_connect (dialog, "response", G_CALLBACK (new_folder_response), model); - gtk_window_set_title (GTK_WINDOW (dialog), "New Shared Folder" ); - gtk_widget_show(dialog); - -} - -GtkWidget * -org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) -{ - - gchar *folderuri = NULL; - gchar *account = NULL; - gchar *id = NULL; - gchar *sub = NULL; - EGwConnection *cnc; - ShareFolder *sharing_tab; - EMConfigTargetFolder *target= (EMConfigTargetFolder *)hook_data->config->target; - - folderuri = g_strdup(target->uri); - if (folderuri) { - account = g_strrstr(folderuri, "groupwise"); - sub = g_strrstr(folderuri, "#"); - } else - return NULL; - - if(sub == NULL) - sub = g_strrstr(folderuri, "/"); - if (sub) - sub++; - else - return NULL; - - if ( !( strcmp (sub, "Mailbox") && strcmp (sub, "Calendar") && strcmp (sub, "Contacts") && strcmp (sub, "Documents") && strcmp (sub, "Authored") && strcmp (sub, "Default Library") && strcmp (sub, "Work In Progress") && strcmp (sub, "Cabinet") && strcmp (sub, "Sent Items") && strcmp (sub, "Trash") && strcmp (sub, "Checklist"))) { - g_free (folderuri); - return NULL; - } - - if (account) { - CamelFolder *folder = target->folder; - CamelStore *store = folder->parent_store; - cnc = get_cnc (store); - if (E_IS_GW_CONNECTION (cnc)) - id = get_container_id (cnc, sub); - else - g_warning("Could not Connnect\n"); - - g_free (folderuri); - if (cnc && id) - sharing_tab = share_folder_new (cnc, id); - else - return NULL; - - gtk_notebook_append_page((GtkNotebook *) hook_data->parent, (GtkWidget *) sharing_tab->vbox, gtk_label_new_with_mnemonic N_("Sharing")); - common = sharing_tab; - - return GTK_WIDGET (sharing_tab); - } else - return NULL; -} - -EGwConnection * -get_cnc (CamelStore *store) -{ - EGwConnection *cnc; - const char *uri, *property_value, *use_ssl, *server_name, *user, *port; - CamelService *service; - CamelURL *url; - - if (!store) - return NULL; - - service = CAMEL_SERVICE(store); - url = service->url; - server_name = g_strdup (url->host); - user = g_strdup (url->user); - property_value = camel_url_get_param (url, "soap_port"); - use_ssl = g_strdup (camel_url_get_param (url, "soap_ssl")); - if(property_value == NULL) - port = g_strdup ("7181"); - else if (strlen(property_value) == 0) - port = g_strdup ("7181"); - else - port = g_strdup (property_value); - - if (use_ssl) - uri = g_strconcat ("https://", server_name, ":", port, "/soap", NULL); - else - uri = g_strconcat ("http://", server_name, ":", port, "/soap", NULL); - - cnc = e_gw_connection_new (uri, user, service->url->passwd); - - return cnc; - -} - -gchar * -get_container_id(EGwConnection *cnc, gchar *fname) -{ - GList *container_list = NULL; - gchar *id = NULL; - const char *name; - /* get list of containers */ - if (e_gw_connection_get_container_list (cnc, "folders", &(container_list)) == E_GW_CONNECTION_STATUS_OK) { - GList *container = NULL; - - for (container = container_list; container != NULL; container = container->next) { - name = e_gw_container_get_name (container->data); - /* if Null is passed as name then we return top lavel id*/ - if (fname == NULL) { - id = g_strdup (e_gw_container_get_id (container->data)); - break; - } else if (!strcmp (name, fname)) { - id = g_strdup (e_gw_container_get_id (container->data)); - break; - } - } - e_gw_connection_free_container_list (container_list); - } - return id; -} diff --git a/plugins/shared-folder/share-folder.c b/plugins/shared-folder/share-folder.c deleted file mode 100644 index 84bc93b2f3..0000000000 --- a/plugins/shared-folder/share-folder.c +++ /dev/null @@ -1,742 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Author: Vivek Jain <jvivek@novell.com> - * - * Copyright 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -# include <config.h> -#endif -#include <glade/glade.h> -#include "share-folder.h" -#include <glib/gmain.h> -#include <gtk/gtktreemodel.h> -#include <gtk/gtkliststore.h> -#include <gtk/gtktreeselection.h> -#include <gtk/gtktreeview.h> -#include <gtk/gtkdialog.h> -#include <gtk/gtkbutton.h> -#include <gtk/gtk.h> -#include <gtk/gtktogglebutton.h> -#include <gtk/gtkcellrenderertoggle.h> -#include <gtk/gtkcellrenderertext.h> -#include <libedataserverui/e-contact-store.h> -#include <libgnomeui/gnome-ui-init.h> -#include <libgnome/gnome-init.h> -#include <widgets/misc/e-error.h> -#include <e-gw-container.h> -#include <e-gw-connection.h> -#define ROOTNODE "vboxSharing" -#define NROOTNODE "vbox191" -#define d(x) - -struct _SharedUser { - EShUsers *user_node; - int flag; -}; -typedef struct _SharedUser SharedUser; - -static void share_folder_class_init (ShareFolderClass *class); -static void share_folder_init (ShareFolder *sf); -static void share_folder_destroy (GtkObject *obj); -static void share_folder_finalise (GObject *obj); -static void free_user_node(EShUsers *user); -static void free_node(SharedUser *user); -static void free_all(ShareFolder *sf); -static SharedUser * find_node(GList *list, gchar *email); -static void free_all(ShareFolder *sf); -static void get_container_list (ShareFolder *sf); -static void user_selected(GtkTreeSelection *selection, ShareFolder *sf); -static void not_shared_clicked (GtkRadioButton *button, ShareFolder *sf); -static void shared_clicked (GtkRadioButton *button, ShareFolder *sf); -static void add_clicked(GtkButton *button, ShareFolder *sf); -static void remove_clicked(GtkButton *button, ShareFolder *sf); -static void not_ok_clicked(GtkButton *button, ShareFolder *sf); -static void not_cancel_clicked(GtkButton *button, GtkWidget *window); -static void not_cancel_clicked(GtkButton *button, GtkWidget *window); -static void share_folder_construct (ShareFolder *sf); -GType share_folder_get_type (void); - -static GtkVBoxClass *parent_class = NULL; - -GType -share_folder_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (ShareFolderClass), - NULL, NULL, - (GClassInitFunc) share_folder_class_init, - NULL, NULL, - sizeof (ShareFolder), - 0, - (GInstanceInitFunc) share_folder_init - }; - - type = g_type_register_static (gtk_vbox_get_type (), "ShareFolder", &info, 0); - } - - return type; -} - -static void -share_folder_class_init (ShareFolderClass *klass) -{ - GObjectClass *gobject_class = G_OBJECT_CLASS (klass); - GtkObjectClass *object_class = GTK_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (gtk_vbox_get_type ()); - object_class->destroy = share_folder_destroy; - gobject_class->finalize = share_folder_finalise; -} - -static void -share_folder_finalise (GObject *obj) -{ - ShareFolder *sf = (ShareFolder *) obj; - g_object_unref (sf->xml); - free_all(sf); - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -share_folder_destroy (GtkObject *obj) -{ - - ShareFolder *sf = (ShareFolder *) obj; - free_all (sf); - GTK_OBJECT_CLASS (parent_class)->destroy (obj); -} - -static void -share_folder_init (ShareFolder *sf) -{ - sf->gcontainer = NULL; - sf->users = 0; - sf->flag_for_ok = 0; - sf->shared = FALSE; - sf->container_list = NULL; - sf->users_list = NULL; - sf->sub = "Shared Folder notification"; - sf->message = NULL; -} - -static void -free_user_node(EShUsers *user) -{ - if(user){ - g_free(user->email); - user->email = NULL; - } - return ; -} - -static void -free_node(SharedUser *usr) -{ - EShUsers *user = usr->user_node; - if(user){ - g_free(user->email); - user->email = NULL; - } - return ; -} - -static SharedUser * -find_node(GList *list, gchar *email) -{ - SharedUser *user = NULL; - EShUsers *usr = NULL; - GList *tmp; - gint i ; - - if(list){ - tmp = g_list_first(list); - for(i=0; tmp ; i++) - { - user = tmp->data; - usr = user->user_node; - if(!g_ascii_strcasecmp(usr->email, email)){ - return user; /*if found, it returns that user*/ - } - tmp= g_list_next(tmp); - } - } - return NULL; -} - -static void -free_all (ShareFolder *sf) -{ - if (sf->users_list){ - g_list_foreach (sf->users_list,(GFunc) free_node, NULL); - g_list_free (sf->users_list); - sf->users_list = NULL; - } - - e_gw_connection_free_container_list (sf->container_list); -} - - -static void -display_container (EGwContainer *container , ShareFolder *sf) -{ - gchar **tail; - gchar *id_shared; - gchar *id_unshared; - gboolean byme = FALSE; - gboolean tome = FALSE; - gchar *email = NULL; - gchar *msg; - GList *user_list = NULL; - EShUsers *user = NULL; - - id_shared = g_strdup(e_gw_container_get_id(container)); - /* this has to be done since id changes after the folder is shared*/ - if( g_str_has_suffix (id_shared, "35")){ - tail = g_strsplit(id_shared, "@", 2); - id_unshared = g_strconcat(tail[0], "@", "13", NULL); - g_strfreev(tail); - } - - if((!g_ascii_strcasecmp(id_unshared, sf->container_id)) || (!g_ascii_strcasecmp(id_shared, sf->container_id)) ){ - sf->gcontainer = container; - byme = e_gw_container_get_is_shared_by_me(container); - tome = e_gw_container_get_is_shared_to_me(container); - if(byme || tome) { - e_gw_container_get_user_list (sf->gcontainer, &user_list); - sf->users = g_list_length (user_list); - if(sf->users != 0) { - sf->is_shared = TRUE; - gtk_toggle_button_set_active((GtkToggleButton *) sf->shared, TRUE); - shared_clicked(sf->shared , sf); - if (tome) { - gtk_widget_set_sensitive (GTK_WIDGET (sf->not_shared), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (sf->add_button), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (sf->remove), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (sf->add_book), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (sf->notification), FALSE); - gtk_widget_set_sensitive (GTK_WIDGET (sf->user_list), FALSE); - email = g_strdup (e_gw_container_get_owner (sf->gcontainer)); - msg = g_strconcat (email, " (Owner)", NULL); - gtk_list_store_append (GTK_LIST_STORE (sf->model), &(sf->iter)); - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 0, msg, -1); - g_free (msg); - g_free (email); - - } else - gtk_widget_set_sensitive (GTK_WIDGET (sf->table), TRUE); -/* I populate the list and set flags to 0 for the existing users*/ - while (user_list) { - SharedUser *shared_user = g_new0 (SharedUser , 1); - gboolean add, edit, delete; - add = edit = delete = FALSE; - user = user_list->data; - shared_user->user_node = user; - shared_user->flag = 0; - email = g_strdup (user->email); - if (user->rights & 0x1) - add = TRUE; - if (user->rights & 0x2) - edit = TRUE; - if (user->rights & 0x4) - delete = TRUE; - - msg = g_strdup_printf ("%s", email); - gtk_list_store_append (GTK_LIST_STORE (sf->model), &(sf->iter)); - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 0, msg, 1, add, 2, edit, 3, delete, -1); - sf->users_list = g_list_append (sf->users_list, shared_user); - g_free (msg); - g_free (email); - msg = NULL; - email = NULL; - user_list = user_list->next; - } - /* i also need to display status*/ - } else { - - gtk_toggle_button_set_active ((GtkToggleButton *) sf->not_shared, TRUE); - not_shared_clicked (sf->not_shared , sf); - } - } - } -} - -static void -get_container_list (ShareFolder *sf) -{ - sf->container_list = NULL; - if (E_IS_GW_CONNECTION (sf->cnc)) { - /* get list of containers */ - if (e_gw_connection_get_container_list (sf->cnc, "folders", &(sf->container_list)) == E_GW_CONNECTION_STATUS_OK) { - GList *container = NULL; - - for (container = sf->container_list; container != NULL; container = container->next) - display_container (E_GW_CONTAINER (container->data), sf); - - } - else - g_warning("Could not get the Container List"); - } -} - - -static void -shared_clicked (GtkRadioButton *button, ShareFolder *sf) -{ - - gtk_widget_set_sensitive (GTK_WIDGET (sf->table) ,TRUE); - sf->flag_for_ok = 0; -} - -static void -not_shared_clicked (GtkRadioButton *button, ShareFolder *sf) -{ - if (!sf->is_shared) { - sf->flag_for_ok = 0; - } else { - sf->flag_for_ok = 2; - } - gtk_widget_set_sensitive (GTK_WIDGET (sf->table), FALSE); - -} - -static void -add_clicked(GtkButton *button, ShareFolder *sf) -{ - const char *email = NULL; - const char *self_email = NULL; - SharedUser *new_user = NULL; - EShUsers *usr = NULL; - gint rights = 0; - gchar *msg = NULL; - EDestinationStore *destination_store; - GList *destinations, *tmp; - ENameSelectorEntry *name_selector_entry; - - name_selector_entry = e_name_selector_peek_section_entry (sf->name_selector, "Add User"); - destination_store = e_name_selector_entry_peek_destination_store (E_NAME_SELECTOR_ENTRY ( - name_selector_entry)); - destinations = e_destination_store_list_destinations (destination_store); - tmp = destinations; - self_email = g_strdup (e_gw_connection_get_user_email (sf->cnc)); - for (; tmp != NULL; tmp = g_list_next (tmp)) { - email = e_destination_get_email (tmp->data); - /* You can't share a folder with yourself*/ - if (g_strrstr (email, "@") == NULL || (!g_ascii_strcasecmp (email , self_email))) - e_error_run (NULL, "org.gnome.evolution.mail_shared_folder:invalid-user",email ,NULL); - else { - if (!g_ascii_strcasecmp (email, "" )) { - e_error_run (NULL, "org.gnome.evolution.mail_shared_folder:no-user",NULL); - - return ; - } - - - /*check whether already exists*/ - if (sf->users_list && email){ - new_user = find_node (sf->users_list, (gchar *)email); - if (new_user) - return ; - - } - usr = g_new0 (EShUsers, 1); - new_user = g_new0 (SharedUser, 1); - usr->email = g_strdup(email); - usr->rights = rights; - new_user->user_node = usr; - new_user->flag = 1; - msg = g_strdup (email); - gtk_list_store_append (GTK_LIST_STORE (sf->model), &(sf->iter)); - - /* have to add code for rights*/ - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 0, msg, -1); - g_free(msg); - sf->users_list = g_list_append (sf->users_list, new_user); - sf->flag_for_ok = 0; - } - } - gtk_entry_set_text (GTK_ENTRY(name_selector_entry), ""); - -} - -static void -remove_clicked(GtkButton *button, ShareFolder *sf) -{ - - SharedUser *usr = NULL; - gchar *email; - - gtk_tree_model_get ((GtkTreeModel *) sf->model, &(sf->iter), 0, &email, -1); - usr = find_node (sf->users_list, email); - if (usr->flag & 0x1) { - sf->users_list = g_list_remove (sf->users_list, usr); - free_node(usr); - } else { - usr->flag = 0; - usr->flag |= 0x4; - } - g_free (email); - gtk_list_store_remove (GTK_LIST_STORE (sf->model), &(sf->iter)); - sf->flag_for_ok = 1; -} - -void -share_folder (ShareFolder *sf) -{ - - GList *new_list = NULL; - GList *update_list = NULL; - GList *remove_list = NULL; - GList *node = NULL; - SharedUser *user = NULL; - - for (node = sf->users_list; node; node = node->next) - { - user = node->data; - if (user->flag & 0x1) - new_list = g_list_append (new_list, user->user_node); - else if (user->flag & 0x2) - update_list = g_list_append (update_list, user->user_node); - else if (user->flag & 0x4) { - remove_list = g_list_append (remove_list, user->user_node); - } - } - - if (E_IS_GW_CONNECTION (sf->cnc)) { - if(sf->flag_for_ok == 2){ /* you have to remove all the users*/ - GList *list = NULL; - - if(new_list){ - g_list_foreach (new_list, (GFunc) free_user_node, NULL); - g_list_free (new_list); - } - if(update_list){ - g_list_foreach (update_list, (GFunc) free_user_node, NULL); - g_list_free (update_list); - } - - new_list = NULL; - if(remove_list){ - g_list_foreach (remove_list,(GFunc) free_user_node, NULL); - g_list_free (remove_list); - } - remove_list = NULL; - if (sf->gcontainer) { - e_gw_container_get_user_list (sf->gcontainer, &list); - remove_list = g_list_copy (list); - - } else { - g_warning("Container is Null"); - } - - - } else { - if (new_list) { - if (e_gw_connection_share_folder (sf->cnc, sf->container_id, new_list, sf->sub, sf->mesg, 0) == E_GW_CONNECTION_STATUS_OK); - } - - if (update_list) { - sf->sub = "Shared Folder rights updated"; - - if (e_gw_connection_share_folder (sf->cnc, sf->container_id, update_list, sf->sub, sf->mesg, 2) == E_GW_CONNECTION_STATUS_OK); - } - } - if (remove_list) { - sf->sub = "Shared Folder removed"; - if (e_gw_connection_share_folder (sf->cnc, sf->container_id, remove_list, sf->sub, sf->mesg, 1) == E_GW_CONNECTION_STATUS_OK); - } - - } -} - -static void -not_ok_clicked(GtkButton *button, ShareFolder *sf) -{ - - gchar *subj = NULL; - gchar *msg = NULL; - GtkTextIter *start, *end; - GtkTextBuffer *buffer; - - buffer = gtk_text_buffer_new (NULL); - start = g_new0 (GtkTextIter, 1); - end = g_new0 (GtkTextIter, 1); - subj = g_strdup (gtk_entry_get_text (sf->subject)); - if (subj) - sf->sub = subj; - buffer = gtk_text_view_get_buffer (sf->message); - gtk_text_buffer_get_start_iter (buffer, start); - gtk_text_buffer_get_end_iter (buffer, end); - msg = gtk_text_buffer_get_text (buffer, start, end, FALSE); - if (msg) - sf->mesg = msg; - gtk_widget_destroy (GTK_WIDGET (sf->window)); - -} - -static void -not_cancel_clicked(GtkButton *button, GtkWidget *window) -{ - gtk_widget_destroy(window); -} - - -static void -notification_clicked(GtkButton *button, ShareFolder *sf) -{ - static GladeXML *xmln; - GtkButton *not_ok; - GtkButton *not_cancel; - GtkWidget *vbox; - - sf->window = gtk_window_new (GTK_WINDOW_TOPLEVEL); - xmln = glade_xml_new (EVOLUTION_GLADEDIR "/properties.glade", NROOTNODE , NULL); - vbox = GTK_WIDGET (glade_xml_get_widget (xmln, "vbox191")); - gtk_container_add (GTK_CONTAINER (sf->window), vbox); - sf->subject = GTK_ENTRY (glade_xml_get_widget (xmln, "entry3")); - gtk_entry_set_text(GTK_ENTRY (sf->subject) , sf->sub); - sf->message = GTK_TEXT_VIEW (glade_xml_get_widget (xmln, "textview1")); - not_ok = GTK_BUTTON (glade_xml_get_widget (xmln, "nOK")); - g_signal_connect ((gpointer) not_ok, "clicked", G_CALLBACK (not_ok_clicked), sf); - not_cancel = GTK_BUTTON (glade_xml_get_widget (xmln, "nCancel")); - g_signal_connect ((gpointer) not_cancel, "clicked", G_CALLBACK (not_cancel_clicked), sf->window); - gtk_window_set_title (GTK_WINDOW (sf->window), "Custom Notification"); - gtk_window_set_position (GTK_WINDOW (sf->window) , GTK_WIN_POS_CENTER_ALWAYS); - gtk_window_set_default_size (GTK_WINDOW (sf->window), 100, 200); - gtk_widget_show_all (sf->window); -} - -static void -addressbook_dialog_response (ENameSelectorDialog *name_selector_dialog, gint response, gpointer user_data) -{ - gtk_widget_hide (GTK_WIDGET (name_selector_dialog)); -} - -static void -addressbook_entry_changed (GtkWidget *entry, gpointer user_data) -{ - -} - -static void -address_button_clicked_cb (GtkButton *button, gpointer data) -{ - ShareFolder *sf = data; - ENameSelectorDialog *name_selector_dialog; - - name_selector_dialog = e_name_selector_peek_dialog (sf->name_selector); - gtk_widget_show (GTK_WIDGET (name_selector_dialog)); -} - - static void -user_selected(GtkTreeSelection *selection, ShareFolder *sf) -{ - - gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - if (gtk_tree_selection_get_selected (selection, &(sf->model), &(sf->iter))){ - gtk_widget_set_sensitive (GTK_WIDGET (sf->remove), TRUE); - - } -} - - -static void -add_right_clicked (GtkCellRenderer *renderer, gchar *arg1, ShareFolder *sf ) -{ - gboolean right = FALSE; - SharedUser *usr = NULL; - EShUsers *user = NULL; - char *email = NULL; - GtkTreeSelection *selection = NULL; - selection = gtk_tree_view_get_selection(GTK_TREE_VIEW (sf->user_list)); - gtk_tree_selection_set_mode(selection, GTK_SELECTION_SINGLE); - if (! gtk_tree_selection_get_selected (selection, &(sf->model), &(sf->iter))); - gtk_tree_model_get ((GtkTreeModel *) sf->model, &(sf->iter), 0, &email, 1, &right , -1); - usr = find_node(sf->users_list, email); - if (!usr) - return ; - if(! usr->flag) /* if user was already existing one change the flag to update*/ - usr->flag = usr->flag | 0x2; - user = usr->user_node; - if (!right) { - user->rights |= 0x1; - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 1, TRUE, -1); - } else { - user->rights &= 0x6; - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 1, FALSE, -1); - } - -} - - static void -edit_right_clicked(GtkCellRenderer *renderer, gchar *arg1, ShareFolder *sf ) -{ - gboolean right = FALSE; - SharedUser *usr = NULL; - EShUsers *user = NULL; - char *email = NULL; - gtk_tree_model_get ((GtkTreeModel *) sf->model, &(sf->iter), 0, &email, 2, &right , -1); - usr = find_node(sf->users_list, email); - if(! usr->flag) /* if user was already existing one change the flag to update*/ - usr->flag = usr->flag | 0x2; - user = usr->user_node; - - if (!right) { - user->rights |= 0x2; - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 2, TRUE, -1); - } else { - user->rights &= 0x5; - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 2, FALSE, -1); - } - -} - - static void -delete_right_clicked(GtkCellRenderer *renderer, gchar *arg1, ShareFolder *sf ) -{ - gboolean right = FALSE; - SharedUser *usr = NULL; - EShUsers *user = NULL; - char *email = NULL; - gtk_tree_model_get ((GtkTreeModel *) sf->model, &(sf->iter), 0, &email, 3, &right , -1); - usr = find_node(sf->users_list, email); - if(! usr->flag) /* if user was already existing one change the flag to update*/ - usr->flag = usr->flag | 0x2; - user = usr->user_node; - if (!right) { - user->rights |= 0x4; - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 3, TRUE, -1); - } else { - user->rights &= 0x3; - gtk_list_store_set (GTK_LIST_STORE (sf->model), &(sf->iter), 3, FALSE, -1); - } - -} - -static void -share_folder_construct (ShareFolder *sf) -{ - GladeXML *xml; - ENameSelectorDialog *name_selector_dialog; - ENameSelectorModel *name_selector_model; - ENameSelectorEntry *name_selector_entry; - GtkWidget *box; - - xml = glade_xml_new (EVOLUTION_GLADEDIR "/properties.glade", ROOTNODE, NULL); - sf->xml =xml; - - if (!sf->xml) { - g_warning ("could not get xml"); - } - sf->vbox = GTK_VBOX (glade_xml_get_widget(sf->xml, "vboxSharing")); - sf->table = GTK_WIDGET (glade_xml_get_widget (sf->xml, "vbox194")); - gtk_widget_set_sensitive (GTK_WIDGET (sf->table), FALSE); - - sf->shared = GTK_RADIO_BUTTON (glade_xml_get_widget (sf->xml, "radShared")); - g_signal_connect ((gpointer) sf->shared, "clicked", G_CALLBACK (shared_clicked), sf); - - sf->not_shared = GTK_RADIO_BUTTON (glade_xml_get_widget (sf->xml, "radNotShared")); - g_signal_connect ((gpointer) sf->not_shared, "clicked", G_CALLBACK (not_shared_clicked), sf); - - sf->add_book = GTK_BUTTON (glade_xml_get_widget (sf->xml, "Address")); - gtk_widget_set_sensitive (GTK_WIDGET (sf->add_book), TRUE); - g_signal_connect((GtkWidget *) sf->add_book, "clicked", G_CALLBACK (address_button_clicked_cb), sf); - - sf->name_selector = e_name_selector_new (); - name_selector_dialog = e_name_selector_peek_dialog (sf->name_selector); - g_signal_connect (name_selector_dialog, "response", - G_CALLBACK (addressbook_dialog_response), sf); - - name_selector_model = e_name_selector_peek_model (sf->name_selector); - e_name_selector_model_add_section (name_selector_model, "Add User", "Add User", NULL); - - name_selector_entry = e_name_selector_peek_section_entry (sf->name_selector, "Add User"); - g_signal_connect (name_selector_entry, "changed", - G_CALLBACK (addressbook_entry_changed), sf); - - sf->add_button = GTK_BUTTON (glade_xml_get_widget(sf->xml, "Add")); - g_signal_connect((GtkWidget *) sf->add_button, "clicked", G_CALLBACK (add_clicked), sf); - - sf->remove = GTK_BUTTON(glade_xml_get_widget(sf->xml, "Remove")); - g_signal_connect ((GtkWidget *) sf->remove, "clicked", G_CALLBACK (remove_clicked), sf); - gtk_widget_set_sensitive(GTK_WIDGET (sf->remove), FALSE); - - sf->notification = GTK_BUTTON (glade_xml_get_widget (sf->xml, "Notification")); - g_signal_connect((GtkWidget *) sf->notification, "clicked", G_CALLBACK (notification_clicked), sf); - - sf->name = GTK_ENTRY (glade_xml_get_widget (sf->xml, "entry4")); - /*TODO:connect name and label*/ - gtk_widget_hide (GTK_WIDGET(sf->name)); - box = GTK_WIDGET (glade_xml_get_widget (sf->xml, "hbox227")); - gtk_box_pack_start (GTK_BOX (box), (GtkWidget *) name_selector_entry, TRUE, TRUE, 0); - gtk_widget_show ((GtkWidget *) name_selector_entry); - - sf->scrolled_window = GTK_WIDGET (glade_xml_get_widget (sf->xml,"scrolledwindow4")); - - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (sf->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - sf->model = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); - sf->user_list = gtk_tree_view_new (); - gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (sf->scrolled_window), (GtkWidget *)sf->user_list); - gtk_tree_view_set_model (GTK_TREE_VIEW (sf->user_list), GTK_TREE_MODEL (sf->model)); - gtk_widget_show (GTK_WIDGET (sf->user_list)); - - sf->cell = gtk_cell_renderer_text_new (); - sf->column = gtk_tree_view_column_new_with_attributes ("Users", sf->cell, "text", 0, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (sf->user_list), - GTK_TREE_VIEW_COLUMN (sf->column)); - - sf->cell = gtk_cell_renderer_toggle_new (); - sf->column = gtk_tree_view_column_new_with_attributes ("Add ", sf->cell, "active" , 1, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (sf->user_list), - GTK_TREE_VIEW_COLUMN (sf->column)); - g_signal_connect (sf->cell, "toggled", G_CALLBACK (add_right_clicked), sf); - - sf->cell = gtk_cell_renderer_toggle_new (); - sf->column = gtk_tree_view_column_new_with_attributes ("Modify", sf->cell, "active", 2, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (sf->user_list), - GTK_TREE_VIEW_COLUMN (sf->column)); - g_signal_connect (sf->cell, "toggled", G_CALLBACK (edit_right_clicked), sf); - - sf->cell = gtk_cell_renderer_toggle_new (); - sf->column = gtk_tree_view_column_new_with_attributes ("Delete", sf->cell, "active", 3, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (sf->user_list), - GTK_TREE_VIEW_COLUMN (sf->column)); - g_signal_connect (sf->cell, "toggled", G_CALLBACK (delete_right_clicked), sf); - - g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW (sf->user_list)), "changed", G_CALLBACK (user_selected), sf); -} - -ShareFolder * -share_folder_new (EGwConnection *ccnc, gchar *id) -{ - ShareFolder *new; - new = (ShareFolder *) g_object_new (share_folder_get_type (), NULL); - share_folder_construct (new); - new->cnc = ccnc; - new->container_id = id; - if (ccnc && id) - get_container_list(new); - - return (ShareFolder *) new; -} - - diff --git a/plugins/shared-folder/share-folder.h b/plugins/shared-folder/share-folder.h deleted file mode 100644 index ac34ada29c..0000000000 --- a/plugins/shared-folder/share-folder.h +++ /dev/null @@ -1,120 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: Vivek Jain <jvivek@novell.com> - * - * Copyright 2002-2003 Ximian, Inc. (www.ximian.com) - * - * 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 Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifndef __SHARE_FOLDER_H__ -#define __SHARE_FOLDER_H__ - -#ifdef __cplusplus -extern "C" { -#pragma } -#endif /* __cplusplus */ - -#include <glib.h> -#include <gtk/gtkvbox.h> -#include <gtk/gtk.h> -#include <camel/camel-store.h> -#include <e-gw-connection.h> -#include <libedataserverui/e-name-selector.h> - -#define _SHARE_FOLDER_TYPE (share_folder_get_type ()) -#define SHARE_FOLDER(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), SHARE_FOLDER, ShareFolder)) -#define SHARE_FOLDER_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), SHARE_FOLDER_TYPE, ShareFolder)) -#define IS_SHARE_FOLDER(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), SHARE_FOLDER_TYPE)) -#define IS_SHARE_FOLDER_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), SHARE_FOLDER_TYPE)) - -typedef struct _ShareFolder ShareFolder; -typedef struct _ShareFolderClass ShareFolderClass; - -struct _GtkWidget; -struct _GladeXML; -struct _GtkButton; -struct _GtkTreeView; -struct _GtkLabel; -struct _GtkEntry; -struct _GtkWindow; -struct _GtkRadioButton; -struct _GtkListStore; -struct _GtkCellRenderer; -struct _GtkTreeViewColumn; -struct _GtkFrame; -struct _GtkVBox; - -struct _ShareFolder { - GtkVBox parent_object; - - struct _GladeXML *xml; - - /* General tab */ - - /* Default Behavior */ - struct _GtkTreeView *user_list; - struct _GtkTextView *message; - struct _GtkButton *add_button; - struct _GtkButton *remove; - struct _GtkButton *add_book; - struct _GtkButton *notification; - struct _GtkEntry *name; - struct _GtkEntry *subject; - struct _GtkRadioButton *shared; - struct _GtkRadioButton *not_shared; - struct _GtkWidget *scrolled_window; - struct _GtkListStore *model; - struct _GtkCellRenderer *cell; - struct _GtkTreeViewColumn *column; - struct _GtkVBox *vbox; - struct _GtkVBox *table; - struct _GtkWidget *window; - - GList *users_list; - EGwContainer *gcontainer; - gint users; - gboolean byme; - gboolean tome; - gint flag_for_ok; - gchar *email; - gboolean is_shared; - EGwConnection *cnc; - gchar *container_id; - gchar *sub; - gchar *mesg; - GList *container_list; - GtkTreeIter iter; - ENameSelector *name_selector; - -}; - -struct _ShareFolderClass { - GtkVBoxClass parent_class; - -}; - -GType share_folderget_type (void); -struct _ShareFolder * share_folder_new (EGwConnection *ccnc, gchar *id); -void share_folder(struct _ShareFolder *sf); -gchar * get_container_id (EGwConnection *cnc, gchar *fname); -EGwConnection * get_cnc (CamelStore *store); - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* __EM_COMPOSER_PREFS_H__ */ diff --git a/plugins/subject-thread/.cvsignore b/plugins/subject-thread/.cvsignore deleted file mode 100644 index 683d5ddbe2..0000000000 --- a/plugins/subject-thread/.cvsignore +++ /dev/null @@ -1,5 +0,0 @@ -.deps -.libs -Makefile -Makefile.in -*.eplug
\ No newline at end of file diff --git a/plugins/subject-thread/ChangeLog b/plugins/subject-thread/ChangeLog deleted file mode 100644 index bfb1facdff..0000000000 --- a/plugins/subject-thread/ChangeLog +++ /dev/null @@ -1,18 +0,0 @@ -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-20 Not Zed <NotZed@Ximian.com> - - * Makefile.am (INCLUDES): removed camel from include path, - everything should include camel/foo. - -2004-10-20 JP Rosevear <jpr@novell.com> - - * subject-thread.c: implement - - * org-gnome-subject-thread.eplug.in: define the - subject-thread plugin - - * Makefile.am: build the subject thread plugin - diff --git a/plugins/subject-thread/Makefile.am b/plugins/subject-thread/Makefile.am deleted file mode 100644 index 2e692b41dc..0000000000 --- a/plugins/subject-thread/Makefile.am +++ /dev/null @@ -1,13 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-subject-thread.eplug -plugin_LTLIBRARIES = liborg-gnome-subject-thread.la - -liborg_gnome_subject_thread_la_SOURCES = subject-thread.c -liborg_gnome_subject_thread_la_LDFLAGS = -module -avoid-version - -EXTRA_DIST = org-gnome-subject-thread.eplug.in
\ No newline at end of file diff --git a/plugins/subject-thread/org-gnome-subject-thread.eplug.in b/plugins/subject-thread/org-gnome-subject-thread.eplug.in deleted file mode 100644 index ac1df66951..0000000000 --- a/plugins/subject-thread/org-gnome-subject-thread.eplug.in +++ /dev/null @@ -1,11 +0,0 @@ -<e-plugin-list> - <e-plugin id="org.gnome.evolution.mail_subject_thread" type="shlib" name="Subject Threading" description="Indicates if threading of messages should fall back to subject" - location="@PLUGINDIR@/liborg-gnome-subject-thread.so"> - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="prefs"> - <item type="item" path="00.general/10.display/80.subject_thread" label="Thread messages by subject" factory="org_gnome_subject_thread_factory"/> - </group> - </hook> - </e-plugin> -</e-plugin-list>
\ No newline at end of file diff --git a/plugins/subject-thread/subject-thread.c b/plugins/subject-thread/subject-thread.c deleted file mode 100644 index 870ba02f5b..0000000000 --- a/plugins/subject-thread/subject-thread.c +++ /dev/null @@ -1,67 +0,0 @@ -/* -*- Mode: C; tab-width: 8; indent-tabs-mode: t; c-basic-offset: 8 -*- */ -/* - * Authors: JP Rosevear <jpr@novell.com> - * - * Copyright 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., 59 Temple Street #330, Boston, MA 02111-1307, USA. - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <libgnome/gnome-i18n.h> -#include <gconf/gconf-client.h> -#include <e-util/e-config.h> -#include <mail/em-config.h> - -#define GCONF_KEY "/apps/evolution/mail/display/thread_subject" - -GtkWidget *org_gnome_subject_thread_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); - -static void -toggled_cb (GtkWidget *widget, EConfig *config) -{ - EMConfigTargetPrefs *target = (EMConfigTargetPrefs *) config->target; - - /* Save the new setting to gconf */ - gconf_client_set_bool (target->gconf, GCONF_KEY, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget)), NULL); -} - -GtkWidget * -org_gnome_subject_thread_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) -{ - GtkWidget *check; - EMConfigTargetPrefs *target = (EMConfigTargetPrefs *) hook_data->config->target; - - /* Create the checkbox we will display, complete with mnemonic that is unique in the dialog */ - check = gtk_check_button_new_with_mnemonic (_("Fall back to threading messages by sub_ject")); - - /* Set the toggle button to the current gconf setting */ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), gconf_client_get_bool (target->gconf, GCONF_KEY, NULL)); - - /* Listen for the item being toggled on and off */ - g_signal_connect (GTK_TOGGLE_BUTTON (check), "toggled", G_CALLBACK (toggled_cb), hook_data->config); - - /* Pack the checkbox in the parent widget and show it */ - gtk_box_pack_start (GTK_BOX (hook_data->parent), check, FALSE, FALSE, 0); - gtk_widget_show (check); - - return check; -} |