diff options
Diffstat (limited to 'plugins')
34 files changed, 574 insertions, 515 deletions
diff --git a/plugins/attachment-reminder/Makefile.am b/plugins/attachment-reminder/Makefile.am index c6ce86e17e..fb77e5a3be 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)\"" @@ -23,7 +24,7 @@ liborg_gnome_evolution_attachment_reminder_la_LDFLAGS = -module -avoid-version $ liborg_gnome_evolution_attachment_reminder_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ - $(top_builddir)/mail/libevolution-mail.la \ + $(top_builddir)/mail/libevolution-module-mail.la \ $(EVOLUTION_MAIL_LIBS) schemadir = $(GCONF_SCHEMA_FILE_DIR) 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/bbdb/Makefile.am b/plugins/bbdb/Makefile.am index 1987a32efa..1bf7604e92 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/calendar-weather/Makefile.am b/plugins/calendar-weather/Makefile.am index 0e43fa1717..4404dedcde 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/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index fe1a73febb..38d41f8470 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -550,13 +550,13 @@ destroy_compo_data (gpointer data) static void action_email_custom_header_cb (GtkAction *action, EMsgComposer *composer) { - GtkUIManager *manager; + GtkUIManager *ui_manager; GtkWidget *menuitem; CustomHeaderOptionsDialog *dialog = NULL; EmailCustomHeaderWindow *new_email_custom_header_window = NULL; - manager = gtkhtml_editor_get_ui_manager (GTKHTML_EDITOR (composer)); - menuitem = gtk_ui_manager_get_widget (manager, "/main-menu/insert-menu/insert-menu-top/Custom Header"); + ui_manager = gtkhtml_editor_get_ui_manager (GTKHTML_EDITOR (composer)); + menuitem = gtk_ui_manager_get_widget (ui_manager, "/main-menu/insert-menu/insert-menu-top/Custom Header"); new_email_custom_header_window = g_object_get_data ((GObject *) composer, "compowindow"); 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/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 5616f273ea..0000000000 --- a/plugins/mail-account-disable/Makefile.am +++ /dev/null @@ -1,23 +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) - --include $(top_srcdir)/git.mk 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 4228a90be5..f3434fd4e8 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 352c2a0fab..5c9feb1832 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..618c6b63f6 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 *ui_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 *ui_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 645581e11d..087c8964a3 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..a23508d3c1 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 *ui_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 *ui_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/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 8c872f23a5..0000000000 --- a/plugins/select-one-source/Makefile.am +++ /dev/null @@ -1,20 +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) - --include $(top_srcdir)/git.mk 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); +} |