aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/prefer-plain
diff options
context:
space:
mode:
authornobody <nobody@localhost>2005-02-04 12:50:50 +0800
committernobody <nobody@localhost>2005-02-04 12:50:50 +0800
commit149acf37ca7ad28ee42e9d00afb6df4e23c98113 (patch)
tree38981335bcf538742a3be591b0ab85cf16bd6bd0 /plugins/prefer-plain
parentab13d05f6e1b47523f2fed817c1963f289cee2d0 (diff)
downloadgsoc2013-evolution-GAL_2_3_4.tar.gz
gsoc2013-evolution-GAL_2_3_4.tar.zst
gsoc2013-evolution-GAL_2_3_4.zip
This commit was manufactured by cvs2svn to create tag 'GAL_2_3_4'.GAL_2_3_4
svn path=/tags/GAL_2_3_4/; revision=28703
Diffstat (limited to 'plugins/prefer-plain')
-rw-r--r--plugins/prefer-plain/.cvsignore5
-rw-r--r--plugins/prefer-plain/ChangeLog13
-rw-r--r--plugins/prefer-plain/Makefile.am13
-rw-r--r--plugins/prefer-plain/org-gnome-prefer-plain.eplug.in33
-rw-r--r--plugins/prefer-plain/prefer-plain.c191
5 files changed, 0 insertions, 255 deletions
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;
-}