diff options
author | Matthew Barnes <mbarnes@redhat.com> | 2009-08-30 13:37:36 +0800 |
---|---|---|
committer | Matthew Barnes <mbarnes@redhat.com> | 2009-08-30 13:40:49 +0800 |
commit | cfb9c32b6657165e4d5e11aa7b47804f679a61f8 (patch) | |
tree | 1f9c8954df7a357b5dc20a13ac82bf31c1112083 /plugins | |
parent | fefeb30f58447f2fa7bcbee16dbe68a9333ce89d (diff) | |
parent | 0f7f4cfe38b3c4cd83efbe9922ae15c5aee00317 (diff) | |
download | gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.gz gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.tar.zst gsoc2013-evolution-cfb9c32b6657165e4d5e11aa7b47804f679a61f8.zip |
Merge commit 'origin/kill-bonobo'
Diffstat (limited to 'plugins')
113 files changed, 1397 insertions, 4104 deletions
diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 88edda37f0..c20e1dde91 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,4 +1,4 @@ SUBDIRS = $(plugins_enabled) -DIST_SUBDIRS = $(all_plugins_base) $(all_plugins_standard) $(all_plugins_experimental) profiler python +DIST_SUBDIRS = $(all_plugins_base) $(all_plugins_standard) $(all_plugins_experimental) profiler -include $(top_srcdir)/git.mk diff --git a/plugins/attachment-reminder/Makefile.am b/plugins/attachment-reminder/Makefile.am index 6d207ef839..8fb3c30ad2 100644 --- a/plugins/attachment-reminder/Makefile.am +++ b/plugins/attachment-reminder/Makefile.am @@ -22,9 +22,13 @@ plugin_LTLIBRARIES = liborg-gnome-evolution-attachment-reminder.la liborg_gnome_evolution_attachment_reminder_la_SOURCES = attachment-reminder.c liborg_gnome_evolution_attachment_reminder_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_evolution_attachment_reminder_la_LIBADD = \ + $(top_builddir)/composer/libcomposer.la \ + $(top_builddir)/shell/libeshell.la \ + $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \ + $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ - $(top_builddir)/mail/libevolution-mail.la \ + $(top_builddir)/mail/libevolution-mail.la \ $(EVOLUTION_MAIL_LIBS) schemadir = $(GCONF_SCHEMA_FILE_DIR) diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c index 87acc1662d..330fd5df8f 100644 --- a/plugins/attachment-reminder/attachment-reminder.c +++ b/plugins/attachment-reminder/attachment-reminder.c @@ -67,7 +67,7 @@ enum { CLUE_N_COLUMNS }; -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); void org_gnome_evolution_attachment_reminder (EPlugin *ep, EMEventTargetComposer *t); @@ -85,7 +85,7 @@ static gboolean clue_foreach_check_isempty (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, UIData *ui); gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { return 0; } diff --git a/plugins/audio-inline/Makefile.am b/plugins/audio-inline/Makefile.am index b9ee89f93b..785d53557a 100644 --- a/plugins/audio-inline/Makefile.am +++ b/plugins/audio-inline/Makefile.am @@ -17,10 +17,10 @@ plugin_LTLIBRARIES = liborg-gnome-audio-inline.la liborg_gnome_audio_inline_la_SOURCES = audio-inline.c liborg_gnome_audio_inline_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_audio_inline_la_LIBADD = \ - $(GSTREAMER_LIBS) \ - $(EVOLUTION_MAIL_LIBS) \ - $(NO_UNDEFINED_REQUIRED_LIBS) +liborg_gnome_audio_inline_la_LIBADD = \ + $(top_builddir)/mail/libevolution-mail.la \ + $(GSTREAMER_LIBS) \ + $(EVOLUTION_MAIL_LIBS) EXTRA_DIST = org-gnome-audio-inline.eplug.xml diff --git a/plugins/audio-inline/org-gnome-audio-inline.eplug.xml b/plugins/audio-inline/org-gnome-audio-inline.eplug.xml index 14ad280740..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"> + _name="Inline Audio"> - <_description>Play audio attachments 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/Makefile.am b/plugins/backup-restore/Makefile.am index c1792abb64..b848d3c51b 100644 --- a/plugins/backup-restore/Makefile.am +++ b/plugins/backup-restore/Makefile.am @@ -1,11 +1,12 @@ AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ -DEVOLUTION_LOCALEDIR=\""$(localedir)"\" \ -DEVOLUTION_TOOLSDIR=\""$(privlibexecdir)"\" \ -DPREFIX=\""$(prefix)"\" \ -DSYSCONFDIR=\""$(sysconfdir)"\" \ -DDATADIR=\""$(datadir)"\" \ -DLIBDIR=\""$(libdir)"\" \ - -I$(top_srcdir) \ $(EVOLUTION_CALENDAR_CFLAGS) \ $(SHELL_CFLAGS) \ $(E_UTIL_CFLAGS) @@ -15,17 +16,20 @@ AM_CPPFLAGS = \ error_DATA = org-gnome-backup-restore.error errordir = $(privdatadir)/errors -plugin_DATA = org-gnome-backup-restore.eplug org-gnome-backup-restore.xml +plugin_DATA = org-gnome-backup-restore.eplug plugin_LTLIBRARIES = liborg-gnome-backup-restore.la liborg_gnome_backup_restore_la_SOURCES = backup-restore.c liborg_gnome_backup_restore_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_backup_restore_la_LIBADD = \ - $(top_builddir)/e-util/libeutil.la +liborg_gnome_backup_restore_la_LIBADD = \ + $(SHELL_LIBS) \ + $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/shell/libeshell.la privlibexec_PROGRAMS = evolution-backup evolution_backup_SOURCES = backup.c -evolution_backup_LDADD = $(SHELL_LIBS) \ +evolution_backup_LDADD = \ + $(SHELL_LIBS) \ $(top_builddir)/e-util/libeutil.la if OS_WIN32 @@ -35,8 +39,7 @@ endif EXTRA_DIST = \ org-gnome-backup-restore.eplug.xml \ - org-gnome-backup-restore.error.xml \ - org-gnome-backup-restore.xml + org-gnome-backup-restore.error.xml BUILT_SOURCES = org-gnome-backup-restore.eplug \ org-gnome-backup-restore.error diff --git a/plugins/backup-restore/backup-restore.c b/plugins/backup-restore/backup-restore.c index 79221d4573..6df2763698 100644 --- a/plugins/backup-restore/backup-restore.c +++ b/plugins/backup-restore/backup-restore.c @@ -31,17 +31,16 @@ #include <gtk/gtk.h> #include <glib/gi18n.h> #include <glib/gstdio.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-standard.h> -#include "shell/es-menu.h" #include "mail/em-config.h" #include "mail/em-account-editor.h" #include "e-util/e-error.h" #include "e-util/e-util.h" #include "e-util/e-dialog-utils.h" +#include "shell/e-shell-window.h" + +gboolean e_plugin_ui_init (GtkUIManager *ui_manager, + EShellWindow *shell_window); -void org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target); -void org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target); GtkWidget * backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data); void backup_restore_commit (EPlugin *ep, EMConfigTargetAccount *target); void backup_restore_abort (EPlugin *ep, EMConfigTargetAccount *target); @@ -104,7 +103,7 @@ dialog_prompt_user(GtkWindow *parent, const gchar *string, const gchar *tag, con /* We should hardcode this to true */ gtk_toggle_button_set_active ((GtkToggleButton *)check, TRUE); gtk_container_set_border_width((GtkContainer *)check, 12); - gtk_box_pack_start ((GtkBox *)((GtkDialog *) mbox)->vbox, check, TRUE, TRUE, 0); + gtk_box_pack_start ((GtkBox *)gtk_dialog_get_content_area ((GtkDialog *) mbox), check, TRUE, TRUE, 0); gtk_widget_show (check); button = gtk_dialog_run ((GtkDialog *) mbox); @@ -129,19 +128,20 @@ epbr_perform_pre_backup_checks (gchar * dir) #endif } -void -org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target) +static void +action_settings_backup_cb (GtkAction *action, + EShellWindow *shell_window) { GtkWidget *dlg; GtkWidget *vbox; + GtkWindow *parent; gint response; - dlg = e_file_get_save_filesel(target->target.widget, _("Select name of the Evolution backup file"), NULL, GTK_FILE_CHOOSER_ACTION_SAVE); + parent = GTK_WINDOW (shell_window); -/* dlg = gtk_file_chooser_dialog_new (_("Select name of the Evolution backup file"), GTK_WINDOW (target->target.widget), */ -/* GTK_FILE_CHOOSER_ACTION_SAVE, */ -/* GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, */ -/* GTK_STOCK_SAVE, GTK_RESPONSE_OK, NULL); */ + dlg = e_file_get_save_filesel ( + parent, _("Select name of the Evolution backup file"), + NULL, GTK_FILE_CHOOSER_ACTION_SAVE); gtk_file_chooser_set_current_name (GTK_FILE_CHOOSER (dlg), "evolution-backup.tar.gz"); @@ -164,7 +164,9 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target) if (epbr_perform_pre_backup_checks (dir)) { - mask = dialog_prompt_user (GTK_WINDOW (target->target.widget), _("_Restart Evolution after backup"), "org.gnome.backup-restore:backup-confirm", NULL); + mask = dialog_prompt_user ( + parent, _("_Restart Evolution after backup"), + "org.gnome.backup-restore:backup-confirm", NULL); if (mask & BR_OK) backup (filename, (mask & BR_START) ? TRUE: FALSE); } else { @@ -180,19 +182,21 @@ org_gnome_backup_restore_backup (EPlugin *ep, ESMenuTargetShell *target) gtk_widget_destroy (dlg); } -void -org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target) +static void +action_settings_restore_cb (GtkAction *action, + EShellWindow *shell_window) { GtkWidget *dlg; GtkWidget *vbox; + GtkWindow *parent; gint response; - dlg = e_file_get_save_filesel(target->target.widget, _("Select name of the Evolution backup file to restore"), NULL, GTK_FILE_CHOOSER_ACTION_OPEN); + parent = GTK_WINDOW (shell_window); -/* dlg = gtk_file_chooser_dialog_new (_("Select Evolution backup file to restore"), GTK_WINDOW (target->target.widget), */ -/* GTK_FILE_CHOOSER_ACTION_OPEN, */ -/* GTK_STOCK_CANCEL, GTK_RESPONSE_CANCEL, */ -/* GTK_STOCK_OPEN, GTK_RESPONSE_OK, NULL); */ + dlg = e_file_get_save_filesel ( + parent, + _("Select name of the Evolution backup file to restore"), + NULL, GTK_FILE_CHOOSER_ACTION_OPEN); vbox = gtk_vbox_new (FALSE, 6); gtk_widget_show (vbox); @@ -211,11 +215,13 @@ org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target) if (sanity_check (filename)) { guint32 mask; - mask = dialog_prompt_user (GTK_WINDOW (target->target.widget), _("_Restart Evolution after restore"), "org.gnome.backup-restore:restore-confirm", NULL); + mask = dialog_prompt_user ( + parent, _("_Restart Evolution after restore"), + "org.gnome.backup-restore:restore-confirm", NULL); if (mask & BR_OK) restore (filename, mask & BR_START); } else { - e_error_run (GTK_WINDOW (target->target.widget), "org.gnome.backup-restore:invalid-backup", NULL); + e_error_run (parent, "org.gnome.backup-restore:invalid-backup", NULL); } g_free (filename); @@ -227,77 +233,74 @@ org_gnome_backup_restore_restore (EPlugin *ep, ESMenuTargetShell *target) } static void -check_toggled (GtkToggleButton *button, GnomeDruid *druid) +check_toggled (GtkToggleButton *button, GtkAssistant *assistant) { - GtkWidget *box = g_object_get_data ((GObject *)button, "box"); - gboolean state = gtk_toggle_button_get_active ((GtkToggleButton *)button); - gchar *prevfile = g_object_get_data ((GObject *)druid, "restore-file"); + GtkWidget *box = g_object_get_data ((GObject *)button, "box"); + gboolean state = gtk_toggle_button_get_active ((GtkToggleButton *)button); gtk_widget_set_sensitive (box, state); - gnome_druid_set_show_finish (druid, state); - if (state && !prevfile) - gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, TRUE); - else - gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE, TRUE); - g_object_set_data ((GObject *)druid, "restore", GINT_TO_POINTER (state?1:0)); + g_object_set_data ((GObject *)assistant, "restore", GINT_TO_POINTER (state?1:0)); + e_config_target_changed ((EConfig *) g_object_get_data ((GObject *)assistant, "restore-config"), E_CONFIG_TARGET_CHANGED_STATE); } static void -restore_wizard (GnomeDruidPage *druidpage, GnomeDruid *druid, gpointer user_data) +file_changed (GtkFileChooser *chooser, GtkAssistant *assistant) { - gboolean state = GPOINTER_TO_INT(g_object_get_data((GObject *)druid, "restore")) ? TRUE:FALSE; - gchar *file = g_object_get_data ((GObject *)druid, "restore-file"); + gchar *file = NULL, *prevfile = NULL; + gchar *uri = NULL; - if (state) { - if (!file ||!sanity_check (file)) { - e_error_run ((GtkWindow *)druid, "org.gnome.backup-restore:invalid-backup", NULL); - } else - restore (file, TRUE); + uri = gtk_file_chooser_get_current_folder_uri (GTK_FILE_CHOOSER (chooser)); + e_file_update_save_path (uri, TRUE); - } + file = gtk_file_chooser_get_filename (chooser); + prevfile = g_object_get_data ((GObject *)assistant, "restore-file"); + g_object_set_data ((GObject *)assistant, "restore-file", file); + g_free (prevfile); + + e_config_target_changed ((EConfig *) g_object_get_data ((GObject *)assistant, "restore-config"), E_CONFIG_TARGET_CHANGED_STATE); } -static void -file_changed (GtkFileChooser *chooser, GnomeDruid *druid) +static gboolean +backup_restore_check (EConfig *ec, const gchar *pageid, gpointer data) { - gchar *file = NULL, *prevfile=NULL; - gchar *uri = NULL; + GtkAssistant *assistant = data; + gint do_restore; + gchar *file; - uri = gtk_file_chooser_get_current_folder_uri(GTK_FILE_CHOOSER (chooser)); - e_file_update_save_path(uri, TRUE); + g_return_val_if_fail (data != NULL, FALSE); + g_return_val_if_fail (GTK_IS_ASSISTANT (data), FALSE); - file = gtk_file_chooser_get_filename (chooser); - prevfile = g_object_get_data ((GObject *)druid, "restore-file"); - g_object_set_data ((GObject *)druid, "restore-file", file); - g_free (prevfile); - if (file) { - gnome_druid_set_buttons_sensitive (druid, TRUE, TRUE, TRUE, TRUE); - } else - gnome_druid_set_buttons_sensitive (druid, TRUE, FALSE, TRUE, TRUE); + do_restore = GPOINTER_TO_INT (g_object_get_data ((GObject *)assistant, "restore")); + file = g_object_get_data ((GObject *)assistant, "restore-file"); + + e_config_set_page_is_finish (ec, "0.startup_page.10.backup_restore", do_restore); + return !do_restore || file; } + GtkWidget * backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data) { - GtkWidget *page; - GtkWidget *box, *hbox, *label, *cbox, *button; + GtkWidget *page, *hbox, *label, *cbox, *button; + GtkAssistant *assistant = GTK_ASSISTANT (hook_data->parent); + + page = gtk_vbox_new (FALSE, 6); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); - page = gnome_druid_page_standard_new_with_vals (_("Restore from backup"), NULL, NULL); hbox = gtk_hbox_new (FALSE, 6); label = gtk_label_new (_("You can restore Evolution from your backup. It can restore all the Mails, Calendars, Tasks, Memos, Contacts. It also restores all your personal settings, mail filters etc.")); gtk_label_set_line_wrap ((GtkLabel *)label, TRUE); gtk_label_set_single_line_mode ((GtkLabel *)label, FALSE); gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 6); - box = gtk_vbox_new (FALSE, 6); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 6); cbox = gtk_check_button_new_with_mnemonic (_("_Restore Evolution from the backup file")); - g_signal_connect (cbox, "toggled", G_CALLBACK (check_toggled), hook_data->parent); + g_signal_connect (cbox, "toggled", G_CALLBACK (check_toggled), assistant); gtk_box_pack_start ((GtkBox *)hbox, cbox, FALSE, FALSE, 6); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); hbox = gtk_hbox_new (FALSE, 6); g_object_set_data ((GObject *)cbox, "box", hbox); @@ -305,24 +308,37 @@ backup_restore_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data) gtk_box_pack_start ((GtkBox *)hbox, label, FALSE, FALSE, 12); button = gtk_file_chooser_button_new (_("Choose a file to restore"), GTK_FILE_CHOOSER_ACTION_OPEN); - g_signal_connect (button, "selection-changed", G_CALLBACK (file_changed), hook_data->parent); + g_signal_connect (button, "selection-changed", G_CALLBACK (file_changed), assistant); gtk_file_chooser_button_set_width_chars ((GtkFileChooserButton *)button, 20); gtk_box_pack_start ((GtkBox *)hbox, button, FALSE, FALSE, 0); - gtk_box_pack_start ((GtkBox *)box, hbox, FALSE, FALSE, 0); + gtk_box_pack_start ((GtkBox *)page, hbox, FALSE, FALSE, 0); gtk_widget_set_sensitive (hbox, FALSE); - gtk_container_add ((GtkContainer *) GNOME_DRUID_PAGE_STANDARD (page)->vbox, box); - gtk_widget_show_all (box); - gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page)); - g_object_set_data ((GObject *)hook_data->parent, "restore", GINT_TO_POINTER (FALSE)); - g_signal_connect (page, "finish", G_CALLBACK (restore_wizard), NULL); + gtk_assistant_append_page (assistant, page); + gtk_assistant_set_page_title (assistant, page, _("Restore from backup")); + gtk_widget_show_all (page); + + g_object_set_data ((GObject *)assistant, "restore", GINT_TO_POINTER (FALSE)); + g_object_set_data ((GObject *)assistant, "restore-config", hook_data->config); + + e_config_add_page_check (hook_data->config, "0.startup_page.10.backup_restore", backup_restore_check, assistant); + return GTK_WIDGET (page); } void backup_restore_commit (EPlugin *ep, EMConfigTargetAccount *target) { - /* Nothing really */ - printf("commit\n"); + GtkWidget *assistant = target->target.config->widget; + gboolean state = GPOINTER_TO_INT (g_object_get_data ((GObject *)assistant, "restore")) ? TRUE : FALSE; + gchar *file = g_object_get_data ((GObject *)assistant, "restore-file"); + + if (state) { + if (!file || !sanity_check (file)) { + e_error_run ((GtkWindow *)assistant, "org.gnome.backup-restore:invalid-backup", NULL); + } else { + restore (file, TRUE); + } + } } void @@ -331,3 +347,35 @@ backup_restore_abort (EPlugin *ep, EMConfigTargetAccount *target) /* Nothing really */ } +static GtkActionEntry entries[] = { + + { "settings-backup", + NULL, + N_("_Backup Settings..."), + NULL, + N_("Backup Evolution data and settings to an archive file"), + G_CALLBACK (action_settings_backup_cb) }, + + { "settings-restore", + NULL, + N_("R_estore Settings..."), + NULL, + N_("Restore Evolution data and settings from an archive file"), + G_CALLBACK (action_settings_restore_cb) } +}; + +gboolean +e_plugin_ui_init (GtkUIManager *ui_manager, + EShellWindow *shell_window) +{ + GtkActionGroup *action_group; + + action_group = e_shell_window_get_action_group (shell_window, "shell"); + + /* Add actions to the "shell" action group. */ + gtk_action_group_add_actions ( + action_group, entries, + G_N_ELEMENTS (entries), shell_window); + + return TRUE; +} diff --git a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml index 2ed7222adc..c78b376296 100644 --- a/plugins/backup-restore/org-gnome-backup-restore.eplug.xml +++ b/plugins/backup-restore/org-gnome-backup-restore.eplug.xml @@ -9,31 +9,24 @@ <author name="JP Rosevear" email="jpr@novell.com"/> <_description>Backup and restore your Evolution data and settings.</_description> - <hook class="org.gnome.evolution.shell.bonobomenu:1.0"> - - <menu id="org.gnome.evolution.shell" target="shell"> - <!-- the path to the bonobo menu description --> - <ui file="@PLUGINDIR@/org-gnome-backup-restore.xml"/> - <item - type="item" - verb="EPBRBackup" - path="/commands/EPBRBackup" - enable="one" - activate="org_gnome_backup_restore_backup"/> - <item - type="item" - verb="EPBRRestore" - path="/commands/EPBRRestore" - enable="one" - activate="org_gnome_backup_restore_restore"/> - </menu> + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.shell"> + <menubar name='main-menu'> + <menu action='file-menu'> + <placeholder name='file-actions'> + <menuitem action='settings-backup'/> + <menuitem action='settings-restore'/> + </placeholder> + </menu> + </menubar> + </ui-manager> + </hook> + <hook class="org.gnome.evolution.mail.config:1.0"> + <group target="account" id="org.gnome.evolution.mail.config.accountWizard" commit="backup_restore_commit" abort="backup_restore_abort"> + <item type="page" path="0.startup_page.10.backup_restore" factory="backup_restore_page"/> + </group> </hook> - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountWizard" commit="backup_restore_commit" abort="backup_restore_abort"> - <item type="page" path="0.startup_page.10" factory="backup_restore_page"/> - </group> - </hook> </e-plugin> </e-plugin-list> diff --git a/plugins/backup-restore/org-gnome-backup-restore.xml b/plugins/backup-restore/org-gnome-backup-restore.xml deleted file mode 100644 index e546ce5581..0000000000 --- a/plugins/backup-restore/org-gnome-backup-restore.xml +++ /dev/null @@ -1,21 +0,0 @@ -<Root> - <commands> - <cmd name="EPBRBackup" _label="_Backup Settings..." - _tip="Backup and restore Evolution data and settings" - pixtype="pixmap"/> - - <cmd name="EPBRRestore" _label="R_estore Settings..." - _tip="Backup and restore Evolution data and settings" - pixtype="pixmap"/> - - </commands> - - <menu> - <submenu name="File"> - <placeholder name="FileOps"> - <menuitem name="EPBRBackup" verb=""/> - <menuitem name="EPBRRestore" verb=""/> - </placeholder> - </submenu> - </menu> -</Root> diff --git a/plugins/bbdb/Makefile.am b/plugins/bbdb/Makefile.am index 182c1e808b..0a44dc0c26 100644 --- a/plugins/bbdb/Makefile.am +++ b/plugins/bbdb/Makefile.am @@ -21,8 +21,10 @@ liborg_gnome_evolution_bbdb_la_SOURCES = bbdb.c bbdb.h gaimbuddies.c liborg_gnome_evolution_bbdb_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_evolution_bbdb_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ - $(EVOLUTION_ADDRESSBOOK_LIBS) \ - $(NO_UNDEFINED_REQUIRED_LIBS) + $(top_builddir)/composer/libcomposer.la \ + $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \ + $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \ + $(EVOLUTION_ADDRESSBOOK_LIBS) EXTRA_DIST = org-gnome-evolution-bbdb.eplug.xml diff --git a/plugins/bbdb/bbdb.c b/plugins/bbdb/bbdb.c index 81bad245fe..d5104dcf0c 100644 --- a/plugins/bbdb/bbdb.c +++ b/plugins/bbdb/bbdb.c @@ -42,7 +42,7 @@ #define d(x) /* Plugin hooks */ -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); void bbdb_handle_send (EPlugin *ep, EMEventTargetComposer *target); GtkWidget *bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); @@ -51,8 +51,8 @@ struct bbdb_stuff { EMConfigTargetPrefs *target; ESourceList *source_list; - GtkWidget *option_menu; - GtkWidget *gaim_option_menu; + GtkWidget *combo_box; + GtkWidget *gaim_combo_box; GtkWidget *check; GtkWidget *check_gaim; }; @@ -63,7 +63,7 @@ static void bbdb_do_it (EBook *book, const gchar *name, const gchar *email); static void add_email_to_contact (EContact *contact, const gchar *email); static void enable_toggled_cb (GtkWidget *widget, gpointer data); static void source_changed_cb (ESourceComboBox *source_combo_box, struct bbdb_stuff *stuff); -static GtkWidget *create_addressbook_option_menu (struct bbdb_stuff *stuff, gint type); +static GtkWidget *create_addressbook_combo_box (struct bbdb_stuff *stuff, gint type); static void cleanup_cb (GObject *o, gpointer data); static ESource * @@ -106,7 +106,7 @@ find_esource_by_uri (ESourceList *source_list, const gchar *target_uri) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { /* Start up the plugin. */ if (enable) { @@ -463,7 +463,7 @@ enable_toggled_cb (GtkWidget *widget, gpointer data) /* Save the new setting to gconf */ gconf_client_set_bool (stuff->target->gconf, GCONF_KEY_ENABLE, active, NULL); - gtk_widget_set_sensitive (stuff->option_menu, active); + gtk_widget_set_sensitive (stuff->combo_box, active); addressbook = gconf_client_get_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK, NULL); @@ -472,7 +472,7 @@ enable_toggled_cb (GtkWidget *widget, gpointer data) GError *error = NULL; selected_source = e_source_combo_box_get_active ( - E_SOURCE_COMBO_BOX (stuff->option_menu)); + E_SOURCE_COMBO_BOX (stuff->combo_box)); if (selected_source != NULL) uri = e_source_get_uri (selected_source); @@ -503,10 +503,10 @@ enable_gaim_toggled_cb (GtkWidget *widget, gpointer data) gconf_client_set_bool (stuff->target->gconf, GCONF_KEY_ENABLE_GAIM, active, NULL); addressbook_gaim = gconf_client_get_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, NULL); - gtk_widget_set_sensitive (stuff->gaim_option_menu, active); + gtk_widget_set_sensitive (stuff->gaim_combo_box, active); if (active && !addressbook_gaim) { selected_source = e_source_combo_box_get_active ( - E_SOURCE_COMBO_BOX (stuff->gaim_option_menu)); + E_SOURCE_COMBO_BOX (stuff->gaim_combo_box)); gconf_client_set_string (stuff->target->gconf, GCONF_KEY_WHICH_ADDRESSBOOK_GAIM, e_source_get_uri (selected_source), NULL); } @@ -560,7 +560,7 @@ gaim_source_changed_cb (ESourceComboBox *source_combo_box, } static GtkWidget * -create_addressbook_option_menu (struct bbdb_stuff *stuff, gint type) +create_addressbook_combo_box (struct bbdb_stuff *stuff, gint type) { GtkWidget *combo_box; ESourceList *source_list; @@ -604,8 +604,8 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) GtkWidget *hbox; GtkWidget *inner_vbox; GtkWidget *check; - GtkWidget *option; - GtkWidget *gaim_option; + GtkWidget *combo_box; + GtkWidget *gaim_combo_box; GtkWidget *check_gaim; GtkWidget *label; GtkWidget *gaim_label; @@ -652,12 +652,12 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) label = gtk_label_new (_("Select Address book for Automatic Contacts")); gtk_box_pack_start (GTK_BOX (inner_vbox), label, FALSE, FALSE, 0); - /* Source selection option menu */ - option = create_addressbook_option_menu (stuff, AUTOMATIC_CONTACTS_ADDRESSBOOK); - g_signal_connect (option, "changed", G_CALLBACK (source_changed_cb), stuff); - gtk_widget_set_sensitive (option, gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE, NULL)); - gtk_box_pack_start (GTK_BOX (inner_vbox), option, FALSE, FALSE, 0); - stuff->option_menu = option; + /* Source selection combo box */ + combo_box = create_addressbook_combo_box (stuff, AUTOMATIC_CONTACTS_ADDRESSBOOK); + g_signal_connect (combo_box, "changed", G_CALLBACK (source_changed_cb), stuff); + gtk_widget_set_sensitive (combo_box, gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE, NULL)); + gtk_box_pack_start (GTK_BOX (inner_vbox), combo_box, FALSE, FALSE, 0); + stuff->combo_box = combo_box; /* "Instant Messaging Contacts" */ frame = gtk_vbox_new (FALSE, 6); @@ -688,12 +688,12 @@ bbdb_page_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data) gaim_label = gtk_label_new (_("Select Address book for Pidgin buddy list")); gtk_box_pack_start (GTK_BOX (inner_vbox), gaim_label, FALSE, FALSE, 0); - /* Gaim Source Selection Option Menu */ - gaim_option = create_addressbook_option_menu (stuff, GAIM_ADDRESSBOOK); - g_signal_connect (gaim_option, "changed", G_CALLBACK (gaim_source_changed_cb), stuff); - gtk_widget_set_sensitive (gaim_option, gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE_GAIM, NULL)); - gtk_box_pack_start (GTK_BOX (inner_vbox), gaim_option, FALSE, FALSE, 0); - stuff->gaim_option_menu = gaim_option; + /* Gaim Source Selection Combo Box */ + gaim_combo_box = create_addressbook_combo_box (stuff, GAIM_ADDRESSBOOK); + g_signal_connect (gaim_combo_box, "changed", G_CALLBACK (gaim_source_changed_cb), stuff); + gtk_widget_set_sensitive (gaim_combo_box, gconf_client_get_bool (target->gconf, GCONF_KEY_ENABLE_GAIM, NULL)); + gtk_box_pack_start (GTK_BOX (inner_vbox), gaim_combo_box, FALSE, FALSE, 0); + stuff->gaim_combo_box = gaim_combo_box; /* Synchronize now button. */ button = gtk_button_new_with_mnemonic (_("Synchronize with _buddy list now")); diff --git a/plugins/bogo-junk-plugin/Makefile.am b/plugins/bogo-junk-plugin/Makefile.am index f488ddf0f7..00453ef090 100644 --- a/plugins/bogo-junk-plugin/Makefile.am +++ b/plugins/bogo-junk-plugin/Makefile.am @@ -11,8 +11,10 @@ plugin_LTLIBRARIES = liborg-gnome-bogo-junk-plugin.la liborg_gnome_bogo_junk_plugin_la_SOURCES = bf-junk-filter.c liborg_gnome_bogo_junk_plugin_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_bogo_junk_plugin_la_LIBADD = \ - $(GNOME_PLATFORM_LIBS) \ - $(top_builddir)/e-util/libeutil.la + $(top_builddir)/mail/libevolution-mail.la \ + $(top_builddir)/e-util/libeutil.la \ + $(EVOLUTION_MAIL_LIBS) \ + $(GNOME_PLATFORM_LIBS) schemadir = $(GCONF_SCHEMA_FILE_DIR) schema_in_files = bogo-junk-plugin.schemas.in diff --git a/plugins/bogo-junk-plugin/bf-junk-filter.c b/plugins/bogo-junk-plugin/bf-junk-filter.c index 3de8c30955..da384225c8 100644 --- a/plugins/bogo-junk-plugin/bf-junk-filter.c +++ b/plugins/bogo-junk-plugin/bf-junk-filter.c @@ -44,7 +44,7 @@ #include <gtk/gtk.h> #include <e-util/e-plugin.h> #include "mail/em-config.h" -#include <mail/em-junk-hook.h> +#include <mail/em-junk.h> #include <camel/camel-data-wrapper.h> #include <camel/camel-mime-message.h> #include <camel/camel-mime-parser.h> @@ -70,15 +70,15 @@ static const gchar em_junk_bf_gconf_dir[] = EM_JUNK_BF_GCONF_DIR; GtkWidget * org_gnome_bogo_convert_unicode (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); /* plugin fonction prototypes */ -gboolean em_junk_bf_check_junk (EPlugin *ep, EMJunkHookTarget *target); -gpointer em_junk_bf_validate_binary (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_bf_report_junk (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_bf_report_non_junk (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_bf_commit_reports (EPlugin *ep, EMJunkHookTarget *target); +gboolean em_junk_bf_check_junk (EPlugin *ep, EMJunkTarget *target); +gpointer em_junk_bf_validate_binary (EPlugin *ep, EMJunkTarget *target); +void em_junk_bf_report_junk (EPlugin *ep, EMJunkTarget *target); +void em_junk_bf_report_non_junk (EPlugin *ep, EMJunkTarget *target); +void em_junk_bf_commit_reports (EPlugin *ep, EMJunkTarget *target); static gint pipe_to_bogofilter (CamelMimeMessage *msg, const gchar **argv, GError **error); /* eplugin stuff */ -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); #define EM_JUNK_BF_GCONF_DIR_LENGTH (G_N_ELEMENTS (em_junk_bf_gconf_dir) - 1) @@ -241,7 +241,7 @@ em_junk_bf_setting_notify (GConfClient *gconf, } gboolean -em_junk_bf_check_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_check_junk (EPlugin *ep, EMJunkTarget *target) { CamelMimeMessage *msg = target->m; gint rv; @@ -266,7 +266,7 @@ em_junk_bf_check_junk (EPlugin *ep, EMJunkHookTarget *target) } void -em_junk_bf_report_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_report_junk (EPlugin *ep, EMJunkTarget *target) { CamelMimeMessage *msg = target->m; @@ -287,7 +287,7 @@ em_junk_bf_report_junk (EPlugin *ep, EMJunkHookTarget *target) } void -em_junk_bf_report_non_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_report_non_junk (EPlugin *ep, EMJunkTarget *target) { CamelMimeMessage *msg = target->m; @@ -308,18 +308,18 @@ em_junk_bf_report_non_junk (EPlugin *ep, EMJunkHookTarget *target) } void -em_junk_bf_commit_reports (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_commit_reports (EPlugin *ep, EMJunkTarget *target) { } gpointer -em_junk_bf_validate_binary (EPlugin *ep, EMJunkHookTarget *target) +em_junk_bf_validate_binary (EPlugin *ep, EMJunkTarget *target) { return g_file_test (em_junk_bf_binary, G_FILE_TEST_EXISTS) ? (gpointer) "1" : NULL; } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { GConfClient *gconf; diff --git a/plugins/bogo-junk-plugin/org-gnome-bogo-junk-plugin.eplug.xml b/plugins/bogo-junk-plugin/org-gnome-bogo-junk-plugin.eplug.xml index e1d8cc83a0..1317b988d9 100644 --- a/plugins/bogo-junk-plugin/org-gnome-bogo-junk-plugin.eplug.xml +++ b/plugins/bogo-junk-plugin/org-gnome-bogo-junk-plugin.eplug.xml @@ -7,13 +7,12 @@ <_description>Filter junk messages using Bogofilter.</_description> <author name="Mikhail Zabaluev" email="mhz@altlinux.org"/> <hook class="org.gnome.evolution.mail.junk:1.0"> - <group id="EMJunk" > - <item name="Bogofilter" report_non_junk="em_junk_bf_report_non_junk" - report_junk="em_junk_bf_report_junk" - check_junk="em_junk_bf_check_junk" - commit_reports="em_junk_bf_commit_reports" - validate_binary="em_junk_bf_validate_binary"/> - </group> + <interface name="Bogofilter" + report_non_junk="em_junk_bf_report_non_junk" + report_junk="em_junk_bf_report_junk" + check_junk="em_junk_bf_check_junk" + commit_reports="em_junk_bf_commit_reports" + validate_binary="em_junk_bf_validate_binary"/> </hook> <!-- hook into the 'mail properties' menu --> <hook class="org.gnome.evolution.mail.config:1.0"> diff --git a/plugins/caldav/caldav-source.c b/plugins/caldav/caldav-source.c index 3407353574..f5d8f59d12 100644 --- a/plugins/caldav/caldav-source.c +++ b/plugins/caldav/caldav-source.c @@ -42,7 +42,7 @@ /*****************************************************************************/ /* prototypes */ -gint e_plugin_lib_enable (EPluginLib *ep, +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget * oge_caldav (EPlugin *epl, @@ -66,7 +66,7 @@ ensure_caldav_source_group (ECalSourceType source_type) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (enable) { diff --git a/plugins/calendar-weather/Makefile.am b/plugins/calendar-weather/Makefile.am index 360555810a..484adf71e9 100644 --- a/plugins/calendar-weather/Makefile.am +++ b/plugins/calendar-weather/Makefile.am @@ -1,26 +1,16 @@ eds_datadir = `pkg-config --variable=privdatadir evolution-data-server-1.2` -weatherdatadir = $(datadir)/evolution/$(BASE_VERSION)/weather -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_builddir)/shell \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - $(SOURCE_SEL_CFLAGS) \ - -DWEATHER_DATADIR=\""$(weatherdatadir)"\" \ - -DWEATHER_EDS_DATADIR=\""$(eds_datadir)/weather"\" \ +AM_CPPFLAGS = \ + -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ + $(EVOLUTION_CALENDAR_CFLAGS) \ + $(SOURCE_SEL_CFLAGS) \ + -DWEATHER_DATADIR=\""$(weatherdatadir)"\" \ + -DWEATHER_EDS_DATADIR=\""$(eds_datadir)/weather"\" \ $(LIBGWEATHER_CFLAGS) @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 cacc7e00fa..b558f7e3d2 100644 --- a/plugins/calendar-weather/calendar-weather.c +++ b/plugins/calendar-weather/calendar-weather.c @@ -24,7 +24,6 @@ #include "e-util/e-icon-factory.h" #include <calendar/gui/e-cal-config.h> #include <calendar/gui/e-cal-event.h> -#include <calendar/gui/calendar-component.h> #include <libedataserver/e-source.h> #include <libedataserver/e-url.h> #include <libedataserver/e-categories.h> @@ -42,17 +41,17 @@ GtkWidget *e_calendar_weather_location (EPlugin *epl, EConfigHookItemFactoryData GtkWidget *e_calendar_weather_refresh (EPlugin *epl, EConfigHookItemFactoryData *data); GtkWidget *e_calendar_weather_units (EPlugin *epl, EConfigHookItemFactoryData *data); gboolean e_calendar_weather_check (EPlugin *epl, EConfigHookPageCheckData *data); -void e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetComponent *data); -gint e_plugin_lib_enable (EPluginLib *epl, gint enable); +void e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetBackend *data); +gint e_plugin_lib_enable (EPlugin *epl, gint enable); #define WEATHER_BASE_URI "weather://" gint -e_plugin_lib_enable (EPluginLib *epl, gint enable) +e_plugin_lib_enable (EPlugin *epl, gint enable) { GList *l; - gboolean found = FALSE; const gchar *tmp; + gint ii; static struct { const gchar *description; @@ -74,43 +73,35 @@ e_plugin_lib_enable (EPluginLib *epl, gint 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 gchar *)l->data, tmp)) { - found = TRUE; - break; - } + if (!strcmp ((const gchar *)l->data, tmp)) + goto exit; } - if (!found) { - gint i; - - for (i = 0; categories[i].description; i++) { - gchar *filename; + for (ii = 0; categories[ii].description; ii++) { + gchar *filename; - filename = e_icon_factory_get_icon_filename (categories[i].icon_name, GTK_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, GTK_ICON_SIZE_MENU); + e_categories_add ( + _(categories[ii].description), NULL, filename, FALSE); + g_free (filename); } +exit: return 0; } void -e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetComponent *data) +e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetBackend *data) { /* Perform a migration step here. This allows us to keep the weather calendar completely * separate from evolution. If the plugin isn't built, the weather source group won't * show up in the user's evolution. If it is, this will create it if it doesn't exist */ - CalendarComponent *component; - ESourceList *source_list; ESourceGroup *group; GSList *groups; ESourceGroup *weather = NULL; - component = data->component; - source_list = calendar_component_peek_source_list (component); - - groups = e_source_list_peek_groups (source_list); + groups = e_source_list_peek_groups (data->source_list); if (groups) { /* groups are already there, we need to search */ GSList *g; @@ -124,7 +115,7 @@ e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetComponent *data) if (!weather) { group = e_source_group_new (_("Weather"), WEATHER_BASE_URI); - e_source_list_add_group (source_list, group, -1); + e_source_list_add_group (data->source_list, group, -1); weather = group; } @@ -132,7 +123,7 @@ e_calendar_weather_migrate (EPlugin *epl, ECalEventTargetComponent *data) if (weather) g_object_unref (weather); - e_source_list_sync (source_list, NULL); + e_source_list_sync (data->source_list, NULL); } static void 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/copy-tool/ChangeLog b/plugins/copy-tool/ChangeLog deleted file mode 100644 index 5fab320dc8..0000000000 --- a/plugins/copy-tool/ChangeLog +++ /dev/null @@ -1,67 +0,0 @@ -2008-08-27 Sankar P <psankar@novell.com> - -License Changes - - * copy-tool.c: - -2008-08-12 Bharath Acharya <abharath@novell.com> - - * Makefile.am: Use NO_UNDEFINED. Link with more libraries. To generate - dlls on Windows. - -2007-04-02 Sankar P <psankar@novell.com> - - * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr> - - * org-gnome-copy-tool.eplug.xml: - Cleanup. - Fixes part of #301149 - -2006-05-19 Hiroyuki Ikezoe <poincare@ikezoe.net> - - ** Fixes bug #322771 - * copy-tool.c: Use GtkClipboard instead of GtkInvisible. - -2005-11-30 Simon Zheng <Simon.Zheng@Sun.Com> - - Fix for 322733. - - * copy-tool.c: (ct_selection_get): Removed printf() statement - in order to avoid printing NULL point. - (org_gnome_copy_tool_copy_address): Removed printf() statement. - (ct_selection_clear_event): Removed printf() statement. - -2005-05-11 Not Zed <NotZed@Ximian.com> - - * Makefile.am: added built_sources/cleanfiles. - -2005-05-06 Not Zed <NotZed@Ximian.com> - - * Makefile.am: - * org-gnome-copy-tool.eplug.xml: s/.in/.xml/ & i18n. - -2005-02-24 Björn Torkelsson <torkel@acc.umu.se> - - * org-gnome-copy-tool.eplug.in: Added a . to the end of description. - -2004-11-03 Not Zed <NotZed@Ximian.com> - - * org-gnome-copy-tool.eplug.in: gave it a better name and fixed - the description and author tags. - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-28 Not Zed <NotZed@Ximian.com> - - * org-gnome-copy-tool.eplug.in: fix folderview popup hook id. - -2004-10-21 JP Rosevear <jpr@novell.com> - - * org-gnome-copy-tool.eplug.in: s/image/icon/ - -2004-10-20 Not Zed <NotZed@Ximian.com> - - * implemented a copy-utils plugin. - diff --git a/plugins/copy-tool/Makefile.am b/plugins/copy-tool/Makefile.am deleted file mode 100644 index 87d1dff454..0000000000 --- a/plugins/copy-tool/Makefile.am +++ /dev/null @@ -1,20 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-copy-tool.eplug -plugin_LTLIBRARIES = liborg-gnome-copy-tool.la - -liborg_gnome_copy_tool_la_SOURCES = copy-tool.c -liborg_gnome_copy_tool_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_copy_tool_la_LIBADD = \ - $(EVOLUTION_MAIL_LIBS) - -EXTRA_DIST = org-gnome-copy-tool.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/copy-tool/copy-tool.c b/plugins/copy-tool/copy-tool.c deleted file mode 100644 index 769bd00431..0000000000 --- a/plugins/copy-tool/copy-tool.c +++ /dev/null @@ -1,71 +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@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -/* Add 'copy to clipboard' things to various menu's. - - Uh, so far only to copy mail addresses from mail content */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include <glib/gi18n-lib.h> -#include <string.h> - -#include "mail/em-popup.h" - -#include <gtk/gtk.h> - -#include "camel/camel-internet-address.h" -#include "camel/camel-url.h" - -void org_gnome_copy_tool_copy_address(gpointer ep, EMPopupTargetURI *t); - -void -org_gnome_copy_tool_copy_address(gpointer ep, EMPopupTargetURI *t) -{ - if (t->uri) { - CamelInternetAddress *cia = camel_internet_address_new(); - CamelURL *curl; - GtkClipboard *clipboard; - gchar *addr; - const gchar *tmp; - - curl = camel_url_new(t->uri, NULL); - camel_address_decode((CamelAddress *)cia, curl->path); - /* should it perhaps use address format? */ - addr = camel_address_encode((CamelAddress *)cia); - tmp = addr && addr[0] ? addr : t->uri + 7; - - clipboard = gtk_clipboard_get (GDK_SELECTION_PRIMARY); - - gtk_clipboard_set_text (clipboard, tmp, strlen (tmp)); - - clipboard = gtk_clipboard_get (GDK_SELECTION_CLIPBOARD); - gtk_clipboard_set_text (clipboard, tmp, strlen (tmp)); - - g_free(addr); - camel_url_free(curl); - camel_object_unref(cia); - } -} diff --git a/plugins/copy-tool/org-gnome-copy-tool.eplug.xml b/plugins/copy-tool/org-gnome-copy-tool.eplug.xml deleted file mode 100644 index 3b6a30752d..0000000000 --- a/plugins/copy-tool/org-gnome-copy-tool.eplug.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.copyTool" - location="@PLUGINDIR@/liborg-gnome-copy-tool@SOEXT@" - _name="Copy Tool"> - <_description>Copy things to the clipboard.</_description> - <author name="Michael Zucchi" email="notzed@ximian.com"/> - - <!-- hook into the uri popup menu --> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.folderview.popup" target="uri"> - <item - type="item" - path="80.test" - icon="gtk-copy" - _label="Copy _Email Address" - visible="mailto" - activate="org_gnome_copy_tool_copy_address"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/default-mailer/Makefile.am b/plugins/default-mailer/Makefile.am index 94d3436f0e..ccb8071a99 100644 --- a/plugins/default-mailer/Makefile.am +++ b/plugins/default-mailer/Makefile.am @@ -1,6 +1,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ - -I$(top_builddir)/shell \ + -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) @EVO_PLUGIN_RULE@ diff --git a/plugins/email-custom-header/Makefile.am b/plugins/email-custom-header/Makefile.am index efd46a5435..2ab28fad67 100644 --- a/plugins/email-custom-header/Makefile.am +++ b/plugins/email-custom-header/Makefile.am @@ -23,8 +23,7 @@ liborg_gnome_email_custom_header_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ $(top_builddir)/mail/libevolution-mail.la \ - $(EVOLUTION_MAIL_LIBS) \ - $(NO_UNDEFINED_REQUIRED_LIBS) + $(EVOLUTION_MAIL_LIBS) liborg_gnome_email_custom_header_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c index 4617edb83e..127cbdc815 100644 --- a/plugins/email-custom-header/email-custom-header.c +++ b/plugins/email-custom-header/email-custom-header.c @@ -29,7 +29,6 @@ #include <gconf/gconf-client.h> #include <e-util/e-error.h> #include <glade/glade.h> -#include "mail/em-menu.h" #include "mail/em-utils.h" #include "mail/em-event.h" #include "composer/e-msg-composer.h" @@ -80,13 +79,13 @@ static void epech_dialog_dispose (GObject *object); static void epech_setup_widgets (CustomHeaderOptionsDialog *mch); static gint epech_check_existing_composer_window(gconstpointer a, gconstpointer b); static void commit_changes (ConfigData *cd); -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); gboolean e_plugin_ui_init(GtkUIManager *ui_manager, EMsgComposer *composer); GtkWidget *org_gnome_email_custom_header_config_option (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { return 0; } @@ -549,13 +548,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/exchange-operations/exchange-account-setup.c b/plugins/exchange-operations/exchange-account-setup.c index 296e44282c..5943d5f3df 100644 --- a/plugins/exchange-operations/exchange-account-setup.c +++ b/plugins/exchange-operations/exchange-account-setup.c @@ -668,7 +668,7 @@ construct_owa_url (CamelURL *url) return owa_url; } -/* used by editor and druid - same code */ +/* used by editor and assistant - same code */ GtkWidget * org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) { @@ -734,7 +734,7 @@ org_gnome_exchange_owa_url(EPlugin *epl, EConfigHookItemFactoryData *data) /* url has hostname but not owa_url. * Account has been created using x-c-s or evo is upgraded to 2.2 - * When invoked from druid, hostname will get set after validation, + * When invoked from assistant, hostname will get set after validation, * so this condition will never be true during account creation. */ owa_url = construct_owa_url (url); diff --git a/plugins/exchange-operations/exchange-operations.c b/plugins/exchange-operations/exchange-operations.c index d79948ccc4..35ed781fad 100644 --- a/plugins/exchange-operations/exchange-operations.c +++ b/plugins/exchange-operations/exchange-operations.c @@ -58,7 +58,7 @@ free_exchange_listener (void) } gint -e_plugin_lib_enable (EPluginLib *eplib, gint enable) +e_plugin_lib_enable (EPlugin *eplib, gint enable) { if (!exchange_global_config_listener) { exchange_global_config_listener = exchange_config_listener_new (); diff --git a/plugins/exchange-operations/exchange-user-dialog.c b/plugins/exchange-operations/exchange-user-dialog.c index 6cb20e682d..eec2c7bddc 100644 --- a/plugins/exchange-operations/exchange-user-dialog.c +++ b/plugins/exchange-operations/exchange-user-dialog.c @@ -22,9 +22,6 @@ #include "exchange-user-dialog.h" #include "e2k-types.h" -#include <bonobo-activation/bonobo-activation.h> -#include <bonobo/bonobo-exception.h> -#include <bonobo/bonobo-widget.h> #include <e-util/e-dialog-utils.h> #include <libedataserverui/e-name-selector.h> #include "e2k-xml-utils.h" diff --git a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml index 381ac94e4c..063d5c98c6 100644 --- a/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml +++ b/plugins/exchange-operations/org-gnome-exchange-operations.eplug.xml @@ -33,7 +33,7 @@ <group target="account" - id="org.gnome.evolution.mail.config.accountDruid" + id="org.gnome.evolution.mail.config.accountAssistant" check="org_gnome_exchange_check_options"> <item type="item_table" path="10.receive/10.config/20.owa" diff --git a/plugins/external-editor/Makefile.am b/plugins/external-editor/Makefile.am index 05457efd17..8c47bca60c 100644 --- a/plugins/external-editor/Makefile.am +++ b/plugins/external-editor/Makefile.am @@ -35,8 +35,15 @@ liborg_gnome_external_editor_la_SOURCES = \ liborg_gnome_external_editor_la_LDFLAGS = \ -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_external_editor_la_LIBADD = \ - $(NO_UNDEFINED_REQUIRED_LIBS) +liborg_gnome_external_editor_la_LIBADD = \ + $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/composer/libcomposer.la \ + $(top_builddir)/shell/libeshell.la \ + $(top_builddir)/addressbook/gui/contact-editor/libecontacteditor.la \ + $(top_builddir)/addressbook/gui/contact-list-editor/libecontactlisteditor.la \ + $(top_builddir)/mail/libevolution-mail.la \ + $(EVOLUTION_MAIL_LIBS) \ + $(GNOME_PLATFORM_LIBS) schemadir = $(GCONF_SCHEMA_FILE_DIR) schema_in_files = apps-evolution-external-editor.schemas.in diff --git a/plugins/external-editor/external-editor.c b/plugins/external-editor/external-editor.c index e6ed35cf6b..88858c0211 100644 --- a/plugins/external-editor/external-editor.c +++ b/plugins/external-editor/external-editor.c @@ -26,7 +26,6 @@ #include <config.h> #endif -#include <mail/em-menu.h> #include <mail/em-config.h> #include <mail/em-composer-utils.h> #include <mail/mail-config.h> diff --git a/plugins/face/Makefile.am b/plugins/face/Makefile.am index 86a522a2d0..07cbb8199d 100644 --- a/plugins/face/Makefile.am +++ b/plugins/face/Makefile.am @@ -22,8 +22,7 @@ liborg_gnome_face_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ $(top_builddir)/mail/libevolution-mail.la \ - $(EVOLUTION_MAIL_LIBS) \ - $(NO_UNDEFINED_REQUIRED_LIBS) + $(EVOLUTION_MAIL_LIBS) liborg_gnome_face_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) diff --git a/plugins/face/face.c b/plugins/face/face.c index 6bbc7bbf1a..1bb56c2bff 100644 --- a/plugins/face/face.c +++ b/plugins/face/face.c @@ -28,7 +28,6 @@ #include "composer/e-msg-composer.h" #include <gtk/gtk.h> #include <glib/gi18n.h> -#include <mail/em-menu.h> #include <e-util/e-error.h> #include <e-util/e-util.h> diff --git a/plugins/folder-unsubscribe/ChangeLog b/plugins/folder-unsubscribe/ChangeLog deleted file mode 100644 index fd8eb19b43..0000000000 --- a/plugins/folder-unsubscribe/ChangeLog +++ /dev/null @@ -1,58 +0,0 @@ -2008-09-23 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #552850 - - * org-gnome-mail-folder-unsubscribe.eplug.xml: - Prefer the term "side bar" over "folder tree". - -2008-08-27 Sankar P <psankar@novell.com> - -License Changes - - * folder-unsubscribe.c: - -2008-08-12 Bharath Acharya <abharath@novell.com> - - * Makefile.am: Use NO_UNDEFINED. Link with more libraries. To generate - dlls on Windows. - -2007-12-20 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #362638 - - * folder-unsubscribe.c: - Use the new MailMsg API for messages. - -2007-11-18 Gilles Dartiguelongue <gdartigu@svn.gnome.org> - - ** Fix bug #495875 - - * org-gnome-mail-folder-unsubscribe.eplug.xml: - right click menu reordering - -2007-04-02 Sankar P <psankar@novell.com> - - * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr> - - * org-gnome-mail-folder-unsubscribe.eplug.xml: - Cleanup. - Fixes part of #301149 - - -2005-05-06 Not Zed <NotZed@Ximian.com> - - * Makefile.am: - * org-gnome-mail-folder-unsubscribe.eplug.xml: s/.in/.xml/ & i18n. - -2005-02-24 Björn Torkelsson <torkel@acc.umu.se> - - * org-gnome-mail-folder-unsubscribe.eplug.in: Updated description. - -2004-11-01 JP Rosevear <jpr@novell.com> - - * Makefile.am: dist .eplug.in file - -2004-10-28 Not Zed <NotZed@Ximian.com> - - * org-gnome-mail-folder-unsubscribe.eplug.in: fix hook id - diff --git a/plugins/folder-unsubscribe/Makefile.am b/plugins/folder-unsubscribe/Makefile.am deleted file mode 100644 index 242d911ed0..0000000000 --- a/plugins/folder-unsubscribe/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-mail-folder-unsubscribe.eplug -plugin_LTLIBRARIES = liborg-gnome-mail-folder-unsubscribe.la - -liborg_gnome_mail_folder_unsubscribe_la_SOURCES = folder-unsubscribe.c -liborg_gnome_mail_folder_unsubscribe_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_mail_folder_unsubscribe_la_LIBADD = \ - $(top_builddir)/mail/libevolution-mail.la \ - $(EVOLUTION_MAIL_LIBS) - -EXTRA_DIST = org-gnome-mail-folder-unsubscribe.eplug.xml - --include $(top_srcdir)/git.mk diff --git a/plugins/folder-unsubscribe/folder-unsubscribe.c b/plugins/folder-unsubscribe/folder-unsubscribe.c deleted file mode 100644 index d1b8957fb0..0000000000 --- a/plugins/folder-unsubscribe/folder-unsubscribe.c +++ /dev/null @@ -1,106 +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: - * Jeffrey Stedfast <fejj@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 <camel/camel-session.h> -#include <camel/camel-store.h> -#include <camel/camel-url.h> - -#include "mail/em-popup.h" -#include "mail/mail-mt.h" -#include "mail/mail-ops.h" - -void org_gnome_mail_folder_unsubscribe (EPlugin *plug, EMPopupTargetFolder *target); - -struct _folder_unsub_t { - MailMsg base; - - gchar *uri; -}; - -static gchar * -folder_unsubscribe_desc (struct _folder_unsub_t *msg) -{ - return g_strdup_printf ( - _("Unsubscribing from folder \"%s\""), msg->uri); -} - -extern CamelSession *session; - -static void -folder_unsubscribe_exec (struct _folder_unsub_t *msg) -{ - const gchar *path = NULL; - CamelStore *store; - CamelURL *url; - - if (!(store = camel_session_get_store (session, msg->uri, &msg->base.ex))) - return; - - url = camel_url_new (msg->uri, NULL); - if (((CamelService *) store)->provider->url_flags & CAMEL_URL_FRAGMENT_IS_PATH) - path = url->fragment; - else if (url->path && url->path[0]) - path = url->path + 1; - - if (path != NULL) - camel_store_unsubscribe_folder (store, path, &msg->base.ex); - - camel_url_free (url); -} - -static void -folder_unsubscribe_free (struct _folder_unsub_t *msg) -{ - g_free (msg->uri); -} - -static MailMsgInfo unsubscribe_info = { - sizeof (struct _folder_unsub_t), - (MailMsgDescFunc) folder_unsubscribe_desc, - (MailMsgExecFunc) folder_unsubscribe_exec, - (MailMsgDoneFunc) NULL, - (MailMsgFreeFunc) folder_unsubscribe_free -}; - -void -org_gnome_mail_folder_unsubscribe (EPlugin *plug, EMPopupTargetFolder *target) -{ - struct _folder_unsub_t *unsub; - - if (target->uri == NULL) - return; - - unsub = mail_msg_new (&unsubscribe_info); - unsub->uri = g_strdup (target->uri); - - mail_msg_unordered_push (unsub); -} diff --git a/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.xml b/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.xml deleted file mode 100644 index 24271fa8af..0000000000 --- a/plugins/folder-unsubscribe/org-gnome-mail-folder-unsubscribe.eplug.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin - id="org.gnome.evolution.mail.folder.unsubscribe" - type="shlib" - domain="@GETTEXT_PACKAGE@" - _name="Unsubscribe Folders" - location="@PLUGINDIR@/liborg-gnome-mail-folder-unsubscribe@SOEXT@"> - <_description>Unsubscribe from an IMAP folder by right-clicking on it in the folder tree.</_description> - <author name="Jeffrey Stedfast" email="fejj@novell.com"/> - - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder"> - <item type="item" path="30.emc.03" _label="_Unsubscribe" - activate="org_gnome_mail_folder_unsubscribe" - enable="delete" visible="delete"/> - </menu> - </hook> - </e-plugin> -</e-plugin-list> diff --git a/plugins/google-account-setup/Makefile.am b/plugins/google-account-setup/Makefile.am index 67a7c2c152..3434dbb331 100644 --- a/plugins/google-account-setup/Makefile.am +++ b/plugins/google-account-setup/Makefile.am @@ -1,7 +1,7 @@ AM_CPPFLAGS = \ -I . \ - -I$(top_srcdir) \ - -I$(top_builddir)/shell \ + -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ -DCALDAV_GLADEDIR=\""$(gladedir)"\" \ $(EVOLUTION_CALENDAR_CFLAGS) \ $(EVOLUTION_ADDRESSBOOK_CFLAGS) diff --git a/plugins/google-account-setup/google-source.c b/plugins/google-account-setup/google-source.c index 2a8b6c46e5..1dc76a0431 100644 --- a/plugins/google-account-setup/google-source.c +++ b/plugins/google-account-setup/google-source.c @@ -37,7 +37,6 @@ #include <calendar/gui/e-cal-config.h> #include <calendar/gui/e-cal-event.h> -#include <calendar/gui/calendar-component.h> #include <libedataserver/e-url.h> #include <libedataserver/e-account-list.h> @@ -61,9 +60,9 @@ /*****************************************************************************/ /* prototypes */ -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget *plugin_google (EPlugin *epl, EConfigHookItemFactoryData *data); -void e_calendar_google_migrate (EPlugin *epl, ECalEventTargetComponent *data); +void e_calendar_google_migrate (EPlugin *epl, ECalEventTargetBackend *data); /*****************************************************************************/ /* plugin intialization */ @@ -83,7 +82,7 @@ ensure_google_source_group (void) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (enable) { @@ -785,15 +784,13 @@ plugin_google (EPlugin *epl, } void -e_calendar_google_migrate (EPlugin *epl, ECalEventTargetComponent *data) +e_calendar_google_migrate (EPlugin *epl, ECalEventTargetBackend *data) { - CalendarComponent *component; ESourceList *source_list; ESourceGroup *google = NULL; gboolean changed = FALSE; - component = data->component; - source_list = calendar_component_peek_source_list (component); + source_list = data->source_list; google = e_source_list_peek_group_by_base_uri (source_list, GOOGLE_BASE_URI); if (google) { diff --git a/plugins/groupwise-account-setup/groupwise-account-setup.c b/plugins/groupwise-account-setup/groupwise-account-setup.c index 6375446d7e..0872a9c2a7 100644 --- a/plugins/groupwise-account-setup/groupwise-account-setup.c +++ b/plugins/groupwise-account-setup/groupwise-account-setup.c @@ -32,7 +32,7 @@ static CamelGwListener *config_listener = NULL; -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget* org_gnome_gw_account_setup(struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); void ensure_mandatory_esource_properties (EPlugin *ep, ESEventTargetUpgrade *target); @@ -114,7 +114,7 @@ free_groupwise_listener ( void ) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (!config_listener) { config_listener = camel_gw_listener_new (); diff --git a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml b/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml index 16947d89c7..f99606f8a4 100644 --- a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml +++ b/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml @@ -6,7 +6,7 @@ <_description>Add Novell GroupWise support to Evolution.</_description> <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountDruid"> + <group target="account" id="org.gnome.evolution.mail.config.accountAssistant"> <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_groupwise_account_setup"/> </group> </hook> diff --git a/plugins/groupwise-features/Makefile.am b/plugins/groupwise-features/Makefile.am index b26fa1693d..20fd6bf812 100644 --- a/plugins/groupwise-features/Makefile.am +++ b/plugins/groupwise-features/Makefile.am @@ -45,7 +45,6 @@ liborg_gnome_groupwise_features_la_LIBADD= \ $(top_builddir)/calendar/gui/libevolution-calendar.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ $(top_builddir)/filter/libfilter.la \ - $(NO_UNDEFINED_REQUIRED_LIBS) \ $(EVOLUTION_CALENDAR_LIBS) \ $(EVOLUTION_MAIL_LIBS) \ $(CAMEL_GROUPWISE_LIBS) diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c index 6dcbfe8d22..a208116f0a 100644 --- a/plugins/groupwise-features/install-shared.c +++ b/plugins/groupwise-features/install-shared.c @@ -27,8 +27,6 @@ #include <string.h> #include <glib.h> #include <gtk/gtk.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-edge.h> #include <glib/gi18n.h> #include <gconf/gconf-client.h> #include <e-util/e-config.h> @@ -154,7 +152,7 @@ accept_free(gpointer data) } static void -accept_clicked(GnomeDruidPage *page, GtkWidget *druid, CamelMimeMessage *msg) +apply_clicked (GtkAssistant *assistant, CamelMimeMessage *msg) { EMFolderTreeModel *model; EMFolderTree *folder_tree; @@ -165,6 +163,7 @@ accept_clicked(GnomeDruidPage *page, GtkWidget *druid, CamelMimeMessage *msg) accept_data = g_new0(struct AcceptData, 1); model = mail_component_peek_tree_model (NULL); folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); + dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); uri = em_folder_tree_get_selected_uri(folder_tree); em_folder_selector_set_selected ((EMFolderSelector *) dialog, uri); @@ -174,11 +173,10 @@ accept_clicked(GnomeDruidPage *page, GtkWidget *druid, CamelMimeMessage *msg) accept_data->model = model; g_object_set_data_full((GObject *)dialog, "accept-data", accept_data, accept_free); g_signal_connect (dialog, "response", G_CALLBACK (install_folder_response), accept_data); - g_object_set_data_full((GObject *)dialog, "druid", druid, (GDestroyNotify)gtk_widget_destroy); + g_object_set_data_full((GObject *)dialog, "assistant", assistant, (GDestroyNotify)gtk_widget_destroy); gtk_window_set_title (GTK_WINDOW (dialog), "Install Shared Folder"); gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); gtk_widget_show (dialog); - } void @@ -188,8 +186,6 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target) const gchar *name; const gchar *email; GtkWidget *window; - GnomeDruid *wizard; - GnomeDruidPageEdge *title_page; CamelMimeMessage *msg = (CamelMimeMessage *) target->message; CamelStreamMem *content; CamelDataWrapper *dw; @@ -216,20 +212,36 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target) from_addr = camel_mime_message_get_from ((CamelMimeMessage *)target->message); if (from_addr && camel_internet_address_get(from_addr, 0, &name, &email)) { + GtkWidget *page; + GtkAssistant *assistant = GTK_ASSISTANT (gtk_assistant_new ()); + start_message = g_strdup_printf (_("The user '%s' has shared a folder with you\n\n" "Message from '%s'\n\n\n" "%s\n\n\n" - "Click 'Forward' to install the shared folder\n\n"), + "Click 'Apply' to install the shared folder\n\n"), name, name, content->buffer->data); - title_page = GNOME_DRUID_PAGE_EDGE (gnome_druid_page_edge_new_with_vals(GNOME_EDGE_START, TRUE, _("Install the shared folder"), start_message, NULL, NULL, NULL)); - g_free(start_message); - wizard = GNOME_DRUID (gnome_druid_new_with_window (_("Shared Folder Installation"), NULL, TRUE, (GtkWidget**)(&window))); - gtk_window_set_position (GTK_WINDOW (window) , GTK_WIN_POS_CENTER_ALWAYS); - gnome_druid_append_page(wizard, GNOME_DRUID_PAGE(title_page)); - gtk_widget_show_all (GTK_WIDGET (title_page)); - camel_object_ref(msg); - g_object_set_data_full((GObject *)title_page, "msg", msg, camel_object_unref); - g_signal_connect (title_page, "next", G_CALLBACK(accept_clicked), msg); + + page = gtk_label_new (start_message); + gtk_label_set_line_wrap (GTK_LABEL (page), TRUE); + gtk_misc_set_alignment (GTK_MISC (page), 0.0, 0.0); + gtk_misc_set_padding (GTK_MISC (page), 10, 10); + + gtk_assistant_append_page (assistant, page); + gtk_assistant_set_page_title (assistant, page, _("Install the shared folder")); + gtk_assistant_set_page_type (assistant, page, GTK_ASSISTANT_PAGE_CONFIRM); + gtk_assistant_set_page_complete (assistant, page, TRUE); + + gtk_window_set_title (GTK_WINDOW (assistant), _("Shared Folder Installation")); + gtk_window_set_position (GTK_WINDOW (assistant) , GTK_WIN_POS_CENTER_ALWAYS); + + camel_object_ref (msg); + g_object_set_data_full((GObject *)page, "msg", msg, camel_object_unref); + + g_signal_connect (assistant, "apply", G_CALLBACK (apply_clicked), msg); + + gtk_widget_show_all (GTK_WIDGET (assistant)); + + g_free (start_message); } else g_warning ("Could not get the sender name"); diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c index b8fe49506b..123fc0641b 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> @@ -303,7 +304,7 @@ proxy_login_cb (GtkDialog *dialog, gint state) static void proxy_soap_login (gchar *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/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index c9e8ffb572..791a2da541 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -382,6 +382,7 @@ create_shared_folder(EPopup *ep, EPopupItem *p, gpointer data) model = mail_component_peek_tree_model (mail_component_peek ()); folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); + dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); uri = em_folder_tree_get_selected_uri(folder_tree); em_folder_selector_set_selected ((EMFolderSelector *) dialog, uri); diff --git a/plugins/hula-account-setup/hula-account-setup.c b/plugins/hula-account-setup/hula-account-setup.c index 3f5898b724..34427f3b71 100644 --- a/plugins/hula-account-setup/hula-account-setup.c +++ b/plugins/hula-account-setup/hula-account-setup.c @@ -27,7 +27,7 @@ static CamelHulaListener *config_listener = NULL; -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget* org_gnome_evolution_hula_account_setup (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); static void @@ -37,7 +37,7 @@ free_hula_listener ( void ) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (!config_listener) { config_listener = camel_hula_listener_new (); diff --git a/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml b/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml index 68ae2fe8dd..e90ce650cb 100644 --- a/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml +++ b/plugins/hula-account-setup/org-gnome-evolution-hula-account-setup.eplug.xml @@ -6,7 +6,7 @@ <_description>Add Hula support to Evolution.</_description> <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountDruid"> + <group target="account" id="org.gnome.evolution.mail.config.accountAssistant"> <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_evolution_hula_account_setup"/> </group> </hook> diff --git a/plugins/imap-features/Makefile.am b/plugins/imap-features/Makefile.am index c539a70cb2..d21841f7c7 100644 --- a/plugins/imap-features/Makefile.am +++ b/plugins/imap-features/Makefile.am @@ -18,9 +18,10 @@ plugin_LTLIBRARIES = liborg-gnome-imap-features.la liborg_gnome_imap_features_la_SOURCES = \ imap-headers.c -liborg_gnome_imap_features_la_LIBADD= \ - $(NO_UNDEFINED_REQUIRED_LIBS) \ - $(EVOLUTION_MAIL_LIBS) +liborg_gnome_imap_features_la_LIBADD= \ + $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/mail/libevolution-mail.la \ + $(EVOLUTION_MAIL_LIBS) liborg_gnome_imap_features_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) diff --git a/plugins/imap-features/imap-headers.c b/plugins/imap-features/imap-headers.c index 0154074498..baa6ee43dc 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/ipod-sync/Makefile.am b/plugins/ipod-sync/Makefile.am index a55fc83a4e..74522a41a3 100644 --- a/plugins/ipod-sync/Makefile.am +++ b/plugins/ipod-sync/Makefile.am @@ -17,7 +17,7 @@ liborg_gnome_ipod_sync_evolution_la_SOURCES = \ format-handler.h \ evolution-ipod-sync.h -liborg_gnome_ipod_sync_evolution_la_LDFLAGS = -module -avoid-version +liborg_gnome_ipod_sync_evolution_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_ipod_sync_evolution_la_LIBADD = \ $(EVOLUTION_CALENDAR_LIBS) diff --git a/plugins/itip-formatter/Makefile.am b/plugins/itip-formatter/Makefile.am index 80b70cc6c9..5253742169 100644 --- a/plugins/itip-formatter/Makefile.am +++ b/plugins/itip-formatter/Makefile.am @@ -1,5 +1,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) \ $(EVOLUTION_CALENDAR_CFLAGS) diff --git a/plugins/itip-formatter/itip-formatter.c b/plugins/itip-formatter/itip-formatter.c index 89313dd995..94f9081ecd 100644 --- a/plugins/itip-formatter/itip-formatter.c +++ b/plugins/itip-formatter/itip-formatter.c @@ -46,7 +46,6 @@ #include <gtkhtml/gtkhtml-embedded.h> #include <mail/em-format-hook.h> #include <mail/em-config.h> -#include <mail/em-format.h> #include <mail/em-format-html.h> #include <mail/em-utils.h> #include <mail/mail-folder-cache.h> @@ -57,6 +56,7 @@ #include <calendar/gui/calendar-config.h> #include <calendar/gui/itip-utils.h> #include <calendar/common/authentication.h> +#include <shell/e-shell.h> #include "itip-view.h" #define CLASSID "itip://" @@ -715,18 +715,27 @@ find_cal_opened_cb (ECal *ecal, ECalendarStatus status, gpointer data) if ((pitip->method == ICAL_METHOD_PUBLISH || pitip->method == ICAL_METHOD_REQUEST) && !pitip->current_ecal) { /* Reuse already declared one or rename? */ + EShell *shell; + EShellSettings *shell_settings; ESource *source = NULL; gchar *uid; + /* FIXME Find a better way to obtain the shell. */ + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + switch (pitip->type) { case E_CAL_SOURCE_TYPE_EVENT: - uid = calendar_config_get_primary_calendar (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-calendar"); break; case E_CAL_SOURCE_TYPE_TODO: - uid = calendar_config_get_primary_tasks (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-task-list"); break; case E_CAL_SOURCE_TYPE_JOURNAL: - uid = calendar_config_get_primary_memos (); + uid = e_shell_settings_get_string ( + shell_settings, "cal-primary-memo-list"); break; default: uid = NULL; 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 7793f851d7..0000000000 --- a/plugins/mail-account-disable/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/widgets \ - -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 aee3043682..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, gpointer data); -void org_gnome_create_mail_account_disable (EPlugin *ep, EMPopupTargetFolder *t); - -static EPopupItem popup_items[] = { - { E_POPUP_ITEM, (gchar *) "40.emc.04", (gchar *) N_("_Disable"), mail_account_disable, NULL, NULL, 0, EM_POPUP_FOLDER_STORE }, - { E_POPUP_ITEM, (gchar *) "40.emc.04", (gchar *) N_("Proxy _Logout"), mail_account_disable, NULL, NULL, 0, EM_POPUP_FOLDER_STORE } -}; - -static void -popup_free (EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free (items); -} - -void -mail_account_disable (EPopup *ep, EPopupItem *p, gpointer 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 535a87a314..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>Disable an account by right-clicking on it in the folder tree.</_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 0915329b42..b53e6a55a6 100644 --- a/plugins/mail-notification/Makefile.am +++ b/plugins/mail-notification/Makefile.am @@ -9,7 +9,8 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) \ - $(LIBNOTIFY_CFLAGS) + $(LIBNOTIFY_CFLAGS) \ + $(CANBERRA_CFLAGS) if DBUS_SUPPORT AM_CPPFLAGS += -DDBUS_API_SUBJECT_TO_CHANGE=1 \ @@ -24,9 +25,12 @@ plugin_LTLIBRARIES = liborg-gnome-mail-notification.la liborg_gnome_mail_notification_la_SOURCES = mail-notification.c liborg_gnome_mail_notification_la_LDFLAGS = \ -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_mail_notification_la_LIBADD = \ - $(LIBNOTIFY_LIBS) \ - $(NO_UNDEFINED_REQUIRED_LIBS) +liborg_gnome_mail_notification_la_LIBADD = \ + $(CANBERRA_LIBS) \ + $(LIBNOTIFY_LIBS) \ + $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/mail/libevolution-mail.la \ + $(GNOME_PLATFORM_LIBS) if DBUS_SUPPORT liborg_gnome_mail_notification_la_LIBADD += $(DBUS_GLIB_LIBS) diff --git a/plugins/mail-notification/apps-evolution-mail-notification.schemas.in b/plugins/mail-notification/apps-evolution-mail-notification.schemas.in index c0a038068d..ad7dd91615 100644 --- a/plugins/mail-notification/apps-evolution-mail-notification.schemas.in +++ b/plugins/mail-notification/apps-evolution-mail-notification.schemas.in @@ -91,6 +91,17 @@ <long>Sound file to be played when new messages arrive, if not in beep mode.</long> </locale> </schema> + <schema> + <key>/schemas/apps/evolution/eplugin/mail-notification/sound-use-theme</key> + <applyto>/apps/evolution/eplugin/mail-notification/sound-use-theme</applyto> + <owner>evolution-mail</owner> + <type>bool</type> + <default>false</default> + <locale name="C"> + <short>Use sound theme</short> + <long>Play themed sound when new messages arrive, if not in beep mode.</long> + </locale> + </schema> </schemalist> </gconfschemafile> diff --git a/plugins/mail-notification/mail-notification.c b/plugins/mail-notification/mail-notification.c index c42473acc7..f6272ba873 100644 --- a/plugins/mail-notification/mail-notification.c +++ b/plugins/mail-notification/mail-notification.c @@ -29,7 +29,7 @@ #include <glib/gi18n.h> #include <gtk/gtk.h> #include <gconf/gconf-client.h> -#include <libgnome/gnome-sound.h> +#include <canberra-gtk.h> #ifdef HAVE_DBUS #include <dbus/dbus-glib.h> @@ -38,7 +38,9 @@ #include <time.h> +#include "e-util/e-binding.h" #include "e-util/e-config.h" +#include "e-util/gconf-bridge.h" #include "mail/em-utils.h" #include "mail/em-event.h" #include "mail/em-folder-tree-model.h" @@ -84,7 +86,7 @@ static GStaticMutex mlock = G_STATIC_MUTEX_INIT; static gboolean is_part_enabled (const gchar *gconf_key) { - /* the part is enabled by defaul */ + /* the part is enabled by default */ gboolean res = TRUE; GConfClient *client; GConfValue *is_key; @@ -102,17 +104,6 @@ is_part_enabled (const gchar *gconf_key) return res; } -static void -set_part_enabled (const gchar *gconf_key, gboolean enable) -{ - GConfClient *client; - - client = gconf_client_get_default (); - - gconf_client_set_bool (client, gconf_key, enable, NULL); - g_object_unref (client); -} - /* ------------------------------------------------------------------- */ /* DBUS part */ /* ------------------------------------------------------------------- */ @@ -201,14 +192,6 @@ init_dbus (void) return TRUE; } -static void -toggled_dbus_cb (GtkWidget *widget, gpointer data) -{ - g_return_if_fail (widget != NULL); - - set_part_enabled (GCONF_KEY_ENABLED_DBUS, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))); -} - /* ------------------------------------------------------------------- */ static void @@ -236,21 +219,6 @@ enable_dbus (gint enable) bus = NULL; } } - -static GtkWidget * -get_config_widget_dbus (void) -{ - GtkWidget *w; - - w = gtk_check_button_new_with_mnemonic (_("Generate a _D-Bus message")); - - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (w), is_part_enabled (GCONF_KEY_ENABLED_DBUS)); - g_signal_connect (G_OBJECT (w), "toggled", G_CALLBACK (toggled_dbus_cb), NULL); - gtk_widget_show (w); - - return w; -} - #endif /* ------------------------------------------------------------------- */ @@ -276,12 +244,12 @@ icon_activated (GtkStatusIcon *icon, NotifyNotification *pnotify) icon_activated (GtkStatusIcon *icon, gpointer pnotify) #endif { - #ifdef HAVE_LIBNOTIFY +#ifdef HAVE_LIBNOTIFY if (notify) notify_notification_close (notify, NULL); notify = NULL; - #endif +#endif gtk_status_icon_set_visible (status_icon, FALSE); g_object_unref (status_icon); @@ -314,45 +282,6 @@ stop_blinking_cb (gpointer data) return FALSE; } -struct _StatusConfigureWidgets -{ - GtkWidget *enable; - GtkWidget *blink; - #ifdef HAVE_LIBNOTIFY - GtkWidget *message; - #endif -}; - -static void -toggled_status_cb (GtkWidget *widget, gpointer data) -{ - struct _StatusConfigureWidgets *scw = (struct _StatusConfigureWidgets *) data; - gboolean enabl; - - g_return_if_fail (scw != NULL); - g_return_if_fail (scw->enable != NULL); - g_return_if_fail (scw->blink != NULL); - #ifdef HAVE_LIBNOTIFY - g_return_if_fail (scw->message != NULL); - #endif - - enabl = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->enable)); - if (widget == scw->enable) - set_part_enabled (GCONF_KEY_ENABLED_STATUS, enabl); - - #define work_widget(w, key) \ - gtk_widget_set_sensitive (w, enabl); \ - if (widget == w) \ - set_part_enabled (key, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (w))); - - work_widget (scw->blink, GCONF_KEY_STATUS_BLINK); - #ifdef HAVE_LIBNOTIFY - work_widget (scw->message, GCONF_KEY_STATUS_NOTIFICATION); - #endif - - #undef work_widget -} - /* ------------------------------------------------------------------- */ static void @@ -409,11 +338,11 @@ popup_menu_status (GtkStatusIcon *status_icon, guint button, guint activate_time menu = GTK_MENU (gtk_menu_new ()); item = gtk_image_menu_item_new_from_stock (GTK_STOCK_CLOSE, NULL); - #ifdef HAVE_LIBNOTIFY +#ifdef HAVE_LIBNOTIFY g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (icon_activated), notify); - #else +#else g_signal_connect (G_OBJECT (item), "activate", G_CALLBACK (icon_activated), NULL); - #endif +#endif gtk_widget_show (item); gtk_menu_shell_append (GTK_MENU_SHELL (menu), item); @@ -513,7 +442,7 @@ new_notify_status (EMEventTargetFolder *t) gtk_status_icon_set_visible (status_icon, TRUE); - #ifdef HAVE_LIBNOTIFY +#ifdef HAVE_LIBNOTIFY /* Now check whether we're supposed to send notifications */ if (is_part_enabled (GCONF_KEY_STATUS_NOTIFICATION)) { if (notify) { @@ -534,16 +463,16 @@ new_notify_status (EMEventTargetFolder *t) } } } - #endif +#endif g_free (msg); if (new_icon) { - #ifdef HAVE_LIBNOTIFY +#ifdef HAVE_LIBNOTIFY g_signal_connect (G_OBJECT (status_icon), "activate", G_CALLBACK (icon_activated), notify); - #else +#else g_signal_connect (G_OBJECT (status_icon), "activate", G_CALLBACK (icon_activated), NULL); - #endif +#endif g_signal_connect (G_OBJECT (status_icon), "popup-menu", G_CALLBACK (popup_menu_status), NULL); } @@ -555,56 +484,77 @@ read_notify_status (EMEventTargetMessage *t) if (!status_icon) return; - #ifdef HAVE_LIBNOTIFY +#ifdef HAVE_LIBNOTIFY icon_activated (status_icon, notify); - #else +#else icon_activated (status_icon, NULL); - #endif -} - -static void -enable_status (gint enable) -{ - /* this does nothing on enable, it's here just to be - consistent with other parts of this plugin */ +#endif } static GtkWidget * get_config_widget_status (void) { - GtkWidget *vbox, *parent, *alignment; - struct _StatusConfigureWidgets *scw; + GtkWidget *vbox; + GtkWidget *master; + GtkWidget *container; + GtkWidget *widget; + GConfBridge *bridge; + const gchar *text; - vbox = gtk_vbox_new (FALSE, 0); - scw = g_malloc0 (sizeof (struct _StatusConfigureWidgets)); + bridge = gconf_bridge_get (); - #define create_check(c, key, desc) \ - c = gtk_check_button_new_with_mnemonic (desc); \ - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (c), is_part_enabled (key)); \ - gtk_box_pack_start (GTK_BOX (parent), c, FALSE, FALSE, 0); \ - g_signal_connect (G_OBJECT (c), "toggled", G_CALLBACK (toggled_status_cb), scw); + vbox = gtk_vbox_new (FALSE, 6); + gtk_widget_show (vbox); - parent = vbox; - create_check (scw->enable, GCONF_KEY_ENABLED_STATUS, _("Show icon in _notification area")); + container = vbox; - parent = gtk_vbox_new (FALSE, 0); - create_check (scw->blink, GCONF_KEY_STATUS_BLINK, _("B_link icon in notification area")); - #ifdef HAVE_LIBNOTIFY - create_check (scw->message, GCONF_KEY_STATUS_NOTIFICATION, _("Popup _message together with the icon")); - #endif + text = _("Show icon in _notification area"); + widget = gtk_check_button_new_with_mnemonic (text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); - alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); - gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 20, 0); - gtk_container_add (GTK_CONTAINER (alignment), parent); - gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); + gconf_bridge_bind_property ( + bridge, GCONF_KEY_ENABLED_STATUS, + G_OBJECT (widget), "active"); - #undef create_check + master = widget; - /* to let structure free properly */ - g_object_set_data_full (G_OBJECT (vbox), "scw-data", scw, g_free); + widget = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); + gtk_alignment_set_padding (GTK_ALIGNMENT (widget), 0, 0, 12, 0); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + e_binding_new ( + G_OBJECT (master), "active", + G_OBJECT (widget), "sensitive"); + + container = widget; + + widget = gtk_vbox_new (FALSE, 6); + gtk_container_add (GTK_CONTAINER (container), widget); + gtk_widget_show (widget); - toggled_status_cb (NULL, scw); - gtk_widget_show_all (vbox); + container = widget; + + text = _("B_link icon in notification area"); + widget = gtk_check_button_new_with_mnemonic (text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + gconf_bridge_bind_property ( + bridge, GCONF_KEY_STATUS_BLINK, + G_OBJECT (widget), "active"); + +#ifdef HAVE_LIBNOTIFY + text = _("Popup _message together with the icon"); + widget = gtk_check_button_new_with_mnemonic (text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + gconf_bridge_bind_property ( + bridge, GCONF_KEY_STATUS_NOTIFICATION, + G_OBJECT (widget), "active"); +#endif return vbox; } @@ -618,57 +568,39 @@ get_config_widget_status (void) #define GCONF_KEY_SOUND_BEEP GCONF_KEY_ROOT "sound-beep" #define GCONF_KEY_SOUND_FILE GCONF_KEY_ROOT "sound-file" +#define GCONF_KEY_SOUND_PLAY_FILE GCONF_KEY_ROOT "sound-play-file" +#define GCONF_KEY_SOUND_USE_THEME GCONF_KEY_ROOT "sound-use-theme" + +static ca_context *mailnotification = NULL; static void -do_play_sound (gboolean beep, const gchar *file) -{ - if (beep) - gdk_beep (); - else if (!file || !*file) - g_warning ("No file to play!"); +do_play_sound (gboolean beep, gboolean use_theme, const gchar *file) +{ + if (!beep) { + if ( (file || *file) && !use_theme ) + ca_context_play(mailnotification, 0, + CA_PROP_MEDIA_FILENAME, file, + NULL); + else + ca_context_play(mailnotification, 0, + CA_PROP_EVENT_ID,"message-new-email", + NULL); + } else - gnome_sound_play (file); + gdk_beep(); } struct _SoundConfigureWidgets { GtkWidget *enable; GtkWidget *beep; + GtkWidget *use_theme; GtkWidget *file; - GtkWidget *label; GtkWidget *filechooser; GtkWidget *play; }; static void -toggled_sound_cb (GtkWidget *widget, gpointer data) -{ - struct _SoundConfigureWidgets *scw = (struct _SoundConfigureWidgets *) data; - gboolean enabl; - - g_return_if_fail (data != NULL); - g_return_if_fail (scw->enable != NULL); - g_return_if_fail (scw->beep != NULL); - g_return_if_fail (scw->file != NULL); - g_return_if_fail (scw->label != NULL); - g_return_if_fail (scw->filechooser != NULL); - g_return_if_fail (scw->play != NULL); - - enabl = gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->enable)); - if (widget == scw->enable) - set_part_enabled (GCONF_KEY_ENABLED_SOUND, enabl); - - gtk_widget_set_sensitive (scw->beep, enabl); - gtk_widget_set_sensitive (scw->file, enabl); - gtk_widget_set_sensitive (scw->label, enabl); - gtk_widget_set_sensitive (scw->filechooser, enabl && gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->file))); - gtk_widget_set_sensitive (scw->play, enabl); - - if (widget == scw->beep || widget == scw->file) - set_part_enabled (GCONF_KEY_SOUND_BEEP, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->beep))); -} - -static void sound_file_set_cb (GtkWidget *widget, gpointer data) { gchar *file; @@ -697,7 +629,9 @@ sound_play_cb (GtkWidget *widget, gpointer data) return; file = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (scw->filechooser)); - do_play_sound (gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (scw->beep)), file); + do_play_sound (gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (scw->beep)), + gtk_toggle_button_get_active(GTK_TOGGLE_BUTTON (scw->use_theme)), + file); g_free (file); } @@ -718,7 +652,9 @@ sound_notify_idle_cb (gpointer user_data) client = gconf_client_get_default (); file = gconf_client_get_string (client, GCONF_KEY_SOUND_FILE, NULL); - do_play_sound (is_part_enabled (GCONF_KEY_SOUND_BEEP), file); + do_play_sound (is_part_enabled (GCONF_KEY_SOUND_BEEP), + is_part_enabled (GCONF_KEY_SOUND_USE_THEME), + file); g_object_unref (client); g_free (file); @@ -754,47 +690,129 @@ read_notify_sound (EMEventTargetMessage *t) static void enable_sound (gint enable) { - if (enable) - gnome_sound_init ("localhost"); + if (enable) { + ca_context_create(&mailnotification); + ca_context_change_props( + mailnotification, + CA_PROP_APPLICATION_NAME, + "mailnotification Plugin", + NULL); + } else - gnome_sound_shutdown (); + ca_context_destroy(mailnotification); } static GtkWidget * get_config_widget_sound (void) { - GtkWidget *vbox, *alignment, *parent, *hbox; + GtkWidget *vbox; + GtkWidget *container; + GtkWidget *master; + GtkWidget *widget; gchar *file; + GConfBridge *bridge; GConfClient *client; + GSList *group = NULL; struct _SoundConfigureWidgets *scw; + const gchar *text; + + bridge = gconf_bridge_get (); - vbox = gtk_vbox_new (FALSE, 0); scw = g_malloc0 (sizeof (struct _SoundConfigureWidgets)); - scw->enable = gtk_check_button_new_with_mnemonic (_("_Play sound when new messages arrive")); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scw->enable), is_part_enabled (GCONF_KEY_ENABLED_SOUND)); - gtk_box_pack_start (GTK_BOX (vbox), scw->enable, FALSE, FALSE, 0); - g_signal_connect (G_OBJECT (scw->enable), "toggled", G_CALLBACK (toggled_sound_cb), scw); + vbox = gtk_vbox_new (FALSE, 6); + gtk_widget_show (vbox); + + container = vbox; - parent = gtk_vbox_new (FALSE, 0); - scw->beep = gtk_radio_button_new_with_mnemonic (NULL, _("_Beep")); - scw->file = gtk_radio_button_new_with_mnemonic_from_widget (GTK_RADIO_BUTTON (scw->beep), _("Play _sound file")); + text = _("_Play sound when new messages arrive"); + widget = gtk_check_button_new_with_mnemonic (text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); - if (is_part_enabled (GCONF_KEY_SOUND_BEEP)) - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scw->beep), TRUE); - else - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (scw->file), TRUE); + gconf_bridge_bind_property ( + bridge, GCONF_KEY_ENABLED_SOUND, + G_OBJECT (widget), "active"); + + master = widget; + scw->enable = widget; + + widget = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); + gtk_alignment_set_padding (GTK_ALIGNMENT (widget), 0, 0, 12, 0); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + e_binding_new ( + G_OBJECT (master), "active", + G_OBJECT (widget), "sensitive"); + + container = widget; + + widget = gtk_vbox_new (FALSE, 6); + gtk_container_add (GTK_CONTAINER (container), widget); + gtk_widget_show (widget); + + container = widget; + + text = _("_Beep"); + widget = gtk_radio_button_new_with_mnemonic (group, text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + gconf_bridge_bind_property ( + bridge, GCONF_KEY_SOUND_BEEP, + G_OBJECT (widget), "active"); - g_signal_connect (G_OBJECT (scw->beep), "toggled", G_CALLBACK (toggled_sound_cb), scw); - g_signal_connect (G_OBJECT (scw->file), "toggled", G_CALLBACK (toggled_sound_cb), scw); + scw->beep = widget; - hbox = gtk_hbox_new (FALSE, 0); - scw->label = gtk_label_new_with_mnemonic (_("Specify _filename:")); - scw->filechooser = gtk_file_chooser_button_new (_("Select sound file"), GTK_FILE_CHOOSER_ACTION_OPEN); - scw->play = gtk_button_new_with_mnemonic (_("Pl_ay")); + group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); - gtk_label_set_mnemonic_widget (GTK_LABEL (scw->label), scw->filechooser); - gtk_button_set_image (GTK_BUTTON (scw->play), gtk_image_new_from_icon_name ("media-playback-start", GTK_ICON_SIZE_BUTTON)); + text = _("Use sound _theme"); + widget = gtk_radio_button_new_with_mnemonic (group, text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + gconf_bridge_bind_property ( + bridge, GCONF_KEY_SOUND_USE_THEME, + G_OBJECT (widget), "active"); + + scw->use_theme = widget; + + group = gtk_radio_button_get_group (GTK_RADIO_BUTTON (widget)); + + widget = gtk_hbox_new (FALSE, 6); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + container = widget; + + text = _("Play _file:"); + widget = gtk_radio_button_new_with_mnemonic (group, text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + gconf_bridge_bind_property ( + bridge, GCONF_KEY_SOUND_PLAY_FILE, + G_OBJECT (widget), "active"); + + scw->file = widget; + + text = _("Select sound file"); + widget = gtk_file_chooser_button_new ( + text, GTK_FILE_CHOOSER_ACTION_OPEN); + gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); + gtk_widget_show (widget); + + scw->filechooser = widget; + + widget = gtk_button_new (); + gtk_button_set_image ( + GTK_BUTTON (widget), gtk_image_new_from_icon_name ( + "media-playback-start", GTK_ICON_SIZE_BUTTON)); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + scw->play = widget; client = gconf_client_get_default (); file = gconf_client_get_string (client, GCONF_KEY_SOUND_FILE, NULL); @@ -805,28 +823,16 @@ get_config_widget_sound (void) g_object_unref (client); g_free (file); - g_signal_connect (G_OBJECT (scw->filechooser), "file-set", G_CALLBACK (sound_file_set_cb), scw); - g_signal_connect (G_OBJECT (scw->play), "clicked", G_CALLBACK (sound_play_cb), scw); - - gtk_box_pack_start (GTK_BOX (hbox), scw->label, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (hbox), scw->filechooser, TRUE, TRUE, 0); - gtk_box_pack_start (GTK_BOX (hbox), scw->play, FALSE, FALSE, 0); - - gtk_box_pack_start (GTK_BOX (parent), scw->beep, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (parent), scw->file, FALSE, FALSE, 0); - gtk_box_pack_start (GTK_BOX (parent), hbox, FALSE, FALSE, 0); - - alignment = gtk_alignment_new (0.0, 0.0, 1.0, 1.0); - gtk_alignment_set_padding (GTK_ALIGNMENT (alignment), 0, 0, 20, 0); - gtk_container_add (GTK_CONTAINER (alignment), parent); - gtk_box_pack_start (GTK_BOX (vbox), alignment, FALSE, FALSE, 0); + g_signal_connect ( + scw->filechooser, "file-set", + G_CALLBACK (sound_file_set_cb), scw); + g_signal_connect ( + scw->play, "clicked", + G_CALLBACK (sound_play_cb), scw); /* to let structure free properly */ g_object_set_data_full (G_OBJECT (vbox), "scw-data", scw, g_free); - toggled_sound_cb (NULL, scw); - gtk_widget_show_all (vbox); - return vbox; } @@ -834,49 +840,54 @@ get_config_widget_sound (void) /* Plugin itself part */ /* ------------------------------------------------------------------- */ -static void -toggled_only_inbox_cb (GtkWidget *widget, gpointer data) -{ - g_return_if_fail (widget != NULL); - - set_part_enabled (GCONF_KEY_NOTIFY_ONLY_INBOX, gtk_toggle_button_get_active (GTK_TOGGLE_BUTTON (widget))); -} - static GtkWidget * get_cfg_widget (void) { - GtkWidget *cfg, *vbox, *check; + GtkWidget *container; + GtkWidget *widget; + GConfBridge *bridge; + const gchar *text; - vbox = gtk_vbox_new (FALSE, 6); - check = gtk_check_button_new_with_mnemonic (_("Notify new messages for _Inbox only")); + bridge = gconf_bridge_get (); + + widget = gtk_vbox_new (FALSE, 12); + gtk_widget_show (widget); + + container = widget; + + text = _("Notify new messages for _Inbox only"); + widget = gtk_check_button_new_with_mnemonic (text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); - gtk_toggle_button_set_active (GTK_TOGGLE_BUTTON (check), is_part_enabled (GCONF_KEY_NOTIFY_ONLY_INBOX)); - g_signal_connect (G_OBJECT (check), "toggled", G_CALLBACK (toggled_only_inbox_cb), NULL); - gtk_widget_show (check); - gtk_box_pack_start (GTK_BOX (vbox), check, FALSE, FALSE, 0); + gconf_bridge_bind_property ( + bridge, GCONF_KEY_NOTIFY_ONLY_INBOX, + G_OBJECT (widget), "active"); #ifdef HAVE_DBUS - cfg = get_config_widget_dbus (); - if (cfg) - gtk_box_pack_start (GTK_BOX (vbox), cfg, FALSE, FALSE, 0); + text = _("Generate a _D-Bus message"); + widget = gtk_check_button_new_with_mnemonic (text); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); + gtk_widget_show (widget); + + gconf_bridge_bind_property ( + bridge, GCONF_KEY_ENABLED_DBUS, + G_OBJECT (widget), "active"); #endif - cfg = get_config_widget_status (); - if (cfg) - gtk_box_pack_start (GTK_BOX (vbox), cfg, FALSE, FALSE, 0); - cfg = get_config_widget_sound (); - if (cfg) - gtk_box_pack_start (GTK_BOX (vbox), cfg, FALSE, FALSE, 0); + widget = get_config_widget_status (); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - gtk_widget_show (vbox); + widget = get_config_widget_sound (); + gtk_box_pack_start (GTK_BOX (container), widget, FALSE, FALSE, 0); - return vbox; + return container; } void org_gnome_mail_new_notify (EPlugin *ep, EMEventTargetFolder *t); void org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t); -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); void @@ -926,16 +937,13 @@ org_gnome_mail_read_notify (EPlugin *ep, EMEventTargetMessage *t) } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (enable) { #ifdef HAVE_DBUS if (is_part_enabled (GCONF_KEY_ENABLED_DBUS)) enable_dbus (enable); #endif - if (is_part_enabled (GCONF_KEY_ENABLED_STATUS)) - enable_status (enable); - if (is_part_enabled (GCONF_KEY_ENABLED_SOUND)) enable_sound (enable); @@ -944,7 +952,6 @@ e_plugin_lib_enable (EPluginLib *ep, gint enable) #ifdef HAVE_DBUS enable_dbus (enable); #endif - enable_status (enable); enable_sound (enable); enabled = FALSE; diff --git a/plugins/mail-to-task/Makefile.am b/plugins/mail-to-task/Makefile.am index dc63da7a8c..0815e65dda 100644 --- a/plugins/mail-to-task/Makefile.am +++ b/plugins/mail-to-task/Makefile.am @@ -6,20 +6,20 @@ AM_CPPFLAGS = \ @EVO_PLUGIN_RULE@ -plugin_DATA = org-gnome-mail-to-task.eplug org-gnome-mail-to-task.xml +plugin_DATA = org-gnome-mail-to-task.eplug plugin_LTLIBRARIES = liborg-gnome-mail-to-task.la liborg_gnome_mail_to_task_la_SOURCES = mail-to-task.c liborg_gnome_mail_to_task_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_mail_to_task_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/calendar/gui/libevolution-calendar.la \ $(top_builddir)/calendar/common/libevolution-calendarprivate.la \ $(top_builddir)/mail/libevolution-mail.la \ $(EVOLUTION_CALENDAR_LIBS) \ $(EVOLUTION_MAIL_LIBS) -EXTRA_DIST = org-gnome-mail-to-task.eplug.xml \ - org-gnome-mail-to-task.xml +EXTRA_DIST = org-gnome-mail-to-task.eplug.xml BUILT_SOURCES = org-gnome-mail-to-task.eplug CLEANFILES = $(BUILT_SOURCES) diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c index 94b629eae2..1b8ad64768 100644 --- a/plugins/mail-to-task/mail-to-task.c +++ b/plugins/mail-to-task/mail-to-task.c @@ -32,10 +32,12 @@ #include <string.h> #include <stdio.h> +#include <gtkhtml/gtkhtml.h> #include <gconf/gconf-client.h> #include <libecal/e-cal.h> #include <libedataserver/e-account.h> #include <libedataserverui/e-source-selector-dialog.h> + #include <camel/camel-folder.h> #include <camel/camel-medium.h> #include <camel/camel-mime-message.h> @@ -43,17 +45,30 @@ #include <camel/camel-stream.h> #include <camel/camel-stream-mem.h> #include <camel/camel-utf8.h> -#include "mail/em-menu.h" -#include "mail/em-popup.h" -#include "mail/em-utils.h" -#include "mail/em-folder-view.h" -#include "mail/em-format-html.h" -#include "mail/mail-config.h" -#include "e-util/e-dialog-utils.h" -#include <gtkhtml/gtkhtml.h> + +#include <mail/em-utils.h> +#include <mail/em-format-html.h> +#include <mail/mail-config.h> +#include <e-util/e-account-utils.h> +#include <e-util/e-dialog-utils.h> #include <calendar/common/authentication.h> +#include <misc/e-popup-action.h> +#include <shell/e-shell-view.h> +#include <shell/e-shell-window-actions.h> #include <calendar/gui/cal-editor-utils.h> +#define E_SHELL_WINDOW_ACTION_CONVERT_TO_EVENT(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-convert-to-event") +#define E_SHELL_WINDOW_ACTION_CONVERT_TO_MEETING(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-convert-to-meeting") +#define E_SHELL_WINDOW_ACTION_CONVERT_TO_MEMO(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-convert-to-memo") +#define E_SHELL_WINDOW_ACTION_CONVERT_TO_TASK(window) \ + E_SHELL_WINDOW_ACTION ((window), "mail-convert-to-task") + +gboolean e_plugin_ui_init (GtkUIManager *ui_manager, + EShellView *shell_view); + static gchar * clean_name(const guchar *s) { @@ -215,7 +230,7 @@ set_organizer (ECalComponent *comp) ECalComponentOrganizer organizer = {NULL, NULL, NULL, NULL}; gchar *res; - account = mail_config_get_default_account (); + account = e_get_default_account (); if (!account) return NULL; @@ -522,7 +537,13 @@ do_manage_comp_idle (GSList *manage_comp_datas) } if (edit_comp) { - open_component_editor (mc->client, edit_comp, edit_comp == mc->comp, &error); + EShell *shell; + + /* FIXME Pass in the EShell instance. */ + shell = e_shell_get_default (); + open_component_editor ( + shell, mc->client, edit_comp, + edit_comp == mc->comp, &error); if (edit_comp != mc->comp) g_object_unref (edit_comp); } @@ -742,12 +763,6 @@ do_mail_to_event (AsyncData *data) return TRUE; } -static void -copy_uids (gchar *uid, GPtrArray *uid_array) -{ - g_ptr_array_add (uid_array, g_strdup (uid)); -} - static gboolean text_contains_nonwhitespace (const gchar *text, gint len) { @@ -775,47 +790,51 @@ text_contains_nonwhitespace (const gchar *text, gint len) /* should be freed with g_free after done with it */ static gchar * -get_selected_text (EMFolderView *emfv) +get_selected_text (EMailReader *reader) { + EMFormatHTMLDisplay *html_display; + GtkHTML *html; gchar *text = NULL; gint len; - if (!emfv || !emfv->preview || !gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active")) + html_display = e_mail_reader_get_html_display (reader); + html = EM_FORMAT_HTML (html_display)->html; + + if (!gtk_html_command (html, "is-selection-active")) return NULL; - if (gtk_html_command (((EMFormatHTML *)emfv->preview)->html, "is-selection-active") - && (text = gtk_html_get_selection_plain_text (((EMFormatHTML *)emfv->preview)->html, &len)) - && len && text && text[0] && text_contains_nonwhitespace (text, len)) { - /* selection is ok, so use it as returned from gtkhtml widget */ - } else { + text = gtk_html_get_selection_plain_text (html, &len); + + if (text == NULL || !text_contains_nonwhitespace (text, len)) { g_free (text); - text = NULL; + return NULL; } return text; } static void -mail_to_event (ECalSourceType source_type, gboolean with_attendees, GPtrArray *uids, CamelFolder *folder, EMFolderView *emfv) +mail_to_event (ECalSourceType source_type, + gboolean with_attendees, + EShellView *shell_view) { - GPtrArray *uid_array = NULL; + EShellContent *shell_content; + EMailReader *reader; + MessageList *message_list; + CamelFolder *folder; + GPtrArray *selected; ESourceList *source_list = NULL; gboolean done = FALSE; GSList *groups, *p; ESource *source = NULL; GError *error = NULL; - g_return_if_fail (uids != NULL); - g_return_if_fail (folder != NULL); - g_return_if_fail (emfv != NULL); + shell_content = e_shell_view_get_shell_content (shell_view); - if (uids->len > 0) { - uid_array = g_ptr_array_new (); - g_ptr_array_foreach (uids, (GFunc)copy_uids, (gpointer) uid_array); - } else { - /* nothing selected */ - return; - } + reader = E_MAIL_READER (shell_content); + message_list = e_mail_reader_get_message_list (reader); + selected = message_list_get_selected (message_list); + folder = message_list->folder; if (!e_cal_get_sources (&source_list, source_type, &error)) { e_notice (NULL, GTK_MESSAGE_ERROR, _("Cannot get source list. %s"), error ? error->message : _("Unknown error.")); @@ -883,11 +902,11 @@ mail_to_event (ECalSourceType source_type, gboolean with_attendees, GPtrArray *u data = g_new0 (AsyncData, 1); data->client = client; data->folder = folder; - data->uids = uid_array; + data->uids = selected; data->with_attendees = with_attendees; - if (uid_array->len == 1) - data->selected_text = get_selected_text (emfv); + if (selected->len == 1) + data->selected_text = get_selected_text (reader); else data->selected_text = NULL; @@ -901,72 +920,138 @@ mail_to_event (ECalSourceType source_type, gboolean with_attendees, GPtrArray *u g_object_unref (source_list); } -/* ************************************************************************* */ - -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); -void org_gnome_mail_to_event (gpointer ep, EMPopupTargetSelect *t); -void org_gnome_mail_to_event_menu (EPlugin *ep, EMMenuTargetSelect *t); -void org_gnome_mail_to_meeting (gpointer ep, EMPopupTargetSelect *t); -void org_gnome_mail_to_meeting_menu (EPlugin *ep, EMMenuTargetSelect *t); -void org_gnome_mail_to_task (gpointer ep, EMPopupTargetSelect *t); -void org_gnome_mail_to_task_menu (EPlugin *ep, EMMenuTargetSelect *t); -void org_gnome_mail_to_memo (gpointer ep, EMPopupTargetSelect *t); -void org_gnome_mail_to_memo_menu (EPlugin *ep, EMMenuTargetSelect *t); - -gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +static void +action_mail_convert_to_event_cb (GtkAction *action, + EShellView *shell_view) { - return 0; + mail_to_event (E_CAL_SOURCE_TYPE_EVENT, FALSE, shell_view); } -void -org_gnome_mail_to_event (gpointer ep, EMPopupTargetSelect *t) +static void +action_mail_convert_to_meeting_cb (GtkAction *action, + EShellView *shell_view) { - mail_to_event (E_CAL_SOURCE_TYPE_EVENT, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); + mail_to_event (E_CAL_SOURCE_TYPE_EVENT, TRUE, shell_view); } -void -org_gnome_mail_to_event_menu (EPlugin *ep, EMMenuTargetSelect *t) +static void +action_mail_convert_to_memo_cb (GtkAction *action, + EShellView *shell_view) { - mail_to_event (E_CAL_SOURCE_TYPE_EVENT, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); + mail_to_event (E_CAL_SOURCE_TYPE_JOURNAL, FALSE, shell_view); } -void -org_gnome_mail_to_meeting (gpointer ep, EMPopupTargetSelect *t) +static void +action_mail_convert_to_task_cb (GtkAction *action, + EShellView *shell_view) { - mail_to_event (E_CAL_SOURCE_TYPE_EVENT, TRUE, t->uids, t->folder, (EMFolderView *) t->target.widget); + mail_to_event (E_CAL_SOURCE_TYPE_TODO, FALSE, shell_view); } -void -org_gnome_mail_to_meeting_menu (EPlugin *ep, EMMenuTargetSelect *t) -{ - mail_to_event (E_CAL_SOURCE_TYPE_EVENT, TRUE, t->uids, t->folder, (EMFolderView *) t->target.widget); -} +static GtkActionEntry entries[] = { + + { "mail-convert-to-event", + "appointment-new", + N_("Create an _Event"), + NULL, + N_("Create a new event from the selected message"), + G_CALLBACK (action_mail_convert_to_event_cb) }, + + { "mail-convert-to-meeting", + "stock_new-meeting", + N_("Create a _Meeting"), + NULL, + N_("Create a new meeting from the selected message"), + G_CALLBACK (action_mail_convert_to_meeting_cb) }, + + { "mail-convert-to-memo", + "stock_insert-note", + N_("Create a Mem_o"), + NULL, + N_("Create a new memo from the selected message"), + G_CALLBACK (action_mail_convert_to_memo_cb) }, + + { "mail-convert-to-task", + "stock_todo", + N_("Create a _Task"), + NULL, + N_("Create a new task from the selected message"), + G_CALLBACK (action_mail_convert_to_task_cb) } +}; -void -org_gnome_mail_to_task (gpointer ep, EMPopupTargetSelect *t) -{ - /* do not create assigned tasks */ - mail_to_event (E_CAL_SOURCE_TYPE_TODO, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); -} +static EPopupActionEntry popup_entries[] = { -void -org_gnome_mail_to_task_menu (EPlugin *ep, EMMenuTargetSelect *t) -{ - /* do not create assigned tasks */ - mail_to_event (E_CAL_SOURCE_TYPE_TODO, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); -} + { "mail-popup-convert-to-event", + NULL, + "mail-convert-to-event" }, + + { "mail-popup-convert-to-meeting", + NULL, + "mail-convert-to-meeting" }, -void -org_gnome_mail_to_memo (gpointer ep, EMPopupTargetSelect *t) + { "mail-popup-convert-to-memo", + NULL, + "mail-convert-to-memo" }, + + { "mail-popup-convert-to-task", + NULL, + "mail-convert-to-task" } +}; + +static void +update_actions_cb (EShellView *shell_view) { - /* do not set organizer and attendees for memos */ - mail_to_event (E_CAL_SOURCE_TYPE_JOURNAL, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); + EShellContent *shell_content; + EShellWindow *shell_window; + GtkAction *action; + gboolean sensitive; + guint32 state; + + shell_content = e_shell_view_get_shell_content (shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + state = e_mail_reader_check_state (E_MAIL_READER (shell_content)); + + sensitive = + (state & E_MAIL_READER_SELECTION_SINGLE) || + (state & E_MAIL_READER_SELECTION_MULTIPLE); + + action = E_SHELL_WINDOW_ACTION_CONVERT_TO_EVENT (shell_window); + gtk_action_set_sensitive (action, sensitive); + + action = E_SHELL_WINDOW_ACTION_CONVERT_TO_MEMO (shell_window); + gtk_action_set_sensitive (action, sensitive); + + action = E_SHELL_WINDOW_ACTION_CONVERT_TO_TASK (shell_window); + gtk_action_set_sensitive (action, sensitive); + + sensitive = (state & E_MAIL_READER_SELECTION_SINGLE); + + action = E_SHELL_WINDOW_ACTION_CONVERT_TO_MEETING (shell_window); + gtk_action_set_sensitive (action, sensitive); + } -void -org_gnome_mail_to_memo_menu (EPlugin *ep, EMMenuTargetSelect *t) +gboolean +e_plugin_ui_init (GtkUIManager *ui_manager, + EShellView *shell_view) { - /* do not set organizer and attendees for memos */ - mail_to_event (E_CAL_SOURCE_TYPE_JOURNAL, FALSE, t->uids, t->folder, (EMFolderView *) t->target.widget); + EShellWindow *shell_window; + GtkActionGroup *action_group; + + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = e_shell_window_get_action_group (shell_window, "mail"); + + gtk_action_group_add_actions ( + action_group, entries, + G_N_ELEMENTS (entries), shell_view); + e_action_group_add_popup_actions ( + action_group, popup_entries, + G_N_ELEMENTS (popup_entries)); + + g_signal_connect ( + shell_view, "update-actions", + G_CALLBACK (update_actions_cb), NULL); + + return TRUE; } diff --git a/plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml b/plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml index e8494fb2d7..614da8cf3b 100644 --- a/plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml +++ b/plugins/mail-to-task/org-gnome-mail-to-task.eplug.xml @@ -1,80 +1,33 @@ -<?xml version="1.0"?> +<?xml version="1.0" encoding="UTF-8"?> <e-plugin-list> - <e-plugin - type="shlib" - id="org.gnome.evolution.plugin.mailToTask" - location="@PLUGINDIR@/liborg-gnome-mail-to-task@SOEXT@" - _name="Mail-to-Task"> - <_description>Convert a mail message to a task.</_description> + <e-plugin type="shlib" location="/home/mbarnes/local/lib/evolution/2.28/plugins/liborg-gnome-mail-to-task.so" id="org.gnome.evolution.plugin.mailToTask" name="Mail-to-Task"> <author name="Rodrigo Moya" email="rodrigo@novell.com"/> + <_description>Convert a mail message to a task.</_description> - <!-- hook into the uri popup menu --> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.folderview.popup" target="select"> - <item - type="item" - path="70.mail_to_event1" - icon="appointment-new" - _label="Create an _Event" - enable="many" - visible="many" - activate="org_gnome_mail_to_event"/> - <item - type="item" - path="70.mail_to_event2" - icon="stock_new-meeting" - _label="Create a _Meeting" - enable="one" - visible="many" - activate="org_gnome_mail_to_meeting"/> - <item - type="item" - path="70.mail_to_event3" - icon="stock_todo" - _label="Create a _Task" - enable="many" - visible="many" - activate="org_gnome_mail_to_task"/> - <item - type="item" - path="70.mail_to_event4" - icon="stock_insert-note" - _label="Create a Mem_o" - enable="many" - visible="many" - activate="org_gnome_mail_to_memo"/> - </menu> + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.mail"> + <menubar name='main-menu'> + <placeholder name='custom-menus'> + <menu action="mail-message-menu"> + <placeholder name="mail-message-actions"> + <menuitem action="mail-convert-to-event"/> + <menuitem action="mail-convert-to-meeting"/> + <menuitem action="mail-convert-to-task"/> + <menuitem action="mail-convert-to-memo"/> + </placeholder> + </menu> + </placeholder> + </menubar> + <popup name="mail-message-popup"> + <placeholder name="mail-message-popup-actions"> + <menuitem action="mail-popup-convert-to-event"/> + <menuitem action="mail-popup-convert-to-meeting"/> + <menuitem action="mail-popup-convert-to-task"/> + <menuitem action="mail-popup-convert-to-memo"/> + </placeholder> + </popup> + </ui-manager> </hook> - <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-mail-to-task.xml"/> - <item - type="item" - verb="ConvertEvent" - path="/commands/ConvertEvent" - enable="many" - activate="org_gnome_mail_to_event_menu"/> - <item - type="item" - verb="ConvertMeeting" - path="/commands/ConvertMeeting" - enable="one" - activate="org_gnome_mail_to_meeting_menu"/> - <item - type="item" - verb="ConvertTask" - path="/commands/ConvertTask" - enable="many" - activate="org_gnome_mail_to_task_menu"/> - <item - type="item" - verb="ConvertMemo" - path="/commands/ConvertMemo" - enable="many" - activate="org_gnome_mail_to_memo_menu"/> - </menu> - </hook> - + </e-plugin> </e-plugin-list> diff --git a/plugins/mail-to-task/org-gnome-mail-to-task.xml b/plugins/mail-to-task/org-gnome-mail-to-task.xml deleted file mode 100644 index c3d72b6d09..0000000000 --- a/plugins/mail-to-task/org-gnome-mail-to-task.xml +++ /dev/null @@ -1,28 +0,0 @@ -<Root> - <commands> - <cmd name="ConvertEvent" _label="Create an _Event" - _tip="Create a new event from the selected message" - pixtype="stock" pixname="appointment-new"/> - <cmd name="ConvertMeeting" _label="Create a _Meeting" - _tip="Create a new meeting from the selected message" - pixtype="stock" pixname="stock_new-meeting"/> - <cmd name="ConvertTask" _label="Create a _Task" - _tip="Create a new task from the selected message" - pixtype="stock" pixname="stock_todo"/> - <cmd name="ConvertMemo" _label="Create a Mem_o" - _tip="Create a new memo from the selected message" - pixtype="stock" pixname="stock_insert-note"/> - </commands> - - <menu> - <placeholder name="MessagePlaceholder"> - <submenu name="Message"> - <separator f="" name="emaillist5"/> - <menuitem name="ConvertEvent" verb=""/> - <menuitem name="ConvertMeeting" verb=""/> - <menuitem name="ConvertTask" verb=""/> - <menuitem name="ConvertMemo" verb=""/> - </submenu> - </placeholder> - </menu> -</Root> diff --git a/plugins/mark-all-read/Makefile.am b/plugins/mark-all-read/Makefile.am index b653e8c1f7..aac01d2b37 100644 --- a/plugins/mark-all-read/Makefile.am +++ b/plugins/mark-all-read/Makefile.am @@ -1,5 +1,6 @@ AM_CPPFLAGS = \ - -I$(top_srcdir)\ + -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) @EVO_PLUGIN_RULE@ @@ -12,6 +13,7 @@ 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)/shell/libeshell.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 e210af6547..dacb5e5685 100644 --- a/plugins/mark-all-read/mark-all-read.c +++ b/plugins/mark-all-read/mark-all-read.c @@ -28,20 +28,26 @@ #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/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-view.h> +#include <shell/e-shell-window.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 (gchar *uri, CamelFolder *folder, gpointer data); static void mar_all_sub_folders (CamelStore *store, CamelFolderInfo *fi, CamelException *ex); @@ -194,16 +200,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) { @@ -274,3 +270,50 @@ 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) +{ + EShellSidebar *shell_sidebar; + EMFolderTree *folder_tree; + const gchar *folder_uri; + + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); + 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); + + g_object_unref (folder_tree); +} + +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_get_action_group (shell_window, "mail"); + + /* Add actions to the "mail" 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 356b8a5793..a254e1e4db 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>Mark all messages in 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>Mark all messages in 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/mono/Camel.cs b/plugins/mono/Camel.cs deleted file mode 100644 index 4ad80e7012..0000000000 --- a/plugins/mono/Camel.cs +++ /dev/null @@ -1,1278 +0,0 @@ - -using System; -using System.Collections; -using System.ComponentModel; -using System.Runtime.InteropServices; - -namespace Camel { - [StructLayout (LayoutKind.Sequential)] - public struct CamelException { - public int id; - public string desc; - } - - public class Arg { - public enum Tag : uint { - END = 0, - IGNORE = 1, - FIRST = 1024, - - TYPE = 0xf0000000, /* type field for tags */ - TAG = 0x0fffffff, /* tag field for args */ - - OBJ = 0x00000000, /* object */ - INT = 0x10000000, /* int */ - DBL = 0x20000000, /* double */ - STR = 0x30000000, /* c string */ - PTR = 0x40000000, /* ptr */ - BOO = 0x50000000 /* bool */ - } - } - - public class Exception : System.ApplicationException { - public enum Type { - NONE = 0, - SYSTEM = 1 - } - - public Type id; - public string desc; - - public Exception(CamelException ex) { - id = (Type)ex.id; - desc = ex.desc; - } - - public Exception(Type _id, string _desc) { - id = _id; - desc = _desc; - } - } - - public class Util { - [DllImport("camel-1.2")] static extern int camel_init(string certdir, bool nss); - - public static void Init(string certdir, bool nss) { - if (camel_init(certdir, nss) != 0) - throw new Exception(Exception.Type.SYSTEM, "Init failure"); - } - - public static string [] getUIDArray(IntPtr o) { - GPtrArray pa = (GPtrArray)Marshal.PtrToStructure(o, typeof(GPtrArray)); - string [] uids = new string[pa.len]; - - for (int i=0;i<pa.len;i++) { - IntPtr x = Marshal.ReadIntPtr(pa.pdata, i * Marshal.SizeOf(typeof(IntPtr))); - uids[i] = Marshal.PtrToStringAuto(x); - } - - return uids; - } -/* - public static IntPtr setUIDs(string [] uids) { - - } -*/ - public struct UIDArray { - public string [] uids; - public int len; - - public UIDArray(string [] _uids) { - uids = _uids; - len = _uids.Length; - } - - public UIDArray(IntPtr raw) { - uids = new string[0]; - len = 0; - Marshal.PtrToStructure(raw, this); - } - } - } - - public class Object { - // should be library scope - public IntPtr cobject; - private int finaliseID = -1; - - protected EventHandlerList events = new EventHandlerList(); - - // reffing & wrapping stuff. - struct CamelObject { - public IntPtr klass; - } - - struct CamelObjectClass { - public IntPtr parent; - int magic; - IntPtr next; - IntPtr prev; - public string name; - }; - - private static Hashtable types = new Hashtable(); - private static Hashtable objects = new Hashtable(); - - [DllImport("camel-1.2")] static extern void camel_object_ref(IntPtr raw); - [DllImport("camel-1.2")] static extern void camel_object_unref(IntPtr raw); - - public Object(IntPtr raw) { - // ok this is a hack around c# crap to do with unargumented constructors. - // we can bypass to a null raw so we can properly instantiate new types - if (raw != (IntPtr)0) { - cobject = raw; - toCamel(this); - } - } - - public Object() { - // this is invalid? - } - - ~Object() { - System.Console.WriteLine("object disposed " + cobject + " type " + this); - - // well we can never get a finalised event anyway ... - if (finalise_id != -1) - camel_object_remove_event(cobject, finalise_id); - if (meta_changed_id != -1) - camel_object_remove_event(cobject, meta_changed_id); - - objects.Remove(cobject); - camel_object_remove_event(cobject, finaliseID); - finaliseID = -1; - camel_object_unref(cobject); - cobject = (IntPtr)0; - - // FIXME: remove any event hooks too - } - - static Object() { - types.Add("CamelObject", typeof(Camel.Object)); - types.Add("CamelSession", typeof(Camel.Session)); - types.Add("CamelFolder", typeof(Camel.Folder)); - types.Add("CamelDataWrapper", typeof(Camel.DataWrapper)); - types.Add("CamelMedium", typeof(Camel.Medium)); - types.Add("CamelMimeMessage", typeof(Camel.MimeMessage)); - types.Add("CamelMimePart", typeof(Camel.MimePart)); - types.Add("CamelMultipart", typeof(Camel.Multipart)); - - types.Add("CamelStore", typeof(Camel.Store)); - types.Add("CamelTransport", typeof(Camel.Transport)); - types.Add("CamelAddress", typeof(Camel.Address)); - types.Add("CamelInternetAddress", typeof(Camel.InternetAddress)); - types.Add("CamelStream", typeof(Camel.Stream)); - types.Add("CamelStreamMem", typeof(Camel.StreamMem)); - types.Add("CamelStreamFs", typeof(Camel.StreamFS)); - } - - public static void objectFinalised(IntPtr o, IntPtr info, IntPtr data) { - System.Console.WriteLine("object finalised " + o); - objects.Remove(o); - } - - public static Object fromCamel(IntPtr raw) { - CamelObject o; - CamelObjectClass klass; - WeakReference weak = (WeakReference)objects[raw]; - - System.Console.WriteLine("object from camel " + raw); - - if (weak != null) - return (Object)weak.Target; - - o = (CamelObject)Marshal.PtrToStructure(raw, typeof(CamelObject)); - if ((object)o == null) - return null; - - klass = (CamelObjectClass)Marshal.PtrToStructure(o.klass, typeof(CamelObjectClass)); - while ((object)klass != null) { - Console.WriteLine(" checking is " + klass.name); - if (types.ContainsKey(klass.name)) { - Console.WriteLine(" yep!"); - camel_object_ref(raw); - return (Camel.Object)Activator.CreateInstance((Type)types[klass.name], new object [] { raw }); - } - - klass = (CamelObjectClass)Marshal.PtrToStructure(klass.parent, typeof(CamelObjectClass)); - } - - Console.WriteLine(" unknown type?"); - camel_object_unref(raw); - return null; - } - - /* this just registers an object created on the cil side */ - public static void toCamel(Object res) { - System.Console.WriteLine("object to camel " + res.cobject); - - objects.Add(res.cobject, new WeakReference(res)); - res.finaliseID = camel_object_hook_event(res.cobject, "finalize", (CamelEventFunc)objectFinalised, (IntPtr)0); - } - - // Camel event Wrapper and helpers - public delegate void CamelEventFunc(IntPtr o, IntPtr info, IntPtr data); - - [DllImport("camel-1.2")] public static extern int camel_object_hook_event(IntPtr raw, string name, CamelEventFunc func, IntPtr data); - [DllImport("camel-1.2")] public static extern void camel_object_remove_event(IntPtr raw, int id); - - protected void addEvent(String name, ref int hookid, CamelEventFunc hook, Delegate value) { - if (hookid == -1) - hookid = camel_object_hook_event(cobject, name, hook, (IntPtr)0); - events.AddHandler(name, value); - } - - protected void removeEvent(String name, ref int hookid, Delegate value) { - events.RemoveHandler(name, value); - if (events[name] == null) { - camel_object_remove_event(cobject, hookid); - hookid = -1; - } - } - - // object events - public delegate void FinaliseEvent(Camel.Object o); - public delegate void MetaChangedEvent(Camel.Object o, String name); - - // how to remove these, at dispose time? - private int finalise_id = -1; - private int meta_changed_id = -1; - - private static void finaliseHook(IntPtr co, IntPtr info, IntPtr data) { - Object o = fromCamel(co); - FinaliseEvent f; - - if (o != null - && (f = (FinaliseEvent)o.events["finalize"]) != null) - f(o); - } - - private static void metaChangedHook(IntPtr co, IntPtr info, IntPtr data) { - Object o = fromCamel(co); - MetaChangedEvent f; - - if (o != null - && (f = (MetaChangedEvent)o.events["finalize"]) != null) - f(o, Marshal.PtrToStringAnsi(info)); - } - - public event FinaliseEvent Finalise { - add { addEvent("finalize", ref finalise_id, (CamelEventFunc)finaliseHook, value); } - remove { removeEvent("finalize", ref finalise_id, value); } - } - - public event MetaChangedEvent MetaChanged { - add { addEvent("meta_changed", ref meta_changed_id, (CamelEventFunc)metaChangedHook, value); } - remove { removeEvent("meta_changed", ref meta_changed_id, value); } - } - - [DllImport("camel-1.2")] static extern IntPtr camel_object_get_ptr(IntPtr raw, ref CamelException ex, int tag); - [DllImport("camel-1.2")] static extern void camel_object_free(IntPtr raw, int tag, IntPtr val); - [DllImport("camel-1.2")] static extern int camel_object_get_int(IntPtr raw, ref CamelException ex, int tag); - - // maybe we want an indexer class to get properties? - // e.g. name = folder.properties[Folder.Tag.NAME] - public String getString(int type) { - String s; - IntPtr o; - CamelException ex = new CamelException(); - - o = camel_object_get_ptr(cobject, ref ex, type); - if (ex.id != 0) - throw new Camel.Exception(ex); - - s = Marshal.PtrToStringAuto(o); - camel_object_free(cobject, type, o); - - return s; - } - - public Camel.Object getObject(int type) { - IntPtr o; - Camel.Object co; - CamelException ex = new CamelException(); - - o = camel_object_get_ptr(cobject, ref ex, type); - if (ex.id != 0) - throw new Camel.Exception(ex); - - co = fromCamel(o); - camel_object_free(cobject, type, o); - - return co; - } - - public int getInt(int type) { - int r; - CamelException ex = new CamelException(); - - r = camel_object_get_int(cobject, ref ex, type); - if (ex.id != 0) - throw new Camel.Exception(ex); - - return r; - } - - // meta-data - [DllImport("camel-1.2")] static extern String camel_object_meta_get(IntPtr raw, string name); - [DllImport("camel-1.2")] static extern bool camel_object_meta_set(IntPtr raw, string name, string value); - - public String metaGet(String name) { - return camel_object_meta_get(cobject, name); - } - - public bool metaSet(String name, String value) { - return camel_object_meta_set(cobject, name, value); - } - } - - public class Provider { - public enum Type { - STORE = 0, - TRANSPORT = 1 - } - } - - public class Session : Object { - public Session(IntPtr raw) : base(raw) { } - - [DllImport("camel-provider-1.2")] static extern IntPtr camel_session_get_service(IntPtr o, string uri, int type, ref CamelException ex); - [DllImport("camel-provider-1.2")] static extern IntPtr camel_session_get_service_connected(IntPtr o, string uri, int type, ref CamelException ex); - - public Service getService(string uri, Provider.Type type) { - IntPtr s; - CamelException ex = new CamelException(); - - s = camel_session_get_service(cobject, uri, (int)type, ref ex); - if (ex.id != 0) - throw new Camel.Exception(ex); - - return (Service)fromCamel(s); - } - } - - public class Service : Object { - public Service(IntPtr raw) : base(raw) { } - // wrap service shit - } - - public class Store : Service { - public Store(IntPtr raw) : base(raw) { } - - [DllImport("camel-provider-1.2")] - static extern IntPtr camel_store_get_folder(IntPtr o, string name, int flags, ref CamelException ex); - - Folder getFolder(string name, int flags) { - IntPtr s; - CamelException ex = new CamelException(); - - s = camel_store_get_folder(cobject, name, flags, ref ex); - if (ex.id != 0) - throw new Camel.Exception(ex); - - return (Folder)fromCamel(s); - } - - void createFolder(string name) { - } - } - - public class Transport : Service { - public Transport(IntPtr raw) : base(raw) { } - - // send to (message, from, reciepients); - } - - public class Folder : Camel.Object { - public Folder(IntPtr raw) : base(raw) { } - - ~Folder() { - if (changed_id != -1) - camel_object_remove_event(cobject, changed_id); - } - - public enum Tag { - NAME = (int) (0x1400 + Arg.Tag.STR), - FULL_NAME = (int) (0x1401 + Arg.Tag.STR), - STORE = (int) (0x1402 + Arg.Tag.OBJ), - PERMANENTFLAGS = (int) (0x1403 + Arg.Tag.INT), - TOTAL = (int) (0x1404 + Arg.Tag.INT), - UNREAD = (int) (0x1405 + Arg.Tag.INT), - DELETED = (int) (0x1406 + Arg.Tag.INT), - JUNKED = (int) (0x1407 + Arg.Tag.INT), - VISIBLE = (int) (0x1408 + Arg.Tag.INT), - UID_ARRAY = (int) (0x1409 + Arg.Tag.PTR), - INFO_ARRAY = (int) (0x140a + Arg.Tag.PTR), // GPtrArray - PROPERTIES = (int) (0x140b + Arg.Tag.PTR), // GSList of properties - } - - [DllImport("camel-provider-1.2")] static extern IntPtr camel_folder_get_message(IntPtr o, string uid, ref CamelException ex); - [DllImport("camel-provider-1.2")] static extern IntPtr camel_folder_get_uids(IntPtr o); - [DllImport("camel-provider-1.2")] static extern void camel_folder_free_uids(IntPtr o, IntPtr uids); - [DllImport("camel-provider-1.2")] static extern IntPtr camel_folder_search_by_expression(IntPtr o, string expr, ref CamelException ex); - [DllImport("camel-provider-1.2")] static extern IntPtr camel_folder_search_by_uids(IntPtr o, string expr, ref Util.UIDArray uids, ref CamelException ex); - [DllImport("camel-provider-1.2")] static extern void camel_folder_search_free(IntPtr o, IntPtr uids); - - [DllImport("camel-provider-1.2")] static extern IntPtr camel_folder_get_message_info(IntPtr raw, String uid); - - public MimeMessage getMessage(string uid) { - CamelException ex = new CamelException(); - IntPtr o = camel_folder_get_message(cobject, uid, ref ex); - - if (ex.id != 0) - throw new Camel.Exception(ex); - - return (MimeMessage)fromCamel(o); - } - - public MessageInfo getMessageInfo(string uid) { - IntPtr o = camel_folder_get_message_info(cobject, uid); - - if (o == (IntPtr)0) - return null; - else - return new MessageInfo(o); - } - - public string [] getUIDs() { - IntPtr o = camel_folder_get_uids(cobject); - Util.UIDArray uids = new Util.UIDArray(o); - - camel_folder_free_uids(cobject, o); - - return uids.uids; - } - - public string [] search(string expr) { - CamelException ex = new CamelException(); - IntPtr o = camel_folder_search_by_expression(cobject, expr, ref ex); - Util.UIDArray uids; - - if (ex.id != 0) - throw new Camel.Exception(ex); - - uids = new Util.UIDArray(o); - camel_folder_search_free(cobject, o); - - return uids.uids; - } - - public string [] searchUIDs(string expr, string [] sub) { - CamelException ex = new CamelException(); - Util.UIDArray uids = new Util.UIDArray(sub); - IntPtr o = camel_folder_search_by_uids(cobject, expr, ref uids, ref ex); - - if (ex.id != 0) - throw new Camel.Exception(ex); - - uids = new Util.UIDArray(o); - camel_folder_search_free(cobject, o); - - return uids.uids; - } - - public String name { - get { return getString((int)Folder.Tag.NAME); } - } - - public String fullName { - get { return getString((int)Folder.Tag.FULL_NAME); } - } - - public Camel.Store store { - get { return (Camel.Store)getObject((int)Folder.Tag.STORE); } - } - - // Folder events - public delegate void ChangedEvent(Camel.Folder f); - - private int changed_id = -1; - - private static void changedHook(IntPtr co, IntPtr info, IntPtr data) { - Camel.Folder o = (Camel.Folder)fromCamel(co); - ChangedEvent f; - - Console.WriteLine("changed hook called for: " + o.cobject); - - if (o != null - && (f = (ChangedEvent)o.events["folder_changed"]) != null) - f(o); - } - - public event ChangedEvent Changed { - add { addEvent("folder_changed", ref changed_id, (CamelEventFunc)changedHook, value); } - remove { removeEvent("folder_changed", ref changed_id, value); } - } - } - - public class DataWrapper : Camel.Object { - public DataWrapper(IntPtr raw) : base(raw) { } - - [DllImport("camel-1.2")] static extern int camel_data_wrapper_write_to_stream(IntPtr o, IntPtr s); - [DllImport("camel-1.2")] static extern int camel_data_wrapper_decode_to_stream(IntPtr o, IntPtr s); - [DllImport("camel-1.2")] static extern int camel_data_wrapper_construct_from_stream(IntPtr o, IntPtr s); - [DllImport("camel-1.2")] static extern IntPtr camel_data_wrapper_get_mime_type_field(IntPtr o); - - public void writeToStream(Camel.Stream stream) { - int res; - - res = camel_data_wrapper_write_to_stream(cobject, stream.cobject); - if (res == -1) - throw new Exception(Exception.Type.SYSTEM, "IO Error"); - } - - public void decodeToStream(Camel.Stream stream) { - int res; - - res = camel_data_wrapper_decode_to_stream(cobject, stream.cobject); - if (res == -1) - throw new Exception(Exception.Type.SYSTEM, "IO Error"); - } - - public void constructFromStream(Camel.Stream stream) { - int res; - - res = camel_data_wrapper_construct_from_stream(cobject, stream.cobject); - if (res == -1) - throw new Exception(Exception.Type.SYSTEM, "IO Error"); - } - - public ContentType mimeType { get { return new ContentType(camel_data_wrapper_get_mime_type_field(cobject)); } } - } - - public class Medium : Camel.DataWrapper { - public Medium(IntPtr raw) : base(raw) { } - - [DllImport("camel-1.2")] static extern IntPtr camel_medium_get_content_object(IntPtr o); - [DllImport("camel-1.2")] static extern void camel_medium_set_content_object(IntPtr o, IntPtr s); - - public DataWrapper content { - get { - IntPtr o = camel_medium_get_content_object(cobject); - - if (o != (IntPtr)0) - return (DataWrapper)Object.fromCamel(o); - else - return null; - } - set { - camel_medium_set_content_object(cobject, value.cobject); - } - } - } - - public class Multipart : Camel.DataWrapper { - [DllImport("camel-1.2")] static extern IntPtr camel_multipart_new(); - [DllImport("camel-1.2")] static extern void camel_multipart_add_part(IntPtr o, IntPtr p); - [DllImport("camel-1.2")] static extern void camel_multipart_remove_part(IntPtr o, IntPtr p); - [DllImport("camel-1.2")] static extern IntPtr camel_multipart_get_part(IntPtr o, int index); - [DllImport("camel-1.2")] static extern int camel_multipart_get_number(IntPtr o); - - public Multipart(IntPtr raw) : base(raw) { } - - public void addPart(MimePart part) { - camel_multipart_add_part(cobject, part.cobject); - } - - public void removePart(MimePart part) { - camel_multipart_add_part(cobject, part.cobject); - } - - public MimePart getPart(int index) { - IntPtr o; - - o = camel_multipart_get_part(cobject, index); - if (o != (IntPtr)0) - return (MimePart)Object.fromCamel(o); - else - return null; - } - - public int getNumber() { - return camel_multipart_get_number(cobject); - } - - // FIXME: finish - } - - public class MimePart : Camel.Medium { - [DllImport("camel-1.2")] static extern IntPtr camel_mime_part_new(); - [DllImport("camel-1.2")] static extern IntPtr camel_mime_part_get_description(IntPtr o); - [DllImport("camel-1.2")] static extern void camel_mime_part_set_description(IntPtr o, string s); - [DllImport("camel-1.2")] static extern IntPtr camel_mime_part_get_disposition(IntPtr o); - [DllImport("camel-1.2")] static extern void camel_mime_part_set_disposition(IntPtr o, string s); - [DllImport("camel-1.2")] static extern IntPtr camel_mime_part_get_filename(IntPtr o); - [DllImport("camel-1.2")] static extern void camel_mime_part_set_filename(IntPtr o, string s); - - public MimePart(IntPtr raw) : base(raw) { } - - public string description { - get { return Marshal.PtrToStringAuto(camel_mime_part_get_description(cobject)); } - set { camel_mime_part_set_description(cobject, value); } - } - - public string disposition { - get { return Marshal.PtrToStringAuto(camel_mime_part_get_disposition(cobject)); } - set { camel_mime_part_set_disposition(cobject, value); } - } - - public string filename { - get { return Marshal.PtrToStringAuto(camel_mime_part_get_filename(cobject)); } - set { camel_mime_part_set_filename(cobject, value); } - } - - // FIXME: finish - } - - public class MimeMessage : Camel.MimePart { - [DllImport("camel-1.2")] static extern IntPtr camel_mime_message_new(); - [DllImport("camel-1.2")] static extern IntPtr camel_mime_message_get_subject(IntPtr o); - [DllImport("camel-1.2")] static extern void camel_mime_message_set_subject(IntPtr o, string s); - [DllImport("camel-1.2")] static extern IntPtr camel_mime_message_get_from(IntPtr o); - [DllImport("camel-1.2")] static extern void camel_mime_message_set_from(IntPtr o, IntPtr s); - [DllImport("camel-1.2")] static extern IntPtr camel_mime_message_get_recipients(IntPtr o, string type); - [DllImport("camel-1.2")] static extern void camel_mime_message_set_recipients(IntPtr o, string type, IntPtr s); - - public MimeMessage(IntPtr raw) : base(raw) { } - - /* We need to use factories to create new objects otherwise the parent will instantiate an instance - of itself instead during the constructor setup */ - public MimeMessage() : base((IntPtr)0) { - cobject = camel_mime_message_new(); - toCamel(this); - } - - public string subject { - get { return Marshal.PtrToStringAuto(camel_mime_message_get_subject(cobject)); } - set { camel_mime_message_set_subject(cobject, value); } - } - - public InternetAddress from { - get { return new InternetAddress(camel_mime_message_get_from(cobject)); } - set { camel_mime_message_set_from(cobject, value.cobject); } - } - - public InternetAddress to { - get { return new InternetAddress(camel_mime_message_get_recipients(cobject, "to")); } - set { camel_mime_message_set_recipients(cobject, "to", value.cobject); } - } - - public InternetAddress cc { - get { return new InternetAddress(camel_mime_message_get_recipients(cobject, "cc")); } - set { camel_mime_message_set_recipients(cobject, "cc", value.cobject); } - } - - public InternetAddress bcc { - get { return new InternetAddress(camel_mime_message_get_recipients(cobject, "bcc")); } - set { camel_mime_message_set_recipients(cobject, "bcc", value.cobject); } - } - - public InternetAddress resentTO { - get { return new InternetAddress(camel_mime_message_get_recipients(cobject, "resent-to")); } - set { camel_mime_message_set_recipients(cobject, "resent-to", value.cobject); } - } - - public InternetAddress resentCC { - get { return new InternetAddress(camel_mime_message_get_recipients(cobject, "resent-cc")); } - set { camel_mime_message_set_recipients(cobject, "resent-cc", value.cobject); } - } - - public InternetAddress resentBCC { - get { return new InternetAddress(camel_mime_message_get_recipients(cobject, "resent-bcc")); } - set { camel_mime_message_set_recipients(cobject, "resent-bcc", value.cobject); } - } - } - - // subclass real streams? or real stream interfaces? - public class Stream : Camel.Object { - public Stream(IntPtr raw) : base(raw) { } - - [DllImport("camel-1.2")] static extern int camel_stream_write(IntPtr o, byte [] data, int len); - [DllImport("camel-1.2")] static extern int camel_stream_read(IntPtr o, byte [] data, int len); - [DllImport("camel-1.2")] static extern int camel_stream_eos(IntPtr o); - [DllImport("camel-1.2")] static extern int camel_stream_close(IntPtr o); - [DllImport("camel-1.2")] static extern int camel_stream_flush(IntPtr o); - [DllImport("camel-1.2")] static extern int camel_stream_reset(IntPtr o); - - public int write(byte [] data, int len) { - int ret; - - ret = camel_stream_write(cobject, data, len); - if (ret == -1) - throw new Exception(Exception.Type.SYSTEM, "IO write Error"); - - return ret; - } - - public int write(string value) { - int ret; - byte [] data; - System.Text.UTF8Encoding enc = new System.Text.UTF8Encoding(); - - data = enc.GetBytes(value); - ret = camel_stream_write(cobject, data, data.Length); - if (ret == -1) - throw new Exception(Exception.Type.SYSTEM, "IO write Error"); - - return ret; - } - - - public int read(byte [] data, int len) { - int ret; - - ret = camel_stream_read(cobject, data, len); - if (ret == -1) - throw new Exception(Exception.Type.SYSTEM, "IO read Error"); - - return ret; - } - - public void close() { - if (camel_stream_close(cobject) == -1) - throw new Exception(Exception.Type.SYSTEM, "IO close Error"); - } - - public void reset() { - if (camel_stream_reset(cobject) == -1) - throw new Exception(Exception.Type.SYSTEM, "IO reset Error"); - } - - public void flush() { - if (camel_stream_flush(cobject) == -1) - throw new Exception(Exception.Type.SYSTEM, "IO close Error"); - } - - public bool eos() { - return (camel_stream_eos(cobject) != 0); - } - } - - public class SeekableStream : Camel.Stream { - public SeekableStream(IntPtr raw) : base(raw) { } - } - - public class StreamFS : Camel.SeekableStream { - public enum Flags { - O_RDONLY = 00, - O_WRONLY = 01, - O_RDWR = 02, - O_CREAT = 0100, - O_EXCL = 0200, - O_TRUNC = 01000, - O_APPEND = 02000 - } - - public static int STDIN_FILENO = 0; - public static int STDOUT_FILENO = 1; - public static int STDERR_FILENO = 2; - - public StreamFS(IntPtr raw) : base(raw) { } - - [DllImport("camel-1.2")] static extern IntPtr camel_stream_fs_new_with_name(string name, int flags, int mode); - [DllImport("camel-1.2")] static extern IntPtr camel_stream_fs_new_with_fd(int fd); - - public StreamFS(string name, Flags flags, int mode) : base((IntPtr)0) { - cobject = camel_stream_fs_new_with_name(name, (int)flags, mode); - toCamel(this); - } - - public StreamFS(int fd) : base((IntPtr)0) { - cobject = camel_stream_fs_new_with_fd(fd); - toCamel(this); - } - } - - // this should obviously be extracted at build time - [StructLayout (LayoutKind.Explicit)] - struct CamelStreamMem { - [FieldOffset(44)] public IntPtr buffer; - } - - struct GByteArray { - public IntPtr data; - public int len; - } - - struct GPtrArray { - public IntPtr pdata; - public int len; - } - - public class StreamMem : Camel.SeekableStream { - public StreamMem(IntPtr raw) : base(raw) { } - - [DllImport("camel-1.2")] - static extern IntPtr camel_stream_mem_new(); - - /* stupid c# */ - public StreamMem() : base((IntPtr)0) { - cobject = camel_stream_mem_new(); - toCamel(this); - } - - // should probably have some sort of interface for incremental/range gets too - public Byte[] getBuffer() { - CamelStreamMem mem = (CamelStreamMem)Marshal.PtrToStructure(cobject, typeof(CamelStreamMem)); - GByteArray ba = (GByteArray)Marshal.PtrToStructure(mem.buffer, typeof(GByteArray)); - Byte[] res = new Byte[ba.len]; - - Marshal.Copy(ba.data, res, 0, ba.len); - - return res; - } - } - - // should do iterators etc? - public class Address : Camel.Object { - public Address(IntPtr raw) : base (raw) { } - - [DllImport("camel-1.2")] static extern IntPtr camel_address_new(); - [DllImport("camel-1.2")] static extern int camel_address_length(IntPtr raw); - [DllImport("camel-1.2")] static extern int camel_address_decode(IntPtr raw, string addr); - [DllImport("camel-1.2")] static extern string camel_address_encode(IntPtr raw); - [DllImport("camel-1.2")] static extern int camel_address_unformat(IntPtr raw, string addr); - [DllImport("camel-1.2")] static extern string camel_address_format(IntPtr raw); - [DllImport("camel-1.2")] static extern int camel_address_cat(IntPtr raw, IntPtr src); - [DllImport("camel-1.2")] static extern int camel_address_copy(IntPtr raw, IntPtr src); - [DllImport("camel-1.2")] static extern void camel_address_remove(IntPtr raw, int index); - - public Address() : base((IntPtr)0) { - cobject = camel_address_new(); - toCamel(this); - } - - public int length() { - return camel_address_length(cobject); - } - - public void decode(string addr) { - if (camel_address_decode(cobject, addr) == -1) - throw new Exception(Exception.Type.SYSTEM, "Invalid address: " + addr); - } - - public string encode() { - return camel_address_encode(cobject); - } - - public void unformat(string addr) { - if (camel_address_unformat(cobject, addr) == -1) - throw new Exception(Exception.Type.SYSTEM, "Invalid address: " + addr); - } - - public string format() { - return camel_address_format(cobject); - } - - public void cat(Address from) { - camel_address_cat(cobject, from.cobject); - } - - public void copy(Address from) { - camel_address_copy(cobject, from.cobject); - } - } - - public class InternetAddress : Camel.Address { - public InternetAddress(IntPtr raw) : base (raw) { } - - [DllImport("camel-1.2")] static extern IntPtr camel_internet_address_new(); - [DllImport("camel-1.2")] static extern int camel_internet_address_add(IntPtr raw, string name, string addr); - [DllImport("camel-1.2")] static extern bool camel_internet_address_get(IntPtr raw, out string name, out string addr); - [DllImport("camel-1.2")] static extern int camel_internet_address_find_name(IntPtr raw, string name, out string addr); - [DllImport("camel-1.2")] static extern int camel_internet_address_find_address(IntPtr raw, string addr, out string name); - [DllImport("camel-1.2")] static extern string camel_internet_address_encode_address(out int len, string name, string addr); - [DllImport("camel-1.2")] static extern string camel_internet_address_format_address(string name, string addr); - - public InternetAddress() : base((IntPtr)0) { - cobject = camel_internet_address_new(); - toCamel(this); - } - - public void add(string name, string addr) { - camel_internet_address_add(cobject, name, addr); - } - - public bool get(out string name, out string addr) { - name = null; - addr = null; - return camel_internet_address_get(cobject, out name, out addr); - } - - // this is a weird arsed interface ... - public int findName(string name, out string addr) { - addr = null; - // FIXME: addr is const, need to marshal to local - return camel_internet_address_find_name(cobject, name, out addr); - } - - public int findAddress(string addr, out string name) { - name = null; - return camel_internet_address_find_name(cobject, addr, out name); - } - - public static string encode(string name, string addr) { - int len = 0; - // another weird-arsed interface - return camel_internet_address_encode_address(out len, name, addr); - } - - public static string format(string name, string addr) { - return camel_internet_address_format_address(name, addr); - } - } - - public class ContentType { - public IntPtr cobject; - - public ContentType(IntPtr raw) { - cobject = raw; - } - - [DllImport("camel-1.2")] static extern bool camel_content_type_is(IntPtr raw, string type, string subtype); - - ~ContentType() { - } - - public bool isType(string type, string subtype) { - return camel_content_type_is(cobject, type, subtype); - } - } - - public class MessageInfo { - public IntPtr cobject; - private Tags user_tags; - private Flags user_flags; - - private enum Type { - SUBJECT, - FROM, - TO, - CC, - MLIST, - - FLAGS, - SIZE, - - DATE_SENT, - DATE_RECEIVED, - - MESSAGE_ID, - REFERENCES, - - USER_FLAGS, - USER_TAGS, - - LAST, - } - - public class Tags { - private MessageInfo mi; - - [DllImport("camel-provider-1.2")] static extern IntPtr camel_message_info_user_tag(IntPtr mi, String name); - [DllImport("camel-provider-1.2")] static extern bool camel_message_info_set_user_tag(IntPtr mi, String name, String value); - - public Tags(MessageInfo raw) { - mi = raw; - } - - public String this [String tag] { - get { - return Marshal.PtrToStringAnsi(camel_message_info_user_tag(mi.cobject, tag)); - } - set { - camel_message_info_set_user_tag(mi.cobject, tag, value); - } - } - } - - public class Flags { - private MessageInfo mi; - - [DllImport("camel-provider-1.2")] static extern bool camel_message_info_user_flag(IntPtr miptr, String name); - [DllImport("camel-provider-1.2")] static extern bool camel_message_info_set_user_flag(IntPtr miptr, String name, bool value); - - // note raw is a pointer to a pointer of tags - public Flags(MessageInfo raw) { - mi = raw; - } - - public bool this [String tag] { - get { - return camel_message_info_user_flag(mi.cobject, tag); - } - set { - camel_message_info_set_user_flag(mi.cobject, tag, value); - } - } - } - - // only used to calculate offsets - private struct CamelMessageInfo { - IntPtr summary; - uint refcount; - string uid; - }; - - public MessageInfo(IntPtr raw) { - cobject = raw; - } - - [DllImport("camel-provider-1.2")] static extern void camel_folder_free_message_info(IntPtr raw, IntPtr info); - [DllImport("camel-provider-1.2")] static extern void camel_message_info_free(IntPtr info); - - ~MessageInfo() { - camel_message_info_free(cobject); - } - - [DllImport("camel-provider-1.2")] static extern IntPtr camel_message_info_ptr(IntPtr raw, int type); - [DllImport("camel-provider-1.2")] static extern uint camel_message_info_uint32(IntPtr raw, int type); - [DllImport("camel-provider-1.2")] static extern uint camel_message_info_time(IntPtr raw, int type); - - public String uid { get { return Marshal.PtrToStringAuto(Marshal.ReadIntPtr(cobject, (int)Marshal.OffsetOf(typeof(CamelMessageInfo), "uid"))); } } - - public String subject { get { return Marshal.PtrToStringAnsi(camel_message_info_ptr(cobject, (int)Type.SUBJECT)); } } - public String from { get { return Marshal.PtrToStringAnsi(camel_message_info_ptr(cobject, (int)Type.FROM)); } } - public String to { get { return Marshal.PtrToStringAnsi(camel_message_info_ptr(cobject, (int)Type.TO)); } } - public String cc { get { return Marshal.PtrToStringAnsi(camel_message_info_ptr(cobject, (int)Type.CC)); } } - public String mlist { get { return Marshal.PtrToStringAnsi(camel_message_info_ptr(cobject, (int)Type.MLIST)); } } - - public uint flags { get { return camel_message_info_uint32(cobject, (int)Type.FLAGS); } } - public uint size { get { return camel_message_info_uint32(cobject, (int)Type.SIZE); } } - - public Tags userTags { - get { - if (user_tags == null) - user_tags = new Tags(this); - return user_tags; - } - } - - public Flags userFlags { - get { - if (user_flags == null) - user_flags = new Flags(this); - return user_flags; - } - } - } - - public class URL { - public IntPtr cobject; - internal Params param_list; - - // we never instantiate this, we just use it to describe the layout - internal struct CamelURL { - internal IntPtr protocol; - internal IntPtr user; - internal IntPtr authmech; - internal IntPtr passwd; - internal IntPtr host; - internal int port; - internal IntPtr path; - internal IntPtr pparams; - internal IntPtr query; - internal IntPtr fragment; - }; - - public class Params { - private URL parent; - - internal Params(URL _parent) { - parent = _parent; - } - - public string this[string name] { - set { camel_url_set_param(parent.cobject, name, value); } - get { return Marshal.PtrToStringAnsi(camel_url_get_param(parent.cobject, name)); } - } - } - - [DllImport("camel-1.2")] static extern IntPtr camel_url_new_with_base(IntPtr bbase, string url); - [DllImport("camel-1.2")] static extern IntPtr camel_url_new(string url, ref CamelException ex); - [DllImport("camel-1.2")] static extern string camel_url_to_string(IntPtr url, int flags); - [DllImport("camel-1.2")] static extern void camel_url_free(IntPtr url); - - // this is a shit to wrap, needs accessors or other pain - [DllImport("camel-1.2")] static extern void camel_url_set_protocol(IntPtr url, string s); - [DllImport("camel-1.2")] static extern void camel_url_set_user(IntPtr url, string s); - [DllImport("camel-1.2")] static extern void camel_url_set_authmech(IntPtr url, string s); - [DllImport("camel-1.2")] static extern void camel_url_set_passwd(IntPtr url, string s); - [DllImport("camel-1.2")] static extern void camel_url_set_host(IntPtr url, string s); - [DllImport("camel-1.2")] static extern void camel_url_set_port(IntPtr url, int p); - [DllImport("camel-1.2")] static extern void camel_url_set_path(IntPtr url, string s); - [DllImport("camel-1.2")] static extern void camel_url_set_param(IntPtr url, string s, string v); - [DllImport("camel-1.2")] static extern void camel_url_set_query(IntPtr url, string s); - [DllImport("camel-1.2")] static extern void camel_url_set_fragment(IntPtr url, string s); - - [DllImport("camel-1.2")] static extern IntPtr camel_url_get_param(IntPtr url, string s); - - [DllImport("camel-1.2")] static extern string camel_url_encode(string url, string escape); - // ugh we can't do this, it writes to its result?? - // -> use StringBuilder - [DllImport("camel-1.2")] static extern IntPtr camel_url_decode(ref string url); - - public URL(string uri) { - CamelException ex = new CamelException(); - - cobject = camel_url_new(uri, ref ex); - if (ex.id != 0) - throw new Exception(ex); - } - - public URL(URL bbase, string uri) { - cobject = camel_url_new_with_base(bbase.cobject, uri); - } - - ~URL() { - camel_url_free(cobject); - } - - /* its ugly but it works */ - private string field(string name) { - return Marshal.PtrToStringAuto(Marshal.ReadIntPtr(cobject, (int)Marshal.OffsetOf(typeof(CamelURL), name))); - } - - public string protocol { - set { camel_url_set_protocol(cobject, value); } - get { return field("protocol"); } - } - - public string user { - set { camel_url_set_user(cobject, value); } - get { return field("user"); } - } - - public string authmech { - set { camel_url_set_authmech(cobject, value); } - get { return field("authmech"); } - } - - public string passwd { - set { camel_url_set_passwd(cobject, value); } - get { return field("passwd"); } - } - - public string host { - set { camel_url_set_host(cobject, value); } - get { return field("host"); } - } - - public int port { - set { camel_url_set_port(cobject, value); } - get { return (int)Marshal.ReadIntPtr(cobject, (int)Marshal.OffsetOf(typeof(CamelURL), "port")); } - } - - public string path { - set { camel_url_set_path(cobject, value); } - get { return field("path"); } - } - - public string query { - set { camel_url_set_query(cobject, value); } - get { return field("query"); } - } - - public string fragment { - set { camel_url_set_fragment(cobject, value); } - get { return field("fragment"); } - } - - public Params paramlist { - get { - if (param_list == null) - param_list = new Params(this); - return param_list; - } - } - - public override string ToString() { - return camel_url_to_string(cobject, 0); - } - - public static string encode(string val) { - return camel_url_encode(val, null); - } - - public static string encode(string val, string escape) { - return camel_url_encode(val, escape); - } - } -} - -namespace Camel.Hash { - public class Stream : System.IO.Stream { - protected Camel.Stream substream; - - public Stream(Camel.Stream sub) { - substream = sub; - } - - public override bool CanSeek { get { return false; } } - public override bool CanRead { get { return true; } } - public override bool CanWrite { get { return true; } } - public override long Length { - get { - throw new System.IO.IOException("Cannot get stream length"); - } - } - public override long Position { - get { - throw new System.IO.IOException("Cannot get stream position"); - } - set { - if (value == 0) { - substream.reset(); - } else { - throw new System.IO.IOException("Cannot set stream position"); - } - } - } - - public override int Read(byte[] buffer, int offset, int count) { - // FIXME: how to add the offset to the buffer? - return substream.read(buffer, count); - } - - public override void Write(byte[] buffer, int offset, int count) { - // FIXME: how to add the offset to the buffer? - substream.write(buffer, count); - } - - public override void Flush() { - substream.flush(); - } - - public override long Seek(long offset, System.IO.SeekOrigin seek) { - throw new System.IO.IOException("Seeking not supported"); - } - - public override void SetLength(long len) { - throw new System.IO.IOException("Cannot set stream length"); - } - } -} - -/* -namespace Evolution.Mail { - class Component : GLib.Object { - public Component(IntPtr raw) : base(raw) {} - public Component() : base() {} - - ~Component() { - Dispose(); - } - - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek(); - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek_base_directory(IntPtr component); - [DllImport("libevolution-mail.so")] static extern IntPtr mail_component_peek(); - - public static Component peek() { - return new Component(mail_component_peek()); - } - - public String baseDirectory { - get {} - } -} -*/ diff --git a/plugins/mono/ChangeLog b/plugins/mono/ChangeLog deleted file mode 100644 index d994cc06f5..0000000000 --- a/plugins/mono/ChangeLog +++ /dev/null @@ -1,84 +0,0 @@ -2009-02-05 Suman Manjunath <msuman@novell.com> - - * mono-plugin.c: Include <mono/metadata/mono-config.h> to fix an implicit- - function-declaration compiler warning. - -2009-01-28 Suman Manjunath <msuman@novell.com> - - * mono-plugin.c: Include <mono/metadata/threads.h> to fix an implicit- - function-declaration compiler warning. - -2008-10-22 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #549025 - - * Makefile.am: - Add $(MONO_CFLAGS) and $(MONO_LIBS) explicitly. The mono plugin - is the only module that should be linking against libmono. - -2008-09-02 Sankar P <psankar@novell.com> - -License Changes - - * mono-plugin.c: - -2008-08-27 Sankar P <psankar@novell.com> - -License Changes - - * mono-plugin.h: - -2008-04-01 Johnny Jacob <jjohnny@novell.com> - - * Camel.cs: Type cast. Fixes compile error. - -2008-03-19 Sankar P <psankar@novell.com> - - * mono-plugin.c: (epm_invoke), - (load_plugin_type_register_function): - * org-gnome-evolution-mono.eplug.xml: - - Use Plugin load levels. Mono loader should load - and register the type "mono", before a plugin - of type "mono" is loaded. - -2007-10-02 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #469657 - - * mono-plugin.c: - Use destroy functions in GHashTables to simplify memory management. - -2007-04-02 Sankar P <psankar@novell.com> - - * Committed on behalf of Gilles Dartiguelongue <dartigug@esiee.fr> - - * org-gnome-evolution-mono.eplug.xml: - Cleanup. - Fixes part of #301149 - -2005-12-17 Tor Lillqvist <tml@novell.com> - - * mono-plugin.c: Drop unused inclusion of <dirent.h>. - -2005-08-19 Not Zed <NotZed@Ximian.com> - - ** See #308117. - - * Makefile.am: link to proper libraries. - -2005-06-15 Harish Krishnaswamy <kharish@novell.com> - - * Makefile.am : mono-plugin.h should be included - in the sources too. - -2005-05-25 Not Zed <NotZed@Ximian.com> - - * mono-plugin.c: implement the mono loader as a plugin itself. - -2005-05-17 Not Zed <NotZed@Ximian.com> - - * Evolution.cs: added initial e_error wrapper. - - * Camel.cs: added multipart & contenttype wrappers. - - diff --git a/plugins/mono/Evolution.cs b/plugins/mono/Evolution.cs deleted file mode 100644 index 0db54405b3..0000000000 --- a/plugins/mono/Evolution.cs +++ /dev/null @@ -1,158 +0,0 @@ -using System; -using System.Runtime.InteropServices; -using System.Reflection; - -using Camel; - -namespace Evolution { - [StructLayout (LayoutKind.Sequential)] - public class PopupTarget { - public IntPtr popup; - public IntPtr widget; - public int type; - public int mask; - }; - - [StructLayout (LayoutKind.Sequential)] - public class MenuTarget { - public IntPtr menu; - public IntPtr widget; - public int type; - public int mask; - }; - - [StructLayout (LayoutKind.Sequential)] - public class EventTarget { - public IntPtr aevent; - public int type; - public int mask; - }; -}; - -namespace Evolution { - public class Error { - // can we marshal varags from c#? - [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, IntPtr end); - [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, IntPtr end); - [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, string arg1, IntPtr end); - [DllImport("eutil")] static extern int e_error_run(IntPtr parent, string tag, string arg0, string arg1, string arg2, IntPtr end); - - public static int run(IntPtr parent, string tag) { - return e_error_run(parent, tag, (IntPtr)0); - } - public static int run(IntPtr parent, string tag, string arg0) { - return e_error_run(parent, tag, arg0, (IntPtr)0); - } - public static int run(IntPtr parent, string tag, string arg0, string arg1) { - return e_error_run(parent, tag, arg0, arg1, (IntPtr)0); - } - public static int run(IntPtr parent, string tag, string arg0, string arg1, string arg2) { - return e_error_run(parent, tag, arg0, arg1, arg2, (IntPtr)0); - } - } -} - -namespace Evolution.Mail { - /* ********************************************************************** */ - [StructLayout (LayoutKind.Sequential)] - public class PopupTargetSelect : PopupTarget { - public IntPtr _folder; - public string uri; - public IntPtr _uids; - - public static PopupTargetSelect get(IntPtr o) { - return (PopupTargetSelect)Marshal.PtrToStructure(o, typeof(PopupTargetSelect)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public string [] uids { - get { return Camel.Util.getUIDArray(_uids); } - } - } - - [StructLayout (LayoutKind.Sequential)] - public class PopupTargetURI : Evolution.PopupTarget { - public string uri; - - public static PopupTargetURI get(IntPtr o) { - return (PopupTargetURI)Marshal.PtrToStructure(o, typeof(PopupTargetURI)); - } - } - - [StructLayout (LayoutKind.Sequential)] - public class PopupTargetPart : PopupTarget { - public string mimeType; - public IntPtr _part; - - public static PopupTargetPart get(IntPtr o) { - return (PopupTargetPart)Marshal.PtrToStructure(o, typeof(PopupTargetPart)); - } - - public Camel.Object part { - get { return (Camel.Object)Camel.Object.fromCamel(_part); } - } - } - - [StructLayout (LayoutKind.Sequential)] - public struct PopupTargetFolder { - public Evolution.PopupTarget target; - public string uri; - - public static PopupTargetFolder get(IntPtr o) { - return (PopupTargetFolder)Marshal.PtrToStructure(o, typeof(PopupTargetFolder)); - } - } - - /* ********************************************************************** */ - [StructLayout (LayoutKind.Sequential)] - public class MenuTargetSelect : MenuTarget { - public IntPtr _folder; - public string uri; - public IntPtr _uids; - - public static MenuTargetSelect get(IntPtr o) { - return (MenuTargetSelect)Marshal.PtrToStructure(o, typeof(MenuTargetSelect)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public string [] uids { - get { return Camel.Util.getUIDArray(_uids); } - } - } - - /* ********************************************************************** */ - [StructLayout (LayoutKind.Sequential)] - public class EventTargetFolder : EventTarget { - public string uri; - - public static EventTargetFolder get(IntPtr o) { - return (EventTargetFolder)Marshal.PtrToStructure(o, typeof(EventTargetFolder)); - } - } - - [StructLayout (LayoutKind.Sequential)] - public class EventTargetMessage : EventTarget { - public IntPtr _folder; - public string uid; - public IntPtr _message; - - public static EventTargetMessage get(IntPtr o) { - return (EventTargetMessage)Marshal.PtrToStructure(o, typeof(EventTargetMessage)); - } - - public Camel.Folder folder { - get { return (Camel.Folder)Camel.Object.fromCamel(_folder); } - } - - public Camel.MimeMessage message { - get { return (Camel.MimeMessage)Camel.Object.fromCamel(_message); } - } - - } -}; diff --git a/plugins/mono/Makefile.am b/plugins/mono/Makefile.am deleted file mode 100644 index 6121bd7f85..0000000000 --- a/plugins/mono/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(E_UTIL_CFLAGS) \ - $(MONO_CFLAGS) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-evolution-mono.eplug -plugin_LTLIBRARIES = liborg-gnome-evolution-mono.la - -liborg_gnome_evolution_mono_la_SOURCES = mono-plugin.c mono-plugin.h -liborg_gnome_evolution_mono_la_LDFLAGS = -module -avoid-version -liborg_gnome_evolution_mono_la_LIBADD = \ - $(E_UTIL_LIBS) \ - $(MONO_LIBS) - -EXTRA_DIST = org-gnome-evolution-mono.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/mono/mono-plugin.c b/plugins/mono/mono-plugin.c deleted file mode 100644 index ae5f199c46..0000000000 --- a/plugins/mono/mono-plugin.c +++ /dev/null @@ -1,240 +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: - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <sys/types.h> -#include <string.h> - -#include "mono-plugin.h" - -#include <mono/metadata/debug-helpers.h> -#include <mono/metadata/object.h> -#include <mono/metadata/appdomain.h> -#include <mono/metadata/assembly.h> -#include <mono/metadata/threads.h> -#include <mono/metadata/mono-config.h> -#include <mono/jit/jit.h> - -#define d(x) (x) - -static MonoDomain *domain; - -/* ********************************************************************** */ -static gpointer epm_parent_class; - -typedef struct _EPluginMonoPrivate { - MonoAssembly *assembly; - MonoClass *klass; - MonoObject *plugin; - GHashTable *methods; -} EPluginMonoPrivate; - -#define epm ((EPluginMono *)ep) - -gpointer load_plugin_type_register_function (gpointer a, gpointer b); - -static gchar * -get_xml_prop(xmlNodePtr node, const gchar *id) -{ - gchar *p = xmlGetProp(node, id); - gchar *out = NULL; - - if (p) { - out = g_strdup(p); - xmlFree(p); - } - - return out; -} - -/* - Two approaches: - You can have a Evolution.Plugin implementation which has every callback as methods on it. - Or you can just use static methods for everything. - - All methods take a single (structured) argument. -*/ - -static gpointer -epm_invoke(EPlugin *ep, const gchar *name, gpointer data) -{ - EPluginMonoPrivate *p = epm->priv; - MonoMethodDesc *d; - MonoMethod *m; - MonoObject *x = NULL, *res; - gpointer *params; - - g_print ("\n\a epm_invoke in mono-plugin.c in mono plugin loader is called \n\a"); - - /* we need to do this every time since we may be called from any thread for some uses */ - mono_thread_attach(domain); - - if (p->assembly == NULL) { - p->assembly = mono_domain_assembly_open(domain, epm->location); - if (p->assembly == NULL) { - g_warning("can't load assembly '%s'", epm->location); - return NULL; - } - - if (epm->handler == NULL - || (p->klass = mono_class_from_name(mono_assembly_get_image(p->assembly), "", epm->handler)) == NULL) { - d(printf("Using static callbacks only")); - } else { - p->plugin = mono_object_new(domain, p->klass); - /* could conceivably init with some context too */ - mono_runtime_object_init(p->plugin); - } - } - - m = g_hash_table_lookup(p->methods, name); - if (m == NULL) { - if (p->klass) { - d(printf("looking up method '%s' in class\n", name)); - /* class method */ - - d = mono_method_desc_new(name, FALSE); - /*if (d == NULL) { - g_warning("Can't create method descriptor for '%s'", name); - return NULL; - }*/ - - gpointer iter = NULL; - MonoMethod* mono_method; - - d(printf ("\n\a About to get methods in klass\n\a")); - - while ((mono_method = mono_class_get_methods (p->klass, &iter))) { - g_print ("\n\a Method name is : <%s>\n\a", mono_method_get_name(mono_method)); - } - d(printf ("\n\a Got methods in klass \n\a")); -//mono_class_get_method_from_name - m = mono_class_get_method_from_name (p->klass, name, -1); - if (m == NULL) { - g_warning("Can't find method callback '%s'", name); - return NULL; - } - } else { - d(printf("looking up static method '%s'\n", name)); - /* static method */ - d = mono_method_desc_new(name, FALSE); - if (d == NULL) { - g_warning("Can't create method descriptor for '%s'", name); - return NULL; - } - - m = mono_method_desc_search_in_image(d, mono_assembly_get_image(p->assembly)); - if (m == NULL) { - g_warning("Can't find method callback '%s'", name); - return NULL; - } - } - - g_hash_table_insert(p->methods, g_strdup(name), m); - } - - params = g_malloc0(sizeof(*params)*1); - params[0] = &data; - res = mono_runtime_invoke(m, p->plugin, params, &x); - /* do i need to free params?? */ - - if (x) - mono_print_unhandled_exception(x); - - if (res) { - gpointer *p = mono_object_unbox(res); - d(printf("mono method returned '%p' %ld\n", *p, (glong)*p)); - return *p; - } else - return NULL; -} - -static gint -epm_construct(EPlugin *ep, xmlNodePtr root) -{ - if (((EPluginClass *)epm_parent_class)->construct(ep, root) == -1) - return -1; - - epm->location = get_xml_prop(root, "location"); - epm->handler = get_xml_prop(root, "handler"); - - if (epm->location == NULL) - return -1; - - return 0; -} - -static void -epm_finalise(GObject *o) -{ - EPlugin *ep = (EPlugin *)o; - EPluginMonoPrivate *p = epm->priv; - - g_free(epm->location); - g_free(epm->handler); - - g_hash_table_destroy(p->methods); - - g_free(epm->priv); - - ((GObjectClass *)epm_parent_class)->finalize(o); -} - -static void -epm_class_init(EPluginClass *klass) -{ - ((GObjectClass *)klass)->finalize = epm_finalise; - klass->construct = epm_construct; - klass->invoke = epm_invoke; - klass->type = "mono"; -} - -static void -epm_init(GObject *o) -{ - EPlugin *ep = (EPlugin *)o; - - epm->priv = g_malloc0(sizeof(*epm->priv)); - epm->priv->methods = g_hash_table_new_full( - g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) NULL); -} - -gpointer -load_plugin_type_register_function (gpointer a, gpointer b) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EPluginMonoClass), NULL, NULL, (GClassInitFunc) epm_class_init, NULL, NULL, - sizeof(EPluginMono), 0, (GInstanceInitFunc) epm_init, - }; - - epm_parent_class = g_type_class_ref(e_plugin_get_type()); - type = g_type_register_static(e_plugin_get_type(), "EPluginMono", &info, 0); - e_plugin_register_type (type); - d(printf("\nType EPluginMono registered from the mono-plugin-loader\n")); - domain = mono_jit_init("Evolution"); - mono_thread_attach(domain); - } - - return GUINT_TO_POINTER(type); -} diff --git a/plugins/mono/mono-plugin.h b/plugins/mono/mono-plugin.h deleted file mode 100644 index 8ea867e806..0000000000 --- a/plugins/mono/mono-plugin.h +++ /dev/null @@ -1,51 +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: - * Sankar P <psankar@novell.com> - * Michael Zucchi <notzed@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _ORG_GNOME_EVOLUTION_MONO_H -#define _ORG_GNOME_EVOLUTION_MONO_H - -#include "e-util/e-plugin.h" - -/* ********************************************************************** */ -/* This is ALL private */ - -typedef struct _EPluginMono EPluginMono; -typedef struct _EPluginMonoClass EPluginMonoClass; - -struct _EPluginMono { - EPlugin plugin; - - struct _EPluginMonoPrivate *priv; - - gchar *location; /* location */ - gchar *handler; /* handler class */ -}; - -struct _EPluginMonoClass { - EPluginClass plugin_class; -}; - -gpointer org_gnome_evolution_mono_get_type(gpointer a, gpointer b); - -#endif /* ! _ORG_GNOME_EVOLUTION_MONO_H */ diff --git a/plugins/mono/org-gnome-evolution-mono.eplug.xml b/plugins/mono/org-gnome-evolution-mono.eplug.xml deleted file mode 100644 index 8b7ea0d043..0000000000 --- a/plugins/mono/org-gnome-evolution-mono.eplug.xml +++ /dev/null @@ -1,11 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin type="shlib" id="org.gnome.evolution.plugin.mono" - location="@PLUGINDIR@/liborg-gnome-evolution-mono@SOEXT@" _name="Mono Loader" load_level="1"> - - <_description>Support plugins written in Mono.</_description> - <author name="Michael Zucchi" email="notzed@ximian.com"/> - <author name="Sankar P" email="psankar@novell.com"/> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/plugin-manager/Makefile.am b/plugins/plugin-manager/Makefile.am index eb8126c398..5f1228f439 100644 --- a/plugins/plugin-manager/Makefile.am +++ b/plugins/plugin-manager/Makefile.am @@ -1,21 +1,22 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) @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 liborg_gnome_plugin_manager_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_plugin_manager_la_LIBADD = \ $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/shell/libeshell.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 406f19b648..da270764a0 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>Manage your Evolution plugins.</_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>Manage your Evolution plugins.</_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 816505b662..838de0e2f3 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(gpointer ep, ESMenuTargetShell *t); +gboolean e_plugin_ui_init (GtkUIManager *ui_manager, + EShellWindow *shell_window); static void eppm_set_label (GtkLabel *l, const gchar *v) @@ -221,19 +221,15 @@ eppm_free (gpointer data) } static void -eppm_response (GtkDialog *w, gint button, Manager *m) -{ - gtk_widget_destroy (GTK_WIDGET (w)); - dialog = NULL; -} - -void -org_gnome_plugin_manager_manage (gpointer ep, ESMenuTargetShell *t) +action_plugin_manager_cb (GtkAction *action, + EShellWindow *shell_window) { Manager *m; gint 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 (gpointer ep, ESMenuTargetShell *t) gchar *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 (gpointer 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 (gpointer 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); } -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +static GtkActionEntry entries[] = { -gint -e_plugin_lib_enable (EPluginLib *ep, gint 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/prefer-plain/prefer-plain.c b/plugins/prefer-plain/prefer-plain.c index dd7e4539b8..b896f19299 100644 --- a/plugins/prefer-plain/prefer-plain.c +++ b/plugins/prefer-plain/prefer-plain.c @@ -26,16 +26,16 @@ #include <gtk/gtk.h> #include <glib/gi18n-lib.h> +#include <gconf/gconf-client.h> #include <string.h> #include <stdio.h> -#include "camel/camel-multipart.h" -#include "camel/camel-mime-part.h" -#include "mail/em-format-hook.h" -#include "mail/em-format.h" +#include <camel/camel-multipart.h> +#include <camel/camel-mime-part.h> -#include <gconf/gconf-client.h> -#include "mail/em-config.h" +#include <em-format/em-format.h> +#include <mail/em-config.h> +#include <mail/em-format-hook.h> void org_gnome_prefer_plain_multipart_alternative(gpointer ep, EMFormatHookTarget *t); void org_gnome_prefer_plain_text_html(gpointer ep, EMFormatHookTarget *t); @@ -243,10 +243,10 @@ org_gnome_prefer_plain_config_mode(struct _EPlugin *epl, struct _EConfigHookItem return (GtkWidget *)dropdown; } -gint e_plugin_lib_enable(EPluginLib *ep, gint enable); +gint e_plugin_lib_enable(EPlugin *ep, gint enable); gint -e_plugin_lib_enable(EPluginLib *ep, gint enable) +e_plugin_lib_enable(EPlugin *ep, gint enable) { gchar *key; gint i; diff --git a/plugins/profiler/Makefile.am b/plugins/profiler/Makefile.am index b276c41296..21f63af33f 100644 --- a/plugins/profiler/Makefile.am +++ b/plugins/profiler/Makefile.am @@ -10,7 +10,7 @@ plugin_DATA = org-gnome-evolution-profiler.eplug plugin_LTLIBRARIES = liborg-gnome-evolution-profiler.la liborg_gnome_evolution_profiler_la_SOURCES = profiler.c -liborg_gnome_evolution_profiler_la_LDFLAGS = -module -avoid-version +liborg_gnome_evolution_profiler_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) EXTRA_DIST = org-gnome-evolution-profiler.eplug.xml diff --git a/plugins/profiler/profiler.c b/plugins/profiler/profiler.c index c6843d349b..1200661b51 100644 --- a/plugins/profiler/profiler.c +++ b/plugins/profiler/profiler.c @@ -40,7 +40,7 @@ org_gnome_evolution_profiler_event(EPlugin *ep, EProfileEventTarget *t) if (!fp) { gchar *name; - name = g_strdup_printf("eprofile.%ld", (glong)getpid()); + name = g_strdup_printf("eprofile.%ld", (glong) getpid()); fp = fopen(name, "w"); if (fp) fprintf(stderr, "Generating profiling data in `%s'\n", name); diff --git a/plugins/pst-import/Makefile.am b/plugins/pst-import/Makefile.am index 35788872c1..56d4e21600 100644 --- a/plugins/pst-import/Makefile.am +++ b/plugins/pst-import/Makefile.am @@ -24,8 +24,10 @@ plugin_LTLIBRARIES = liborg-gnome-pst-import.la liborg_gnome_pst_import_la_SOURCES = pst-importer.c liborg_gnome_pst_import_la_LDFLAGS = \ -module -avoid-version $(NO_UNDEFINED) -liborg_gnome_pst_import_la_LIBADD = \ - $(NO_UNDEFINED_REQUIRED_LIBS) \ +liborg_gnome_pst_import_la_LIBADD = \ + $(top_builddir)/mail/libevolution-mail.la \ + $(EVOLUTION_CALENDAR_LIBS) \ + $(EVOLUTION_MAIL_LIBS) \ $(LIBPST_LIBS) EXTRA_DIST = org-gnome-pst-import.eplug.xml diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c index ddc7e7662f..8009d563f7 100644 --- a/plugins/pst-import/pst-importer.c +++ b/plugins/pst-import/pst-importer.c @@ -61,7 +61,7 @@ #include <camel/camel-stream-fs.h> #include <camel/camel-file-utils.h> -#include <mail/mail-component.h> +#include <mail/e-mail-local.h> #include <mail/mail-mt.h> #include <mail/mail-tools.h> #include <mail/em-utils.h> @@ -94,7 +94,7 @@ gboolean org_credativ_evolution_readpst_supported (EPlugin *epl, EImportTarget * GtkWidget *org_credativ_evolution_readpst_getwidget (EImport *ei, EImportTarget *target, EImportImporter *im); void org_credativ_evolution_readpst_import (EImport *ei, EImportTarget *target, EImportImporter *im); void org_credativ_evolution_readpst_cancel (EImport *ei, EImportTarget *target, EImportImporter *im); -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); /* em-folder-selection-button.h is private, even though other internal evo plugins use it! so declare the functions here @@ -225,7 +225,7 @@ get_suggested_foldername (EImportTargetURI *target) /* Suggest a folder that is in the same mail storage as the users' inbox, with a name derived from the .PST file */ - inbox = mail_component_get_folder_uri (NULL, MAIL_COMPONENT_FOLDER_INBOX); + inbox = e_mail_local_get_folder_uri (E_MAIL_FOLDER_INBOX); delim = g_strrstr (inbox, "#"); if (delim != NULL) { @@ -255,10 +255,11 @@ get_suggested_foldername (EImportTargetURI *target) } if (mail_tool_uri_to_folder (foldername->str, 0, NULL) != NULL) { + CamelFolder *folder; + /* Folder exists - add a number */ gint i, len; len = foldername->len; - CamelFolder *folder; for (i=1; i<10000; i++) { g_string_truncate (foldername, len); @@ -350,7 +351,7 @@ pst_import_describe (PstImporter *m, gint complete) } static ECal* -open_ecal (ECalSourceType type, gchar *name) +open_ecal (ECalSourceType type, const gchar *name) { /* Hack - grab the first calendar we can find TODO - add a selection mechanism in get_widget */ @@ -730,7 +731,7 @@ static CamelMimePart * attachment_to_part (PstImporter *m, pst_item_attach *attach) { CamelMimePart *part; - gchar *mimetype; + const gchar *mimetype; part = camel_mime_part_new (); @@ -831,7 +832,7 @@ pst_process_email (PstImporter *m, pst_item *item) if (item->email->sentto_address.str != NULL) { addr = camel_internet_address_new (); - if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->sentto_address.str) > 0); + if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->sentto_address.str) > 0) camel_mime_message_set_recipients (msg, "To", addr); camel_object_unref (addr); @@ -840,7 +841,7 @@ pst_process_email (PstImporter *m, pst_item *item) if (item->email->cc_address.str != NULL) { addr = camel_internet_address_new (); - if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->cc_address.str) > 0); + if (camel_address_decode (CAMEL_ADDRESS (addr), item->email->cc_address.str) > 0) camel_mime_message_set_recipients (msg, "CC", addr); camel_object_unref (addr); @@ -941,7 +942,7 @@ contact_set_string (EContact *contact, EContactField id, gchar *string) } static void -unknown_field (EContact *contact, GString *notes, gchar *name, gchar *string) +unknown_field (EContact *contact, GString *notes, const gchar *name, gchar *string) { /* Field could not be mapped directly so add to notes field */ if (string != NULL) { @@ -1010,9 +1011,9 @@ pst_process_contact (PstImporter *m, pst_item *item) { pst_item_contact *c; EContact *ec; - c = item->contact; GString *notes; + c = item->contact; notes = g_string_sized_new (2048); ec = e_contact_new (); @@ -1274,12 +1275,13 @@ fill_calcomponent (PstImporter *m, pst_item *item, ECalComponent *ec, const gcha pst_item_appointment *a; pst_item_email *e; - a = item->appointment; - e = item->email; ECalComponentText text; struct icaltimetype tt_start, tt_end; ECalComponentDateTime dt_start, dt_end; + a = item->appointment; + e = item->email; + if (item->create_date) { struct icaltimetype tt; tt = get_ical_date (item->create_date, FALSE); @@ -1653,7 +1655,7 @@ org_credativ_evolution_readpst_cancel (EImport *ei, EImportTarget *target, EImpo } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { if (enable) { bindtextdomain (GETTEXT_PACKAGE, LOCALEDIR); diff --git a/plugins/python/ChangeLog b/plugins/python/ChangeLog deleted file mode 100644 index 38cd85f29f..0000000000 --- a/plugins/python/ChangeLog +++ /dev/null @@ -1,38 +0,0 @@ -2008-09-24 Philip Withnall <philip@tecnocode.co.uk> - - ** Fixes bug #553479 - - * org-gnome-evolution-python.eplug.xml: String capitalisation - improvements. - -2008-09-12 Sankar P <psankar@novell.com> - -License Changes - - * python-plugin-loader.c: - * python-plugin-loader.h: - -2008-07-21 Johnny Jacob <jjohnny@novell.com> - - * Makefile.am (example_sources): More typo fixes. :( - -2008-07-21 Johnny Jacob <jjohnny@novell.com> - - * Makefile.am (example_SOURCES): Add example sources - EXTRA_DIST. - -2008-06-12 Johnny Jacob <jjohnny@novell.com> - - * example/org-gnome-hello-python-ui.xml: Added. - - * example/org-gnome-hello-python.eplug.xml: Added. - - * example/Makefile.am : Added. - - * example/hello_python.py: Added. - -2008-06-09 Johnny Jacob <jjohnny@novell.com> - - * python-plugin-loader.c: Python plugin loader. - Initial Commit. - diff --git a/plugins/python/Makefile.am b/plugins/python/Makefile.am deleted file mode 100644 index f6a48ac727..0000000000 --- a/plugins/python/Makefile.am +++ /dev/null @@ -1,30 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(E_UTIL_CFLAGS) \ - $(PY_INCLUDES) - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-evolution-python.eplug -plugin_LTLIBRARIES = liborg-gnome-evolution-python.la - -liborg_gnome_evolution_python_la_SOURCES = python-plugin-loader.c python-plugin-loader.h -liborg_gnome_evolution_python_la_LDFLAGS = -module -avoid-version -liborg_gnome_evolution_python_la_LIBADD = \ - -lpthread -ldl -lutil -lm \ - $(PY_LIBS) \ - $(E_UTIL_LIBS) - -example_sources = \ - example/hello_python.py \ - example/org-gnome-hello-python-ui.xml \ - example/org-gnome-hello-python.eplug.xml \ - example/Makefile.am - -EXTRA_DIST = org-gnome-evolution-python.eplug.xml \ - $(example_sources) - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/python/example/Makefile.am b/plugins/python/example/Makefile.am deleted file mode 100644 index 8e5ddd49fd..0000000000 --- a/plugins/python/example/Makefile.am +++ /dev/null @@ -1,32 +0,0 @@ -AM_CPPFLAGS = \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" - -@EVO_PLUGIN_RULE@ - -plugin_DATA = \ - hello_python.py \ - org-gnome-hello-python-ui.xml \ - org-gnome-hello-python.eplug - -liborg_gnome_py_plug_test_la_LIBADD= \ - $(NO_UNDEFINED_REQUIRED_LIBS) - -liborg_gnome_py_plug_test_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - -errordir = $(privdatadir)/errors - -BUILDME = org-gnome-hello-python.eplug \ -$(error_i18n) - -BUILT_SOURCES = \ - $(BUILDME) - -EXTRA_DIST = \ - hello_python.py \ - org-gnome-hello-python-ui.xml \ - org-gnome-hello-python.eplug.xml - -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/python/example/hello_python.py b/plugins/python/example/hello_python.py deleted file mode 100644 index 16dc2a12f8..0000000000 --- a/plugins/python/example/hello_python.py +++ /dev/null @@ -1,5 +0,0 @@ -'''hello_python.py - Python source designed to ''' -'''demonstrate the use of python Eplugins''' - -def say_hello(): - print 'Hello ! From python' diff --git a/plugins/python/example/org-gnome-hello-python-ui.xml b/plugins/python/example/org-gnome-hello-python-ui.xml deleted file mode 100644 index 074960e84d..0000000000 --- a/plugins/python/example/org-gnome-hello-python-ui.xml +++ /dev/null @@ -1,16 +0,0 @@ -<Root> - <commands> - <cmd name="HelloPy" _label="Hello Python" - _tip="Python Plugin Loader tests" - /> - </commands> - - <menu> - <placeholder name="MessagePlaceholder"> - <submenu name="Message"> - <separator f="" name="sep"/> - <menuitem name="HelloPy" verb=""/> - </submenu> - </placeholder> - </menu> -</Root> diff --git a/plugins/python/example/org-gnome-hello-python.eplug.xml b/plugins/python/example/org-gnome-hello-python.eplug.xml deleted file mode 100644 index 8f77d5ba01..0000000000 --- a/plugins/python/example/org-gnome-hello-python.eplug.xml +++ /dev/null @@ -1,20 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin id="org.gnome.evolution.hello_python" type="python" _name="Python Test Plugin" location="@PLUGINDIR@" module_name="hello_python"> - - <author name="Johnny Jacob" email="jjohnny@novell.com"/> - - <_description> - Test Plugin for Python EPlugin loader. - </_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. Any UI items on Evolution should come here --> - <ui file="@PLUGINDIR@/org-gnome-hello-python-ui.xml"/> - <item type="item" verb="HelloPy" path="/commands/HelloPy" enable="one" activate="say_hello"/> - </menu> - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/python/org-gnome-evolution-python.eplug.xml b/plugins/python/org-gnome-evolution-python.eplug.xml deleted file mode 100644 index 5f215f65e5..0000000000 --- a/plugins/python/org-gnome-evolution-python.eplug.xml +++ /dev/null @@ -1,10 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin type="shlib" id="org.gnome.evolution.plugin.python" - location="@PLUGINDIR@/liborg-gnome-evolution-python@SOEXT@" _name="Python Loader" load_level="1"> - - <_description>A plugin which loads other plugins written using Python.</_description> - - <author name="Johnny Jacob" email="jjohnny@novell.com"/> - </e-plugin> -</e-plugin-list> diff --git a/plugins/python/python-plugin-loader.c b/plugins/python/python-plugin-loader.c deleted file mode 100644 index 0a03809e97..0000000000 --- a/plugins/python/python-plugin-loader.c +++ /dev/null @@ -1,192 +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 <jjohnny@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include <sys/types.h> -#include <string.h> -#include <Python.h> - -#include "python-plugin-loader.h" - -#define d(x) - -static gpointer epp_parent_class; - -typedef struct _EPluginPythonPrivate { - PyObject *pModule; - PyObject *pClass; - PyObject *pFunc; - PyObject *pDict; - GHashTable *methods; -} EPluginPythonPrivate; - -#define epp ((EPluginPython *)ep) - -gpointer load_plugin_type_register_function (gpointer a, gpointer b); - -static gchar * -get_xml_prop(xmlNodePtr node, const gchar *id) -{ - gchar *p = xmlGetProp(node, id); - gchar *out = NULL; - - if (p) { - out = g_strdup(p); - xmlFree(p); - } - - return out; -} - -static gpointer -epp_invoke(EPlugin *ep, const gchar *name, gpointer data) -{ - EPluginPythonPrivate *p = epp->priv; - PyObject *pModuleName, *pFunc; - PyObject *pInstance, *pValue = NULL; - - /* we need to do this every time since we may be called from any thread for some uses */ - Py_Initialize(); - - if (p->pModule == NULL) { - pModuleName = PyString_FromString(epp->module_name); - - PyRun_SimpleString(g_strdup_printf ("import sys; sys.path.insert(0, '%s')", epp->location)); - - p->pModule = PyImport_Import(pModuleName); - - Py_DECREF(pModuleName); //Free - - if (p->pModule == NULL) { - PyErr_Print(); - g_warning("can't load python module '%s'", epp->location); - return NULL; - } - - p->pDict = PyModule_GetDict(p->pModule); - - if (epp->pClass) { - p->pClass = PyDict_GetItemString(p->pDict, epp->pClass); - } - } - - if (p->pClass) { - - if (PyCallable_Check(p->pClass)) - pInstance = PyObject_CallObject(p->pClass, NULL); - - pValue = PyObject_CallMethod(pInstance, name, NULL); - - } else { - - pFunc = PyDict_GetItemString(p->pDict, name); - - if (pFunc && PyCallable_Check(pFunc)) - pValue = PyObject_CallObject(pFunc, NULL); - else - PyErr_Print(); - } - - if (pValue) { - d(printf("%s(%d):%s: Result of call: %ld \n", __FILE__, __LINE__, __PRETTY_FUNCTION__, PyInt_AsLong(pValue))); - Py_DECREF(pValue); - /* Fixme */ - return NULL; - } else - return NULL; -} - -static gint -epp_construct(EPlugin *ep, xmlNodePtr root) -{ - if (((EPluginClass *)epp_parent_class)->construct(ep, root) == -1) - return -1; - - epp->location = get_xml_prop(root, "location"); - epp->module_name = get_xml_prop (root, "module_name"); - epp->pClass = get_xml_prop(root, "pClass"); - - if (epp->location == NULL) - return -1; - - return 0; -} - -static void -epp_finalise(GObject *o) -{ - EPlugin *ep = (EPlugin *)o; - EPluginPythonPrivate *p = epp->priv; - - g_free(epp->location); - g_free(epp->module_name); - g_free(epp->pClass); - - g_hash_table_destroy(p->methods); - - g_free(epp->priv); - - ((GObjectClass *)epp_parent_class)->finalize(o); -} - -static void -epp_class_init(EPluginClass *klass) -{ - ((GObjectClass *)klass)->finalize = epp_finalise; - klass->construct = epp_construct; - klass->invoke = epp_invoke; - klass->type = "python"; -} - -static void -epp_init(GObject *o) -{ - EPlugin *ep = (EPlugin *)o; - - epp->priv = g_malloc0(sizeof(*epp->priv)); - epp->priv->methods = g_hash_table_new_full( - g_str_hash, g_str_equal, - (GDestroyNotify) g_free, - (GDestroyNotify) NULL); -} - -gpointer -load_plugin_type_register_function (gpointer a, gpointer b) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof(EPluginPythonClass), NULL, NULL, (GClassInitFunc) epp_class_init, NULL, NULL, - sizeof(EPluginPython), 0, (GInstanceInitFunc) epp_init, - }; - - epp_parent_class = g_type_class_ref(e_plugin_get_type()); - type = g_type_register_static(e_plugin_get_type(), "EPluginPython", &info, 0); - e_plugin_register_type (type); - - d(printf("\nType EPluginPython registered from the python-plugin-loader\n")); - - Py_Initialize(); //TODO : Does this mean i can cache the instance of pyobjects ? - } - - return GUINT_TO_POINTER(type); -} diff --git a/plugins/python/python-plugin-loader.h b/plugins/python/python-plugin-loader.h deleted file mode 100644 index 66bd8d5ba2..0000000000 --- a/plugins/python/python-plugin-loader.h +++ /dev/null @@ -1,47 +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 <jjohnny@novell.com> - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef _ORG_GNOME_EVOLUTION_PYTHON_H -#define _ORG_GNOME_EVOLUTION_PYTHON_H - -#include "e-util/e-plugin.h" - -typedef struct _EPluginPython EPluginPython; -typedef struct _EPluginPythonClass EPluginPythonClass; - -struct _EPluginPython { - EPlugin plugin; - - struct _EPluginPythonPrivate *priv; - - gchar *location; /* location */ - gchar *pClass; /* handler class */ - gchar *module_name; -}; - -struct _EPluginPythonClass { - EPluginClass plugin_class; -}; - -gpointer org_gnome_evolution_python_get_type(gpointer a, gpointer b); - -#endif /* ! _ORG_GNOME_EVOLUTION_PYTHON_H */ diff --git a/plugins/sa-junk-plugin/Makefile.am b/plugins/sa-junk-plugin/Makefile.am index eebfdf0c26..66e31a0d6b 100644 --- a/plugins/sa-junk-plugin/Makefile.am +++ b/plugins/sa-junk-plugin/Makefile.am @@ -1,5 +1,6 @@ AM_CPPFLAGS = \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ $(EVOLUTION_MAIL_CFLAGS) @EVO_PLUGIN_RULE@ @@ -10,6 +11,11 @@ plugin_LTLIBRARIES = liborg-gnome-sa-junk-plugin.la liborg_gnome_sa_junk_plugin_la_SOURCES = em-junk-filter.c liborg_gnome_sa_junk_plugin_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) +liborg_gnome_sa_junk_plugin_la_LIBADD = \ + $(top_builddir)/mail/libevolution-mail.la \ + $(top_builddir)/e-util/libeutil.la \ + $(EVOLUTION_MAIL_LIBS) \ + $(GNOME_PLATFORM_LIBS) BUILT_SOURCES = $(plugin_DATA) $(error_DATA) diff --git a/plugins/sa-junk-plugin/em-junk-filter.c b/plugins/sa-junk-plugin/em-junk-filter.c index 74010f2555..ff38f18d6a 100644 --- a/plugins/sa-junk-plugin/em-junk-filter.c +++ b/plugins/sa-junk-plugin/em-junk-filter.c @@ -42,7 +42,7 @@ #include <camel/camel-stream-fs.h> #include <camel/camel-stream-mem.h> #include <camel/camel-i18n.h> -#include <mail/em-junk-hook.h> +#include <mail/em-junk.h> #include <mail/em-utils.h> #include <e-util/e-mktemp.h> @@ -58,10 +58,10 @@ static pthread_mutex_t em_junk_sa_report_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t em_junk_sa_preferred_socket_path_lock = PTHREAD_MUTEX_INITIALIZER; static pthread_mutex_t em_junk_sa_spamd_restart_lock = PTHREAD_MUTEX_INITIALIZER; -gint e_plugin_lib_enable (EPluginLib *ep, gint enable); -gboolean em_junk_sa_check_junk (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_sa_report_junk (EPlugin *ep, EMJunkHookTarget *target); -void em_junk_sa_report_non_junk (EPlugin *ep, EMJunkHookTarget *target); +gint e_plugin_lib_enable (EPlugin *ep, gint enable); +gboolean em_junk_sa_check_junk (EPlugin *ep, EMJunkTarget *target); +void em_junk_sa_report_junk (EPlugin *ep, EMJunkTarget *target); +void em_junk_sa_report_non_junk (EPlugin *ep, EMJunkTarget *target); void em_junk_sa_commit_reports (EPlugin *ep); gpointer em_junk_sa_validate_binary (EPlugin *ep); GtkWidget *org_gnome_sa_use_remote_tests (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); @@ -571,7 +571,7 @@ em_junk_sa_respawn_spamd () } gboolean -em_junk_sa_check_junk(EPlugin *ep, EMJunkHookTarget *target) +em_junk_sa_check_junk(EPlugin *ep, EMJunkTarget *target) { GByteArray *out = NULL; const gchar *argv[7]; @@ -675,7 +675,7 @@ get_spamassassin_version () } void -em_junk_sa_report_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_sa_report_junk (EPlugin *ep, EMJunkTarget *target) { const gchar *sync_op = (get_spamassassin_version () >= 3) @@ -715,7 +715,7 @@ em_junk_sa_report_junk (EPlugin *ep, EMJunkHookTarget *target) } void -em_junk_sa_report_non_junk (EPlugin *ep, EMJunkHookTarget *target) +em_junk_sa_report_non_junk (EPlugin *ep, EMJunkTarget *target) { const gchar *sync_op = (get_spamassassin_version () >= 3) @@ -812,7 +812,7 @@ em_junk_sa_setting_notify(GConfClient *gconf, guint cnxn_id, GConfEntry *entry, } gint -e_plugin_lib_enable (EPluginLib *ep, gint enable) +e_plugin_lib_enable (EPlugin *ep, gint enable) { em_junk_sa_init(); diff --git a/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml b/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml index 3403a3b8aa..83ed170c74 100644 --- a/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml +++ b/plugins/sa-junk-plugin/org-gnome-sa-junk-plugin.eplug.xml @@ -6,14 +6,12 @@ <_description>Filter junk messages using SpamAssassin.</_description> <author name="Vivek Jain" email="jvivek@novell.com"/> <hook class="org.gnome.evolution.mail.junk:1.0"> - <group id="EMJunk" > - <item name="SpamAssassin" - check_junk="em_junk_sa_check_junk" - report_junk="em_junk_sa_report_junk" - report_non_junk="em_junk_sa_report_non_junk" - commit_reports="em_junk_sa_commit_reports" - validate_binary="em_junk_sa_validate_binary"/> - </group> + <interface name="SpamAssassin" + check_junk="em_junk_sa_check_junk" + report_junk="em_junk_sa_report_junk" + report_non_junk="em_junk_sa_report_non_junk" + commit_reports="em_junk_sa_commit_reports" + validate_binary="em_junk_sa_validate_binary"/> </hook> <!-- hook into the 'mail properties' menu --> <hook class="org.gnome.evolution.mail.config:1.0"> @@ -21,6 +19,6 @@ <item type="section_table" path="40.junk/10.options" _label="SpamAssassin Options"/> <item type="item_table" path="40.junk/20.options" factory="org_gnome_sa_use_remote_tests"/> </group> - </hook> + </hook> </e-plugin> </e-plugin-list> 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 3788fd30fa..0000000000 --- a/plugins/select-one-source/Makefile.am +++ /dev/null @@ -1,21 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - -I$(top_srcdir)/widgets \ - $(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 12a3d03a88..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>Quickly select a single calendar or task list 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 c211814151..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/startup-wizard/Makefile.am b/plugins/startup-wizard/Makefile.am index 81c75776d9..39ddf0d043 100644 --- a/plugins/startup-wizard/Makefile.am +++ b/plugins/startup-wizard/Makefile.am @@ -1,5 +1,6 @@ -AM_CPPFLAGS = -I . \ - -I$(top_srcdir) \ +AM_CPPFLAGS = -I . \ + -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ -I$(top_builddir)/shell \ $(EVOLUTION_CALENDAR_CFLAGS) \ $(EVOLUTION_MAIL_CFLAGS) diff --git a/plugins/startup-wizard/startup-wizard.c b/plugins/startup-wizard/startup-wizard.c index 7dd3f5b3e3..14c4c6cffe 100644 --- a/plugins/startup-wizard/startup-wizard.c +++ b/plugins/startup-wizard/startup-wizard.c @@ -24,11 +24,9 @@ #include <gconf/gconf-client.h> #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <libgnomeui/gnome-druid.h> -#include <libgnomeui/gnome-druid-page-edge.h> -#include <libgnomeui/gnome-druid-page-standard.h> #include "e-util/e-error.h" #include "e-util/e-import.h" +#include "shell/e-shell.h" #include "shell/es-event.h" #include "mail/em-config.h" #include "mail/em-account-editor.h" @@ -47,7 +45,7 @@ static GtkWidget *import_dialog, *import_progress, *import_label; static GSList *import_iterator, *import_importers; G_GNUC_NORETURN static void -startup_wizard_delete (void) { +startup_wizard_terminate (void) { gtk_main_quit (); _exit (0); } @@ -55,10 +53,12 @@ startup_wizard_delete (void) { void startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) { + EMAccountEditor *emae; + GtkWidget *start_page; GConfClient *client; GSList *accounts; - EMAccountEditor *emae; - GnomeDruidPageEdge *start_page; + EConfig *config; + GList *page_children; client = gconf_client_get_default (); accounts = gconf_client_get_list (client, "/apps/evolution/mail/accounts", GCONF_VALUE_STRING, NULL); @@ -73,26 +73,43 @@ startup_wizard (EPlugin *ep, ESEventTargetUpgrade *target) /** @HookPoint-EMConfig: New Mail Account Wizard * @Id: org.gnome.evolution.mail.config.accountWizard - * @Type: E_CONFIG_DRUID + * @Type: E_CONFIG_ASSISTANT * @Class: org.gnome.evolution.mail.config:1.0 * @Target: EMConfigTargetAccount * - * The new mail account druid. + * The new mail account assistant. */ - emae = em_account_editor_new (NULL, EMAE_DRUID, "org.gnome.evolution.mail.config.accountWizard"); - - gtk_window_set_title (GTK_WINDOW (emae->editor), _("Evolution Setup Assistant")); + emae = em_account_editor_new ( + NULL, EMAE_ASSISTANT, + "org.gnome.evolution.mail.config.accountWizard"); + + gtk_window_set_title ( + GTK_WINDOW (emae->editor), _("Evolution Setup Assistant")); + + config = (EConfig *) emae->config; + start_page = e_config_page_get (config, "0.start"); + + gtk_assistant_set_page_title (GTK_ASSISTANT (config->widget), start_page, _("Welcome")); + page_children = gtk_container_get_children (GTK_CONTAINER (start_page)); + if (page_children) { + GtkLabel *label = GTK_LABEL (page_children->data); + if (label) { + gtk_label_set_text (label, _("" + "Welcome to Evolution. The next few screens will allow Evolution to connect " + "to your email accounts, and to import files from other applications. \n" + "\n" + "Please click the \"Forward\" button to continue. ")); + } + + g_list_free (page_children); + } - start_page = GNOME_DRUID_PAGE_EDGE (e_config_page_get ((EConfig *) emae->config, "0.start")); - gnome_druid_page_edge_set_title (start_page, _("Welcome")); - gnome_druid_page_edge_set_text (start_page, _("" - "Welcome to Evolution. The next few screens will allow Evolution to connect " - "to your email accounts, and to import files from other applications. \n" - "\n" - "Please click the \"Forward\" button to continue. ")); - g_signal_connect (emae->editor, "delete-event", G_CALLBACK (startup_wizard_delete), NULL); + g_signal_connect ( + emae->editor, "delete-event", + G_CALLBACK (startup_wizard_terminate), NULL); gtk_widget_show (emae->editor); + gtk_main (); } @@ -112,13 +129,14 @@ startup_wizard_importer_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data if (import_importers == NULL) return NULL; - page = gnome_druid_page_standard_new_with_vals (_("Importing files"), NULL, NULL); + page = gtk_vbox_new (FALSE, 0); + gtk_container_set_border_width (GTK_CONTAINER (page), 12); label = gtk_label_new (_("Please select the information that you would like to import:")); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), label, FALSE, FALSE, 3); + gtk_box_pack_start (GTK_BOX (page), label, FALSE, FALSE, 3); sep = gtk_hseparator_new (); - gtk_box_pack_start (GTK_BOX (GNOME_DRUID_PAGE_STANDARD (page)->vbox), sep, FALSE, FALSE, 3); + gtk_box_pack_start (GTK_BOX (page), sep, FALSE, FALSE, 3); table = gtk_table_new(g_slist_length(import_importers), 2, FALSE); for (l = import_importers; l; l = l->next) { @@ -141,10 +159,12 @@ startup_wizard_importer_page (EPlugin *ep, EConfigHookItemFactoryData *hook_data gtk_table_attach((GtkTable *)table, w, 1, 2, row, row+1, GTK_FILL, 0, 3, 0); row++; } - gtk_widget_show(table); - gtk_box_pack_start((GtkBox *)((GnomeDruidPageStandard *)page)->vbox, table, FALSE, FALSE, 3); - gnome_druid_append_page (GNOME_DRUID (hook_data->parent), GNOME_DRUID_PAGE (page)); + gtk_box_pack_start (GTK_BOX (page), table, FALSE, FALSE, 3); + + gtk_widget_show_all (page); + gtk_assistant_append_page (GTK_ASSISTANT (hook_data->parent), page); + gtk_assistant_set_page_title (GTK_ASSISTANT (hook_data->parent), page, _("Importing files")); return page; } @@ -188,12 +208,19 @@ import_done(EImport *ei, gpointer d) void startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target) { + EShell *shell; + EShellSettings *shell_settings; gchar *location; + shell = e_shell_get_default (); + shell_settings = e_shell_get_shell_settings (shell); + /* Use System Timezone by default */ - calendar_config_set_use_system_timezone (TRUE); + e_shell_settings_set_boolean ( + shell_settings, "cal-use-system-timezone", TRUE); location = e_cal_util_get_system_timezone_location (); - calendar_config_set_timezone (location); + e_shell_settings_set_string ( + shell_settings, "cal-timezone-string", location); g_free (location); if (import_importers) { @@ -217,6 +244,5 @@ startup_wizard_commit (EPlugin *ep, EMConfigTargetAccount *target) void startup_wizard_abort (EPlugin *ep, EMConfigTargetAccount *target) { - gtk_main_quit (); - _exit (0); + startup_wizard_terminate (); } diff --git a/plugins/templates/org-gnome-templates.eplug.xml b/plugins/templates/org-gnome-templates.eplug.xml index 02b14148ad..b4b8a81039 100644 --- a/plugins/templates/org-gnome-templates.eplug.xml +++ b/plugins/templates/org-gnome-templates.eplug.xml @@ -7,30 +7,22 @@ _name="Templates"> <_description>Drafts based template plugin</_description> <author name="Bharath Acharya" email="abharath@novell.com"/> - <author name="Diego Escalante Urrelo" email="diegoe@gnome.org"/> + <author name="Diego Escalante Urrelo" email="diegoe@gnome.org"/> - <!-- hook into the mail popup menu --> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu - id="org.gnome.evolution.mail.folderview.popup" - target="select" - factory="org_gnome_templates_popup"> - </menu> + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.shell"/> + <ui-manager id="org.gnome.evolution.composer"> + <menubar name='main-menu'> + <placeholder name='pre-edit-menu'> + <menu action='file-menu'> + <placeholder name="template-holder"> + <menuitem action="template"/> + </placeholder> + </menu> + </placeholder> + </menubar> + </ui-manager> </hook> - - <hook class="org.gnome.evolution.ui:1.0"> - <ui-manager id="org.gnome.evolution.composer"> - <menubar name='main-menu'> - <placeholder name='pre-edit-menu'> - <menu action='file-menu'> - <placeholder name="template-holder"> - <menuitem action="Template"/> - </placeholder> - </menu> - </placeholder> - </menubar> - </ui-manager> - </hook> </e-plugin> </e-plugin-list> diff --git a/plugins/templates/templates.c b/plugins/templates/templates.c index 4e03245e54..81f6bd7025 100644 --- a/plugins/templates/templates.c +++ b/plugins/templates/templates.c @@ -27,6 +27,7 @@ #include <glib/gi18n.h> #include <string.h> +#include <glade/glade.h> #include <gconf/gconf-client.h> #include <e-util/e-config.h> @@ -34,14 +35,17 @@ #include <camel/camel-multipart.h> #include <camel/camel-stream-mem.h> +#include <mail/e-mail-local.h> +#include <mail/e-mail-reader.h> #include <mail/em-composer-utils.h> -#include <mail/em-popup.h> +#include <mail/em-utils.h> #include <mail/mail-session.h> -#include <mail/mail-component.h> #include <mail/mail-ops.h> +#include <mail/message-list.h> #include <e-util/e-error.h> #include <e-util/e-plugin.h> -#include <glade/glade.h> +#include <e-util/e-util.h> +#include <shell/e-shell-view.h> #include <composer/e-msg-composer.h> @@ -63,32 +67,10 @@ enum { CLUE_N_COLUMNS }; -typedef struct { - CamelMimeMessage *msg; - EMPopupTargetSelect *t; -} UserData; - -static gchar * get_content (CamelMimeMessage *message); - -static void reply_with_template (EPopup *ep, EPopupItem *item, gpointer data); - -static void popup_free (EPopup *ep, GSList *l, gpointer data); - -static GSList *fill_submenu (CamelStore *store, - CamelFolderInfo *info, - GSList *list, - EMPopupTargetSelect *t); - -static GSList *append_to_menu (CamelFolder *folder, - GPtrArray *uids, - GSList *list, - EMPopupTargetSelect *t); - -void org_gnome_templates_popup (EPlugin *ep, EMPopupTargetSelect *t); - GtkWidget *e_plugin_lib_get_configure_widget (EPlugin *epl); -gboolean e_plugin_ui_init (GtkUIManager *ui_manager, EMsgComposer *composer); +gboolean e_plugin_ui_init (GtkUIManager *ui_manager, GObject *object); +gint e_plugin_lib_enable (EPlugin *plugin, gboolean enabled); /* Thanks to attachment reminder plugin for this*/ static void commit_changes (UIData *ui); @@ -102,6 +84,8 @@ static void value_cell_edited_callback (GtkCellRendererText *cell, gchar *path_ static gboolean clue_foreach_check_isempty (GtkTreeModel *model, GtkTreePath *path, GtkTreeIter *iter, UIData *ui); +static gboolean plugin_enabled; + static void selection_changed (GtkTreeSelection *selection, UIData *ui) { @@ -496,32 +480,23 @@ get_content (CamelMimeMessage *message) } static void -reply_with_template (EPopup *ep, EPopupItem *item, gpointer data) +action_reply_with_template_cb (GtkAction *action, + CamelMimeMessage *message) { - CamelMimeMessage *new, *template, *reply_to; - CamelFolder *templates_folder; + CamelMimeMessage *new, *template; + CamelFolder *folder; struct _camel_header_raw *header; - UserData *userdata = item->user_data; gchar *cont; - /* We get the templates folder and all the uids of the messages in there */ - templates_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_TEMPLATES); - - /* Get from the currently selected folder, the currently selected message */ - reply_to = camel_folder_get_message (userdata->t->folder, - g_ptr_array_index (userdata->t->uids, 0), - NULL); - - /* The message we'll be using has been stored when building the menu */ - template = userdata->msg; + folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES); + template = g_object_get_data (G_OBJECT (action), "template"); /* The new message we are creating */ new = camel_mime_message_new(); /* Add the headers from the message we are replying to, so CC and that - * stuff is preserved. - */ - header = ((CamelMimePart *)reply_to)->headers; + * stuff is preserved. */ + header = ((CamelMimePart *)message)->headers; while (header) { if (g_ascii_strncasecmp (header->name, "content-", 8) != 0) { camel_medium_add_header((CamelMedium *) new, @@ -538,7 +513,7 @@ reply_with_template (EPopup *ep, EPopupItem *item, gpointer data) /* Set the To: field to the same To: field of the message we are replying to. */ camel_mime_message_set_recipients (new, CAMEL_RECIPIENT_TYPE_TO, - camel_mime_message_get_from (reply_to)); + camel_mime_message_get_from (message)); /* Copy the CC and BCC from the template.*/ camel_mime_message_set_recipients (new, CAMEL_RECIPIENT_TYPE_CC, @@ -551,160 +526,144 @@ reply_with_template (EPopup *ep, EPopupItem *item, gpointer data) cont, (gint) g_utf8_strlen(cont, -1), "text"); /* Create the composer */ - em_utils_edit_message (new, templates_folder); + em_utils_edit_message (new, folder); camel_object_unref(new); } static void -popup_free (EPopup *ep, GSList *l, gpointer data) +build_template_menus_recurse (GtkUIManager *ui_manager, + GtkActionGroup *action_group, + const gchar *menu_path, + guint *action_count, + guint merge_id, + CamelFolderInfo *folder_info, + CamelMimeMessage *message) { - g_slist_free (l); -} + CamelStore *store; -static GSList -*append_to_menu (CamelFolder *folder, GPtrArray *uids, GSList *list, EMPopupTargetSelect *t) -{ - gint i; + store = e_mail_local_get_store (); - for (i = 0; i < uids->len; i++) { - const gchar *subject; + while (folder_info != NULL) { + CamelFolder *folder; + GPtrArray *uids; + GtkAction *action; + const gchar *action_label; + gchar *action_name; gchar *path; - EPopupItem *item; - CamelMimeMessage *message; - UserData *user_data; - const gchar *uid; - - uid = g_strdup (g_ptr_array_index (uids, i)); - - /* Same as in fill_submenu */ - if (!g_str_has_suffix (folder->name, "Templates")) - path = g_strdup_printf ("80.%s", folder->full_name); - else - path = g_strdup ("80.Templates"); - - /* If this uid is trashed, ignore it */ - if (camel_folder_get_message_flags (folder, uid) & CAMEL_MESSAGE_DELETED) - continue; - - /* Get the message for this uid */ - message = camel_folder_get_message (folder, - uid, - NULL); + guint ii; - subject = camel_mime_message_get_subject (message); + folder = camel_store_get_folder ( + store, folder_info->full_name, 0, NULL); - /* Create the menu item for it */ - item = g_slice_alloc0(sizeof(*item)); - item->type = E_POPUP_ITEM; - item->path = g_strdup_printf ("%s/%02d", path, i); - item->label = g_strdup ((strlen(subject) > 0) ? subject : _("No title")); - item->visible = EM_POPUP_SELECT_MANY | EM_POPUP_SELECT_ONE; + action_name = g_strdup_printf ( + "templates-menu-%d", *action_count); + *action_count = *action_count + 1; - /* Make some info available to the callback */ - user_data = g_slice_new(UserData); - user_data->msg = message; - user_data->t = t; - - item->user_data = user_data; - item->activate = reply_with_template; - - list = g_slist_prepend (list, item); - } + /* To avoid having a Templates dir, we ignore the top level */ + if (g_str_has_suffix (folder->name, "Templates")) + action_label = _("Templates"); + else + action_label = folder->name; - return list; -} + action = gtk_action_new ( + action_name, action_label, NULL, NULL); -static GSList -*fill_submenu (CamelStore *store, CamelFolderInfo *info, GSList *list, EMPopupTargetSelect *t) -{ - while (info) { - CamelFolder *folder; - GPtrArray *uids; - EPopupItem *item; + gtk_action_group_add_action (action_group, action); - folder = camel_store_get_folder (store, info->full_name, 0, NULL); + gtk_ui_manager_add_ui ( + ui_manager, merge_id, menu_path, action_name, + action_name, GTK_UI_MANAGER_MENU, FALSE); - item = g_slice_alloc0(sizeof(*item)); - item->type = E_POPUP_SUBMENU; - item->label = folder->name; - item->visible = EM_POPUP_SELECT_MANY | EM_POPUP_SELECT_ONE; + path = g_strdup_printf ("%s/%s", menu_path, action_name); - /* To avoid having a Templates dir, we ignore the top level */ - if (!g_str_has_suffix (folder->name, "Templates")) - item->path = g_strdup_printf ("80.%s", folder->full_name); - else - item->path = g_strdup ("80.Templates"); + g_object_unref (action); + g_free (action_name); - list = g_slist_prepend (list, item); + /* Add submenus, if any. */ + if (folder_info->child != NULL) + build_template_menus_recurse ( + ui_manager, action_group, + path, action_count, merge_id, + folder_info->child, message); - /* Get the uids for this folder and fill them in the menu */ + /* Get the UIDs for this folder and add them to the menu. */ uids = camel_folder_get_uids (folder); - list = append_to_menu (folder, uids, list, t); - camel_folder_free_uids (folder, uids); + for (ii = 0; ii < uids->len; ii++) { + CamelMimeMessage *template; + const gchar *uid = uids->pdata[ii]; + guint32 flags; - /* If the folder has a child, call this function again */ - if (info->child) { - list = fill_submenu (store, info->child, list, t); - } + /* If the UIDs is marked for deletion, skip it. */ + flags = camel_folder_get_message_flags (folder, uid); + if (flags & CAMEL_MESSAGE_DELETED) + continue; - info = info->next; - } + template = camel_folder_get_message (folder, uid, NULL); + camel_object_ref (template); - return list; -} + action_label = + camel_mime_message_get_subject (template); + if (action_label == NULL || *action_label == '\0') + action_label = _("No Title"); -void -org_gnome_templates_popup (EPlugin *ep, EMPopupTargetSelect *t) -{ - CamelFolder *templates_folder; - CamelFolderInfo *templates_info; - CamelStore *store; + action_name = g_strdup_printf ( + "templates-item-%d", *action_count); + *action_count = *action_count + 1; - GSList *list = NULL; + action = gtk_action_new ( + action_name, action_label, NULL, NULL); - /* We get the templates folder and all the uids of the messages in there */ - store = mail_component_peek_local_store (NULL); + g_object_set_data_full ( + G_OBJECT (action), "template", template, + (GDestroyNotify) camel_object_unref); - templates_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_TEMPLATES); + g_signal_connect ( + action, "activate", + G_CALLBACK (action_reply_with_template_cb), + message); - templates_info = camel_store_get_folder_info (store, - templates_folder->full_name, - CAMEL_STORE_FOLDER_INFO_RECURSIVE | CAMEL_STORE_FOLDER_INFO_FAST, - NULL); + gtk_action_group_add_action (action_group, action); - /* Get subfolders and fill it */ - list = fill_submenu (store, templates_info, list, t); + gtk_ui_manager_add_ui ( + ui_manager, merge_id, path, action_name, + action_name, GTK_UI_MANAGER_MENUITEM, FALSE); - e_popup_add_items (t->target.popup, list, NULL, popup_free, NULL); + g_object_unref (action); + g_free (action_name); + } + camel_folder_free_uids (folder, uids); + + g_free (path); - return; + folder_info = folder_info->next; + } } static void action_template_cb (GtkAction *action, - EMsgComposer *composer) + EMsgComposer *composer) { CamelMessageInfo *info; CamelMimeMessage *msg; - CamelFolder *templates_folder; + CamelFolder *folder; + + /* Get the templates folder and all UIDs of the messages there. */ + folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES); - /* We get the templates folder and all the uids of the messages in there */ - templates_folder = mail_component_get_folder(NULL, MAIL_COMPONENT_FOLDER_TEMPLATES); msg = e_msg_composer_get_message_draft (composer); info = camel_message_info_new (NULL); /* FIXME: what's the ~0 for? :) */ - camel_message_info_set_flags (info, CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DRAFT, ~0); + camel_message_info_set_flags ( + info, CAMEL_MESSAGE_SEEN | CAMEL_MESSAGE_DRAFT, ~0); - mail_append_mail (templates_folder, msg, info, NULL, composer); - - return; + mail_append_mail (folder, msg, info, NULL, composer); } -static GtkActionEntry entries[] = { +static GtkActionEntry composer_entries[] = { - { "Template", + { "template", GTK_STOCK_SAVE, N_("Save as _Template"), "<Shift><Control>t", @@ -712,9 +671,73 @@ static GtkActionEntry entries[] = { G_CALLBACK (action_template_cb) } }; -gboolean -e_plugin_ui_init (GtkUIManager *ui_manager, - EMsgComposer *composer) +static void +update_actions_cb (EShellView *shell_view) +{ + EShellContent *shell_content; + EShellWindow *shell_window; + GtkActionGroup *action_group; + GtkUIManager *ui_manager; + MessageList *message_list; + CamelMimeMessage *message; + CamelFolderInfo *folder_info; + CamelFolder *folder; + CamelStore *store; + EMailReader *reader; + GPtrArray *uids; + guint action_count = 0; + guint merge_id; + gpointer data; + + shell_content = e_shell_view_get_shell_content (shell_view); + shell_window = e_shell_view_get_shell_window (shell_view); + + ui_manager = e_shell_window_get_ui_manager (shell_window); + action_group = e_lookup_action_group (ui_manager, "templates"); + data = g_object_get_data (G_OBJECT (action_group), "merge-id"); + merge_id = GPOINTER_TO_UINT (data); + g_return_if_fail (merge_id > 0); + + gtk_ui_manager_remove_ui (ui_manager, merge_id); + e_action_group_remove_all_actions (action_group); + + if (!plugin_enabled) + return; + + reader = E_MAIL_READER (shell_content); + message_list = e_mail_reader_get_message_list (reader); + + folder = message_list->folder; + uids = message_list_get_selected (message_list); + + if (uids->len != 1) + goto exit; + + /* This is the source message to use in replying with a template. */ + message = camel_folder_get_message (folder, uids->pdata[0], NULL); + + /* Now recursively build template submenus in the pop-up menu. */ + + store = e_mail_local_get_store (); + folder = e_mail_local_get_folder (E_MAIL_FOLDER_TEMPLATES); + + folder_info = camel_store_get_folder_info ( + store, folder->full_name, + CAMEL_STORE_FOLDER_INFO_RECURSIVE | + CAMEL_STORE_FOLDER_INFO_FAST, NULL); + + build_template_menus_recurse ( + ui_manager, action_group, + "/mail-message-popup/mail-message-templates", + &action_count, merge_id, folder_info, message); + +exit: + em_utils_uids_free (uids); +} + +static gboolean +init_composer_actions (GtkUIManager *ui_manager, + EMsgComposer *composer) { GtkhtmlEditor *editor; @@ -723,7 +746,64 @@ e_plugin_ui_init (GtkUIManager *ui_manager, /* Add actions to the "composer" action group. */ gtk_action_group_add_actions ( gtkhtml_editor_get_action_group (editor, "composer"), - entries, G_N_ELEMENTS (entries), composer); + composer_entries, G_N_ELEMENTS (composer_entries), composer); return TRUE; } + +static gboolean +init_shell_actions (GtkUIManager *ui_manager, + EShellWindow *shell_window) +{ + EShellView *shell_view; + GtkActionGroup *action_group; + guint merge_id; + + shell_view = e_shell_window_get_shell_view (shell_window, "mail"); + + /* This is where we keep dynamically-built menu items. */ + e_shell_window_add_action_group (shell_window, "templates"); + action_group = e_lookup_action_group (ui_manager, "templates"); + + merge_id = gtk_ui_manager_new_merge_id (ui_manager); + + g_object_set_data ( + G_OBJECT (action_group), "merge-id", + GUINT_TO_POINTER (merge_id)); + + g_signal_connect ( + shell_view, "update-actions", + G_CALLBACK (update_actions_cb), NULL); + + return TRUE; +} + +gboolean +e_plugin_ui_init (GtkUIManager *ui_manager, + GObject *object) +{ + /* XXX This is a scenario I hadn't considered when designing + * EPluginUI: two different UI manager IDs with different + * closures sharing the same plugin entry point. We know + * the closures are both GObjects so we query the type. + * Awkward, but it should work for now. */ + + if (E_IS_MSG_COMPOSER (object)) + return init_composer_actions ( + ui_manager, E_MSG_COMPOSER (object)); + + if (E_IS_SHELL_WINDOW (object)) + return init_shell_actions ( + ui_manager, E_SHELL_WINDOW (object)); + + return FALSE; +} + +gint +e_plugin_lib_enable (EPlugin *plugin, + gboolean enabled) +{ + plugin_enabled = enabled; + + return 0; +} diff --git a/plugins/tnef-attachments/Makefile.am b/plugins/tnef-attachments/Makefile.am index d9447f263d..2273e6ed80 100644 --- a/plugins/tnef-attachments/Makefile.am +++ b/plugins/tnef-attachments/Makefile.am @@ -8,6 +8,7 @@ endif AM_CPPFLAGS = \ -I$(top_srcdir) \ + -I$(top_srcdir)/widgets \ -DGETTEXT_PACKAGE="\"$(GETTEXT_PACKAGE)\"" \ -DLOCALEDIR="\"$(localedir)\"" \ $(EVOLUTION_MAIL_CFLAGS) \ @@ -21,7 +22,9 @@ plugin_LTLIBRARIES = liborg-gnome-tnef-attachments.la liborg_gnome_tnef_attachments_la_SOURCES = tnef-plugin.c liborg_gnome_tnef_attachments_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) liborg_gnome_tnef_attachments_la_LIBADD = \ - $(NO_UNDEFINED_REQUIRED_LIBS) \ + $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/em-format/libemformat.la \ + $(EVOLUTION_MAIL_LIBS) \ -lytnef EXTRA_DIST = org-gnome-tnef-attachments.eplug.xml diff --git a/plugins/tnef-attachments/tnef-plugin.c b/plugins/tnef-attachments/tnef-plugin.c index c03dd39d68..3e537e1dca 100644 --- a/plugins/tnef-attachments/tnef-plugin.c +++ b/plugins/tnef-attachments/tnef-plugin.c @@ -46,7 +46,7 @@ #include <camel/camel-multipart.h> #include <camel/camel-stream-fs.h> -#include <mail/em-format.h> +#include <em-format/em-format.h> #include <mail/em-format-hook.h> #include <mail/em-utils.h> #include <e-util/e-error.h> @@ -158,7 +158,7 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t) camel_medium_set_content_object((CamelMedium *)part, content); camel_object_unref(content); - type = em_utils_snoop_type(part); + type = em_format_snoop_type(part); if (type) camel_data_wrapper_set_mime_type((CamelDataWrapper *)part, type); @@ -192,10 +192,10 @@ org_gnome_format_tnef(gpointer ep, EMFormatHookTarget *t) g_free(tmpdir); } -gint e_plugin_lib_enable(EPluginLib *ep, gint enable); +gint e_plugin_lib_enable(EPlugin *ep, gint enable); gint -e_plugin_lib_enable(EPluginLib *ep, gint enable) +e_plugin_lib_enable(EPlugin *ep, gint enable) { if (loaded) return 0; diff --git a/plugins/vcard-inline/Makefile.am b/plugins/vcard-inline/Makefile.am index 5a8ed2c88e..dd8f92fd1a 100644 --- a/plugins/vcard-inline/Makefile.am +++ b/plugins/vcard-inline/Makefile.am @@ -18,10 +18,13 @@ 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) \ - $(EVOLUTION_ADDRESSBOOK_LIBS) \ - $(NO_UNDEFINED_REQUIRED_LIBS) + $(top_builddir)/mail/libevolution-mail.la \ + $(top_builddir)/addressbook/util/libeabutil.la \ + $(top_builddir)/addressbook/gui/widgets/libeabwidgets.la \ + $(top_builddir)/addressbook/gui/merging/libeabbookmerging.la \ + $(top_builddir)/addressbook/printing/libecontactprint.la \ + $(EVOLUTION_ADDRESSBOOK_LIBS) \ + $(EVOLUTION_MAIL_LIBS) EXTRA_DIST = org-gnome-vcard-inline.eplug.xml diff --git a/plugins/vcard-inline/vcard-inline.c b/plugins/vcard-inline/vcard-inline.c index 6c4eeebff6..0aafc8c82d 100644 --- a/plugins/vcard-inline/vcard-inline.c +++ b/plugins/vcard-inline/vcard-inline.c @@ -29,9 +29,9 @@ #include <camel/camel-stream-mem.h> #include <gtkhtml/gtkhtml-embedded.h> -#include "addressbook/gui/component/addressbook.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" @@ -46,7 +46,6 @@ struct _VCardInlinePObject { GList *contact_list; GtkWidget *contact_display; GtkWidget *message_label; - EABContactDisplayRenderMode mode; }; static gint org_gnome_vcard_inline_classid; @@ -149,25 +148,23 @@ 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 (vcard_object->mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) { - vcard_object->mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT; + if (mode == EAB_CONTACT_DISPLAY_RENDER_NORMAL) { + mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT; label = _("Show Full vCard"); } else { - vcard_object->mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL; + mode = EAB_CONTACT_DISPLAY_RENDER_NORMAL; label = _("Show Compact vCard"); } + eab_contact_display_set_mode (contact_display, mode); gtk_button_set_label (button, label); - - eab_contact_display_render ( - EAB_CONTACT_DISPLAY (vcard_object->contact_display), - E_CONTACT (vcard_object->contact_list->data), - vcard_object->mode); } static gboolean @@ -179,11 +176,16 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format, GtkWidget *button_box; GtkWidget *container; GtkWidget *widget; + EContact *contact; guint length; vcard_object = (VCardInlinePObject *) object; length = g_list_length (vcard_object->contact_list); - g_return_val_if_fail (length > 0, FALSE); + + if (vcard_object->contact_list != NULL) + contact = E_CONTACT (vcard_object->contact_list->data); + else + contact = NULL; container = GTK_WIDGET (embedded); @@ -203,15 +205,15 @@ org_gnome_vcard_inline_embed (EMFormatHTML *format, 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); - eab_contact_display_render ( - EAB_CONTACT_DISPLAY (vcard_object->contact_display), - E_CONTACT (vcard_object->contact_list->data), - vcard_object->mode); - widget = gtk_label_new (NULL); gtk_box_pack_start (GTK_BOX (container), widget, TRUE, TRUE, 0); vcard_object->message_label = g_object_ref (widget); @@ -280,7 +282,6 @@ org_gnome_vcard_inline_format (gpointer ep, EMFormatHookTarget *target) camel_object_ref (target->part); - vcard_object->mode = EAB_CONTACT_DISPLAY_RENDER_COMPACT; vcard_object->object.free = org_gnome_vcard_inline_pobject_free; org_gnome_vcard_inline_decode (vcard_object, target->part); diff --git a/plugins/webdav-account-setup/webdav-contacts-source.c b/plugins/webdav-account-setup/webdav-contacts-source.c index b6d4443d4d..990a541cc9 100644 --- a/plugins/webdav-account-setup/webdav-contacts-source.c +++ b/plugins/webdav-account-setup/webdav-contacts-source.c @@ -52,7 +52,7 @@ GtkWidget * plugin_webdav_contacts(EPlugin *epl, EConfigHookItemFactoryData *data); gint -e_plugin_lib_enable(EPluginLib *ep, gint enable); +e_plugin_lib_enable(EPlugin *ep, gint enable); static void ensure_webdav_contacts_source_group(void) @@ -341,7 +341,7 @@ plugin_webdav_contacts(EPlugin *epl, EConfigHookItemFactoryData *data) } gint -e_plugin_lib_enable(EPluginLib *ep, gint enable) +e_plugin_lib_enable(EPlugin *ep, gint enable) { if (enable) { ensure_webdav_contacts_source_group(); |