diff options
25 files changed, 845 insertions, 786 deletions
diff --git a/configure.ac b/configure.ac index 5ba9b0235c..12ef0d34f1 100644 --- a/configure.ac +++ b/configure.ac @@ -1746,7 +1746,7 @@ AC_ARG_ENABLE([plugins], [enable_plugins="$enableval"],[enable_plugins=all]) dnl Add any new plugins here -plugins_base_always="calendar-file calendar-http $CALENDAR_WEATHER itip-formatter plugin-manager default-source addressbook-file startup-wizard mark-all-read groupwise-features groupwise-account-setup publish-calendar caldav imap-features google-account-setup webdav-account-setup" +plugins_base_always="calendar-file calendar-http $CALENDAR_WEATHER itip-formatter plugin-manager default-source addressbook-file startup-wizard mark-all-read groupwise-features publish-calendar caldav imap-features google-account-setup webdav-account-setup" plugins_base="$plugins_base_always $SA_JUNK_PLUGIN $BF_JUNK_PLUGIN $EXCHANGE_PLUGIN" all_plugins_base="$plugins_base_always sa-junk-plugin bogo-junk-plugin exchange-operations" @@ -1784,7 +1784,7 @@ xexperimental) esac dnl Temporary KILL-BONOBO hack -for broken_plugin in exchange-operations groupwise-features +for broken_plugin in exchange-operations do if echo ${plugins_enabled} | grep "$broken_plugin" > /dev/null then @@ -2033,7 +2033,6 @@ plugins/exchange-operations/Makefile plugins/external-editor/Makefile plugins/face/Makefile plugins/google-account-setup/Makefile -plugins/groupwise-account-setup/Makefile plugins/groupwise-features/Makefile plugins/hula-account-setup/Makefile plugins/imap-features/Makefile diff --git a/modules/calendar/e-cal-shell-content.c b/modules/calendar/e-cal-shell-content.c index 8821a7fe07..689b5cf22a 100644 --- a/modules/calendar/e-cal-shell-content.c +++ b/modules/calendar/e-cal-shell-content.c @@ -57,7 +57,10 @@ struct _ECalShellContentPrivate { }; enum { - PROP_0 + PROP_0, + PROP_CALENDAR, + PROP_TASK_TABLE, + PROP_MEMO_TABLE }; /* Used to indicate who has the focus within the calendar view. */ @@ -226,6 +229,21 @@ cal_shell_content_get_property (GObject *object, GParamSpec *pspec) { switch (property_id) { + case PROP_CALENDAR: + g_value_set_object ( + value, e_cal_shell_content_get_calendar ( + E_CAL_SHELL_CONTENT (object))); + return; + case PROP_TASK_TABLE: + g_value_set_object ( + value, e_cal_shell_content_get_task_table ( + E_CAL_SHELL_CONTENT (object))); + return; + case PROP_MEMO_TABLE: + g_value_set_object ( + value, e_cal_shell_content_get_memo_table ( + E_CAL_SHELL_CONTENT (object))); + return; } G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec); @@ -505,6 +523,37 @@ cal_shell_content_class_init (ECalShellContentClass *class) widget_class = GTK_WIDGET_CLASS (class); widget_class->map = cal_shell_content_map; + + g_object_class_install_property ( + object_class, + PROP_CALENDAR, + g_param_spec_object ( + "calendar", + NULL, + NULL, + GNOME_TYPE_CALENDAR, + G_PARAM_READABLE)); + + g_object_class_install_property ( + object_class, + PROP_TASK_TABLE, + g_param_spec_object ( + "task-table", + NULL, + NULL, + E_TYPE_CALENDAR_TABLE, + G_PARAM_READABLE)); + + g_object_class_install_property ( + object_class, + PROP_MEMO_TABLE, + g_param_spec_object ( + "memo-table", + NULL, + NULL, + E_TYPE_MEMO_TABLE, + G_PARAM_READABLE)); + } static void diff --git a/plugins/groupwise-account-setup/ChangeLog b/plugins/groupwise-account-setup/ChangeLog deleted file mode 100644 index cde1135294..0000000000 --- a/plugins/groupwise-account-setup/ChangeLog +++ /dev/null @@ -1,211 +0,0 @@ -2009-01-29 Bharath Acharya <abharath@novell.com> - - ** Fix for bug #470474 (bugzilla.novell.com) - - * groupwise-account-setup.c (set_esource_props): a corruption. Cleanup - unused strings. - -2008-11-11 Suman Manjunath <msuman@novell.com> - - ** Fix for bug #440646 (bugzilla.novell.com) - - * camel-gw-listener.c (add_proxy_sources): Set the ESource color-spec - for proxy accounts in the correct format. - -2008-09-25 Philip Withnall <philip@tecnocode.co.uk> - - ** Fix for bug #553148 - - * org-gnome-gw-account-setup.eplug.xml: Standardise "GroupWise" - usage in translatable strings. - -2008-09-02 Sankar P <psankar@novell.com> - -License Changes - - * camel-gw-listener.c: - -2008-08-27 Sankar P <psankar@novell.com> - -License Changes - - * camel-gw-listener.h: - * groupwise-account-setup.c: - -2008-07-31 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #545568 - - * org-gnome-gw-account-setup.eplug.xml: - Add "system_plugin=true" so it's not shown in the Plugin Manager. - This plugin is not designed to be disabled by the user. - -2008-04-30 Chenthill Palanisamy <pchenthill@novell.com> - - ** Fixes #358644 (bnc) - Retracted groupwise appointments should disappear as soon as they are - retracted. - - * camel-gw-listener.c: (add_esource), (modify_esource), - (add_calendar_tasks_sources), (add_proxy_sources), (account_added), - (account_changed): - * groupwise-account-setup.c: (is_groupwise_account), - (set_esource_props), (ensure_mandatory_esource_properties): - * org-gnome-gw-account-setup.eplug.xml: - -2007-10-26 Kjartan Maraas <kmaraas@gnome.org> - - * camel-gw-listener.c: (camel_gw_listener_new): - ANSIfication of function declaration. - -2007-08-23 Milan Crha <mcrha@redhat.com> - - ** Fix for bug #308636 - - * camel-gw-listener.c: (add_esource): - Set "create_source=yes" property to source group based on new parameter - and always set property "delete=no" to new source. - * camel-gw-listener.c: , (add_calendar_tasks_sources), - (add_proxy_sources): Uses add_source. - -2007-05-25 Matthew Barnes <mbarnes@redhat.com> - - * camel-gw-listener.c (remove_esource), (modify_esource): - Don't assume the relative URI is non-NULL (#427232). - -2007-04-01 Matthew Barnes <mbarnes@redhat.com> - - ** Fixes part of bug #373116 - - * camel-gw-listener.c (add_esource): - Use the new ESource color API. - -2007-02-09 Sankar P <psankar@novell.com> - - * camel-gw-listener.c: (add_esource), (remove_esource), - (add_proxy_sources): Picks a random color for proxy calendars, - Checks the Memo/Notes component for proxies - -2006-12-03 Harish Krishnaswamy <kharish@novell.com> - - * plugins/groupwise-account-setup/camel-gw-listener.c: - (add_esource), (add_calendar_tasks_sources), - (get_addressbook_names_from_server), (add_proxy_sources), - (prune_proxies), (camel_gw_listener_construct): - Add code to prune dead proxy entries (so they are executed - regardless of which component gets loaded first). Clean up - the existing code, fix leaks and ensure new proxy calendars - have their (different) color set. - -2006-09-19 Kjartan Maraas <kmaraas@gnome.org> - - * org-gnome-gw-account-setup.eplug.xml: Mark description for - translation. - -2006-09-18 Matthew Barnes <mbarnes@redhat.com> - - * camel-gw-listener.c: (finalize) - Chain up to parent's finalize() method. - -2006-07-22 Chenthill Palanisamy <pchenthill@novell.com> - - * camel-gw-listener.c: (add_calendar_tasks_sources), - (remove_calendar_tasks_sources), (add_proxy_sources), - (account_changed): Added support Gw notes. - -2006-04-19 Harish Krishnaswamy <kharish@novell.com> - - * camel-gw-listener.c: (add_esource): - Add default color to the GW source created. - Fixes #167102 (bugzilla.novell.com). - -2006-03-11 Sushma Rai <rsushma@novell.com> - - * camel-gw-listener.c (get_addressbook_names_from_server): If use_ssl - parameter is found use https, otherwise use http. - Asking for password thrice on failure. Also freeing password key. - (account_changed): Checking for NULL old ssl paramter. Fixes a crash. - -2006-01-06 Simon Zheng <simon.zheng@sun.com> - - * camel-gw-listener.c: - * camel-gw-listener.h: - 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-21 Chenthill Palanisamy <pchenthill@novell.com> - - Committing for Sushma Rai <rsushma@novell.com> - - Fixes #320119 - * camel-gw-listener.c: (add_addressbook_sources): Skip the - Novell System Addressbook which is a personal addressbook - returned from the server. - -2005-12-12 Harish Krishnaswamy <kharish@novell.com> - - * Makefile.am: Fix make-clean issues. - -2005-11-24 Sushma Rai <rsushma@novell.com> - - * camel-gw-listener.c (add_addressbook_sources): Checking if the - frequent contacts folder is read from the server, and if not - displaying the warning message to user, asking to use some other - GroupWise mail clinet to get it created. - -2005-11-09 Parthasarathi Susarla <sparthasarathi@novell.com> - - * camel-gw-listener.c (get_addressbook_names_from_server): - check if string (eg. use_ssl) are NULL before strcmp(). - prevents a violation. - -2005-09-28 Sushma Rai <rsushma@novell.com> - - * camel-gw-listener.c (add_addressbook_sources): Removed name - comparison and using writable property, to find the system - address book, while marking for offline usage. - -2005-09-16 Vivek Jain <jvivek@novell.com> - - * camel-gw-listener.c:(get_addressbook_names_from_server) - uncache the password if it could not authenticate, else since we - remember it always it kept getting wrong one - use 'flags' variable which served no purpose till now - **Fixes #313078 - -2005-08-23 Not Zed <NotZed@Ximian.com> - - * groupwise-account-setup.c (org_gnome_groupwise_account_setup): - def9ine before defining. - - * camel-gw-listener.c (account_added): fix warning. - -2005-07-27 Sankar P <psankar@novell.com> - - * camel-gw-listener.c (get_addressbook_names_from_server) : - Added code to get the password from the cache, instead of asking the user twice. - and also freeing the password that was leaking before. - Fixes #310353 - -2005-07-23 Sushma Rai <rsushma@novell.com> - - * camel-gw-listener.c (add_addressbook_sources): marking - "Novell GroupWise Address Book" for offline usage by default. This is - needed as we now reply from cache always. - -2005-07-13 Tor Lillqvist <tml@novell.com> - - * org-gnome-gw-account-setup.eplug.xml: Use SOEXT. - -2005-07-12 Vivek Jain <jvivek@novell.com> - - * Makefile.am: included missing header file - -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>) - * groupwise-account-setup/*: Make the - camel-groupwise-listener load on startup. (new plugin) - diff --git a/plugins/groupwise-account-setup/Makefile.am b/plugins/groupwise-account-setup/Makefile.am deleted file mode 100644 index ddf3161f8b..0000000000 --- a/plugins/groupwise-account-setup/Makefile.am +++ /dev/null @@ -1,34 +0,0 @@ -AM_CPPFLAGS = \ - -I$(top_srcdir) \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) \ - $(CAMEL_GROUPWISE_CFLAGS) \ - -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-gw-account-setup.eplug -plugin_LTLIBRARIES = liborg-gnome-gw-account-setup.la - -liborg_gnome_gw_account_setup_la_SOURCES = \ - camel-gw-listener.c \ - camel-gw-listener.h \ - groupwise-account-setup.c - -liborg_gnome_gw_account_setup_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - -liborg_gnome_gw_account_setup_la_LIBADD= \ - $(top_builddir)/e-util/libeutil.la \ - $(top_builddir)/widgets/misc/libemiscwidgets.la \ - $(top_builddir)/filter/libfilter.la \ - $(EVOLUTION_CALENDAR_LIBS) \ - $(EVOLUTION_MAIL_LIBS) \ - $(CAMEL_GROUPWISE_LIBS) - -EXTRA_DIST = org-gnome-gw-account-setup.eplug.xml - -BUILT_SOURCES = $(plugin_DATA) -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk 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 deleted file mode 100644 index f99606f8a4..0000000000 --- a/plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml +++ /dev/null @@ -1,34 +0,0 @@ -<?xml version="1.0"?> -<e-plugin-list> - <e-plugin id="org.gnome.evolution.plugin.gw-account-setup" type="shlib" _name="GroupWise Account Setup" - location="@PLUGINDIR@/liborg-gnome-gw-account-setup@SOEXT@" load-on-startup="true" system_plugin="true"> - <author name="Sivaiah Nallagatla" email="snallagatla@novell.com"/> - <_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.accountAssistant"> - <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_groupwise_account_setup"/> - </group> - </hook> - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountEditor"> - <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_groupwise_account_setup"/> - </group> - </hook> - - <hook class="org.gnome.evolution.mail.config:1.0"> - <group target="account" id="org.gnome.evolution.mail.config.accountWizard"> - <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_groupwise_account_setup"/> - </group> - </hook> - - <hook class="org.gnome.evolution.shell.events:1.0"> - <event - id="upgrade.done" - handle="ensure_mandatory_esource_properties" - target="upgrade" - /> - </hook> - - </e-plugin> -</e-plugin-list> diff --git a/plugins/groupwise-features/Makefile.am b/plugins/groupwise-features/Makefile.am index 20fd6bf812..1b3a5eb73a 100644 --- a/plugins/groupwise-features/Makefile.am +++ b/plugins/groupwise-features/Makefile.am @@ -12,6 +12,7 @@ AM_CPPFLAGS = \ $(EVOLUTION_CALENDAR_CFLAGS) \ $(EVOLUTION_ADDRESSBOOK_CFLAGS) \ $(CAMEL_GROUPWISE_CFLAGS) \ + $(GNOME_PLATFORM_CFLAGS) \ -DEVOLUTION_GLADEDIR=\""$(gladedir)"\" \ -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" @@ -21,6 +22,8 @@ plugin_DATA = org-gnome-groupwise-features.eplug org-gnome-compose-send-options. plugin_LTLIBRARIES = liborg-gnome-groupwise-features.la liborg_gnome_groupwise_features_la_SOURCES = \ + gw-ui.h \ + gw-ui.c \ share-folder-common.c \ share-folder.c \ share-folder.h \ @@ -38,13 +41,18 @@ liborg_gnome_groupwise_features_la_SOURCES = \ proxy-login.h \ proxy-login.c \ process-meeting.c \ - mail-retract.c + mail-retract.c \ + camel-gw-listener.c \ + camel-gw-listener.h \ + groupwise-account-setup.c liborg_gnome_groupwise_features_la_LIBADD= \ $(top_builddir)/e-util/libeutil.la \ + $(top_builddir)/shell/libeshell.la \ $(top_builddir)/calendar/gui/libevolution-calendar.la \ $(top_builddir)/widgets/misc/libemiscwidgets.la \ $(top_builddir)/filter/libfilter.la \ + $(top_builddir)/mail/libevolution-mail.la \ $(EVOLUTION_CALENDAR_LIBS) \ $(EVOLUTION_MAIL_LIBS) \ $(CAMEL_GROUPWISE_LIBS) diff --git a/plugins/groupwise-account-setup/camel-gw-listener.c b/plugins/groupwise-features/camel-gw-listener.c index 72b810feea..72b810feea 100644 --- a/plugins/groupwise-account-setup/camel-gw-listener.c +++ b/plugins/groupwise-features/camel-gw-listener.c diff --git a/plugins/groupwise-account-setup/camel-gw-listener.h b/plugins/groupwise-features/camel-gw-listener.h index 1c4cedbe5a..1c4cedbe5a 100644 --- a/plugins/groupwise-account-setup/camel-gw-listener.h +++ b/plugins/groupwise-features/camel-gw-listener.h diff --git a/plugins/groupwise-account-setup/groupwise-account-setup.c b/plugins/groupwise-features/groupwise-account-setup.c index 0872a9c2a7..0872a9c2a7 100644 --- a/plugins/groupwise-account-setup/groupwise-account-setup.c +++ b/plugins/groupwise-features/groupwise-account-setup.c diff --git a/plugins/groupwise-features/gw-ui.c b/plugins/groupwise-features/gw-ui.c new file mode 100644 index 0000000000..f026311841 --- /dev/null +++ b/plugins/groupwise-features/gw-ui.c @@ -0,0 +1,457 @@ +/* + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#include <gtk/gtk.h> +#include <glib/gi18n.h> + +#include <shell/e-shell-view.h> +#include <shell/e-shell-window.h> + +#include <mail/e-mail-reader.h> +#include <mail/em-folder-tree.h> +#include <mail/em-folder-tree-model.h> + +#include <calendar/gui/e-calendar-view.h> +#include <calendar/gui/gnome-cal.h> + +#include "gw-ui.h" + +gboolean gw_ui_mail_folder_popup (GtkUIManager *ui_manager, EShellView *shell_view); +gboolean gw_ui_mail_message_popup (GtkUIManager *ui_manager, EShellView *shell_view); +gboolean gw_ui_calendar_event_popup (GtkUIManager *ui_manager, EShellView *shell_view); + +static gboolean +is_in_gw_account (EShellView *shell_view, gboolean *is_on_store, gchar **folder_full_name) +{ + EShellSidebar *shell_sidebar; + EMFolderTree *folder_tree = NULL; + GtkTreeSelection *selection; + GtkTreeModel *model = NULL; + GtkTreeIter iter; + gboolean is_store = FALSE, res; + gchar *uri = NULL; + gchar *full_name = NULL; + + if (folder_full_name) + *folder_full_name = NULL; + + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); + g_return_val_if_fail (folder_tree != NULL, FALSE); + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree)); + g_return_val_if_fail (selection != NULL, FALSE); + + if (!gtk_tree_selection_get_selected (selection, &model, &iter)) + return FALSE; + + gtk_tree_model_get (model, &iter, + COL_STRING_FULL_NAME, &full_name, + COL_STRING_URI, &uri, + COL_BOOL_IS_STORE, &is_store, + -1); + + res = uri && g_ascii_strncasecmp (uri, "groupwise://", 12) == 0; + + if (is_on_store) + *is_on_store = is_store; + + if (!is_store) { + if (folder_full_name) + *folder_full_name = full_name; + else + g_free (full_name); + + } else { + g_free (full_name); + } + + g_free (uri); + + return res; +} + +static void +visible_actions (GtkActionGroup *action_group, gboolean visible, const GtkActionEntry *entries, guint n_entries) +{ + gint i; + + g_return_if_fail (action_group != NULL); + g_return_if_fail (entries != NULL); + + for (i = 0; i < n_entries; i++) { + GtkAction *action = gtk_action_group_get_action (action_group, entries[i].name); + + g_return_if_fail (action != NULL); + + gtk_action_set_visible (action, visible); + } +} + +static GtkActionEntry mfp_entries[] = { + { "gw-new-shared-folder", + "folder-new", + N_("New _Shared Folder..."), + NULL, + NULL, + G_CALLBACK (gw_new_shared_folder_cb) }, + + { "gw-proxy-login", + NULL, + N_("_Proxy Login..."), + NULL, + NULL, + G_CALLBACK (gw_proxy_login_cb) } +}; + +static void +update_mfp_entries_cb (EShellView *shell_view, gpointer user_data) +{ + GtkActionGroup *action_group; + EShellWindow *shell_window; + gboolean is_on_store = FALSE, visible; + + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = e_shell_window_get_action_group (shell_window, "mail"); + + visible = is_in_gw_account (shell_view, &is_on_store, NULL); + visible_actions (action_group, visible, mfp_entries, G_N_ELEMENTS (mfp_entries)); + + if (visible && !is_on_store) { + GtkAction *action = gtk_action_group_get_action (action_group, "gw-proxy-login"); + + g_return_if_fail (action != NULL); + + gtk_action_set_visible (action, FALSE); + } +} + +gboolean +gw_ui_mail_folder_popup (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"); + + gtk_action_group_add_actions ( + action_group, mfp_entries, + G_N_ELEMENTS (mfp_entries), shell_view); + + g_signal_connect (shell_view, "update-actions", G_CALLBACK (update_mfp_entries_cb), NULL); + + return TRUE; +} + +static GtkActionEntry mmp_entries[] = { + { "gw-junk-mail-settings", + NULL, + N_("Junk Mail Settings..."), + NULL, + NULL, + G_CALLBACK (gw_junk_mail_settings_cb) }, + + { "gw-track-message-status", + NULL, + N_("Track Message Status..."), + NULL, + NULL, + G_CALLBACK (gw_track_message_status_cb) }, + { "gw-retract-mail", + NULL, + N_("Retract Mail"), + NULL, + NULL, + G_CALLBACK (gw_retract_mail_cb) } +}; + +static void +update_mmp_entries_cb (EShellView *shell_view, gpointer user_data) +{ + EShellWindow *shell_window; + GtkActionGroup *action_group; + gboolean visible; + gchar *full_name = NULL, *uri = NULL; + guint n_selected = 0; + + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + + shell_window = e_shell_view_get_shell_window (shell_view); + action_group = e_shell_window_get_action_group (shell_window, "mail"); + + visible = is_in_gw_account (shell_view, NULL, &full_name); + if (visible) { + EShellContent *shell_content; + EMailReader *reader; + MessageList *message_list; + GPtrArray *selected; + + shell_content = e_shell_view_get_shell_content (shell_view); + + reader = (EMailReader *) (shell_content); + message_list = e_mail_reader_get_message_list (reader); + selected = message_list_get_selected (message_list); + + if (selected) + n_selected = selected->len; + + message_list_free_uids (message_list, selected); + + visible = n_selected > 0; + } + + visible_actions (action_group, visible, mmp_entries, G_N_ELEMENTS (mmp_entries)); + + if (visible) { + GtkAction *action; + gboolean is_sent_items_folder = full_name && g_ascii_strncasecmp (full_name, "Sent Items", 10) == 0; + + action = gtk_action_group_get_action (action_group, "gw-track-message-status"); + g_return_if_fail (action != NULL); + gtk_action_set_visible (action, is_sent_items_folder && n_selected == 1); + + action = gtk_action_group_get_action (action_group, "gw-retract-mail"); + g_return_if_fail (action != NULL); + gtk_action_set_visible (action, is_sent_items_folder && n_selected == 1); + } + + g_free (full_name); + g_free (uri); +} + +gboolean +gw_ui_mail_message_popup (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"); + + gtk_action_group_add_actions ( + action_group, mmp_entries, + G_N_ELEMENTS (mmp_entries), shell_view); + + g_signal_connect (shell_view, "update-actions", G_CALLBACK (update_mmp_entries_cb), NULL); + + return TRUE; +} + +static icalproperty * +get_attendee_prop (icalcomponent *icalcomp, const gchar *address) +{ + icalproperty *prop; + + if (!(address && *address)) + return NULL; + + for (prop = icalcomponent_get_first_property (icalcomp, ICAL_ATTENDEE_PROPERTY); + prop; + prop = icalcomponent_get_next_property (icalcomp, ICAL_ATTENDEE_PROPERTY)) { + const gchar *attendee = icalproperty_get_attendee (prop); + + if (g_str_equal (itip_strip_mailto (attendee), address)) { + return prop; + } + } + + return NULL; +} + +static gboolean +needs_to_accept (icalcomponent *icalcomp, const gchar *user_email) +{ + icalproperty *prop; + icalparameter *param; + icalparameter_partstat status = ICAL_PARTSTAT_NONE; + + prop = get_attendee_prop (icalcomp, user_email); + + /* It might be a mailing list */ + if (!prop) + return TRUE; + param = icalproperty_get_first_parameter (prop, ICAL_PARTSTAT_PARAMETER); + if (param) + status = icalparameter_get_partstat (param); + + if (status == ICAL_PARTSTAT_ACCEPTED || status == ICAL_PARTSTAT_TENTATIVE) + return FALSE; + + return TRUE; +} + +static gboolean +is_meeting_owner (ECalComponent *comp, ECal *client) +{ + ECalComponentOrganizer org; + gchar *email = NULL; + const gchar *strip = NULL; + gboolean ret_val = FALSE; + + if (!(e_cal_component_has_attendees (comp) && + e_cal_get_save_schedules (client))) + return ret_val; + + e_cal_component_get_organizer (comp, &org); + strip = itip_strip_mailto (org.value); + + if (e_cal_get_cal_address (client, &email, NULL) && !g_ascii_strcasecmp (email, strip)) { + ret_val = TRUE; + } + + if (!ret_val) + ret_val = e_account_list_find(itip_addresses_get(), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL; + + g_free (email); + return ret_val; +} + +static GtkActionEntry cal_entries[] = { + { "gw-meeting-accept", + GTK_STOCK_APPLY, + N_("Accept"), + NULL, + NULL, + G_CALLBACK (gw_meeting_accept_cb) }, + + { "gw-meeting-accept-tentative", + GTK_STOCK_DIALOG_QUESTION, + N_("Accept Tentatively"), + NULL, + NULL, + G_CALLBACK (gw_meeting_accept_tentative_cb) }, + + { "gw-meeting-decline", + GTK_STOCK_CANCEL, + N_("Decline"), + NULL, + NULL, + G_CALLBACK (gw_meeting_decline_cb) }, + + { "gw-resend-meeting", + GTK_STOCK_EDIT, + N_("Rese_nd Meeting..."), + NULL, + NULL, + G_CALLBACK (gw_resend_meeting_cb) } +}; + +static void +update_cal_entries_cb (EShellView *shell_view, gpointer user_data) +{ + EShellWindow *shell_window; + GtkActionGroup *action_group; + gboolean visible = FALSE, is_unaccepted = FALSE, is_mtg_owner = FALSE; + EShellContent *shell_content; + GnomeCalendar *gcal = NULL; + GnomeCalendarViewType view_type; + ECalendarView *view; + + g_return_if_fail (E_IS_SHELL_VIEW (shell_view)); + + shell_window = e_shell_view_get_shell_window (shell_view); + shell_content = e_shell_view_get_shell_content (shell_view); + + g_object_get (shell_content, "calendar", &gcal, NULL); + + view_type = gnome_calendar_get_view (gcal); + view = gnome_calendar_get_calendar_view (gcal, view_type); + + if (view) { + GList *selected; + + selected = e_calendar_view_get_selected_events (view); + if (selected && selected->data) { + ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data; + const gchar *uri; + + uri = event->comp_data ? e_cal_get_uri (event->comp_data->client) : NULL; + + if (uri && g_ascii_strncasecmp (uri, "groupwise://", 12) == 0) { + visible = e_cal_util_component_has_attendee (event->comp_data->icalcomp); + if (visible) { + ECalComponent *comp; + + comp = e_cal_component_new (); + e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); + + if (e_cal_get_static_capability (event->comp_data->client, CAL_STATIC_CAPABILITY_HAS_UNACCEPTED_MEETING)) { + gchar *user_email; + + user_email = itip_get_comp_attendee (comp, event->comp_data->client); + + is_unaccepted = needs_to_accept (event->comp_data->icalcomp, user_email); + + g_free (user_email); + } + + is_mtg_owner = is_meeting_owner (comp, event->comp_data->client); + + g_object_unref (comp); + } + } + } + + g_list_free (selected); + } + + action_group = e_shell_window_get_action_group (shell_window, "calendar"); + visible_actions (action_group, visible, cal_entries, G_N_ELEMENTS (cal_entries)); + + if (visible && !is_unaccepted) { + GtkAction *action; + + action = gtk_action_group_get_action (action_group, "gw-meeting-accept"); + g_return_if_fail (action != NULL); + gtk_action_set_visible (action, FALSE); + + action = gtk_action_group_get_action (action_group, "gw-meeting-accept-tentative"); + g_return_if_fail (action != NULL); + gtk_action_set_visible (action, FALSE); + } + + if (visible && !is_mtg_owner) { + GtkAction *action; + + action = gtk_action_group_get_action (action_group, "gw-resend-meeting"); + g_return_if_fail (action != NULL); + gtk_action_set_visible (action, FALSE); + } +} + +gboolean +gw_ui_calendar_event_popup (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, "calendar"); + + gtk_action_group_add_actions ( + action_group, cal_entries, + G_N_ELEMENTS (cal_entries), shell_view); + + g_signal_connect (shell_view, "update-actions", G_CALLBACK (update_cal_entries_cb), NULL); + + return TRUE; +} diff --git a/plugins/groupwise-features/gw-ui.h b/plugins/groupwise-features/gw-ui.h new file mode 100644 index 0000000000..d8ed509e99 --- /dev/null +++ b/plugins/groupwise-features/gw-ui.h @@ -0,0 +1,38 @@ +/* + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) version 3. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with the program; if not, see <http://www.gnu.org/licenses/> + * + * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) + * + */ + +#ifndef GW_UI_HEADER +#define GW_UI_HEADER + +#include <gtk/gtk.h> +#include <shell/e-shell-view.h> + +void gw_new_shared_folder_cb (GtkAction *action, EShellView *shell_view); +void gw_proxy_login_cb (GtkAction *action, EShellView *shell_view); + +void gw_junk_mail_settings_cb (GtkAction *action, EShellView *shell_view); +void gw_track_message_status_cb (GtkAction *action, EShellView *shell_view); +void gw_retract_mail_cb (GtkAction *action, EShellView *shell_view); + +void gw_meeting_accept_cb (GtkAction *action, EShellView *shell_view); +void gw_meeting_accept_tentative_cb (GtkAction *action, EShellView *shell_view); +void gw_meeting_decline_cb (GtkAction *action, EShellView *shell_view); +void gw_resend_meeting_cb (GtkAction *action, EShellView *shell_view); + +#endif diff --git a/plugins/groupwise-features/install-shared.c b/plugins/groupwise-features/install-shared.c index a208116f0a..d1edff3e02 100644 --- a/plugins/groupwise-features/install-shared.c +++ b/plugins/groupwise-features/install-shared.c @@ -30,9 +30,9 @@ #include <glib/gi18n.h> #include <gconf/gconf-client.h> #include <e-util/e-config.h> +#include <shell/e-shell.h> #include <mail/em-config.h> #include <mail/em-event.h> -#include <mail/mail-component.h> #include <camel/camel-mime-message.h> #include <camel/camel-folder.h> #include <camel/camel-stream.h> @@ -76,6 +76,12 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) if (response == GTK_RESPONSE_CANCEL) { gtk_widget_destroy (GTK_WIDGET (emfs)); } else { + CamelSession *session; + EShell *shell; + + shell = e_shell_get_default (); + session = e_shell_settings_get_pointer (e_shell_get_shell_settings (shell), "mail-session"); + model = accept_data->model; item_id = camel_mime_message_get_message_id (accept_data->msg); uri = em_folder_selector_get_selected_uri (emfs); @@ -94,7 +100,7 @@ install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) parent_name = NULL; } camel_exception_init (&ex); - if (!(store = (CamelStore *) camel_session_get_service (mail_component_peek_session(NULL), uri, CAMEL_PROVIDER_STORE, &ex))) { + if (!(store = (CamelStore *) camel_session_get_service (session, uri, CAMEL_PROVIDER_STORE, &ex))) { camel_exception_clear (&ex); g_strfreev (names); return; @@ -154,23 +160,25 @@ accept_free(gpointer data) static void apply_clicked (GtkAssistant *assistant, CamelMimeMessage *msg) { - EMFolderTreeModel *model; EMFolderTree *folder_tree; GtkWidget *dialog; struct AcceptData *accept_data; gchar *uri; + gpointer parent; + + parent = gtk_widget_get_toplevel (GTK_WIDGET (assistant)); + parent = GTK_WIDGET_TOPLEVEL (parent) ? parent : NULL; accept_data = g_new0(struct AcceptData, 1); - model = mail_component_peek_tree_model (NULL); - folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); + folder_tree = (EMFolderTree *) em_folder_tree_new (); - dialog = em_folder_selector_create_new (folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); + dialog = em_folder_selector_create_new (parent, folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); uri = em_folder_tree_get_selected_uri(folder_tree); em_folder_selector_set_selected ((EMFolderSelector *) dialog, uri); g_free(uri); accept_data->msg = msg; camel_object_ref(msg); - accept_data->model = model; + accept_data->model = EM_FOLDER_TREE_MODEL (gtk_tree_view_get_model (GTK_TREE_VIEW (folder_tree))); 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, "assistant", assistant, (GDestroyNotify)gtk_widget_destroy); @@ -185,7 +193,6 @@ org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target) const CamelInternetAddress *from_addr = NULL; const gchar *name; const gchar *email; - GtkWidget *window; CamelMimeMessage *msg = (CamelMimeMessage *) target->message; CamelStreamMem *content; CamelDataWrapper *dw; diff --git a/plugins/groupwise-features/junk-mail-settings.c b/plugins/groupwise-features/junk-mail-settings.c index bfaeee585d..fe82ccb4d5 100644 --- a/plugins/groupwise-features/junk-mail-settings.c +++ b/plugins/groupwise-features/junk-mail-settings.c @@ -29,22 +29,14 @@ #include <stdio.h> #include <gtk/gtk.h> -#include "camel/camel-store.h" -#include "camel/camel-folder.h" -#include "camel/camel-medium.h" -#include "camel/camel-mime-message.h" -#include "mail/em-popup.h" -#include <mail/em-folder-view.h> +#include <mail/e-mail-reader.h> + #include <e-gw-connection.h> -#include "mail/em-account-editor.h" -#include "libedataserver/e-account.h" -#include "mail/em-config.h" + +#include "gw-ui.h" #include "share-folder.h" #include "junk-settings.h" -void -org_gnome_junk_settings(EPlugin *ep, EMPopupTargetSelect *t); - static void abort_changes (JunkSettings *js) { @@ -65,17 +57,26 @@ junk_dialog_response (GtkWidget *dialog, gint response, JunkSettings *js) } -static void -junk_mail_settings (EPopup *ep, EPopupItem *item, gpointer data) +void +gw_junk_mail_settings_cb (GtkAction *action, EShellView *shell_view) { GtkWidget *dialog ,*w, *notebook, *box; JunkSettings *junk_tab; gint page_count =0; EGwConnection *cnc; gchar *msg; - CamelFolder *folder = (CamelFolder *)data; - CamelStore *store = folder->parent_store; - cnc = get_cnc (store); + EShellContent *shell_content; + EMailReader *reader; + MessageList *message_list; + + shell_content = e_shell_view_get_shell_content (shell_view); + + reader = (EMailReader *) (shell_content); + message_list = e_mail_reader_get_message_list (reader); + g_return_if_fail (message_list != NULL); + g_return_if_fail (message_list->folder != NULL); + + cnc = get_cnc (message_list->folder->parent_store); dialog = gtk_dialog_new_with_buttons (_("Junk Settings"), NULL, @@ -99,7 +100,7 @@ junk_mail_settings (EPopup *ep, EPopupItem *item, gpointer data) w = (GtkWidget *)junk_tab->vbox; gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 6); - /*We might have to add more options for settings i.e. more pages*/ + /* We might have to add more options for settings i.e. more pages */ while (page_count > 0 ) { notebook = gtk_notebook_new (); gtk_notebook_append_page ((GtkNotebook *)notebook, box, NULL); @@ -112,40 +113,3 @@ junk_mail_settings (EPopup *ep, EPopupItem *item, gpointer data) g_signal_connect (dialog, "response", G_CALLBACK (junk_dialog_response), junk_tab); gtk_widget_show_all (dialog); } - -static EPopupItem popup_items[] = { - { E_POPUP_ITEM, (gchar *) "50.emfv.05", (gchar *) N_("Junk Mail Settings..."), junk_mail_settings, NULL, NULL, 0, EM_POPUP_SELECT_MANY|EM_FOLDER_VIEW_SELECT_LISTONLY} -}; - -static void -popup_free (EPopup *ep, GSList *items, gpointer data) -{ -g_slist_free (items); -} - -void -org_gnome_junk_settings(EPlugin *ep, EMPopupTargetSelect *t) -{ - GSList *menus = NULL; - - gint i = 0; - static gint first = 0; - - if (! g_strrstr (t->uri, "groupwise://")) - return; - - /* for translation*/ - if (!first) { - popup_items[0].label = _(popup_items[0].label); - - } - - first++; - - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); - - e_popup_add_items (t->target.popup, menus, NULL, popup_free, t->folder); - -} - diff --git a/plugins/groupwise-features/mail-retract.c b/plugins/groupwise-features/mail-retract.c index 8dd58baeac..9581c0132b 100644 --- a/plugins/groupwise-features/mail-retract.c +++ b/plugins/groupwise-features/mail-retract.c @@ -24,31 +24,61 @@ #include <config.h> #endif -#include <mail/em-popup.h> -#include <mail/em-folder-view.h> #include <glib/gi18n-lib.h> -#include <share-folder.h> #include <e-gw-connection.h> #include <camel/camel-store.h> #include <camel/camel-folder.h> + #include <e-util/e-error.h> -void org_gnome_retract_message (EPlugin *ep, EMPopupTargetSelect *t); +#include <mail/e-mail-reader.h> + +#include "gw-ui.h" +#include "share-folder.h" -static void retract_mail_settings (EPopup *ep, EPopupItem *item, gpointer data) +static gboolean +get_selected_info (EShellView *shell_view, CamelFolder **folder, gchar **selected_uid) +{ + EShellContent *shell_content; + EMailReader *reader; + MessageList *message_list; + GPtrArray *selected; + + shell_content = e_shell_view_get_shell_content (shell_view); + + reader = (EMailReader *) (shell_content); + message_list = e_mail_reader_get_message_list (reader); + g_return_val_if_fail (message_list != NULL, FALSE); + + selected = message_list_get_selected (message_list); + if (selected && selected->len == 1) { + *folder = message_list->folder; + *selected_uid = g_strdup (g_ptr_array_index (selected, 0)); + } + + message_list_free_uids (message_list, selected); + + return *selected_uid != NULL; +} + +void +gw_retract_mail_cb (GtkAction *action, EShellView *shell_view) { EGwConnection *cnc; - CamelFolder *folder = (CamelFolder *)data; - CamelStore *store = folder->parent_store; - gchar *id; + CamelFolder *folder; + CamelStore *store; + gchar *id = NULL; GtkWidget *confirm_dialog, *confirm_warning; gint n; + g_return_if_fail (get_selected_info (shell_view, &folder, &id)); + g_return_if_fail (folder != NULL); + + store = folder->parent_store; + cnc = get_cnc (store); if (cnc && E_IS_GW_CONNECTION(cnc)) { - id = (gchar *)item->user_data; - confirm_dialog = gtk_dialog_new_with_buttons (_("Message Retract"), NULL, GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, GTK_STOCK_YES, GTK_RESPONSE_YES, @@ -79,40 +109,6 @@ static void retract_mail_settings (EPopup *ep, EPopupItem *item, gpointer data) } } } -} - -static EPopupItem popup_items[] = { - { E_POPUP_BAR, (gchar *) "20.emfv.03" }, - { E_POPUP_ITEM, (gchar *) "20.emfv.04", (gchar *) N_("Retract Mail"), retract_mail_settings, NULL, NULL, 0, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY} -}; - -static void popup_free (EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free (items); -} -void org_gnome_retract_message (EPlugin *ep, EMPopupTargetSelect *t) -{ - GSList *menus = NULL; - GPtrArray *uids; - gint i = 0; - static gint first = 0; - - uids = t->uids; - if (g_strrstr (t->uri, "groupwise://") && !g_ascii_strcasecmp((t->folder)->full_name, "Sent Items")) { - - /* for translation*/ - if (!first) { - popup_items[1].label = _(popup_items[1].label); - popup_items[1].user_data = g_strdup((gchar *) g_ptr_array_index(uids, 0)); - } - - first++; - - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); - - e_popup_add_items (t->target.popup, menus, NULL, popup_free, t->folder); - } - return; + g_free (id); } diff --git a/plugins/groupwise-features/mail-send-options.c b/plugins/groupwise-features/mail-send-options.c index 8244088f8a..3b3e8eb8a7 100644 --- a/plugins/groupwise-features/mail-send-options.c +++ b/plugins/groupwise-features/mail-send-options.c @@ -32,7 +32,6 @@ #include "mail-send-options.h" -#include "mail/em-menu.h" #include "mail/em-utils.h" #include "mail/em-event.h" diff --git a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml index ea4f06a6e7..6ebc98e42c 100644 --- a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml +++ b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml @@ -1,7 +1,8 @@ <?xml version="1.0"?> <e-plugin-list> <e-plugin id="org.gnome.evolution.groupwise_features" type="shlib" _name="GroupWise Features" - location="@PLUGINDIR@/liborg-gnome-groupwise-features@SOEXT@"> + location="@PLUGINDIR@/liborg-gnome-groupwise-features@SOEXT@" load-on-startup="true" system_plugin="true"> + <author name="Sivaiah Nallagatla" email="snallagatla@novell.com" /> <author name="Vivek Jain" email="jvivek@novell.com" /> <author name="Chenthill Palanisamy" email="pchenthill@novell.com"/> @@ -11,107 +12,84 @@ <author name="Raghavendran R" email="raghavguru7@gmail.com"/> <_description>Fine-tune your GroupWise accounts.</_description> + <hook class="org.gnome.evolution.mail.config:1.0"> - <group id="org.gnome.evolution.mail.folderConfig" target="folder" - check= "shared_folder_check" - commit="shared_folder_commit" - abort ="shared_folder_abort"> - <item - type="page" - path="10.shared" - label="Shared" - factory="org_gnome_shared_folder_factory"/> + <group id="org.gnome.evolution.mail.folderConfig" target="folder" check= "shared_folder_check" commit="shared_folder_commit" abort ="shared_folder_abort"> + <item type="page" path="10.shared" label="Shared" factory="org_gnome_shared_folder_factory"/> </group> - <group id="org.gnome.evolution.mail.config.accountEditor" target="account" - check = "send_options_changed" - commit = "send_options_commit" - abort = "send_options_abort"> - <item - type="section" - path="40.defaults/50.send_options" - label="Send Options" - factory="org_gnome_send_options" /> + <group id="org.gnome.evolution.mail.config.accountEditor" target="account" check = "send_options_changed" commit = "send_options_commit" abort = "send_options_abort"> + <item type="section" path="40.defaults/50.send_options" label="Send Options" factory="org_gnome_send_options" /> </group> - </hook> - <hook class="org.gnome.evolution.mail.events:1.0"> - <event - target="message" - id="message.reading" - type="pass" - handle="org_gnome_popup_wizard"/> - </hook> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder" factory = "org_gnome_create_option"> - </menu> - <menu id="org.gnome.evolution.mail.folderview.popup" target="select" factory = "org_gnome_junk_settings"/> - <menu id="org.gnome.evolution.mail.folderview.popup" target="select" factory = "org_gnome_track_status"/> - </hook> - <hook class="org.gnome.evolution.addressbook.config:1.0"> - <group - id="com.novell.evolution.addressbook.config.accountEditor" target="source" - commit="commit_groupwise_addressbook"> - <item - type="item" - path="00.general/10.display/00.gw_dummy" - factory="e_book_groupwise_dummy"/> + <group id="org.gnome.evolution.mail.config.accountEditor" target="account" commit = "proxy_commit" abort="proxy_abort"> + <item type="page" path="60.proxy" factory="org_gnome_proxy"/> </group> - <group - id="com.novell.evolution.addressbook.config.accountEditor" target="source" - commit="commit_groupwise_addressbook"> - <item - type="item" - path="00.general/10.display/00.gw_dummy" - factory="e_book_groupwise_dummy"/> + + <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> + <group target="account" id="org.gnome.evolution.mail.config.accountEditor"> + <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_groupwise_account_setup"/> + </group> + <group target="account" id="org.gnome.evolution.mail.config.accountWizard"> + <item type="item_table" path="20.receive_options/30.soapport/50.dummy" factory="org_gnome_groupwise_account_setup"/> </group> - </hook> - <hook class="org.gnome.evolution.mail.events:1.0"> - <event - id="composer.selectsendoption" - handle="org_gnome_composer_send_options" - target="composer" - enable="sendoption" - /> </hook> - <hook class="org.gnome.evolution.mail.events:1.0"> - <event - id="message.replying" - handle="org_gnome_composer_message_reply" - target="message" - enable="reply" - /> + <!-- cannot have one hook with two same ui-manager id-s, thus splitting here --> + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.mail" callback="gw_ui_mail_folder_popup"> + <popup name="mail-folder-popup"> + <placeholder name="mail-folder-popup-actions"> + <menuitem action="gw-new-shared-folder"/> + <menuitem action="gw-proxy-login"/> + </placeholder> + </popup> + </ui-manager> </hook> - <hook class="org.gnome.evolution.mail.config:1.0"> - <group id="org.gnome.evolution.mail.config.accountEditor" - target="account" commit = "proxy_commit" abort="proxy_abort"> - <item type="page" path="60.proxy" factory="org_gnome_proxy"/> - </group> - </hook> - - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.foldertree.popup" target="folder" - factory = "org_gnome_create_proxy_login_option"> - </menu> - </hook> - - - <hook class="org.gnome.evolution.calendar.popup:1.0"> - <menu id="org.gnome.evolution.calendar.view.popup" target="select" factory = "org_gnome_accept"> - </menu> + <hook class="org.gnome.evolution.ui:1.0"> + <ui-manager id="org.gnome.evolution.mail" callback="gw_ui_mail_message_popup"> + <popup name="mail-message-popup"> + <placeholder name="mail-message-popup-actions"> + <separator /> + <menuitem action="gw-junk-mail-settings"/> + <menuitem action="gw-track-message-status"/> + <separator /> + <menuitem action="gw-retract-mail"/> + </placeholder> + </popup> + </ui-manager> + + <ui-manager id="org.gnome.evolution.calendar" callback="gw_ui_calendar_event_popup"> + <popup name="calendar-event-popup"> + <placeholder name="event-popup-actions"> + <menuitem action="gw-meeting-accept"/> + <menuitem action="gw-meeting-accept-tentative"/> + <menuitem action="gw-meeting-decline"/> + <menuitem action="gw-resend-meeting"/> + </placeholder> + </popup> + </ui-manager> </hook> - <hook class="org.gnome.evolution.calendar.popup:1.0"> - <menu id="org.gnome.evolution.calendar.view.popup" target="select" factory = "org_gnome_retract_resend"> - </menu> + <hook class="org.gnome.evolution.mail.events:1.0"> + <event target="message" id="message.reading" type="pass" handle="org_gnome_popup_wizard"/> + <event id="composer.selectsendoption" handle="org_gnome_composer_send_options" target="composer" enable="sendoption"/> + <event id="message.replying" handle="org_gnome_composer_message_reply" target="message" enable="reply"/> </hook> - <hook class="org.gnome.evolution.mail.popup:1.0"> - <menu id="org.gnome.evolution.mail.folderview.popup" target="select" - factory = "org_gnome_retract_message"> - </menu> + <hook class="org.gnome.evolution.addressbook.config:1.0"> + <group id="com.novell.evolution.addressbook.config.accountEditor" target="source" commit="commit_groupwise_addressbook"> + <item type="item" path="00.general/10.display/00.gw_dummy" factory="e_book_groupwise_dummy"/> + </group> + <group id="com.novell.evolution.addressbook.config.accountEditor" target="source" commit="commit_groupwise_addressbook"> + <item type="item" path="00.general/10.display/00.gw_dummy" factory="e_book_groupwise_dummy"/> + </group> </hook> - + + <hook class="org.gnome.evolution.shell.events:1.0"> + <event id="upgrade.done" handle="ensure_mandatory_esource_properties" target="upgrade"/> + </hook> </e-plugin> </e-plugin-list> diff --git a/plugins/groupwise-features/process-meeting.c b/plugins/groupwise-features/process-meeting.c index 299b19e3b6..7f49d8ab5d 100644 --- a/plugins/groupwise-features/process-meeting.c +++ b/plugins/groupwise-features/process-meeting.c @@ -28,77 +28,21 @@ #include <string.h> #include <glib/gi18n.h> #include <gtk/gtk.h> -#include <calendar/gui/e-cal-popup.h> +#include <libecal/e-cal.h> + +#include <e-util/e-error.h> + #include <calendar/gui/e-calendar-view.h> #include <calendar/gui/itip-utils.h> -#include <e-util/e-error.h> -#include <libecal/e-cal.h> +#include <calendar/gui/gnome-cal.h> + +#include "gw-ui.h" typedef struct { ECal *ecal; icalcomponent *icalcomp; } ReceiveData; -ECalendarView *c_view; - -void org_gnome_accept(EPlugin *ep, ECalPopupTargetSelect *target); -void org_gnome_retract_resend (EPlugin *ep, ECalPopupTargetSelect *target); -static void on_accept_meeting (EPopup *ep, EPopupItem *pitem, gpointer data); -static void on_accept_meeting_tentative (EPopup *ep, EPopupItem *pitem, gpointer data); -static void on_decline_meeting (EPopup *ep, EPopupItem *pitem, gpointer data); -static void on_resend_meeting (EPopup *ep, EPopupItem *pitem, gpointer data); - -static EPopupItem popup_items[] = { - { E_POPUP_ITEM, (gchar *) "41.accept", (gchar *) N_("Accept"), on_accept_meeting, NULL, (gchar *) GTK_STOCK_APPLY, 0, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_MEETING | E_CAL_POPUP_SELECT_ACCEPTABLE}, - { E_POPUP_ITEM, (gchar *) "42.accept", (gchar *) N_("Accept Tentatively"), on_accept_meeting_tentative, NULL, (gchar *) GTK_STOCK_DIALOG_QUESTION, 0, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_MEETING | E_CAL_POPUP_SELECT_ACCEPTABLE}, - { E_POPUP_ITEM, (gchar *) "43.decline", (gchar *) N_("Decline"), on_decline_meeting, NULL, (gchar *) GTK_STOCK_CANCEL, 0, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_MEETING} -}; - -static void -popup_free (EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free (items); - items = NULL; -} - -void -org_gnome_accept (EPlugin *ep, ECalPopupTargetSelect *target) -{ - GSList *menus = NULL; - GList *selected; - gint i = 0; - static gint first = 0; - const gchar *uri = NULL; - ECalendarView *cal_view = E_CALENDAR_VIEW (target->target.widget); - - c_view = cal_view; - selected = e_calendar_view_get_selected_events (cal_view); - if (selected) { - ECalendarViewEvent *event = (ECalendarViewEvent *) selected->data; - - uri = e_cal_get_uri (event->comp_data->client); - } else - return; - - if (!uri) - return; - - if (! g_strrstr (uri, "groupwise://")) - return; - - /* for translation*/ - if (!first) { - popup_items[0].label = _(popup_items[0].label); - } - - first++; - - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); - - e_popup_add_items (target->target.popup, menus, NULL, popup_free, NULL); -} - static void finalize_receive_data (ReceiveData *r_data) { @@ -258,55 +202,49 @@ process_meeting (ECalendarView *cal_view, icalparameter_partstat status) } } -/*FIXME the data does not give us the ECalendarView object. - we should remove the global c_view variable once we get it from the data*/ -static void -on_accept_meeting (EPopup *ep, EPopupItem *pitem, gpointer data) +static ECalendarView * +get_calendar_view (EShellView *shell_view) { - ECalendarView *cal_view = c_view; + EShellContent *shell_content; + GnomeCalendar *gcal = NULL; + GnomeCalendarViewType view_type; - process_meeting (cal_view, ICAL_PARTSTAT_ACCEPTED); -} -static void -on_accept_meeting_tentative (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - ECalendarView *cal_view = c_view; + g_return_val_if_fail (shell_view != NULL, NULL); - process_meeting (cal_view, ICAL_PARTSTAT_TENTATIVE); -} + shell_content = e_shell_view_get_shell_content (shell_view); -static void -on_decline_meeting (EPopup *ep, EPopupItem *pitem, gpointer data) -{ - ECalendarView *cal_view = c_view; + g_object_get (shell_content, "calendar", &gcal, NULL); - process_meeting (cal_view, ICAL_PARTSTAT_DECLINED); + view_type = gnome_calendar_get_view (gcal); + + return gnome_calendar_get_calendar_view (gcal, view_type); } -static gboolean -is_meeting_owner (ECalComponent *comp, ECal *client) +void +gw_meeting_accept_cb (GtkAction *action, EShellView *shell_view) { - ECalComponentOrganizer org; - gchar *email = NULL; - const gchar *strip = NULL; - gboolean ret_val = FALSE; + ECalendarView *cal_view = get_calendar_view (shell_view); + g_return_if_fail (cal_view != NULL); - if (!(e_cal_component_has_attendees (comp) && - e_cal_get_save_schedules (client))) - return ret_val; + process_meeting (cal_view, ICAL_PARTSTAT_ACCEPTED); +} - e_cal_component_get_organizer (comp, &org); - strip = itip_strip_mailto (org.value); +void +gw_meeting_accept_tentative_cb (GtkAction *action, EShellView *shell_view) +{ + ECalendarView *cal_view = get_calendar_view (shell_view); + g_return_if_fail (cal_view != NULL); - if (e_cal_get_cal_address (client, &email, NULL) && !g_ascii_strcasecmp (email, strip)) { - ret_val = TRUE; - } + process_meeting (cal_view, ICAL_PARTSTAT_TENTATIVE); +} - if (!ret_val) - ret_val = e_account_list_find(itip_addresses_get(), E_ACCOUNT_FIND_ID_ADDRESS, strip) != NULL; +void +gw_meeting_decline_cb (GtkAction *action, EShellView *shell_view) +{ + ECalendarView *cal_view = get_calendar_view (shell_view); + g_return_if_fail (cal_view != NULL); - g_free (email); - return ret_val; + process_meeting (cal_view, ICAL_PARTSTAT_DECLINED); } typedef struct { @@ -315,60 +253,6 @@ typedef struct { CalObjModType mod; } ThreadData; -static EPopupItem retract_popup_items[] = { - { E_POPUP_ITEM, (gchar *) "49.resend", (gchar *) N_("Rese_nd Meeting..."), on_resend_meeting, NULL, (gchar *) GTK_STOCK_EDIT, 0, E_CAL_POPUP_SELECT_NOTEDITING | E_CAL_POPUP_SELECT_MEETING} -}; - -void -org_gnome_retract_resend (EPlugin *ep, ECalPopupTargetSelect *target) -{ - GSList *menus = NULL; - GList *selected; - gint i = 0; - static gint first = 0; - const gchar *uri = NULL; - ECalendarView *cal_view = E_CALENDAR_VIEW (target->target.widget); - ECalComponent *comp = NULL; - ECalendarViewEvent *event = NULL; - - c_view = cal_view; - selected = e_calendar_view_get_selected_events (cal_view); - if (selected) { - event = (ECalendarViewEvent *) selected->data; - - uri = e_cal_get_uri (event->comp_data->client); - } else - return; - - if (!uri) - return; - - if (! g_strrstr (uri, "groupwise://")) - return; - - comp = e_cal_component_new (); - e_cal_component_set_icalcomponent (comp, icalcomponent_new_clone (event->comp_data->icalcomp)); - - if (!is_meeting_owner (comp, event->comp_data->client)) { - g_object_unref (comp); - return; - } - - /* for translation*/ - if (!first) { - retract_popup_items[0].label = _(retract_popup_items[0].label); - } - - first++; - - for (i = 0; i < sizeof (retract_popup_items) / sizeof (retract_popup_items[0]); i++) - menus = g_slist_prepend (menus, &retract_popup_items[i]); - - e_popup_add_items (target->target.popup, menus, NULL, popup_free, NULL); - - g_object_unref (comp); -} - static void add_retract_data (ECalComponent *comp, const gchar *retract_comment, CalObjModType mod) { @@ -474,11 +358,13 @@ object_created_cb (CompEditor *ce, gpointer data) } } -static void -on_resend_meeting (EPopup *ep, EPopupItem *pitem, gpointer data) +void +gw_resend_meeting_cb (GtkAction *action, EShellView *shell_view) { - ECalendarView *cal_view = c_view; GList *selected; + ECalendarView *cal_view = get_calendar_view (shell_view); + + g_return_if_fail (cal_view != NULL); selected = e_calendar_view_get_selected_events (cal_view); if (selected) { diff --git a/plugins/groupwise-features/proxy-login.c b/plugins/groupwise-features/proxy-login.c index 123fc0641b..f230a880d3 100644 --- a/plugins/groupwise-features/proxy-login.c +++ b/plugins/groupwise-features/proxy-login.c @@ -30,11 +30,9 @@ #include <glade/glade.h> #include <libedataserverui/e-passwords.h> -#include <mail/mail-component.h> #include <mail/em-folder-tree.h> #include <mail/mail-config.h> #include <mail/em-folder-selector.h> -#include <mail/em-popup.h> #include <mail/em-account-editor.h> #include <camel/camel-url.h> #include <camel/camel-store.h> @@ -49,6 +47,8 @@ #include <e-gw-connection.h> #include <e-gw-message.h> #include <libedataserverui/e-name-selector.h> + +#include "gw-ui.h" #include "proxy-login.h" #define GW(name) glade_xml_get_widget (priv->xml, name) @@ -375,7 +375,6 @@ proxy_soap_login (gchar *email) static void proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data) { - MailComponent *component = mail_component_peek (); EAccount *account = user_data; gint permissions = GPOINTER_TO_INT(g_object_get_data ((GObject *)account, "permissions")); @@ -386,7 +385,7 @@ proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data) store->mode &= !CAMEL_STORE_WRITE; store->flags |= CAMEL_STORE_PROXY; - mail_component_add_store (component, store, account->name); + /*mail_component_add_store (mail_component_peek (), store, account->name);*/ } static void @@ -472,13 +471,36 @@ proxy_login_update_tree (void) } void -org_gnome_proxy_account_login (EPopup *ep, EPopupItem *p, gpointer data) +gw_proxy_login_cb (GtkAction *action, EShellView *shell_view) { - gchar *uri = data; + EShellSidebar *shell_sidebar; + EMFolderTree *folder_tree = NULL; + GtkTreeSelection *selection; + GtkTreeModel *model = NULL; + GtkTreeIter iter; + gboolean is_store = FALSE; + gchar *uri = NULL; proxyLoginPrivate *priv; EGwConnection *cnc; gchar *gladefile; + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); + g_return_if_fail (folder_tree != NULL); + + selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (folder_tree)); + g_return_if_fail (selection != NULL); + + if (!gtk_tree_selection_get_selected (selection, &model, &iter)) + return; + + gtk_tree_model_get (model, &iter, COL_STRING_URI, &uri, COL_BOOL_IS_STORE, &is_store, -1); + + if (!is_store || !uri) { + g_free (uri); + return; + } + /* This pops-up the password dialog in case the User has forgot-passwords explicitly */ cnc = proxy_login_get_cnc (mail_config_get_account_by_source_url (uri), NULL); if (cnc) @@ -504,35 +526,6 @@ org_gnome_proxy_account_login (EPopup *ep, EPopupItem *p, gpointer data) proxy_login_update_tree (); g_signal_connect (GTK_DIALOG (priv->main), "response", G_CALLBACK(proxy_login_cb), NULL); gtk_widget_show (GTK_WIDGET (priv->main)); - } - -static EPopupItem popup_items[] = { -/* To Translators: In this case, Proxy does not mean something like 'HTTP Proxy', but a groupwise - * feature by which one person can send/read mails/appointments using another person's identity - * without knowing his password, for example if that other person is on vacation */ - { E_POPUP_ITEM, (gchar *) "20.emc.04", (gchar *) N_("_Proxy Login..."), org_gnome_proxy_account_login, NULL, NULL, 0, EM_POPUP_FOLDER_STORE } -}; - -static void -popup_free (EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free (items); -} - -void -org_gnome_create_proxy_login_option (EPlugin *ep, EMPopupTargetFolder *t) -{ - EAccount *account; - GSList *menus = NULL; - gint i; - - account = mail_config_get_account_by_source_url (t->uri); - if (g_strrstr (t->uri,"groupwise://") && !account->parent_uid) { - popup_items[0].label = _(popup_items[0].label); - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); - e_popup_add_items (t->target.popup, menus, NULL, popup_free, t->uri); - } - return; + g_free (uri); } diff --git a/plugins/groupwise-features/proxy-login.h b/plugins/groupwise-features/proxy-login.h index 47c2b3b901..150684c140 100644 --- a/plugins/groupwise-features/proxy-login.h +++ b/plugins/groupwise-features/proxy-login.h @@ -55,11 +55,9 @@ proxyLogin * proxy_login_new (void); static void proxy_login_cb (GtkDialog *dialog, gint state); static void proxy_login_add_new_store (gchar *uri, CamelStore *store, gpointer user_data); static void proxy_login_setup_tree_view (void); -void org_gnome_proxy_account_login (EPopup *ep, EPopupItem *p, gpointer data); proxyLogin* proxy_dialog_new (void); static void proxy_soap_login (gchar *email); gchar *parse_email_for_name (gchar *email); static void proxy_login_update_tree (void); static void proxy_login_tree_view_changed_cb(GtkDialog *dialog); -void org_gnome_create_proxy_login_option(EPlugin *ep, EMPopupTargetFolder *t); static gint proxy_get_password (EAccount *account, gchar **user_name, gchar **password); diff --git a/plugins/groupwise-features/proxy.c b/plugins/groupwise-features/proxy.c index 91016a6126..a31b49112b 100644 --- a/plugins/groupwise-features/proxy.c +++ b/plugins/groupwise-features/proxy.c @@ -39,7 +39,6 @@ #include <mail/em-account-editor.h> #include <mail/em-config.h> -#include <mail/mail-component.h> #include <mail/mail-ops.h> #include <mail/mail-session.h> #include <libedataserver/e-account.h> diff --git a/plugins/groupwise-features/share-folder-common.c b/plugins/groupwise-features/share-folder-common.c index 791a2da541..3856fcc7a3 100644 --- a/plugins/groupwise-features/share-folder-common.c +++ b/plugins/groupwise-features/share-folder-common.c @@ -30,12 +30,10 @@ #include <glib/gi18n.h> #include <e-util/e-config.h> #include <mail/em-config.h> -#include <mail/em-popup.h> #include <mail/em-folder-properties.h> #include <mail/em-folder-tree.h> #include <mail/em-folder-selector.h> #include <mail/mail-mt.h> -#include <mail/mail-component.h> #include <mail/mail-config.h> #include <mail/mail-vfolder.h> #include <mail/em-vfolder-rule.h> @@ -48,7 +46,10 @@ #include <e-gw-container.h> #include <e-gw-connection.h> #include <glade/glade.h> +#include <shell/e-shell-sidebar.h> #include "share-folder.h" +#include "gw-ui.h" + #define d(x) ShareFolder *common = NULL; @@ -61,9 +62,6 @@ struct ShareInfo { }; GtkWidget * org_gnome_shared_folder_factory (EPlugin *ep, EConfigHookItemFactoryData *hook_data); -void org_gnome_create_option(EPlugin *ep, EMPopupTargetFolder *target); -static void create_shared_folder(EPopup *ep, EPopupItem *p, gpointer data); -static void popup_free (EPopup *ep, GSList *items, gpointer data); void shared_folder_commit (EPlugin *ep, EConfigTarget *tget); void shared_folder_abort (EPlugin *ep, EConfigTarget *target); @@ -103,7 +101,7 @@ shared_folder_commit (EPlugin *ep, EConfigTarget *tget) EMConfigTargetFolder *target = (EMConfigTargetFolder *)tget->config->target; CamelFolder *folder = target->folder; CamelStore *store = folder->parent_store; - EMFolderTreeModel *model = mail_component_peek_tree_model (mail_component_peek ()); + EMFolderTreeModel *model = NULL; /*mail_component_peek_tree_model (mail_component_peek ())*/; if (common) { share_folder (common); refresh_folder_tree (model, store); @@ -265,7 +263,7 @@ users_dialog_response(GtkWidget *dialog, gint response, struct ShareInfo *ssi) return; } - if (!(si = g_hash_table_lookup ((ssi->model)->store_hash, store))) { + if (!(si = em_folder_tree_model_lookup_store_info (ssi->model, store))) { g_assert_not_reached (); camel_object_unref (store); return; @@ -336,61 +334,31 @@ new_folder_response (EMFolderSelector *emfs, gint response, EMFolderTreeModel *m } -static EPopupItem popup_items[] = { - { E_POPUP_ITEM, (gchar *) "20.emc.001", (gchar *) N_("New _Shared Folder..."), create_shared_folder, NULL, (gchar *) "folder-new", 0, EM_POPUP_FOLDER_INFERIORS } -}; - -static void -popup_free (EPopup *ep, GSList *items, gpointer data) -{ -g_slist_free (items); -} - void -org_gnome_create_option(EPlugin *ep, EMPopupTargetFolder *t) -{ - GSList *menus = NULL; - gint i = 0; - static gint first = 0; - - if (! g_strrstr (t->uri, "groupwise://")) - return; - - /* for translation*/ - if (!first) { - popup_items[0].label = _(popup_items[0].label); - - } - - first++; - - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); - - e_popup_add_items (t->target.popup, menus, NULL, popup_free, NULL); - -} - -static void -create_shared_folder(EPopup *ep, EPopupItem *p, gpointer data) +gw_new_shared_folder_cb (GtkAction *action, EShellView *shell_view) { - - EMFolderTreeModel *model; - EMFolderTree *folder_tree; + EShellSidebar *shell_sidebar; + EMFolderTree *folder_tree = NULL; GtkWidget *dialog; gchar *uri; + gpointer parent; + + parent = e_shell_view_get_shell_window (shell_view); - model = mail_component_peek_tree_model (mail_component_peek ()); - folder_tree = (EMFolderTree *) em_folder_tree_new_with_model (model); + shell_sidebar = e_shell_view_get_shell_sidebar (shell_view); + g_object_get (shell_sidebar, "folder-tree", &folder_tree, NULL); - 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); + dialog = em_folder_selector_create_new (parent, folder_tree, 0, _("Create folder"), _("Specify where to create the folder:")); + uri = em_folder_tree_get_selected_uri (folder_tree); + if (uri != NULL) + em_folder_selector_set_selected ((EMFolderSelector *) dialog, uri); g_free(uri); - g_signal_connect (dialog, "response", G_CALLBACK (new_folder_response), model); + + g_signal_connect (dialog, "response", G_CALLBACK (new_folder_response), gtk_tree_view_get_model (GTK_TREE_VIEW (folder_tree))); gtk_window_set_title (GTK_WINDOW (dialog), "New Shared Folder" ); gtk_widget_show(dialog); + g_object_unref (folder_tree); } GtkWidget * diff --git a/plugins/groupwise-features/status-track.c b/plugins/groupwise-features/status-track.c index 5507568809..e38497823b 100644 --- a/plugins/groupwise-features/status-track.c +++ b/plugins/groupwise-features/status-track.c @@ -32,17 +32,17 @@ #include <time.h> #include <gtk/gtk.h> -#include "camel/camel-folder.h" -#include "camel/camel-mime-utils.h" -#include "camel/camel-medium.h" -#include "camel/camel-mime-message.h" -#include <mail/em-popup.h> -#include <mail/em-folder-view.h> +#include <camel/camel-folder.h> +#include <camel/camel-mime-utils.h> +#include <camel/camel-medium.h> +#include <camel/camel-mime-message.h> + +#include <mail/e-mail-reader.h> #include <e-gw-connection.h> -#include "share-folder.h" -void org_gnome_track_status (gpointer ep, EMPopupTargetSelect *t); +#include "gw-ui.h" +#include "share-folder.h" static gchar * format_date (const gchar * value) @@ -57,11 +57,40 @@ format_date (const gchar * value) return str; } -static void -track_status (EPopup *ep, EPopupItem *item, gpointer data) +static CamelMimeMessage * +get_selected_message (EShellView *shell_view, CamelFolder **folder, gchar **selected_uid) { - EMPopupTargetSelect *t = (EMPopupTargetSelect *)data; CamelMimeMessage *msg = NULL; + EShellContent *shell_content; + EMailReader *reader; + MessageList *message_list; + GPtrArray *selected; + + shell_content = e_shell_view_get_shell_content (shell_view); + + reader = (EMailReader *) (shell_content); + message_list = e_mail_reader_get_message_list (reader); + g_return_val_if_fail (message_list != NULL, NULL); + + selected = message_list_get_selected (message_list); + if (selected && selected->len == 1) { + *folder = message_list->folder; + *selected_uid = g_strdup (g_ptr_array_index (selected, 0)); + + msg = camel_folder_get_message (*folder, *selected_uid, NULL); + } + + message_list_free_uids (message_list, selected); + + return msg; +} + +void +gw_track_message_status_cb (GtkAction *action, EShellView *shell_view) +{ + CamelMimeMessage *msg = NULL; + CamelFolder *folder = NULL; + gchar *selected_uid = NULL; const CamelInternetAddress *from; const gchar *namep, *addp; @@ -81,14 +110,15 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data) EGwConnection *cnc; EGwItem *gwitem; - /*Get message*/ - msg = camel_folder_get_message (t->folder, g_ptr_array_index (t->uids, 0), NULL); + /* Get message */ + msg = get_selected_message (shell_view, &folder, &selected_uid); if (!msg) { g_print ("Error!! No message\n"); + g_free (selected_uid); return; } - /*Create the dialog*/ + /* Create the dialog */ d = (GtkDialog *) gtk_dialog_new (); gtk_dialog_add_button (d, GTK_STOCK_OK, GTK_RESPONSE_OK); gtk_window_set_title (GTK_WINDOW (d), _("Message Status")); @@ -104,7 +134,7 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data) gtk_table_set_col_spacings (table ,12); gtk_table_set_row_spacings (table, 6); - /*Subject*/ + /* Subject */ boldmsg = g_strdup_printf ("<b>%s</b>", _("Subject:")); widget = gtk_label_new (boldmsg); g_free (boldmsg); @@ -116,7 +146,7 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data) gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0); row++; - /*From*/ + /* From */ from = camel_mime_message_get_from (msg); camel_internet_address_get (from, 0, &namep, &addp); boldmsg = g_strdup_printf ("<b>%s</b>", _("From:")); @@ -130,7 +160,7 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data) gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0); row++; - /*creation date*/ + /* creation date */ time = camel_mime_message_get_date (msg, NULL); time_str = ctime (&time); time_str[strlen(time_str)-1] = '\0' ; @@ -145,22 +175,22 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data) gtk_table_attach (table, widget , 1, 2, row, row + 1, GTK_FILL, 0, 0, 0); row++; - /*spacing*/ + /* spacing */ widget = gtk_label_new (""); gtk_table_attach (table, widget, 0, 1, row, row + 1, GTK_FILL, 0, 0, 0); row++; - /*Table headers*/ + /* Table headers */ row = 0; table = (GtkTable *) gtk_table_new (1, 3, FALSE); gtk_table_set_col_spacings (table ,12); gtk_table_set_row_spacings (table, 6); gtk_box_pack_start (GTK_BOX (vbox), GTK_WIDGET (table), FALSE, TRUE, 0); - cnc = get_cnc (t->folder->parent_store); + cnc = get_cnc (folder->parent_store); if (E_IS_GW_CONNECTION(cnc)) { GSList *recipient_list; - e_gw_connection_get_item (cnc, get_container_id (cnc, "Sent Items"), g_ptr_array_index (t->uids, 0), "distribution recipientStatus", &gwitem); + e_gw_connection_get_item (cnc, get_container_id (cnc, "Sent Items"), selected_uid, "distribution recipientStatus", &gwitem); recipient_list = e_gw_item_get_recipient_list (gwitem); for (;recipient_list != NULL; recipient_list = recipient_list->next) { @@ -225,46 +255,13 @@ track_status (EPopup *ep, EPopupItem *item, gpointer data) } } - /*set size and display the dialog*/ + /* set size and display the dialog */ gtk_widget_set_size_request (GTK_WIDGET (win), 400, 300); gtk_widget_show_all (GTK_WIDGET (d)); if (gtk_dialog_run (d) == GTK_RESPONSE_OK) gtk_widget_destroy (GTK_WIDGET (d)); else gtk_widget_destroy (GTK_WIDGET (d)); -} - -static EPopupItem popup_items[] = { - { E_POPUP_ITEM, (gchar * ) "20.emfv.02", (gchar *) N_("Track Message Status..."), track_status, NULL, NULL, 0, EM_POPUP_SELECT_ONE|EM_FOLDER_VIEW_SELECT_LISTONLY} -}; - -static void -popup_free (EPopup *ep, GSList *items, gpointer data) -{ - g_slist_free (items); -} - -void org_gnome_track_status (gpointer ep, EMPopupTargetSelect *t) -{ - GSList *menus = NULL; - - gint i = 0; - static gint first = 0; - - if (! g_strrstr (t->uri, "groupwise://") || g_ascii_strncasecmp ((t->folder)->full_name, "Sent Items", 10)) - return; - - /* for translation*/ - if (!first) { - popup_items[0].label = _(popup_items[0].label); - - } - - first++; - - for (i = 0; i < sizeof (popup_items) / sizeof (popup_items[0]); i++) - menus = g_slist_prepend (menus, &popup_items[i]); - - e_popup_add_items (t->target.popup, menus, NULL, popup_free, t); + g_free (selected_uid); } diff --git a/po/POTFILES.in b/po/POTFILES.in index bf4ec0ed90..62c654cdfc 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -344,8 +344,7 @@ plugins/face/org-gnome-face.eplug.xml plugins/google-account-setup/google-contacts-source.c plugins/google-account-setup/google-source.c plugins/google-account-setup/org-gnome-evolution-google.eplug.xml -plugins/groupwise-account-setup/camel-gw-listener.c -plugins/groupwise-account-setup/org-gnome-gw-account-setup.eplug.xml +plugins/groupwise-features/camel-gw-listener.c plugins/groupwise-features/install-shared.c plugins/groupwise-features/junk-mail-settings.c plugins/groupwise-features/junk-settings.c diff --git a/po/POTFILES.skip b/po/POTFILES.skip index 5957c69930..73865ab9cc 100644 --- a/po/POTFILES.skip +++ b/po/POTFILES.skip @@ -24,6 +24,7 @@ mail/importers/evolution-outlook-importer.c mail/importers/netscape-importer.c mail/message-tags.glade plugins/exchange-operations/exchange-operations.c +plugins/groupwise-features/groupwise-account-setup.c plugins/ipod-sync/sync.c plugins/mailing-list-actions/org-gnome-mailing-list-actions.xml shell/importer/import.glade diff --git a/ui/evolution-calendars.ui b/ui/evolution-calendars.ui index 29546490f5..f7170656fe 100644 --- a/ui/evolution-calendars.ui +++ b/ui/evolution-calendars.ui @@ -92,6 +92,8 @@ <menuitem action='event-popup-delete'/> <menuitem action='event-popup-delete-occurrence'/> <menuitem action='event-popup-delete-occurrence-all'/> + <separator/> + <placeholder name='event-popup-actions'/> </popup> <popup name='calendar-memopad-popup'> <menuitem action='calendar-memopad-new'/> |