diff options
Diffstat (limited to 'plugins')
46 files changed, 586 insertions, 1701 deletions
diff --git a/plugins/attachment-reminder/Makefile.am b/plugins/attachment-reminder/Makefile.am index d6e9fb8809..c13d6bca92 100644 --- a/plugins/attachment-reminder/Makefile.am +++ b/plugins/attachment-reminder/Makefile.am @@ -1,6 +1,7 @@ INCLUDES = \ -I$(top_builddir)/composer \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) \ -DEVOLUTION_PLUGINDIR="\"$(plugindir)\"" diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c index 15bac58080..200425041d 100644 --- a/plugins/attachment-reminder/attachment-reminder.c +++ b/plugins/attachment-reminder/attachment-reminder.c @@ -24,6 +24,7 @@ #include <glib/gi18n.h> #include <string.h> +#include <glade/glade-xml.h> #include <gconf/gconf-client.h> #include <e-util/e-config.h> @@ -43,7 +44,6 @@ #include <mail/em-utils.h> -#include "widgets/misc/e-attachment-bar.h" #include "composer/e-msg-composer.h" #include "composer/e-composer-actions.h" @@ -182,12 +182,13 @@ check_for_attachment_clues (gchar *msg) static gboolean check_for_attachment (EMsgComposer *composer) { - EAttachmentBar* bar = (EAttachmentBar*)e_msg_composer_get_attachment_bar (composer); + EAttachmentView *view; + EAttachmentStore *store; - if (e_attachment_bar_get_num_attachments (bar)) - return TRUE; + view = e_msg_composer_get_attachment_view (composer); + store = e_attachment_view_get_store (view); - return FALSE; + return (e_attachment_store_get_num_attachments (store) > 0); } static gchar* diff --git a/plugins/audio-inline/org-gnome-audio-inline.eplug.xml b/plugins/audio-inline/org-gnome-audio-inline.eplug.xml index 16c282a014..1e853df10b 100644 --- a/plugins/audio-inline/org-gnome-audio-inline.eplug.xml +++ b/plugins/audio-inline/org-gnome-audio-inline.eplug.xml @@ -4,33 +4,94 @@ type="shlib" id="org.gnome.evolution.plugin.audioInline" location="@PLUGINDIR@/liborg-gnome-audio-inline@SOEXT@" - _name="Audio inline plugin"> + _name="Inline Audio"> - <_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"/> + <_description> + Play audio attachments directly in mail messages. + </_description> <hook class="org.gnome.evolution.mail.format:1.0"> <group id="EMFormatHTMLDisplay"> - <item mime_type="audio/ac3" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/x-ac3" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/basic" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <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/mp4" 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="audio/x-wav" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/microsoft-wav" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/x-wma" format="org_gnome_audio_inline_format" flags="inline_disposition"/> - <item mime_type="audio/x-ms-wma" 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"/> + <item + mime_type="audio/ac3" + format="org_gnome_audio_inline_format" + flags="inline_disposition"/> + <item + mime_type="audio/x-ac3" + format="org_gnome_audio_inline_format" + flags="inline_disposition"/> + <item + mime_type="audio/basic" + format="org_gnome_audio_inline_format" + flags="inline_disposition"/> + <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/mp4" + 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="audio/x-wav" + format="org_gnome_audio_inline_format" + flags="inline_disposition"/> + <item + mime_type="audio/microsoft-wav" + format="org_gnome_audio_inline_format" + flags="inline_disposition"/> + <item + mime_type="audio/x-wma" + format="org_gnome_audio_inline_format" + flags="inline_disposition"/> + <item + mime_type="audio/x-ms-wma" + 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> diff --git a/plugins/backup-restore/backup.c b/plugins/backup-restore/backup.c index ac0b257d17..39ed4de4a9 100644 --- a/plugins/backup-restore/backup.c +++ b/plugins/backup-restore/backup.c @@ -431,22 +431,21 @@ dlg_response (GtkWidget *dlg, gint response, gpointer data) int main (int argc, char **argv) { - GnomeProgram *program; - GOptionContext *context; char *file = NULL, *oper = NULL; gint i; + GError *error = NULL; - gtk_init (&argc, &argv); bindtextdomain (GETTEXT_PACKAGE, EVOLUTION_LOCALEDIR); bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8"); textdomain (GETTEXT_PACKAGE); - context = g_option_context_new (NULL); - g_option_context_add_main_entries (context, options, GETTEXT_PACKAGE); - program = gnome_program_init (PACKAGE, VERSION, LIBGNOME_MODULE, argc, argv, - GNOME_PROGRAM_STANDARD_PROPERTIES, - GNOME_PARAM_GOPTION_CONTEXT, context, - GNOME_PARAM_NONE); + gtk_init_with_args ( + &argc, &argv, NULL, options, GETTEXT_PACKAGE, &error); + if (error != NULL) { + g_printerr ("%s\n", error->message); + g_error_free (error); + exit (1); + } if (opt_remaining) { for (i = 0; i < g_strv_length (opt_remaining); i++) { diff --git a/plugins/bbdb/Makefile.am b/plugins/bbdb/Makefile.am index 1f1ddfea46..a91fd41a60 100644 --- a/plugins/bbdb/Makefile.am +++ b/plugins/bbdb/Makefile.am @@ -1,6 +1,7 @@ INCLUDES = \ -I$(top_builddir)/composer \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) \ $(EVOLUTION_ADDRESSBOOK_CFLAGS) diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c index 00ca5acac5..afc13be3e8 100644 --- a/plugins/caldav/caldav-source.c +++ b/plugins/caldav/caldav-source.c @@ -304,7 +304,7 @@ oge_caldav (EPlugin *epl, char *username; const char *ssl_prop; gboolean ssl_enabled; - int row; + int row, i; source = t->source; group = e_source_peek_group (source); diff --git a/plugins/calendar-weather/Makefile.am b/plugins/calendar-weather/Makefile.am index 2e2be150e3..cb0253e8fe 100644 --- a/plugins/calendar-weather/Makefile.am +++ b/plugins/calendar-weather/Makefile.am @@ -1,5 +1,4 @@ eds_datadir = `pkg-config --variable=privdatadir evolution-data-server-1.2` -weatherdatadir = $(datadir)/evolution/$(BASE_VERSION)/weather INCLUDES = \ -I$(top_srcdir) \ @@ -12,15 +11,6 @@ INCLUDES = \ @EVO_PLUGIN_RULE@ -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 diff --git a/plugins/calendar-weather/calendar-weather.c b/plugins/calendar-weather/calendar-weather.c index f61d90c4d0..77eda067aa 100644 --- a/plugins/calendar-weather/calendar-weather.c +++ b/plugins/calendar-weather/calendar-weather.c @@ -51,8 +51,8 @@ int e_plugin_lib_enable (EPluginLib *epl, int enable) { GList *l; - gboolean found = FALSE; - const char *tmp; + const gchar *tmp; + gint ii; static struct { const char *description; @@ -74,24 +74,21 @@ e_plugin_lib_enable (EPluginLib *epl, int enable) /* Add the categories icons if we don't have them. */ for (l = e_categories_get_list (); l; l = g_list_next (l)) { - if (!strcmp ((const char *)l->data, tmp)) { - found = TRUE; - break; - } + if (!strcmp ((const char *)l->data, tmp)) + goto exit; } - if (!found) { - int i; - - for (i = 0; categories[i].description; i++) { - char *filename; + for (ii = 0; categories[ii].description; ii++) { + char *filename; - filename = e_icon_factory_get_icon_filename (categories[i].icon_name, E_ICON_SIZE_MENU); - e_categories_add (_(categories[i].description), NULL, filename, FALSE); - g_free (filename); - } + filename = e_icon_factory_get_icon_filename ( + categories[ii].icon_name, E_ICON_SIZE_MENU); + e_categories_add ( + _(categories[ii].description), NULL, filename, FALSE); + g_free (filename); } +exit: return 0; } 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/external-editor/external-editor.c b/plugins/external-editor/external-editor.c index 140eff1089..5ba4ca7830 100644 --- a/plugins/external-editor/external-editor.c +++ b/plugins/external-editor/external-editor.c @@ -204,9 +204,7 @@ async_external_editor (GArray *array) */ composer = e_msg_composer_new_with_message (message); - g_signal_connect (GTK_OBJECT (composer), "send", G_CALLBACK (em_utils_composer_send_cb), NULL); - g_signal_connect (GTK_OBJECT (composer), "save-draft", G_CALLBACK (em_utils_composer_save_draft_cb), NULL); - + /* Composer cannot be shown in any random thread. Should happen in main thread */ g_idle_add ((GSourceFunc) show_composer_dialog, composer); diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c index 46210d0956..64653a073a 100644 --- a/plugins/groupwise-features/proxy-login.c +++ b/plugins/groupwise-features/proxy-login.c @@ -43,6 +43,7 @@ #include <e-util/e-error.h> #include <e-util/e-icon-factory.h> #include <e-util/e-util-private.h> +#include <e-util/e-account-utils.h> #include <e-gw-container.h> #include <e-gw-connection.h> @@ -302,7 +303,7 @@ proxy_login_cb (GtkDialog *dialog, gint state) static void proxy_soap_login (char *email) { - EAccountList *accounts = mail_config_get_accounts(); + EAccountList *accounts = e_get_account_list (); EAccount *srcAccount; EAccount *dstAccount; EGwConnection *proxy_cnc, *cnc; diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c index e3d20334b9..f3fb94967d 100644 --- a/plugins/imap-features/imap-headers.c +++ b/plugins/imap-features/imap-headers.c @@ -31,8 +31,7 @@ #include <gtk/gtk.h> -#include <libedataserver/e-account.h> -#include <libedataserver/e-account-list.h> +#include "e-util/e-account-utils.h" #include <camel/camel-url.h> #include <camel/camel-exception.h> @@ -84,7 +83,7 @@ imap_headers_commit (EPlugin *efp, EConfigHookItemFactoryData *data) if (g_str_has_prefix (account->source->url, "imap://") || (use_imap && g_str_has_prefix (account->source->url, "groupwise://"))) { EAccount *temp = NULL; - EAccountList *accounts = mail_config_get_accounts (); + EAccountList *accounts = e_get_account_list (); CamelURL *url = NULL; CamelException ex; GtkTreeModel *model; diff --git a/plugins/import-ics-attachments/ChangeLog b/plugins/import-ics-attachments/ChangeLog deleted file mode 100644 index 21a9408c9c..0000000000 --- a/plugins/import-ics-attachments/ChangeLog +++ /dev/null @@ -1,109 +0,0 @@ -2009-01-21 Milan Crha <mcrha@redhat.com> - - * Makefile.am: Use also EVOLUTION_CALENDAR_CFLAGS. - -2008-09-02 Sankar P <psankar@novell.com> - -License Changes - - * icsimporter.c: - -2008-08-12 Bharath Acharya <abharath@novell.com> - - * Makefile.am: Added necessary libraries to link to. Build break while - compiling on Windows. - -2008-08-11 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #546892 - - * icsimporter.c: - Prefer gtk_image_new_from_icon_name() over e_icon_factory_get_image(). - -2008-04-17 Milan Crha <mcrha@redhat.com> - - ** Part of fix for bug #526739 - - * icsimporter.c: Do not include gnome-vfs. - -2007-02-20 Paul Bolle <pebolle@tiscali.nl> - - ** Fix for bug #517082 - - * icsimporter.c: (init_widgets): Fix small leak. - -2008-02-06 Milan Crha <mcrha@redhat.com> - - ** Fix for bug #514622 - - * icsimporter.c: (dialog_close_cb): Drop this function. - * icsimporter.c: (init_widgets), (dialog_response_cb), - (ical_import_done): Do not call "close" on already closed dialog. - -2007-10-01 Milan Crha <mcrha@redhat.com> - - * icsimporter.c: (prepare_events), (prepare_tasks): - Really go through every component when removing one. - -2007-06-03 Srinivasa Ragavan <sragavan@novell.com> - - ** Fix for version removal from Installed files from Gilles Dartiguelongue - - * Makefile.am: - -2007-05-12 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #337616 - - * Makefile.am: Add "eplug" file to CLEANFILES. - -2007-03-27 Matthew Barnes <mbarnes@redhat.com> - - * icsimporter.c: Don't mix declarations and code (#405495). - -2007-03-20 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #419524 - - * Include <glib/gi18n.h> instead of <libgnome/gnome-i18n.h>. - -2006-11-28 Parthasarathi Susarla <ajaysusarla@gmail.com> - - ** Fix bug #348679 - - * icsimporter.c: (org_gnome_evolution_import_ics_attachment): - Do not access structure elements directly. Use the methods of the - class in the CamelDataWrapper Class - -2006-08-28 Kjartan Maraas <kmaraas@gnome.org> - - * org-gnome-evolution-mail-attachments-import-ics.eplug.xml: Mark - name and description for translation. - -2006-08-23 Srinivasa Ragavan <sragavan@novell.com> - - ** Fix for bug #347248 - - * icsimporter.c: (get_menu_type), (import_ics): Update the - em_utils_temp_save_part to use readwrite mode. - -2006-02-21 Chenthill Palanisamy <pchenthill@novell.com> - - reviewed by Veerapuram Varadhan <vvaradhan@novell.com> - - Fixes a crash - * icsimporter.c: (org_gnome_evolution_import_ics_attachments): - If the number of attachments selected is not equal to one, just return; - - -2006-01-22 Harish Krishnaswamy <kharish@novell.com> - - * icsimporter.c (get_menu_type), (dialog_response_cb), - (dialog_close_cb), (get_icalcomponent_from_file): - Fix twenty odd compiler warnings and style oddness. - -2006-01-17 Harish Krishnaswamy <kharish@novell.com> - - * import-ics-attachments : Initial commits. Plugin written and submitted by - Johnny Jacob <johnnyjacob@gmail.com> - diff --git a/plugins/import-ics-attachments/Makefile.am b/plugins/import-ics-attachments/Makefile.am deleted file mode 100644 index baded42123..0000000000 --- a/plugins/import-ics-attachments/Makefile.am +++ /dev/null @@ -1,35 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir)\ - -I$(top_srcdir)/camel \ - -I$(top_srcdir)/widgets/misc \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - -DEVOLUTION_DATADIR=\""$(datadir)"\" \ - -DEVOLUTION_PRIVDATADIR=\""$(privdatadir)"\" \ - -DEVOLUTION_ICONSDIR=\""$(imagesdir)"\" \ - -DEVOLUTION_IMAGES=\""$(imagesdir)"\" \ - -DEVOLUTION_BUTTONSDIR=\""$(buttonsdir)"\" \ - -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ - -DEVOLUTION_UIDIR=\""$(evolutionuidir)"\" \ - -DCAMEL_PROVIDERDIR=\""$(camel_providerdir)"\" \ - -DPLUGINDIR=\""$(plugindir)"\" \ - -DPREFIX=\""$(prefix)"\" - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-evolution-mail-attachments-import-ics.eplug -plugin_LTLIBRARIES = liborg-gnome-evolution-mail-attachments-import-ics.la - -liborg_gnome_evolution_mail_attachments_import_ics_la_SOURCES = icsimporter.c -liborg_gnome_evolution_mail_attachments_import_ics_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_evolution_mail_attachments_import_ics_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/mail/libevolution-mail.la \ - $(top_builddir)/calendar/common/libevolution-calendarprivate.la \ - $(EVOLUTION_CALENDAR_LIBS) \ - $(EVOLUTION_MAIL_LIBS) - -EXTRA_DIST = org-gnome-evolution-mail-attachments-import-ics.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) diff --git a/plugins/import-ics-attachments/icsimporter.c b/plugins/import-ics-attachments/icsimporter.c deleted file mode 100644 index fbd5e46518..0000000000 --- a/plugins/import-ics-attachments/icsimporter.c +++ /dev/null @@ -1,435 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Johnny Jacob <johnnyjacob@gmail.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif -#include <string.h> -#include <glib.h> -#include <gtk/gtk.h> -#include <glib/gi18n.h> -#include <e-util/e-config.h> -#include <e-util/e-popup.h> -#include <mail/em-popup.h> -#include <mail/em-menu.h> -#include <mail/mail-ops.h> -#include <mail/mail-mt.h> -#include <mail/em-folder-view.h> -#include <mail/em-format-html-display.h> -#include <mail/em-utils.h> -#include "e-attachment-bar.h" -#include <camel/camel-vee-folder.h> -#include "e-util/e-error.h" -#include <libedataserverui/e-source-selector.h> -#include <libecal/e-cal.h> -#include <libical/icalvcal.h> -#include <calendar/common/authentication.h> - -typedef struct { - ECal *client; - int source_type; - icalcomponent *icalcomp; - GtkWidget *window; - GtkWidget *selector; -} ICalImporterData; - - -static void import_ics (EPlugin *ep, EPopupTarget *t, void *data); -static icalcomponent* get_icalcomponent_from_file(char *filename); -static void prepare_events (icalcomponent *icalcomp, GList **vtodos); -static void prepare_tasks (icalcomponent *icalcomp, GList *vtodos); -static void import_items(ICalImporterData *icidata); -static gboolean update_objects (ECal *client, icalcomponent *icalcomp); -static void dialog_response_cb (GtkDialog *dialog, gint response_id, ICalImporterData *icidata); -static void ical_import_done(ICalImporterData *icidata); -static void init_widgets (char *path); -static icalcomponent_kind get_menu_type (void *data); - -void org_gnome_evolution_import_ics_attachments (EPlugin *ep, EMPopupTargetAttachments *t); -void org_gnome_evolution_import_ics_part (EPlugin *ep, EMPopupTargetPart *t); - -static void -popup_free (EPopup *ep, GSList *items, void *data) -{ - g_slist_free (items); -} - -static EPopupItem popup_calendar_items[] = { - { E_POPUP_BAR, "25.display.00"}, - { E_POPUP_ITEM, "25.display.01", N_("_Import to Calendar"), (EPopupActivateFunc)import_ics, NULL, "stock_mail-import"} -}; - -static EPopupItem popup_tasks_items[] = { - { E_POPUP_BAR, "25.display.00"}, - { E_POPUP_ITEM, "25.display.01", N_("_Import to Tasks"), (EPopupActivateFunc)import_ics, NULL, "stock_mail-import"} -}; - - -void org_gnome_evolution_import_ics_attachments (EPlugin *ep, EMPopupTargetAttachments *t) -{ - GSList *menus = NULL; - icalcomponent_kind kind; - int len = 0; - int i = 0; - CamelContentType *type; - - len = g_slist_length(t->attachments); - - if (len != 1) - return; - - type = camel_data_wrapper_get_mime_type_field (((CamelDataWrapper *) ((EAttachment *) t->attachments->data)->body)); - if (type && camel_content_type_is(type, "text", "calendar")) { - - kind = get_menu_type (t); - - if (kind == ICAL_VTODO_COMPONENT ) { - for (i = 0; i < sizeof (popup_tasks_items) / sizeof (popup_tasks_items[0]); i++) - menus = g_slist_prepend (menus, &popup_tasks_items[i]); - } else if ( kind == ICAL_VEVENT_COMPONENT) { - for (i = 0; i < sizeof (popup_calendar_items) / sizeof (popup_calendar_items[0]); i++) - menus = g_slist_prepend (menus, &popup_calendar_items[i]); - } - - e_popup_add_items (t->target.popup, menus, NULL, popup_free, t); - } -} - -void org_gnome_evolution_import_ics_part (EPlugin*ep, EMPopupTargetPart *t) -{ - GSList *menus = NULL; - icalcomponent_kind kind; - int i = 0; - - if (!camel_content_type_is(((CamelDataWrapper *) t->part)->mime_type, "text", "calendar")) - return; - - kind = get_menu_type (t); - - if (kind == ICAL_VTODO_COMPONENT ) { - for (i = 0; i < sizeof (popup_tasks_items) / sizeof (popup_tasks_items[0]); i++) - menus = g_slist_prepend (menus, &popup_tasks_items[i]); - } else if ( kind == ICAL_VEVENT_COMPONENT) { - for (i = 0; i < sizeof (popup_calendar_items) / sizeof (popup_calendar_items[0]); i++) - menus = g_slist_prepend (menus, &popup_calendar_items[i]); - } - - e_popup_add_items (t->target.popup, menus, NULL, popup_free, t); -} - -static icalcomponent_kind -get_menu_type (void *data) -{ - CamelMimePart *part; - char *path; - icalcomponent *icalcomp, *subcomp; - icalcomponent_kind kind; - EPopupTarget *target = (EPopupTarget *) data; - - if (target->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) target)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) target)->part; - - path = em_utils_temp_save_part (NULL, part, FALSE); - - icalcomp = get_icalcomponent_from_file (path); - - subcomp = icalcomponent_get_inner(icalcomp); - kind = icalcomponent_isa (subcomp); - - if (kind == ICAL_VTODO_COMPONENT ) { - return ICAL_VTODO_COMPONENT; - } else if ( kind == ICAL_VEVENT_COMPONENT) { - return ICAL_VEVENT_COMPONENT; - } - return ICAL_NO_COMPONENT; -} - -static void -import_ics (EPlugin *ep, EPopupTarget *t, void *data) -{ - CamelMimePart *part; - char *path; - EPopupTarget *target = (EPopupTarget *) data; - - if (target->type == EM_POPUP_TARGET_ATTACHMENTS) - part = ((EAttachment *) ((EMPopupTargetAttachments *) target)->attachments->data)->body; - else - part = ((EMPopupTargetPart *) target)->part; - - path = em_utils_temp_save_part (NULL, part, FALSE); - init_widgets(path); -} - -static void -init_widgets(char *path) -{ - - GtkWidget *vbox, *hbox, *dialog; - icalcomponent_kind kind; - icalcomponent *subcomp; - GtkWidget *selector, *label; - ESourceList *source_list; - ESource *primary; - GtkWidget *scrolled; - ICalImporterData *icidata = g_malloc0(sizeof(*icidata)); - GtkWidget *icon, *button; - char *label_str = NULL; - char *markup; - - g_return_if_fail ( path != NULL); - dialog = gtk_dialog_new_with_buttons (_("Import ICS"), - NULL, GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, - NULL); - icidata->window = dialog; - g_signal_connect (dialog, - "response", - G_CALLBACK (dialog_response_cb), - icidata); - - vbox = GTK_DIALOG(dialog)->vbox; - hbox = gtk_hbox_new (FALSE, FALSE); - label = gtk_label_new(NULL); - - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, TRUE, 6); - - icidata->icalcomp = get_icalcomponent_from_file (path); - - subcomp = icalcomponent_get_inner(icidata->icalcomp); - kind = icalcomponent_isa (subcomp); - - if (kind == ICAL_VTODO_COMPONENT ) { - e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_TODO, NULL); - label_str = _("Select Task List"); - icidata->source_type = E_CAL_SOURCE_TYPE_TODO; - } else if ( kind == ICAL_VEVENT_COMPONENT) { - e_cal_get_sources (&source_list, E_CAL_SOURCE_TYPE_EVENT, NULL); - label_str = _("Select Calendar"); - icidata->source_type = E_CAL_SOURCE_TYPE_EVENT; - } - - markup = g_markup_printf_escaped ("<b>%s</b>", label_str); - gtk_label_set_markup (GTK_LABEL (label), markup); - g_free (markup); - hbox = gtk_hbox_new (FALSE, FALSE); - gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 6); - gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 6); - - selector = e_source_selector_new (source_list); - e_source_selector_show_selection (E_SOURCE_SELECTOR (selector), FALSE); - scrolled = gtk_scrolled_window_new(NULL, NULL); - gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW (scrolled), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - gtk_container_add((GtkContainer *)scrolled, selector); - gtk_scrolled_window_set_shadow_type (GTK_SCROLLED_WINDOW (scrolled), GTK_SHADOW_IN); - hbox = gtk_hbox_new (FALSE, FALSE); - gtk_box_pack_start (GTK_BOX (hbox), scrolled, TRUE, TRUE, 6); - gtk_box_pack_start (GTK_BOX (vbox), hbox, TRUE, TRUE, 6); - icidata->selector = selector; - - - /* FIXME What if no sources? */ - primary = e_source_list_peek_source_any (source_list); - e_source_selector_set_primary_selection (E_SOURCE_SELECTOR (selector), primary); - - g_object_unref (source_list); - hbox = gtk_hbox_new (FALSE, FALSE); - icon = gtk_image_new_from_icon_name ( - "stock_mail-import", GTK_ICON_SIZE_MENU); - gtk_box_pack_start (GTK_BOX(hbox), icon, FALSE, FALSE, 6); - label = gtk_label_new_with_mnemonic (_("_Import")); - gtk_box_pack_start (GTK_BOX(hbox), label, FALSE, FALSE, 6); - gtk_widget_show(label); - button = gtk_button_new (); - gtk_container_add (GTK_CONTAINER (button), hbox); - gtk_dialog_add_action_widget (GTK_DIALOG (dialog), button, GTK_RESPONSE_OK); - gtk_widget_grab_focus (button); - - gtk_window_set_default_size (GTK_WINDOW (dialog), 210,340); - gtk_widget_show_all (dialog); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); -} - -static void -dialog_response_cb (GtkDialog *dialog, gint response_id, ICalImporterData *icidata) -{ - switch (response_id) { - case GTK_RESPONSE_OK : - import_items(icidata); - break; - - case GTK_RESPONSE_CANCEL : - case GTK_RESPONSE_DELETE_EVENT : - break; - } -} - -/* This removes all components except VEVENTs and VTIMEZONEs from the toplevel */ -static void -prepare_events (icalcomponent *icalcomp, GList **vtodos) -{ - icalcomponent *subcomp; - icalcompiter iter; - - if (vtodos) - *vtodos = NULL; - - iter = icalcomponent_begin_component (icalcomp, ICAL_ANY_COMPONENT); - while ((subcomp = icalcompiter_deref (&iter)) != NULL) { - icalcomponent_kind child_kind = icalcomponent_isa (subcomp); - if (child_kind != ICAL_VEVENT_COMPONENT - && child_kind != ICAL_VTIMEZONE_COMPONENT) { - - icalcompiter_next (&iter); - - icalcomponent_remove_component (icalcomp, subcomp); - if (child_kind == ICAL_VTODO_COMPONENT && vtodos) - *vtodos = g_list_prepend (*vtodos, subcomp); - else - icalcomponent_free (subcomp); - } else { - icalcompiter_next (&iter); - } - } -} - -/* This removes all components except VTODOs and VTIMEZONEs from the toplevel - icalcomponent, and adds the given list of VTODO components. The list is - freed afterwards. */ -static void -prepare_tasks (icalcomponent *icalcomp, GList *vtodos) -{ - icalcomponent *subcomp; - GList *elem; - icalcompiter iter; - - iter = icalcomponent_begin_component (icalcomp, ICAL_ANY_COMPONENT); - while ((subcomp = icalcompiter_deref (&iter)) != NULL) { - icalcomponent_kind child_kind = icalcomponent_isa (subcomp); - if (child_kind != ICAL_VTODO_COMPONENT - && child_kind != ICAL_VTIMEZONE_COMPONENT) { - icalcompiter_next (&iter); - icalcomponent_remove_component (icalcomp, subcomp); - icalcomponent_free (subcomp); - } else { - icalcompiter_next (&iter); - } - } - - for (elem = vtodos; elem; elem = elem->next) { - icalcomponent_add_component (icalcomp, elem->data); - } - g_list_free (vtodos); -} - -static void -import_items(ICalImporterData *icidata) -{ - ESource *source; - g_return_if_fail (icidata != NULL); - - source = e_source_selector_peek_primary_selection ((ESourceSelector *)icidata->selector); - g_return_if_fail ( source != NULL); - - icidata->client = auth_new_cal_from_source (source, icidata->source_type); - e_cal_open (icidata->client, FALSE, NULL); - - switch (icidata->source_type) { - case E_CAL_SOURCE_TYPE_EVENT: - prepare_events (icidata->icalcomp, NULL); - if (!update_objects (icidata->client, icidata->icalcomp)) - /* FIXME: e_error ... */; - break; - case E_CAL_SOURCE_TYPE_TODO: - prepare_tasks (icidata->icalcomp, NULL); - if (!update_objects (icidata->client, icidata->icalcomp)) - /* FIXME: e_error ... */; - break; - default: - g_assert_not_reached (); - } - ical_import_done (icidata); -} - -static gboolean -update_objects (ECal *client, icalcomponent *icalcomp) -{ - icalcomponent_kind kind; - icalcomponent *vcal; - gboolean success = TRUE; - - kind = icalcomponent_isa (icalcomp); - - if (kind == ICAL_VTODO_COMPONENT || kind == ICAL_VEVENT_COMPONENT) { - vcal = e_cal_util_new_top_level (); - if (icalcomponent_get_method (icalcomp) == ICAL_METHOD_CANCEL) - icalcomponent_set_method (vcal, ICAL_METHOD_CANCEL); - else - icalcomponent_set_method (vcal, ICAL_METHOD_PUBLISH); - icalcomponent_add_component (vcal, icalcomponent_new_clone (icalcomp)); - } else if (kind == ICAL_VCALENDAR_COMPONENT) { - vcal = icalcomponent_new_clone (icalcomp); - if (!icalcomponent_get_first_property (vcal, ICAL_METHOD_PROPERTY)) - icalcomponent_set_method (vcal, ICAL_METHOD_PUBLISH); - } else - return FALSE; - - if (!e_cal_receive_objects (client, vcal, NULL)) - success = FALSE; - - icalcomponent_free (vcal); - - return success; -} - -static void -ical_import_done(ICalImporterData *icidata) -{ - g_object_unref (icidata->client); - icalcomponent_free (icidata->icalcomp); - g_free (icidata); -} - -static icalcomponent * -get_icalcomponent_from_file(char *filename) -{ - char *contents; - icalcomponent *icalcomp; - - g_return_val_if_fail (filename != NULL, NULL); - - if (!g_file_get_contents (filename, &contents, NULL, NULL)) { - g_free (filename); - return NULL; - } - g_free (filename); - - icalcomp = e_cal_util_parse_ics_string (contents); - g_free (contents); - - if (icalcomp) { - return icalcomp; - } - return NULL; -} diff --git a/plugins/import-ics-attachments/org-gnome-evolution-mail-attachments-import-ics.eplug.xml b/plugins/import-ics-attachments/org-gnome-evolution-mail-attachments-import-ics.eplug.xml deleted file mode 100644 index 745d0fb724..0000000000 --- a/plugins/import-ics-attachments/org-gnome-evolution-mail-attachments-import-ics.eplug.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <!-- the path to the shared library --> - <e-plugin - id="org.gnome.evolution.mail.attachments.import.ics" - type="shlib" - location="@PLUGINDIR@/liborg-gnome-evolution-mail-attachments-import-ics@SOEXT@" - _name="Import to Calendar"> - - <author name="Johnny Jacob" email="johnnyjacob@gmail.com"/> - <_description>Imports ICS attachments to calendar.</_description> - - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.formathtmldisplay.popup" target="part" factory="org_gnome_evolution_import_ics_part"> - </menu> - </hook> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.attachments.popup" target="attachments" factory="org_gnome_evolution_import_ics_attachments"> - </menu> - </hook> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu target="attachments" id="org.gnome.evolution.mail.composer.attachmentbar.popup" factory="org_gnome_evolution_import_ics_attachments"> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/mail-account-disable/ChangeLog b/plugins/mail-account-disable/ChangeLog deleted file mode 100644 index 86dc9a4897..0000000000 --- a/plugins/mail-account-disable/ChangeLog +++ /dev/null @@ -1,62 +0,0 @@ -2008-10-03 Sankar P <psankar@novell.com> - -License Changes - - * mail-account-disable.c: - -2007-11-18 Gilles Dartiguelongue <gdartigu@svn.gnome.org> - - ** Fix bug #495875 - - * mail-account-disable.c: - right click menu reordering - -2007-04-02 Sankar P <psankar@novell.com> - - * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr> - - * org-gnome-mail-account-disable.eplug.xml: - Cleanup. - Fixes part of #301149 - -2006-08-21 Matthew Barnes <mbarnes@redhat.com> - - * mail-account-disable.c: - "Disable" did not work for "On This Computer" - fixes bug 350901. - -2006-01-06 Simon Zheng <simon.zheng@sun.com> - - * mail-account-disable.c: - use libedataserver/e-account-list.h instead of e-util/e-account-list.h. - use libedataserver/e-account.h instead of e-util/e-account.h. - -2005-12-12 Harish Krishnaswamy <kharish@novell.com> - - * Makefile.am: Fix make-clean issues. - -2005-08-23 Not Zed <NotZed@Ximian.com> - - * Makefile.am: Remove the special case for win32, its a bug on all - platforms, silly. - - * mail-account-disable.c (mail_account_disable): make signature - match usage. - -2005-07-13 Tor Lillqvist <tml@novell.com> - - * Makefile.am (INCLUDES): Remove duplicated line. - (LDFLAGS): Use NO_UNDEFINED. - (LIBADD): Link with the required libraries, but let's do it only - on Win32. - - * org-gnome-mail-account-disable.eplug.xml: Use SOEXT. - -2005-07-12 Vivek Jain <jvivek@novell.com> - - have a ChangeLog and transfer the changelog entry from the main - ChangeLog - (2005-07-10 Shreyas Srinivasan <sshreyas@novell.com>) - - * plugins/mail-account-disable/*: Plugin to add Disable/ Proxy - Logout to a store menu on right click. - diff --git a/plugins/mail-account-disable/Makefile.am b/plugins/mail-account-disable/Makefile.am deleted file mode 100644 index 7ec8a1124e..0000000000 --- a/plugins/mail-account-disable/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -INCLUDES = \ - -I$(top_srcdir) \ - -I$(top_builddir)/mail \ - $(EVOLUTION_MAIL_CFLAGS) \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-mail-account-disable.eplug -plugin_LTLIBRARIES = libmail-account-disable.la - -libmail_account_disable_la_SOURCES = mail-account-disable.c -libmail_account_disable_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -libmail_account_disable_la_LIBADD = $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/mail/libevolution-mail.la \ - $(EVOLUTION_MAIL_LIBS) - -EXTRA_DIST = org-gnome-mail-account-disable.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) diff --git a/plugins/mail-account-disable/mail-account-disable.c b/plugins/mail-account-disable/mail-account-disable.c deleted file mode 100644 index 886b66a66f..0000000000 --- a/plugins/mail-account-disable/mail-account-disable.c +++ /dev/null @@ -1,100 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Shreyas Srinivasan <sshreyas@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include <config.h> -#endif - -#include <glib.h> -#include <glib/gi18n.h> -#include <string.h> -#include <mail/mail-component.h> -#include <mail/em-folder-selector.h> -#include <mail/em-popup.h> -#include <mail/em-account-editor.h> -#include <mail/mail-config.h> -#include <libedataserver/e-account.h> -#include <libedataserver/e-account-list.h> - -#define ACCOUNT_DISABLE 0 -#define PROXY_LOGOUT 1 - -void mail_account_disable (EPopup *ep, EPopupItem *p, void *data); -void org_gnome_create_mail_account_disable (EPlugin *ep, EMPopupTargetFolder *t); - -static EPopupItem popup_items[] = { - { E_POPUP_ITEM, "40.emc.04", N_("_Disable"), mail_account_disable, NULL, NULL, 0, EM_POPUP_FOLDER_STORE }, - { E_POPUP_ITEM, "40.emc.04", N_("Proxy _Logout"), mail_account_disable, NULL, NULL, 0, EM_POPUP_FOLDER_STORE } -}; - -static void -popup_free (EPopup *ep, GSList *items, void *data) -{ - g_slist_free (items); -} - -void -mail_account_disable (EPopup *ep, EPopupItem *p, void *data) -{ - MailComponent *component; - EAccount *account = data; - - g_assert (account != NULL); - - component = mail_component_peek (); - - if (mail_config_has_proxies (account)) - mail_config_remove_account_proxies (account); - - account->enabled = !account->enabled; - e_account_list_change (mail_config_get_accounts (), account); - mail_component_remove_store_by_uri (component, account->source->url); - - if (account->parent_uid) - mail_config_remove_account (account); - - mail_config_save_accounts(); -} - -void -org_gnome_create_mail_account_disable (EPlugin *ep, EMPopupTargetFolder *t) -{ - EAccount *account; - GSList *menus = NULL; - - account = mail_config_get_account_by_source_url (t->uri); - - if (account == NULL) - return; - - if (g_strrstr (t->uri,"groupwise://") && account->parent_uid) { - popup_items[PROXY_LOGOUT].label = _(popup_items [PROXY_LOGOUT].label); - menus = g_slist_prepend (menus, &popup_items [PROXY_LOGOUT]); - } - else { - popup_items[ACCOUNT_DISABLE].label = _(popup_items [ACCOUNT_DISABLE].label); - menus = g_slist_prepend (menus, &popup_items [ACCOUNT_DISABLE]); - } - - e_popup_add_items (t->target.popup, menus, NULL, popup_free, account); -} - diff --git a/plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml b/plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml deleted file mode 100644 index f1e0b34ef9..0000000000 --- a/plugins/mail-account-disable/org-gnome-mail-account-disable.eplug.xml +++ /dev/null @@ -1,18 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - id="org.gnome.mail.account.disable" - type="shlib" - domain="@GETTEXT_PACKAGE@" - _name="Disable Account" - location="@PLUGINDIR@/libmail-account-disable@SOEXT@"> - <_description>Allows disabling of accounts.</_description> - <author name="Shreyas Srinivasan" email="sshreyas@novell.com"/> - - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder" - factory="org_gnome_create_mail_account_disable"> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/mail-notification/Makefile.am b/plugins/mail-notification/Makefile.am index 8915fe92ad..7e56421987 100644 --- a/plugins/mail-notification/Makefile.am +++ b/plugins/mail-notification/Makefile.am @@ -7,6 +7,7 @@ endif INCLUDES = \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) \ $(LIBNOTIFY_CFLAGS) diff --git a/plugins/mark-all-read/Makefile.am b/plugins/mark-all-read/Makefile.am index 756e945d00..c13125c7a5 100644 --- a/plugins/mark-all-read/Makefile.am +++ b/plugins/mark-all-read/Makefile.am @@ -12,7 +12,7 @@ liborg_gnome_mark_all_read_la_SOURCES = mark-all-read.c liborg_gnome_mark_all_read_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_mark_all_read_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/mail/libevolution-mail.la \ + $(top_builddir)/mail/libevolution-module-mail.la \ $(EVOLUTION_MAIL_LIBS) EXTRA_DIST = org-gnome-mark-all-read.eplug.xml diff --git a/plugins/mark-all-read/mark-all-read.c b/plugins/mark-all-read/mark-all-read.c index c9ea67ca61..c98b33edd1 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -28,20 +28,27 @@ #include <glib.h> #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <e-util/e-config.h> -#include <mail/em-popup.h> +#include <e-util/e-plugin-ui.h> +#include <mail/e-mail-shell-sidebar.h> +#include <mail/em-folder-tree.h> #include <mail/mail-ops.h> #include <mail/mail-mt.h> #include <camel/camel-vee-folder.h> #include "e-util/e-error.h" +#include <shell/e-shell-sidebar.h> +#include <shell/e-shell-window.h> +#include <shell/e-shell-window-actions.h> + #define PRIMARY_TEXT \ N_("Also mark messages in subfolders?") #define SECONDARY_TEXT \ N_("Do you want to mark messages as read in the current folder " \ "only, or in the current folder as well as all subfolders?") -void org_gnome_mark_all_read (EPlugin *ep, EMPopupTargetFolder *target); +gboolean e_plugin_ui_init (GtkUIManager *manager, + EShellView *shell_view); + static void mar_got_folder (char *uri, CamelFolder *folder, void *data); static void mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex); @@ -190,16 +197,6 @@ prompt_user (void) return response; } -void -org_gnome_mark_all_read (EPlugin *ep, EMPopupTargetFolder *t) -{ - if (t->uri == NULL) { - return; - } - - mail_get_folder(t->uri, 0, mar_got_folder, NULL, mail_msg_unordered_push); -} - static void mark_all_as_read (CamelFolder *folder) { @@ -270,3 +267,52 @@ mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex) fi = fi->next; } } + +static void +action_mail_mark_read_recursive_cb (GtkAction *action, + EShellView *shell_view) +{ + EMailShellSidebar *mail_shell_sidebar; + EShellSidebar *shell_sidebar; + EMFolderTree *folder_tree; + const gchar *folder_uri; + + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + g_return_if_fail (E_IS_MAIL_SHELL_SIDEBAR (shell_sidebar)); + + mail_shell_sidebar = E_MAIL_SHELL_SIDEBAR (shell_sidebar); + folder_tree = e_mail_shell_sidebar_get_folder_tree (mail_shell_sidebar); + folder_uri = em_folder_tree_get_selected_uri (folder_tree); + g_return_if_fail (folder_uri != NULL); + + mail_get_folder ( + folder_uri, 0, mar_got_folder, NULL, mail_msg_unordered_push); +} + +static GtkActionEntry entries[] = { + + { "mail-mark-read-recursive", + "mail-mark-read", + N_("Mark Me_ssages as Read"), + NULL, + NULL, /* XXX Add a tooltip! */ + G_CALLBACK (action_mail_mark_read_recursive_cb) } +}; + +gboolean +e_plugin_ui_init (GtkUIManager *manager, + EShellView *shell_view) +{ + EShellWindow *shell_window; + GtkActionGroup *action_group; + + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = E_SHELL_WINDOW_ACTION_GROUP_SHELL (shell_window); + + /* Add actions to the "shell" action group. */ + gtk_action_group_add_actions ( + action_group, entries, + G_N_ELEMENTS (entries), shell_view); + + return TRUE; +} diff --git a/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml b/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml index a4542572a5..76c0864fa1 100644 --- a/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml +++ b/plugins/mark-all-read/org-gnome-mark-all-read.eplug.xml @@ -1,18 +1,21 @@ <?xml version="1.0"?> <e-plugin-list> - <e-plugin - id="org.gnome.evolution.mail.folder.mark_all_read" - type="shlib" - domain="@GETTEXT_PACKAGE@" - _name="Mark All Read" - location="@PLUGINDIR@/liborg-gnome-mark-all-read@SOEXT@"> - <author name="Chenthill Palanisamy" email="pchenthill@novell.com"/> - <_description>Used for marking all the messages under a folder as read</_description> + <e-plugin id="org.gnome.evolution.mail.folder.mark_all_read" + type="shlib" + domain="@GETTEXT_PACKAGE@" + _name="Mark All Read" + location="@PLUGINDIR@/liborg-gnome-mark-all-read@SOEXT@"> + <author name="Chenthill Palanisamy" email="pchenthill@novell.com"/> + <_description>Used for marking all the messages under a folder as read</_description> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder"> - <item type="item" path="30.emc.01" icon="mail-mark-read" _label="Mark Me_ssages as Read" activate="org_gnome_mark_all_read" enable="folder" visible="folder"/> - </menu> - </hook> - </e-plugin> + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.mail"> + <popup name="mail-folder-popup"> + <placeholder name="mail-folder-popup-actions"> + <menuitem action="mail-mark-read-recursive"/> + </placeholder> + </popup> + </ui-manager> + </hook> + </e-plugin> </e-plugin-list> diff --git a/plugins/plugin-manager/Makefile.am b/plugins/plugin-manager/Makefile.am index f9d6642521..22e4ca7d51 100644 --- a/plugins/plugin-manager/Makefile.am +++ b/plugins/plugin-manager/Makefile.am @@ -4,7 +4,7 @@ INCLUDES = \ @EVO_PLUGIN_RULE@ -plugin_DATA = org-gnome-plugin-manager.eplug org-gnome-plugin-manager.xml +plugin_DATA = org-gnome-plugin-manager.eplug plugin_LTLIBRARIES = liborg-gnome-plugin-manager.la liborg_gnome_plugin_manager_la_SOURCES = plugin-manager.c @@ -13,9 +13,8 @@ liborg_gnome_plugin_manager_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ $(EVOLUTION_MAIL_LIBS) -EXTRA_DIST = \ - org-gnome-plugin-manager.eplug.xml \ - org-gnome-plugin-manager.xml +EXTRA_DIST = \ + org-gnome-plugin-manager.eplug.xml BUILT_SOURCES = org-gnome-plugin-manager.eplug diff --git a/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml b/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml index d8e4849f2f..c931b5c968 100644 --- a/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml +++ b/plugins/plugin-manager/org-gnome-plugin-manager.eplug.xml @@ -6,18 +6,19 @@ location="@PLUGINDIR@/liborg-gnome-plugin-manager@SOEXT@" _name="Plugin Manager" system_plugin="true"> - <_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> + <_description>A plugin for managing which plugins are enabled or disabled.</_description> + + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.shell"> + <menubar name="main-menu"> + <menu action="edit-menu"> + <placeholder name="administrative-actions"> + <menuitem action="plugin-manager"/> + </placeholder> + </menu> + </menubar> + </ui-manager> </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 3f74a2dd4c..0000000000 --- a/plugins/plugin-manager/org-gnome-plugin-manager.xml +++ /dev/null @@ -1,15 +0,0 @@ -<Root> - <commands> - <cmd name="EPluginManagerManage" _label="_Plugins" - _tip="Enable and disable plugins"/> - </commands> - - <menu> - <submenu name="Edit"> - <placeholder name="PluginManagerPlaceholder"> - <menuitem name="EPluginManagerManage" verb=""/> - </placeholder> - </submenu> - - </menu> -</Root> diff --git a/plugins/plugin-manager/plugin-manager.c b/plugins/plugin-manager/plugin-manager.c index 19af3eeb7e..129ff0a74f 100644 --- a/plugins/plugin-manager/plugin-manager.c +++ b/plugins/plugin-manager/plugin-manager.c @@ -32,7 +32,8 @@ #include <stdio.h> #include "e-util/e-plugin.h" -#include "shell/es-menu.h" +#include "shell/e-shell-window.h" +#include "shell/e-shell-window-actions.h" #define d(S) (S) @@ -61,7 +62,6 @@ static struct { typedef struct _Manager Manager; struct _Manager { - GtkDialog *dialog; GtkTreeView *treeview; GtkTreeModel *model; @@ -75,13 +75,13 @@ struct _Manager { }; /* for tracking if we're shown */ -static GtkDialog *dialog; static GtkWidget *notebook; static GtkWidget *configure_page; static gint last_selected_page; static gulong switch_page_handler_id; -void org_gnome_plugin_manager_manage(void *ep, ESMenuTargetShell *t); +gboolean e_plugin_ui_init (GtkUIManager *manager, + EShellWindow *shell_window); static void eppm_set_label (GtkLabel *l, const char *v) @@ -221,19 +221,15 @@ eppm_free (void *data) } static void -eppm_response (GtkDialog *w, int button, Manager *m) -{ - gtk_widget_destroy (GTK_WIDGET (w)); - dialog = NULL; -} - -void -org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t) +action_plugin_manager_cb (GtkAction *action, + EShellWindow *shell_window) { Manager *m; int i; + GtkWidget *dialog; GtkWidget *hbox, *w; GtkWidget *overview_page; + GtkWidget *content_area; GtkListStore *store; GtkTreeSelection *selection; GtkCellRenderer *renderer; @@ -241,26 +237,23 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t) char *string; GtkWidget *subvbox; - if (dialog) { - gtk_window_present (GTK_WINDOW (dialog)); - return; - } - m = g_malloc0 (sizeof (*m)); /* Setup the ui */ - m->dialog = GTK_DIALOG (gtk_dialog_new_with_buttons (_("Plugin Manager"), - GTK_WINDOW (gtk_widget_get_toplevel (t->target.widget)), - GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, - NULL)); + dialog = gtk_dialog_new_with_buttons ( + _("Plugin Manager"), + GTK_WINDOW (shell_window), + GTK_DIALOG_DESTROY_WITH_PARENT, + GTK_STOCK_CLOSE, GTK_RESPONSE_CLOSE, NULL); + + content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - gtk_window_set_default_size (GTK_WINDOW (m->dialog), 640, 400); - g_object_set (G_OBJECT (m->dialog), "has_separator", FALSE, NULL); + gtk_window_set_default_size (GTK_WINDOW (dialog), 640, 400); + g_object_set (dialog, "has_separator", FALSE, NULL); hbox = gtk_hbox_new (FALSE, 0); gtk_container_set_border_width (GTK_CONTAINER (hbox), 12); - gtk_box_pack_start (GTK_BOX (m->dialog->vbox), hbox, TRUE, TRUE, 0); + gtk_box_pack_start (GTK_BOX (content_area), hbox, TRUE, TRUE, 0); string = g_strdup_printf ("<i>%s</i>", _("Note: Some changes will not take effect until restart")); @@ -272,7 +265,7 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t) gtk_widget_show (w); g_free (string); - gtk_box_pack_start (GTK_BOX (m->dialog->vbox), w, FALSE, TRUE, 6); + gtk_box_pack_start (GTK_BOX (content_area), w, FALSE, TRUE, 6); notebook = gtk_notebook_new (); gtk_notebook_set_show_tabs (GTK_NOTEBOOK (notebook), TRUE); @@ -423,24 +416,34 @@ org_gnome_plugin_manager_manage (void *ep, ESMenuTargetShell *t) atk_object_set_name (gtk_widget_get_accessible (GTK_WIDGET (m->treeview)), _("Plugin")); - g_object_set_data_full (G_OBJECT (m->dialog), "plugin-manager", m, eppm_free); - g_signal_connect (m->dialog, "response", G_CALLBACK (eppm_response), m); - - dialog = m->dialog; + gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_show (GTK_WIDGET (m->dialog)); + gtk_widget_destroy (dialog); + eppm_free (m); } -int e_plugin_lib_enable (EPluginLib *ep, int enable); +static GtkActionEntry entries[] = { -int -e_plugin_lib_enable (EPluginLib *ep, int enable) + { "plugin-manager", + NULL, + N_("_Plugins"), + NULL, + N_("Enable and disable plugins"), + G_CALLBACK (action_plugin_manager_cb) } +}; + +gboolean +e_plugin_ui_init (GtkUIManager *manager, + EShellWindow *shell_window) { - if (enable) { - } else { - /* This plugin can't be disabled ... */ - return -1; - } + GtkActionGroup *action_group; + + action_group = E_SHELL_WINDOW_ACTION_GROUP_SHELL (shell_window); + + /* Add actions to the "shell" action group. */ + gtk_action_group_add_actions ( + action_group, entries, + G_N_ELEMENTS (entries), shell_window); - return 0; + return TRUE; } diff --git a/plugins/save-attachments/ChangeLog b/plugins/save-attachments/ChangeLog deleted file mode 100644 index 9980fdf13d..0000000000 --- a/plugins/save-attachments/ChangeLog +++ /dev/null @@ -1,102 +0,0 @@ -2009-01-28 Tor Lillqvist <tml@novell.com> - - * Makefile.am: Use -no-undefined and link with more libs on - Windows. - -2008-09-19 Sankar P <psankar@novell.com> - -License Changes - - * save-attachments.c: - -2007-12-20 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #362638 - - * save-attachments.c: - Use the new MailMsg API for messages. - -2007-04-02 Sankar P <psankar@novell.com> - - * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr> - - * org-gnome-save-attachments.eplug.xml: - Cleanup. - Fixes part of #301149 - -2007-03-29 Matthew Barnes <mbarnes@redhat.com> - - * save-attachments.c: - Evolution requires GLib 2.10 now; remove dead backward-compatibility - code for GLib < 2.8 (#418971). - -2007-01-27 Nickolay V. Shmyrev <nshmyrev@yandex.ru> - - * save-attachments.c: (save_got_message): - mark strings as translatable. See bug #399381 for details. - -2006-07-07 Hiroyuki Ikezoe <poincare@ikezoe.net> - - ** Fixes bug #341369 - * save-attachments.c: fixing a memory leak. - -2006-02-28 Shi Pu <shi.pu@sun.com> - - ** Fixes #323853 - - * save-attachments.c: (save_response), (entry_changed), - (save_got_message): - replace GnomeFileEntry by GtkFileChooserButton. - -2005-12-17 Tor Lillqvist <tml@novell.com> - - * save-attachments.c (entry_changed): Use GLib API to manipulate - pathname. - -2005-05-16 Not Zed <NotZed@Ximian.com> - - * save-attachments.c: moved e-error to e-util - -2005-05-13 Rodney Dawes <dobey@novell.com> - - * org-gnome-save-attachments.xml: Update for new menu layout - -2005-05-12 Not Zed <NotZed@Ximian.com> - - * Makefile.am: setup built_sources/cleanfiles. - -2005-05-06 Not Zed <NotZed@Ximian.com> - - * Makefile.am: - * org-gnome-save-attachments.eplug.xml: s/.in/.xml/ & i18n. - -2005-02-24 Björn Torkelsson <torkel@acc.umu.se> - - * org-gnome-save-attachments.eplug.in: Removed plugin from the - name. - Fixed description and added author - -2005-02-07 Not Zed <NotZed@Ximian.com> - - * save-attachments.c (save_part): fix the access() call test. - -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 05c724a4e4..0000000000 --- a/plugins/save-attachments/Makefile.am +++ /dev/null @@ -1,31 +0,0 @@ -if OS_WIN32 -NO_UNDEFINED_REQUIRED_LIBS = \ - $(top_builddir)/mail/libevolution-mail.la \ - $(EVOLUTION_MAIL_LIBS) \ - $(GNOME_PLATFORM_LIBS) \ - $(top_builddir)/e-util/libeutil.la -endif - -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 $(NO_UNDEFINED) - -liborg_gnome_save_attachments_la_LIBADD = \ - $(NO_UNDEFINED_REQUIRED_LIBS) - - -EXTRA_DIST = \ - org-gnome-save-attachments.eplug.xml \ - org-gnome-save-attachments.xml - -BUILT_SOURCES = org-gnome-save-attachments.eplug -CLEANFILES = $(BUILT_SOURCES) diff --git a/plugins/save-attachments/org-gnome-save-attachments.eplug.xml b/plugins/save-attachments/org-gnome-save-attachments.eplug.xml deleted file mode 100644 index d51b341db4..0000000000 --- a/plugins/save-attachments/org-gnome-save-attachments.eplug.xml +++ /dev/null @@ -1,26 +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@SOEXT@" - _name="Save attachments"> - - <author name="Not Zed" email="NotZed@Ximian.com"/> - <_description>A plugin for saving all attachments or parts of a message at once.</_description> - - <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 75f4aef7fb..0000000000 --- a/plugins/save-attachments/org-gnome-save-attachments.xml +++ /dev/null @@ -1,20 +0,0 @@ -<Root> - <commands> - <cmd name="EPSASaveAttachments" _label="Save Attachments..." - _tip="Save all attachments" - pixtype="stock" pixname="Save"/> - </commands> - - <menu> -<!-- - <placeholder name="MessagePlaceholder"> - <submenu name="Message"> - <placeholder name="MailMessageActions"> - <separator f="" name="emaillist5"/> - <menuitem name="EPSASaveAttachments" verb=""/> - </placeholder> - </submenu> - </placeholder> ---> - </menu> -</Root> diff --git a/plugins/save-attachments/save-attachments.c b/plugins/save-attachments/save-attachments.c deleted file mode 100644 index c48711c55a..0000000000 --- a/plugins/save-attachments/save-attachments.c +++ /dev/null @@ -1,392 +0,0 @@ -/* - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * Michael Zucchi <notzed@ximian.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -/* 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 <gtk/gtk.h> -#include <glib/gi18n.h> -#include <glib/gstdio.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 "e-util/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); - if (data->model) - g_object_unref(data->model); - 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 (g_access(save, F_OK) == 0) - 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 = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data->entry)); - 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; - char *basename = NULL; - const char *file; - - path = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data->entry)); - if (path == NULL - || G_IS_DIR_SEPARATOR (path[strlen(path)-1]) - || (basename = g_path_get_basename(path)) == NULL - || (basename[0] == '.' && basename[1] == '\0') - || (g_file_test(path, G_FILE_TEST_IS_DIR))) - file = "attachment"; - else - file = basename; - - gtk_tree_model_foreach((GtkTreeModel *)data->model, entry_changed_update, (void *)file); - g_free(path); - g_free(basename); -} - -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 = gtk_file_chooser_button_new (_("Select save base name"), GTK_FILE_CHOOSER_ACTION_OPEN); - 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); - - g_signal_connect(GTK_FILE_CHOOSER_BUTTON (w), "selection-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_msg_unordered_push); -} diff --git a/plugins/select-one-source/ChangeLog b/plugins/select-one-source/ChangeLog deleted file mode 100644 index 0534fee906..0000000000 --- a/plugins/select-one-source/ChangeLog +++ /dev/null @@ -1,64 +0,0 @@ -2008-10-13 Suman Manjunath <msuman@novell.com> - - ** Fix for bug #424818 (bugzilla.novell.com) - - * mark-calendar-offline.c: Removed this unused PoC file. The - corresponding plugin has also been integrated into the main code. - -2008-08-27 Sankar P <psankar@novell.com> - -License Changes - - * mark-calendar-offline.c: - * select-one-source.c: - -2008-08-12 Bharath Acharya <abharath@novell.com> - - * Makefile.am: Use NO_UNDEFINED. Link with more libraries. To generate - dlls on Windows. - -2007-11-11 Gilles Dartiguelongue <gdartigu@svn.gnome.org> - - ** Fix bug #495872 - - * org-gnome-select-one-source.eplug.xml: - add right-click menu item for memo component - -2007-04-02 Sankar P <psankar@novell.com> - - * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr> - - * org-gnome-select-one-source.eplug.xml: - Cleanup. - Fixes part of #301149 - -2006-02-13 Karsten Bräckelmann <guenther@rudersport.de> - - * org-gnome-select-one-source.eplug.xml: - Fix mnemonics to be consistent. Fixes bug #330934. - -2005-12-12 Harish Krishnaswamy <kharish@novell.com> - - * Makefile.am: Fix make-clean issues. - -2005-05-06 Not Zed <NotZed@Ximian.com> - - * Makefile.am: - * org-gnome-select-one-source.eplug.xml: s/.in/.xml/ & i18n. - -2005-02-24 Björn Torkelsson <torkel@acc.umu.se> - - * org-gnome-select-one-source.eplug.in: Fixed description and - added author. - Added xml tag. - -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 7bd40ef4f7..0000000000 --- a/plugins/select-one-source/Makefile.am +++ /dev/null @@ -1,18 +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 $(NO_UNDEFINED) -liborg_gnome_select_one_source_la_LIBADD = \ - $(EVOLUTION_CALENDAR_LIBS) - -EXTRA_DIST = org-gnome-select-one-source.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) diff --git a/plugins/select-one-source/org-gnome-select-one-source.eplug.xml b/plugins/select-one-source/org-gnome-select-one-source.eplug.xml deleted file mode 100644 index cfde40c2c9..0000000000 --- a/plugins/select-one-source/org-gnome-select-one-source.eplug.xml +++ /dev/null @@ -1,21 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin id="org.gnome.evolution.select_one_source" type="shlib" - _name="Select one source" - location="@PLUGINDIR@/liborg-gnome-select-one-source@SOEXT@"> - <author name="JP Rosevear" email="jpr@novell.com"/> - <_description>Selects a single calendar or task source for viewing.</_description> - - <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.memos.source.popup" target="source"> - <item type="item" path="25.select_one_source" _label="Show _only this Memo 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> 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 e45ef2debf..0000000000 --- a/plugins/select-one-source/select-one-source.c +++ /dev/null @@ -1,54 +0,0 @@ -/* - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) version 3. - * - * 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 - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with the program; if not, see <http://www.gnu.org/licenses/> - * - * - * Authors: - * JP Rosevear <jpr@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -/* 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/vcard-inline/Makefile.am b/plugins/vcard-inline/Makefile.am new file mode 100644 index 0000000000..781eb53bd4 --- /dev/null +++ b/plugins/vcard-inline/Makefile.am @@ -0,0 +1,20 @@ +INCLUDES = \ + -I$(top_srcdir) \ + $(EVOLUTION_ADDRESSBOOK_CFLAGS) \ + $(EVOLUTION_MAIL_CFLAGS) + +@EVO_PLUGIN_RULE@ + +plugin_DATA = org-gnome-vcard-inline.eplug +plugin_LTLIBRARIES = liborg-gnome-vcard-inline.la + +liborg_gnome_vcard_inline_la_SOURCES = vcard-inline.c +liborg_gnome_vcard_inline_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) +liborg_gnome_vcard_inline_la_LIBADD = \ + $(EVOLUTION_ADDRESSBOOK_LIBS) + $(EVOLUTION_MAIL_LIBS) + +EXTRA_DIST = org-gnome-vcard-inline.eplug.xml + +BUILT_SOURCES = $(plugin_DATA) +CLEANFILES = $(BUILT_SOURCES) diff --git a/plugins/vcard-inline/org-gnome-vcard-inline.eplug.xml b/plugins/vcard-inline/org-gnome-vcard-inline.eplug.xml new file mode 100644 index 0000000000..c54587d369 --- /dev/null +++ b/plugins/vcard-inline/org-gnome-vcard-inline.eplug.xml @@ -0,0 +1,28 @@ +<?xml version="1.0"?> +<e-plugin-list> + <e-plugin + type="shlib" + id="org.gnome.evolution.plugin.vcardInline" + location="@PLUGINDIR@/liborg-gnome-vcard-inline@SOEXT@" + _name="Inline vCards"> + + <author name="Matthew Barnes" email="mbarnes@redhat.com"/> + <_description> + Show vCards directly in mail messages. + </_description> + + <hook class="org.gnome.evolution.mail.format:1.0"> + <group id="EMFormatHTMLDisplay"> + <item + mime_type="text/vCard" + format="org_gnome_vcard_inline_format" + flags="inline_disposition"/> + <item + mime_type="text/x-vCard" + format="org_gnome_vcard_inline_format" + flags="inline_disposition"/> + </group> + </hook> + + </e-plugin> +</e-plugin-list> diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c new file mode 100644 index 0000000000..211eb69c2d --- /dev/null +++ b/plugins/vcard-inline/vcard-inline.c @@ -0,0 +1,285 @@ +/* + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * 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 + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifdef HAVE_CONFIG_H +#include "config.h" +#endif + +#include <gtk/gtk.h> +#include <glib/gi18n-lib.h> +#include <libebook/e-book.h> +#include <libebook/e-contact.h> +#include <camel/camel-medium.h> +#include <camel/camel-mime-part.h> +#include <camel/camel-stream-mem.h> +#include <gtkhtml/gtkhtml-embedded.h> + +#include "addressbook/gui/merging/eab-contact-merging.h" +#include "addressbook/gui/widgets/eab-contact-display.h" +#include "addressbook/util/addressbook.h" +#include "addressbook/util/eab-book-util.h" +#include "mail/em-format-hook.h" +#include "mail/em-format-html.h" + +#define d(x) + +typedef struct _VCardInlinePObject VCardInlinePObject; + +struct _VCardInlinePObject { + EMFormatHTMLPObject object; + + GList *contact_list; + GtkWidget *contact_display; + GtkWidget *message_label; +}; + +static gint org_gnome_vcard_inline_classid; + +/* Forward Declarations */ +void org_gnome_vcard_inline_format (void *ep, EMFormatHookTarget *target); + +static void +org_gnome_vcard_inline_pobject_free (EMFormatHTMLPObject *object) +{ + VCardInlinePObject *vcard_object; + + vcard_object = (VCardInlinePObject *) object; + + g_list_foreach ( + vcard_object->contact_list, + (GFunc) g_object_unref, NULL); + g_list_free (vcard_object->contact_list); + vcard_object->contact_list = NULL; + + if (vcard_object->contact_display != NULL) { + g_object_unref (vcard_object->contact_display); + vcard_object->contact_display = NULL; + } + + if (vcard_object->message_label != NULL) { + g_object_unref (vcard_object->message_label); + vcard_object->message_label = NULL; + } +} + +static void +org_gnome_vcard_inline_decode (VCardInlinePObject *vcard_object, + CamelMimePart *mime_part) +{ + CamelDataWrapper *data_wrapper; + CamelMedium *medium; + CamelStream *stream; + GList *contact_list; + GByteArray *array; + const gchar *string; + + array = g_byte_array_new (); + medium = CAMEL_MEDIUM (mime_part); + + /* Stream takes ownership of the byte array. */ + stream = camel_stream_mem_new_with_byte_array (array); + data_wrapper = camel_medium_get_content_object (medium); + camel_data_wrapper_decode_to_stream (data_wrapper, stream); + + string = (gchar *) array->data; + contact_list = eab_contact_list_from_string (string); + vcard_object->contact_list = contact_list; + + camel_object_unref (data_wrapper); + camel_object_unref (stream); +} + +static void +org_gnome_vcard_inline_book_open_cb (EBook *book, + EBookStatus status, + gpointer user_data) +{ + GList *contact_list = user_data; + GList *iter; + + if (status != E_BOOK_ERROR_OK) + goto exit; + + for (iter = contact_list; iter != NULL; iter = iter->next) + eab_merging_book_add_contact ( + book, E_CONTACT (iter->data), NULL, NULL); + +exit: + if (book != NULL) + g_object_unref (book); + + g_list_foreach (contact_list, (GFunc) g_object_unref, NULL); + g_list_free (contact_list); +} + +static void +org_gnome_vcard_inline_save_cb (VCardInlinePObject *vcard_object) +{ + GList *contact_list; + + contact_list = g_list_copy (vcard_object->contact_list); + g_list_foreach (contact_list, (GFunc) g_object_ref, NULL); + + addressbook_load_default_book ( + org_gnome_vcard_inline_book_open_cb, contact_list); +} + +static void +org_gnome_vcard_inline_toggle_cb (VCardInlinePObject *vcard_object, + GtkButton *button) +{ + EABContactDisplay *contact_display; + EABContactDisplayMode mode; + const gchar *label; + + contact_display = EAB_CONTACT_DISPLAY (vcard_object->contact_display); + mode = eab_contact_display_get_mode (contact_display); + + /* Toggle between "full" and "compact" modes. */ + if (mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) { + mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT; + label = _("Show Full vCard"); + } else { + mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL; + label = _("Show Compact vCard"); + } + + eab_contact_display_set_mode (contact_display, mode); + gtk_button_set_label (button, label); +} + +static gboolean +org_gnome_vcard_inline_embed (EMFormatHTML *format, + GtkHTMLEmbedded *embedded, + EMFormatHTMLPObject *object) +{ + VCardInlinePObject *vcard_object; + GtkWidget *button_box; + GtkWidget *container; + GtkWidget *widget; + EContact *contact; + guint length; + + vcard_object = (VCardInlinePObject *) object; + length = g_list_length (vcard_object->contact_list); + + if (vcard_object->contact_list != NULL) + contact = E_CONTACT (vcard_object->contact_list->data); + else + contact = NULL; + + container = GTK_WIDGET (embedded); + + widget = gtk_vbox_new (FALSE, 0); + gtk_container_add (GTK_CONTAINER (container), widget); + gtk_widget_show (widget); + + container = widget; + + widget = gtk_hbutton_box_new (); + gtk_button_box_set_layout ( + GTK_BUTTON_BOX (widget), GTK_BUTTONBOX_START); + gtk_box_set_spacing (GTK_BOX (widget), 12); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, TRUE, 0); + gtk_widget_show (widget); + + button_box = widget; + + widget = eab_contact_display_new (); + eab_contact_display_set_contact ( + EAB_CONTACT_DISPLAY (widget), contact); + eab_contact_display_set_mode ( + EAB_CONTACT_DISPLAY (widget), + EAB_CONTACT_DISPLAY_RENDER_COMPACT); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + vcard_object->contact_display = g_object_ref (widget); + gtk_widget_show (widget); + + widget = gtk_label_new (NULL); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + vcard_object->message_label = g_object_ref (widget); + + if (length == 2) { + const gchar *text; + + text = _("There is one other contact."); + gtk_label_set_text (GTK_LABEL (widget), text); + gtk_widget_show (widget); + + } else if (length > 2) { + gchar *text; + + text = g_strdup_printf ( + _("There are %d other contacts."), length - 1); + gtk_label_set_text (GTK_LABEL (widget), text); + gtk_widget_show (widget); + g_free (text); + + } else + gtk_widget_hide (widget); + + container = button_box; + + widget = gtk_button_new_with_label (_("Show Full vCard")); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + g_signal_connect_swapped ( + widget, "clicked", + G_CALLBACK (org_gnome_vcard_inline_toggle_cb), + vcard_object); + + widget = gtk_button_new_with_label (_("Save in Address Book")); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + g_signal_connect_swapped ( + widget, "clicked", + G_CALLBACK (org_gnome_vcard_inline_save_cb), + vcard_object); + + return TRUE; +} + +void +org_gnome_vcard_inline_format (void *ep, EMFormatHookTarget *target) +{ + VCardInlinePObject *vcard_object; + gchar *classid; + + classid = g_strdup_printf ( + "org-gnome-vcard-inline-display-%d", + org_gnome_vcard_inline_classid++); + + vcard_object = (VCardInlinePObject *) + em_format_html_add_pobject ( + EM_FORMAT_HTML (target->format), + sizeof (VCardInlinePObject), + classid, target->part, + org_gnome_vcard_inline_embed); + + camel_object_ref (target->part); + + vcard_object->object.free = org_gnome_vcard_inline_pobject_free; + org_gnome_vcard_inline_decode (vcard_object, target->part); + + camel_stream_printf ( + target->stream, "<object classid=%s></object>", classid); + + g_free (classid); +} |