From 49cd4f549b73059b273ce9a0a2b95bc7770a4f1c Mon Sep 17 00:00:00 2001 From: Vibha Yadav Date: Wed, 4 May 2011 17:34:48 +0530 Subject: Bug 649365 - Creation of new repository evolution-groupwise Removing groupwise plugin code from evolution. --- plugins/groupwise-features/Makefile.am | 97 -- plugins/groupwise-features/addressbook-groupwise.c | 69 -- plugins/groupwise-features/camel-gw-listener.c | 1043 -------------------- plugins/groupwise-features/camel-gw-listener.h | 58 -- .../groupwise-features/groupwise-account-setup.c | 138 --- plugins/groupwise-features/gw-ui.c | 459 --------- plugins/groupwise-features/gw-ui.h | 38 - plugins/groupwise-features/install-shared.c | 274 ----- plugins/groupwise-features/junk-mail-settings.c | 119 --- plugins/groupwise-features/junk-settings.c | 428 -------- plugins/groupwise-features/junk-settings.h | 82 -- plugins/groupwise-features/junk-settings.ui | 458 --------- plugins/groupwise-features/mail-retract.c | 119 --- plugins/groupwise-features/mail-send-options.c | 246 ----- plugins/groupwise-features/mail-send-options.h | 43 - plugins/groupwise-features/notification.ui | 216 ---- .../org-gnome-compose-send-options.xml | 17 - .../org-gnome-groupwise-features.eplug.xml | 108 -- .../org-gnome-mail-retract.error.xml | 8 - .../org-gnome-process-meeting.error.xml | 44 - .../org-gnome-proxy-login.error.xml | 16 - .../groupwise-features/org-gnome-proxy.error.xml | 27 - .../org-gnome-shared-folder.error.xml | 19 - plugins/groupwise-features/process-meeting.c | 442 --------- plugins/groupwise-features/properties.ui | 756 -------------- plugins/groupwise-features/proxy-add-dialog.ui | 730 -------------- plugins/groupwise-features/proxy-listing.ui | 153 --- plugins/groupwise-features/proxy-login-dialog.ui | 191 ---- plugins/groupwise-features/proxy-login.c | 563 ----------- plugins/groupwise-features/proxy-login.h | 62 -- plugins/groupwise-features/proxy.c | 1034 ------------------- plugins/groupwise-features/proxy.h | 65 -- plugins/groupwise-features/send-options.c | 567 ----------- plugins/groupwise-features/share-folder-common.c | 519 ---------- plugins/groupwise-features/share-folder.c | 767 -------------- plugins/groupwise-features/share-folder.h | 100 -- plugins/groupwise-features/status-track.c | 271 ----- 37 files changed, 10346 deletions(-) delete mode 100644 plugins/groupwise-features/Makefile.am delete mode 100644 plugins/groupwise-features/addressbook-groupwise.c delete mode 100644 plugins/groupwise-features/camel-gw-listener.c delete mode 100644 plugins/groupwise-features/camel-gw-listener.h delete mode 100644 plugins/groupwise-features/groupwise-account-setup.c delete mode 100644 plugins/groupwise-features/gw-ui.c delete mode 100644 plugins/groupwise-features/gw-ui.h delete mode 100644 plugins/groupwise-features/install-shared.c delete mode 100644 plugins/groupwise-features/junk-mail-settings.c delete mode 100644 plugins/groupwise-features/junk-settings.c delete mode 100644 plugins/groupwise-features/junk-settings.h delete mode 100644 plugins/groupwise-features/junk-settings.ui delete mode 100644 plugins/groupwise-features/mail-retract.c delete mode 100644 plugins/groupwise-features/mail-send-options.c delete mode 100644 plugins/groupwise-features/mail-send-options.h delete mode 100644 plugins/groupwise-features/notification.ui delete mode 100644 plugins/groupwise-features/org-gnome-compose-send-options.xml delete mode 100644 plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml delete mode 100644 plugins/groupwise-features/org-gnome-mail-retract.error.xml delete mode 100644 plugins/groupwise-features/org-gnome-process-meeting.error.xml delete mode 100644 plugins/groupwise-features/org-gnome-proxy-login.error.xml delete mode 100644 plugins/groupwise-features/org-gnome-proxy.error.xml delete mode 100644 plugins/groupwise-features/org-gnome-shared-folder.error.xml delete mode 100644 plugins/groupwise-features/process-meeting.c delete mode 100644 plugins/groupwise-features/properties.ui delete mode 100644 plugins/groupwise-features/proxy-add-dialog.ui delete mode 100644 plugins/groupwise-features/proxy-listing.ui delete mode 100644 plugins/groupwise-features/proxy-login-dialog.ui delete mode 100644 plugins/groupwise-features/proxy-login.c delete mode 100644 plugins/groupwise-features/proxy-login.h delete mode 100644 plugins/groupwise-features/proxy.c delete mode 100644 plugins/groupwise-features/proxy.h delete mode 100644 plugins/groupwise-features/send-options.c delete mode 100644 plugins/groupwise-features/share-folder-common.c delete mode 100644 plugins/groupwise-features/share-folder.c delete mode 100644 plugins/groupwise-features/share-folder.h delete mode 100644 plugins/groupwise-features/status-track.c (limited to 'plugins') diff --git a/plugins/groupwise-features/Makefile.am b/plugins/groupwise-features/Makefile.am deleted file mode 100644 index 848f5bfc09..0000000000 --- a/plugins/groupwise-features/Makefile.am +++ /dev/null @@ -1,97 +0,0 @@ -if OS_WIN32 -NO_UNDEFINED_REQUIRED_LIBS = $(top_builddir)/mail/libevolution-mail.la -endif - -@EVO_PLUGIN_RULE@ - -plugin_DATA = org-gnome-groupwise-features.eplug org-gnome-compose-send-options.xml - -plugin_LTLIBRARIES = liborg-gnome-groupwise-features.la - -liborg_gnome_groupwise_features_la_CPPFLAGS = \ - $(AM_CPPFLAGS) \ - -I$(top_srcdir) \ - -I$(top_srcdir)/widgets \ - -I$(top_srcdir)/widgets/misc \ - -I$(top_builddir)/composer \ - -I$(top_builddir)/mail \ - $(EVOLUTION_MAIL_CFLAGS) \ - $(EVOLUTION_CALENDAR_CFLAGS) \ - $(EVOLUTION_ADDRESSBOOK_CFLAGS) \ - $(CAMEL_GROUPWISE_CFLAGS) \ - $(GNOME_PLATFORM_CFLAGS) \ - -DEVOLUTION_UIDIR=\""$(uidir)"\" \ - -DEVOLUTION_IMAGESDIR=\""$(imagesdir)"\" - -liborg_gnome_groupwise_features_la_SOURCES = \ - gw-ui.h \ - gw-ui.c \ - share-folder-common.c \ - share-folder.c \ - share-folder.h \ - install-shared.c \ - send-options.c \ - mail-send-options.c \ - mail-send-options.h \ - status-track.c \ - addressbook-groupwise.c \ - junk-mail-settings.c \ - junk-settings.c \ - junk-settings.h \ - proxy.h \ - proxy.c \ - proxy-login.h \ - proxy-login.c \ - process-meeting.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)/composer/libcomposer.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) \ - $(GNOME_PLATFORM_LIBS) - -liborg_gnome_groupwise_features_la_LDFLAGS = -module -avoid-version $(NO_UNDEFINED) - -ui_DATA = \ - properties.ui \ - notification.ui \ - junk-settings.ui \ - proxy-add-dialog.ui \ - proxy-listing.ui \ - proxy-login-dialog.ui - -error_DATA = \ - org-gnome-shared-folder.error \ - org-gnome-proxy.error \ - org-gnome-proxy-login.error \ - org-gnome-process-meeting.error \ - org-gnome-mail-retract.error - -errordir = $(privdatadir)/errors - -BUILT_SOURCES = org-gnome-groupwise-features.eplug $(error_DATA) - -EXTRA_DIST = \ - $(ui_DATA) \ - org-gnome-compose-send-options.xml \ - org-gnome-groupwise-features.eplug.xml \ - org-gnome-shared-folder.error.xml \ - org-gnome-process-meeting.error.xml \ - org-gnome-proxy.error.xml \ - org-gnome-proxy-login.error.xml \ - org-gnome-mail-retract.error.xml - -CLEANFILES = $(BUILT_SOURCES) - --include $(top_srcdir)/git.mk diff --git a/plugins/groupwise-features/addressbook-groupwise.c b/plugins/groupwise-features/addressbook-groupwise.c deleted file mode 100644 index 8dda4dca40..0000000000 --- a/plugins/groupwise-features/addressbook-groupwise.c +++ /dev/null @@ -1,69 +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 - * - * - * Authors: - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include -#include -#include -#include -#include -#include -#include - -void commit_groupwise_addressbook (EPlugin *epl, EConfigTarget *target); -GtkWidget *e_book_groupwise_dummy (EPlugin *epl, EConfigHookItemFactoryData *data); - -void -commit_groupwise_addressbook (EPlugin *epl, EConfigTarget *target) -{ - EABConfigTargetSource *t = (EABConfigTargetSource *) target; - ESource *source = t->source; - gchar *uri_text; - ESourceGroup *source_group; - gchar *relative_uri; - GSList *l; - - uri_text = e_source_get_uri (source); - if (strncmp (uri_text, "groupwise", 9)) { - g_free (uri_text); - - return; - } - e_source_set_property (source, "auth-domain", "Groupwise"); - relative_uri = g_strconcat (";", e_source_peek_name (source), NULL); - e_source_set_relative_uri (source, relative_uri); - g_free (relative_uri); - - source_group = e_source_peek_group (source); - l = e_source_group_peek_sources (source_group); - if (l && l->data ) { - e_source_set_property(source, "auth", e_source_get_property(l->data, "auth")); - e_source_set_property(source, "user", e_source_get_property(l->data, "user")); - e_source_set_property(source, "use_ssl", e_source_get_property(l->data, "use_ssl")); - e_source_set_property(source, "port", e_source_get_property(l->data, "port")); - } -} - -GtkWidget * -e_book_groupwise_dummy (EPlugin *epl, EConfigHookItemFactoryData *data) -{ - - return NULL; -} diff --git a/plugins/groupwise-features/camel-gw-listener.c b/plugins/groupwise-features/camel-gw-listener.c deleted file mode 100644 index ed73953098..0000000000 --- a/plugins/groupwise-features/camel-gw-listener.c +++ /dev/null @@ -1,1043 +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 - * - * - * Authors: - * Sivaiah Nallagatla - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include "camel-gw-listener.h" -#include -#include -#include -#include -#include -#include "e-util/e-alert-dialog.h" -#include -#include -#include - -/*stores some info about all currently existing groupwise accounts - list of GwAccountInfo structures */ - -static GList *groupwise_accounts = NULL; - -struct _CamelGwListenerPrivate { - GConfClient *gconf_client; - /* we get notification about mail account changes form this object */ - EAccountList *account_list; -}; - -struct _GwAccountInfo { - gchar *uid; - gchar *name; - gchar *source_url; - gboolean auto_check; - guint auto_check_time; -}; - -typedef struct _GwAccountInfo GwAccountInfo; - -#define GROUPWISE_URI_PREFIX "groupwise://" -#define GROUPWISE_PREFIX_LENGTH 12 - -#define PARENT_TYPE G_TYPE_OBJECT - -static GObjectClass *parent_class = NULL; - -static void dispose (GObject *object); -static void finalize (GObject *object); - -static void -camel_gw_listener_class_init (CamelGwListenerClass *class) -{ - GObjectClass *object_class; - - parent_class = g_type_class_ref (PARENT_TYPE); - object_class = G_OBJECT_CLASS (class); - - /* virtual method override */ - object_class->dispose = dispose; - object_class->finalize = finalize; -} - -static void -camel_gw_listener_init (CamelGwListener *config_listener, CamelGwListenerClass *class) -{ - config_listener->priv = g_new0 (CamelGwListenerPrivate, 1); -} - -static void -dispose (GObject *object) -{ - CamelGwListener *config_listener = CAMEL_GW_LISTENER (object); - - g_object_unref (config_listener->priv->gconf_client); - g_object_unref (config_listener->priv->account_list); - - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -finalize (GObject *object) -{ - CamelGwListener *config_listener = CAMEL_GW_LISTENER (object); - GList *list; - GwAccountInfo *info; - - if (config_listener->priv) { - g_free (config_listener->priv); - } - - for (list = g_list_first (groupwise_accounts); list; list = g_list_next (list)) { - - info = (GwAccountInfo *) (list->data); - - if (info) { - - g_free (info->uid); - g_free (info->name); - g_free (info->source_url); - g_free (info); - } - } - - g_list_free (groupwise_accounts); - - G_OBJECT_CLASS (parent_class)->finalize (object); -} - -/*determines whehter the passed in account is groupwise or not by looking at source url */ - -static gboolean -is_groupwise_account (EAccount *account) -{ - if (account->source->url != NULL) { - return (strncmp (account->source->url, GROUPWISE_URI_PREFIX, GROUPWISE_PREFIX_LENGTH ) == 0); - } else { - return FALSE; - } -} - -/* looks up for an existing groupwise account info in the groupwise_accounts list based on uid */ - -static GwAccountInfo* -lookup_account_info (const gchar *key) -{ - GList *list; - GwAccountInfo *info; - gint found = 0; - - if (!key) - return NULL; - - info = NULL; - - for (list = g_list_first (groupwise_accounts); list; list = g_list_next (list)) { - info = (GwAccountInfo *) (list->data); - found = (strcmp (info->uid, key) == 0); - if (found) - break; - } - if (found) - return info; - return NULL; -} - -#define CALENDAR_SOURCES "/apps/evolution/calendar/sources" -#define TASKS_SOURCES "/apps/evolution/tasks/sources" -#define NOTES_SOURCES "/apps/evolution/memos/sources" -#define SELECTED_CALENDARS "/apps/evolution/calendar/display/selected_calendars" -#define SELECTED_TASKS "/apps/evolution/calendar/tasks/selected_tasks" -#define SELECTED_NOTES "/apps/evolution/calendar/memos/selected_memos" - -static void -add_esource (const gchar *conf_key, GwAccountInfo *info, const gchar *source_name, CamelURL *url, const gchar * parent_id_name, gboolean can_create) -{ - ESourceList *source_list; - ESourceGroup *group; - ESource *source; - GConfClient* client; - GSList *ids, *temp; - const gchar *source_selection_key; - gchar *relative_uri; - const gchar *soap_port; - const gchar * use_ssl; - const gchar *poa_address; - const gchar *offline_sync; - const gchar *group_name; - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - - group_name = info->name; - - soap_port = camel_url_get_param (url, "soap_port"); - - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - - use_ssl = camel_url_get_param (url, "use_ssl"); - - offline_sync = camel_url_get_param (url, "offline_sync"); - - client = gconf_client_get_default (); - source_list = e_source_list_new_for_gconf (client, conf_key); - group = e_source_group_new (group_name, GROUPWISE_URI_PREFIX); - - if (!e_source_list_add_group (source_list, group, -1)) - return; - - if (!can_create) - e_source_group_set_property (group, "create_source", "no"); - - relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address); - source = e_source_new (source_name, relative_uri); - e_source_set_property (source, "auth", "1"); - e_source_set_property (source, "username", url->user); - e_source_set_property (source, "port", soap_port); - e_source_set_property (source, "auth-domain", "Groupwise"); - e_source_set_property (source, "use_ssl", use_ssl); - - if (info->auto_check) { - gchar *str = g_strdup_printf ("%d", info->auto_check_time); - - e_source_set_property (source, "refresh", str); - g_free (str); - } else - e_source_set_property (source, "refresh", NULL); - - e_source_set_property (source, "offline_sync", offline_sync ? "1" : "0" ); - e_source_set_property (source, "delete", "no"); - if (parent_id_name) { - e_source_set_property (source, "parent_id_name", parent_id_name); - e_source_set_color_spec (source, camel_url_get_param (url, "color")); - } else - e_source_set_color_spec (source, "#EEBC60"); - e_source_group_add_source (group, source, -1); - e_source_list_sync (source_list, NULL); - - if (!strcmp (conf_key, CALENDAR_SOURCES)) - source_selection_key = SELECTED_CALENDARS; - else if (!strcmp (conf_key, TASKS_SOURCES)) - source_selection_key = SELECTED_TASKS; - else if (!strcmp (conf_key, NOTES_SOURCES)) - source_selection_key = SELECTED_NOTES; - else - source_selection_key = NULL; - - if (source_selection_key) { - ids = gconf_client_get_list (client, source_selection_key , GCONF_VALUE_STRING, NULL); - ids = g_slist_append (ids, g_strdup (e_source_peek_uid (source))); - gconf_client_set_list (client, source_selection_key, GCONF_VALUE_STRING, ids, NULL); - temp = ids; - - for (; temp != NULL; temp = g_slist_next (temp)) - g_free (temp->data); - - g_slist_free (ids); - } - - g_object_unref (source); - g_object_unref (group); - g_object_unref (source_list); - g_object_unref (client); - g_free (relative_uri); -} - -static void -remove_esource (const gchar *conf_key, const gchar *group_name, gchar * source_name, const gchar * relative_uri) -{ - ESourceList *list; - GSList *groups; - gboolean found_group; - GConfClient* client; - GSList *ids; - GSList *node_tobe_deleted; - const gchar *source_selection_key; - - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, conf_key); - groups = e_source_list_peek_groups (list); - - found_group = FALSE; - - for (; groups != NULL && !found_group; groups = g_slist_next (groups)) { - ESourceGroup *group = E_SOURCE_GROUP (groups->data); - - if (strcmp (e_source_group_peek_name (group), group_name) == 0 && - strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX ) == 0) { - GSList *sources = e_source_group_peek_sources (group); - - for (; sources != NULL; sources = g_slist_next (sources)) { - ESource *source = E_SOURCE (sources->data); - const gchar *source_relative_uri; - - source_relative_uri = e_source_peek_relative_uri (source); - if (source_relative_uri == NULL) - continue; - if (strcmp (source_relative_uri, relative_uri) == 0) { - - if (!strcmp (conf_key, CALENDAR_SOURCES)) - source_selection_key = SELECTED_CALENDARS; - else if (!strcmp (conf_key, TASKS_SOURCES)) - source_selection_key = SELECTED_TASKS; - else if (!strcmp (conf_key, NOTES_SOURCES)) - source_selection_key = SELECTED_NOTES; - else source_selection_key = NULL; - if (source_selection_key) { - ids = gconf_client_get_list (client, source_selection_key , - GCONF_VALUE_STRING, NULL); - node_tobe_deleted = g_slist_find_custom (ids, e_source_peek_uid (source), (GCompareFunc) strcmp); - if (node_tobe_deleted) { - g_free (node_tobe_deleted->data); - ids = g_slist_delete_link (ids, node_tobe_deleted); - } - gconf_client_set_list (client, source_selection_key, - GCONF_VALUE_STRING, ids, NULL); - - } - e_source_list_remove_group (list, group); - e_source_list_sync (list, NULL); - found_group = TRUE; - break; - - } - } - - if (found_group) - break; - - } - - } - - g_object_unref (list); - g_object_unref (client); - -} - -/* looks up for e-source with having same info as old_account_info and changes its values passed in new values */ - -static void -modify_esource (const gchar * conf_key, GwAccountInfo *old_account_info, EAccount *a, CamelURL *new_url) -{ - ESourceList *list; - GSList *groups; - gchar *old_relative_uri; - CamelURL *url; - gboolean found_group; - GConfClient* client; - const gchar *poa_address; - const gchar *new_poa_address; - const gchar * new_group_name = a->name; - - url = camel_url_new (old_account_info->source_url, NULL); - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - new_poa_address = new_url->host; - - old_relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address); - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, conf_key); - groups = e_source_list_peek_groups (list); - - found_group = FALSE; - - for (; groups != NULL && !found_group; groups = g_slist_next (groups)) { - ESourceGroup *group = E_SOURCE_GROUP (groups->data); - - if (strcmp (e_source_group_peek_name (group), old_account_info->name) == 0 && - strcmp (e_source_group_peek_base_uri (group), GROUPWISE_URI_PREFIX) == 0) { - GSList *sources = e_source_group_peek_sources (group); - - for (; sources != NULL; sources = g_slist_next (sources)) { - ESource *source = E_SOURCE (sources->data); - const gchar *source_relative_uri; - - source_relative_uri = e_source_peek_relative_uri (source); - if (source_relative_uri == NULL) - continue; - if (strcmp (source_relative_uri, old_relative_uri) == 0) { - gchar *new_relative_uri; - - new_relative_uri = g_strdup_printf ("%s@%s/", new_url->user, new_poa_address); - e_source_group_set_name (group, new_group_name); - e_source_set_relative_uri (source, new_relative_uri); - e_source_set_property (source, "username", new_url->user); - e_source_set_property (source, "port", camel_url_get_param (new_url,"soap_port")); - e_source_set_property (source, "use_ssl", camel_url_get_param (url, "use_ssl")); - e_source_set_property (source, "offline_sync", camel_url_get_param (url, "offline_sync") ? "1" : "0"); - - if (a->source->auto_check) { - gchar *str = g_strdup_printf ("%d", a->source->auto_check_time); - - e_source_set_property (source, "refresh", str); - g_free (str); - } else - e_source_set_property (source, "refresh", NULL); - - e_source_list_sync (list, NULL); - found_group = TRUE; - g_free (new_relative_uri); - break; - } - } - - if (found_group) - break; - } - } - - g_object_unref (list); - g_object_unref (client); - camel_url_free (url); - g_free (old_relative_uri); - -} -/* add sources for calendar and tasks if the account added is groupwise account - adds the new account info to groupwise_accounts list */ - -static void -add_calendar_tasks_sources (GwAccountInfo *info) -{ - CamelURL *url; - - url = camel_url_new (info->source_url, NULL); - add_esource ("/apps/evolution/calendar/sources", info, _("Calendar"), url, NULL, FALSE); - add_esource ("/apps/evolution/tasks/sources", info, _("Tasks"), url, NULL, FALSE); - add_esource ("/apps/evolution/memos/sources", info, _("Notes"), url, NULL, TRUE); - - camel_url_free (url); - -} - -/* removes calendar and tasks sources if the account removed is groupwise account - removes the the account info from groupwise_account list */ - -static void -remove_calendar_tasks_sources (GwAccountInfo *info) -{ - CamelURL *url; - gchar *relative_uri; - const gchar *poa_address; - - url = camel_url_new (info->source_url, NULL); - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - - relative_uri = g_strdup_printf ("%s@%s/", url->user, poa_address); - remove_esource ("/apps/evolution/calendar/sources", info->name, _("Calendar"), relative_uri); - remove_esource ("/apps/evolution/tasks/sources", info->name, _("Checklist"), relative_uri); - remove_esource ("/apps/evolution/memos/sources", info->name, _("Notes"), relative_uri); - - camel_url_free (url); - g_free (relative_uri); - -} - -static GList* -get_addressbook_names_from_server (gchar *source_url) -{ - gchar *key; - EGwConnection *cnc; - gchar *password; - GList *book_list = NULL; - gint status, count = 0; - const gchar *soap_port; - CamelURL *url; - gboolean remember; - gchar *failed_auth = NULL; - gchar *prompt; - gchar *password_prompt; - gchar *uri; - const gchar *use_ssl; - const gchar *poa_address; - guint32 flags = E_PASSWORDS_REMEMBER_FOREVER|E_PASSWORDS_SECRET; - - url = camel_url_new (source_url, NULL); - if (url == NULL) { - return NULL; - } - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return NULL; - - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - use_ssl = camel_url_get_param (url, "use_ssl"); - - key = g_strdup_printf ("groupwise://%s@%s/", url->user, poa_address); - - if (use_ssl && g_str_equal (use_ssl, "always")) - uri = g_strdup_printf ("https://%s:%s/soap", poa_address, soap_port); - else - uri = g_strdup_printf ("http://%s:%s/soap", poa_address, soap_port); - - cnc = NULL; - - do { - count++; - /*we have to uncache the password before prompting again*/ - if (failed_auth) { - e_passwords_forget_password ("Groupwise", key); - password = NULL; - } - - password = e_passwords_get_password ("Groupwise", key); - if (!password) { - /* Translators: First %s is the server name, second %s is user name */ - password_prompt = g_strdup_printf (_("Enter password for %s (user %s)"), - poa_address, url->user); - prompt = g_strconcat (failed_auth ? failed_auth : "", password_prompt, NULL); - g_free (password_prompt); - password = e_passwords_ask_password (prompt, "Groupwise", key, prompt, - flags, &remember, - NULL); - g_free (prompt); - - if (!password) - break; - } - - cnc = e_gw_connection_new (uri, url->user, password); - g_free (password); - if (!E_IS_GW_CONNECTION (cnc)) { - if (count == 3) - break; - } - - failed_auth = _("Failed to authenticate.\n"); - flags |= E_PASSWORDS_REPROMPT; - } while (cnc == NULL); - - g_free (key); - - if (E_IS_GW_CONNECTION (cnc)) { - book_list = NULL; - status = e_gw_connection_get_address_book_list (cnc, &book_list); - if (status == E_GW_CONNECTION_STATUS_OK) - return book_list; - } - - /*FIXME: This error message should be relocated to addressbook and should reflect - * that it actually failed to get the addressbooks*/ - e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), - "mail:gw-accountsetup-error", poa_address, - NULL); - return NULL; -} - -static void -add_proxy_sources (GwAccountInfo *info, const gchar *parent_name) -{ - CamelURL *url; - gchar *color; - - url = camel_url_new (info->source_url, NULL); - - color = g_strdup_printf ("#%06X", g_random_int_range (0x100000, 0xffffaa)); - /* The above range is chosen so that the colors are neither too light nor too dark - and appealing in all the themes */ - - camel_url_set_param (url, "color", color); - - add_esource ("/apps/evolution/calendar/sources", info, _("Calendar"), url, parent_name, FALSE); - add_esource ("/apps/evolution/tasks/sources", info, _("Tasks"), url, parent_name, FALSE); - add_esource ("/apps/evolution/memos/sources", info, _("Notes"), url, parent_name, TRUE); - - g_free (color); - camel_url_free (url); -} - -static gboolean -add_addressbook_sources (EAccount *account) -{ - CamelURL *url; - ESourceList *list; - ESourceGroup *group; - ESource *source; - gchar *base_uri; - const gchar *soap_port; - GList *books_list, *temp_list; - GConfClient* client; - const gchar * use_ssl; - const gchar *poa_address; - gboolean is_frequent_contacts = FALSE, is_writable = FALSE; - - url = camel_url_new (account->source->url, NULL); - if (url == NULL) { - return FALSE; - } - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return FALSE; - - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - use_ssl = camel_url_get_param (url, "use_ssl"); - base_uri = g_strdup_printf ("groupwise://%s@%s", url->user, poa_address); - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, "/apps/evolution/addressbook/sources" ); - group = e_source_group_new (account->name, base_uri); - books_list = get_addressbook_names_from_server (account->source->url); - temp_list = books_list; - if (!temp_list) - return FALSE; - for (; temp_list != NULL; temp_list = g_list_next (temp_list)) { - const gchar *book_name = e_gw_container_get_name (E_GW_CONTAINER (temp_list->data)); - /* is_writable is set to TRUE if the book has isPersonal property, - * by e_gw_connection_get_address_book_list() - */ - is_writable = e_gw_container_get_is_writable (E_GW_CONTAINER (temp_list->data)); - if (is_writable && - !g_ascii_strncasecmp (book_name, "Novell GroupWise Address Book", strlen (book_name))) { - /* This is a hack to not to show multiple groupwise system address books - * if they are the personal address books with the name of system address book - * See http://bugzilla.gnome.org/show_bug.cgi?id=320119 - * and http://bugzilla.gnome.org/show_bug.cgi?id=309511 - */ - continue; - } - - if (!is_frequent_contacts) - is_frequent_contacts = e_gw_container_get_is_frequent_contacts (E_GW_CONTAINER (temp_list->data)); - source = e_source_new (book_name, g_strconcat (";",book_name, NULL)); - e_source_set_property (source, "auth", "plain/password"); - e_source_set_property (source, "auth-domain", "Groupwise"); - e_source_set_property (source, "port", soap_port); - e_source_set_property(source, "user", url->user); - /* mark system address book for offline usage */ - /* FIXME: add isPersonal flag to container and use that isFrequentContact - * properties, instead of using writable to distinguish between the - * system address book and other address books. - */ - if (!is_writable) - e_source_set_property (source, "offline_sync", "1"); - else - e_source_set_property (source, "offline_sync", - camel_url_get_param (url, "offline_sync") ? "1" : "0"); - if (!is_writable) - e_source_set_property (source, "completion", "true"); - if (is_frequent_contacts) - e_source_set_property (source, "completion", "true"); - e_source_set_property (source, "use_ssl", use_ssl); - e_source_group_add_source (group, source, -1); - g_object_unref (source); - } - e_source_list_add_group (list, group, -1); - e_source_list_sync (list, NULL); - g_object_unref (group); - g_object_unref (list); - g_object_unref (client); - g_free (base_uri); - - if (!is_frequent_contacts) { - /* display warning message */ - e_alert_run_dialog_for_args (e_shell_get_active_window (NULL), - "addressbook:gw-book-list-init", NULL); - } - return TRUE; -} - -static void -modify_addressbook_sources ( EAccount *account, GwAccountInfo *existing_account_info ) -{ - CamelURL *url; - ESourceList *list; - ESourceGroup *group; - GSList *groups; - gboolean found_group; - gboolean delete_group; - gchar *old_base_uri; - gchar *new_base_uri; - const gchar *soap_port; - const gchar *use_ssl; - GSList *sources; - ESource *source; - GConfClient *client; - const gchar *poa_address; - - url = camel_url_new (existing_account_info->source_url, NULL); - if (url == NULL) { - return; - } - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - - old_base_uri = g_strdup_printf ("groupwise://%s@%s", url->user, poa_address); - camel_url_free (url); - - url = camel_url_new (account->source->url, NULL); - if (url == NULL) - return; - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - new_base_uri = g_strdup_printf ("groupwise://%s@%s", url->user, poa_address); - soap_port = camel_url_get_param (url, "soap_port"); - if (!soap_port || strlen (soap_port) == 0) - soap_port = "7191"; - use_ssl = camel_url_get_param (url, "use_ssl"); - - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, "/apps/evolution/addressbook/sources" ); - groups = e_source_list_peek_groups (list); - delete_group = FALSE; - if (strcmp (old_base_uri, new_base_uri) != 0) - delete_group = TRUE; - group = NULL; - found_group = FALSE; - for (; groups != NULL && !found_group; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); - if ( strcmp ( e_source_group_peek_base_uri (group), old_base_uri) == 0 && strcmp (e_source_group_peek_name (group), existing_account_info->name) == 0) { - found_group = TRUE; - if (!delete_group) { - e_source_group_set_name (group, account->name); - sources = e_source_group_peek_sources (group); - for (; sources != NULL; sources = g_slist_next (sources)) { - source = E_SOURCE (sources->data); - e_source_set_property (source, "port", soap_port); - e_source_set_property (source, "use_ssl", use_ssl); - } - - e_source_list_sync (list, NULL); - } - - } - } - if (found_group && delete_group) { - e_source_list_remove_group (list, group); - e_source_list_sync (list, NULL); - g_object_unref (list); - list = NULL; - add_addressbook_sources (account); - } - g_free (old_base_uri); - if (list) - g_object_unref (list); - camel_url_free (url); - g_object_unref (client); - -} - -static void -remove_addressbook_sources (GwAccountInfo *existing_account_info) -{ - ESourceList *list; - ESourceGroup *group; - GSList *groups; - CamelURL *url; - gchar *base_uri; - GConfClient *client; - const gchar *poa_address; - - url = camel_url_new (existing_account_info->source_url, NULL); - if (url == NULL) { - return; - } - - poa_address = url->host; - if (!poa_address || strlen (poa_address) ==0) - return; - - base_uri = g_strdup_printf ("groupwise://%s@%s", url->user, poa_address); - client = gconf_client_get_default (); - list = e_source_list_new_for_gconf (client, "/apps/evolution/addressbook/sources" ); - groups = e_source_list_peek_groups (list); - - for (; groups != NULL; groups = g_slist_next (groups)) { - - group = E_SOURCE_GROUP (groups->data); - if ( strcmp ( e_source_group_peek_base_uri (group), base_uri) == 0 && strcmp (e_source_group_peek_name (group), existing_account_info->name) == 0) { - - e_source_list_remove_group (list, group); - e_source_list_sync (list, NULL); - break; - } - } - g_object_unref (list); - g_object_unref (client); - g_free (base_uri); - camel_url_free (url); - -} - -static void -account_added (EAccountList *account_listener, EAccount *account) -{ - - GwAccountInfo *info; - EAccount *parent; - gboolean status; - CamelURL *parent_url; - - if (!is_groupwise_account (account)) - return; - - info = g_new0 (GwAccountInfo, 1); - info->uid = g_strdup (account->uid); - info->name = g_strdup (account->name); - info->source_url = g_strdup (account->source->url); - info->auto_check = account->source->auto_check; - info->auto_check_time = account->source->auto_check_time; - if (account->parent_uid) { - parent = (EAccount *)e_account_list_find (account_listener, E_ACCOUNT_FIND_UID, account->parent_uid); - - if (!parent) - return; - - parent_url = camel_url_new (e_account_get_string (parent, E_ACCOUNT_SOURCE_URL), NULL); - add_proxy_sources (info, parent_url->user); - } else { - status = add_addressbook_sources (account); - - if (status) - add_calendar_tasks_sources (info); - } - groupwise_accounts = g_list_append (groupwise_accounts, info); -} - -static void -account_removed (EAccountList *account_listener, EAccount *account) -{ - GwAccountInfo *info; - - if (!is_groupwise_account (account)) - return; - - info = lookup_account_info (account->uid); - if (info == NULL) - return; - - remove_calendar_tasks_sources (info); - remove_addressbook_sources (info); - groupwise_accounts = g_list_remove (groupwise_accounts, info); - g_free (info->uid); - g_free (info->name); - g_free (info->source_url); - g_free (info); -} - -static void -account_changed (EAccountList *account_listener, EAccount *account) -{ - gboolean is_gw_account; - CamelURL *old_url, *new_url; - const gchar *old_soap_port, *new_soap_port; - GwAccountInfo *existing_account_info; - const gchar *old_use_ssl, *new_use_ssl; - const gchar *old_poa_address, *new_poa_address; - - is_gw_account = is_groupwise_account (account); - - existing_account_info = lookup_account_info (account->uid); - - if (existing_account_info == NULL && is_gw_account) { - - if (!account->enabled) - return; - - /* some account of other type is changed to Groupwise */ - account_added (account_listener, account); - - } else if ( existing_account_info != NULL && !is_gw_account) { - - /*Groupwise account is changed to some other type */ - remove_calendar_tasks_sources (existing_account_info); - remove_addressbook_sources (existing_account_info); - groupwise_accounts = g_list_remove (groupwise_accounts, existing_account_info); - g_free (existing_account_info->uid); - g_free (existing_account_info->name); - g_free (existing_account_info->source_url); - g_free (existing_account_info); - - } else if (existing_account_info != NULL && is_gw_account) { - - if (!account->enabled) { - account_removed (account_listener, account); - return; - } - - /* some info of groupwise account is changed . update the sources with new info if required */ - old_url = camel_url_new (existing_account_info->source_url, NULL); - old_poa_address = old_url->host; - old_soap_port = camel_url_get_param (old_url, "soap_port"); - old_use_ssl = camel_url_get_param (old_url, "use_ssl"); - new_url = camel_url_new (account->source->url, NULL); - new_poa_address = new_url->host; - - if (!new_poa_address || strlen (new_poa_address) ==0) - return; - - new_soap_port = camel_url_get_param (new_url, "soap_port"); - - if (!new_soap_port || strlen (new_soap_port) == 0) - new_soap_port = "7191"; - - new_use_ssl = camel_url_get_param (new_url, "use_ssl"); - - if ((old_poa_address && strcmp (old_poa_address, new_poa_address)) - || (old_soap_port && strcmp (old_soap_port, new_soap_port)) - || strcmp (old_url->user, new_url->user) - || (!old_use_ssl) - || strcmp (old_use_ssl, new_use_ssl)) { - - account_removed (account_listener, account); - account_added (account_listener, account); - } else if (strcmp (existing_account_info->name, account->name)) { - - modify_esource ("/apps/evolution/calendar/sources", existing_account_info, account, new_url); - modify_esource ("/apps/evolution/tasks/sources", existing_account_info, account, new_url); - modify_esource ("/apps/evolution/memos/sources", existing_account_info, account, new_url); - modify_addressbook_sources (account, existing_account_info); - - } - - g_free (existing_account_info->name); - g_free (existing_account_info->source_url); - existing_account_info->name = g_strdup (account->name); - existing_account_info->source_url = g_strdup (account->source->url); - camel_url_free (old_url); - camel_url_free (new_url); - } -} - -static void -prune_proxies (void) { - - EAccountList *account_list; - ESourceList *sources; - ESourceGroup *group; - GSList *groups, *e_sources, *l, *p; - ESource *source; - GError *err = NULL; - const gchar *parent_id_name = NULL; - gint i; - ECalSourceType types[] = { E_CAL_SOURCE_TYPE_EVENT, - E_CAL_SOURCE_TYPE_TODO, - E_CAL_SOURCE_TYPE_JOURNAL - }; - - account_list = e_get_account_list (); - e_account_list_prune_proxies (account_list); - - for (i=0; i<3; i++) { - if (e_cal_get_sources (&sources, types[i], &err)) { - /* peek groupwise id and prune for proxies. */ - groups = e_source_list_peek_groups (sources); - for (l = groups; l != NULL;) { - group = (ESourceGroup *) l->data; - l = l->next; - if (!strcmp (e_source_group_peek_base_uri (group), "groupwise://")) { - e_sources = e_source_group_peek_sources (group); - for (p = e_sources; p != NULL; p = p->next) { - source = (ESource *)p->data; - parent_id_name = e_source_get_property (source, "parent_id_name"); - if (parent_id_name) { - e_source_group_remove_source (group, source); - e_source_list_remove_group (sources, group); - break; - } - } - } - } - e_source_list_sync (sources, NULL); - } - } - -} -static void -camel_gw_listener_construct (CamelGwListener *config_listener) -{ - EIterator *iter; - EAccount *account; - GwAccountInfo *info; - - prune_proxies (); - - config_listener->priv->account_list = e_account_list_new (config_listener->priv->gconf_client); - - for (iter = e_list_get_iterator (E_LIST ( config_listener->priv->account_list) ); e_iterator_is_valid (iter); e_iterator_next (iter)) { - - account = E_ACCOUNT (e_iterator_get (iter)); - - if ( is_groupwise_account (account) && account->enabled) { - - info = g_new0 (GwAccountInfo, 1); - info->uid = g_strdup (account->uid); - info->name = g_strdup (account->name); - info->source_url = g_strdup (account->source->url); - groupwise_accounts = g_list_append (groupwise_accounts, info); - - } - - } - - g_signal_connect (config_listener->priv->account_list, "account_added", G_CALLBACK (account_added), NULL); - g_signal_connect (config_listener->priv->account_list, "account_changed", G_CALLBACK (account_changed), NULL); - g_signal_connect (config_listener->priv->account_list, "account_removed", G_CALLBACK (account_removed), NULL); -} - -GType -camel_gw_listener_get_type (void) -{ - static GType camel_gw_listener_type = 0; - - if (!camel_gw_listener_type) { - static GTypeInfo info = { - sizeof (CamelGwListenerClass), - (GBaseInitFunc) NULL, - (GBaseFinalizeFunc) NULL, - (GClassInitFunc) camel_gw_listener_class_init, - NULL, NULL, - sizeof (CamelGwListener), - 0, - (GInstanceInitFunc) camel_gw_listener_init - }; - camel_gw_listener_type = g_type_register_static (PARENT_TYPE, "CamelGwListener", &info, 0); - } - - return camel_gw_listener_type; -} - -CamelGwListener* -camel_gw_listener_new (void) -{ - CamelGwListener *config_listener; - - config_listener = g_object_new (CAMEL_TYPE_GW_LISTENER, NULL); - config_listener->priv->gconf_client = gconf_client_get_default (); - - camel_gw_listener_construct (config_listener); - - return config_listener; -} diff --git a/plugins/groupwise-features/camel-gw-listener.h b/plugins/groupwise-features/camel-gw-listener.h deleted file mode 100644 index cc545def61..0000000000 --- a/plugins/groupwise-features/camel-gw-listener.h +++ /dev/null @@ -1,58 +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 - * - * - * Authors: - * Sivaiah Nallagatla - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef CAMEL_GW_LISTENER_H -#define CAMEL_GW_LISTENER_H - -#include -#include -#include - -G_BEGIN_DECLS - -#define CAMEL_TYPE_GW_LISTENER (camel_gw_listener_get_type ()) -#define CAMEL_GW_LISTENER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CAMEL_TYPE_GW_LISTENER, CamelGwListener)) -#define CAMEL_GW_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CAMEL_TYPE_GW_LISTENER, CamelGWListenerClass)) -#define CAMEL_IS_GWLISTENER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CAMEL_TYPE_GW_LISTENER)) -#define CAMEL_IS_GW_LISTENER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((obj), CAMEL_TYPE_GW_LISTENER)) - -typedef struct _CamelGwListener CamelGwListener; -typedef struct _CamelGwListenerClass CamelGwListenerClass; -typedef struct _CamelGwListenerPrivate CamelGwListenerPrivate; - -struct _CamelGwListener { - GObject parent; - - CamelGwListenerPrivate *priv; -}; - -struct _CamelGwListenerClass { - GObjectClass parent_class; -}; - -GType camel_gw_listener_get_type (void); -CamelGwListener *camel_gw_listener_new (void); - -G_END_DECLS - -#endif diff --git a/plugins/groupwise-features/groupwise-account-setup.c b/plugins/groupwise-features/groupwise-account-setup.c deleted file mode 100644 index f232bab055..0000000000 --- a/plugins/groupwise-features/groupwise-account-setup.c +++ /dev/null @@ -1,138 +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 - * - * - * Authors: - * Sivaiah Nallagatla - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include "camel-gw-listener.h" -#include -#include "mail/em-config.h" -#include -#include "shell/es-event.h" -#include -#include - -#define GROUPWISE_BASE_URI "groupwise://" - -static CamelGwListener *config_listener = NULL; - -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); - -static gboolean -is_groupwise_account (EAccount *account) -{ - if (account->source->url != NULL) { - return g_str_has_prefix (account->source->url, GROUPWISE_BASE_URI); - } else { - return FALSE; - } -} - -static void -set_esource_props (const gchar *path, EAccount *a, GConfClient *client, const gchar *name) -{ - ESourceList *list; - GSList *groups; - - list = e_source_list_new_for_gconf (client, path); - groups = e_source_list_peek_groups (list); - - for (; groups != NULL; groups = g_slist_next (groups)) { - ESourceGroup *group = E_SOURCE_GROUP (groups->data); - - if (strcmp (e_source_group_peek_name (group), name) == 0 && - strcmp (e_source_group_peek_base_uri (group), GROUPWISE_BASE_URI) == 0) { - GSList *sources = e_source_group_peek_sources (group); - - for (; sources != NULL; sources = g_slist_next (sources)) { - ESource *source = E_SOURCE (sources->data); - - if (a->source->auto_check) { - gchar *str = g_strdup_printf ("%d",a->source->auto_check_time); - - e_source_set_property (source, "refresh", str); - g_free (str); - } else - e_source_set_property (source, "refresh", NULL); - break; - } - } - } - e_source_list_sync (list, NULL); - - g_object_unref (list); -} - -void -ensure_mandatory_esource_properties (EPlugin *ep, ESEventTargetUpgrade *target) -{ - GConfClient* client; - EAccountList *al; - EIterator *it; - - al = e_get_account_list (); - client = gconf_client_get_default (); - - for (it = e_list_get_iterator ((EList *)al); - e_iterator_is_valid (it); - e_iterator_next (it)) { - EAccount *a; - - a = (EAccount *) e_iterator_get (it); - if (!a->enabled || !is_groupwise_account (a)) - continue; - set_esource_props ("/apps/evolution/calendar/sources", a, client, a->name); - set_esource_props ("/apps/evolution/tasks/sources", a, client, a->name); - set_esource_props ("/apps/evolution/memos/sources", a, client, a->name); - } - g_object_unref (client); -} - -static void -free_groupwise_listener ( void ) -{ - g_object_unref (config_listener); -} - -gint -e_plugin_lib_enable (EPlugin *ep, gint enable) -{ - if (!config_listener) { - config_listener = camel_gw_listener_new (); - g_atexit ( free_groupwise_listener ); - } - - return 0; -} - -GtkWidget * org_gnome_groupwise_account_setup (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data); - -GtkWidget * -org_gnome_groupwise_account_setup (struct _EPlugin *epl, struct _EConfigHookItemFactoryData *data) -{ - if (data->old) - return data->old; - /* FIXME, with new soap camel provider we don't need extra settings in receiving options page, Remove them - from camel-groupwise-provider.c once soap provider is ready and add any groupwise sepcific settings like "add contacts automatically to Frequent contacts folder" here*/ - - return NULL; -} diff --git a/plugins/groupwise-features/gw-ui.c b/plugins/groupwise-features/gw-ui.c deleted file mode 100644 index 08b9382838..0000000000 --- a/plugins/groupwise-features/gw-ui.c +++ /dev/null @@ -1,459 +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 - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include -#include - -#include - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include - -#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; - GPtrArray *uids; - - shell_content = e_shell_view_get_shell_content (shell_view); - - reader = E_MAIL_READER (shell_content); - uids = e_mail_reader_get_selected_uids (reader); - - if (uids) - n_selected = uids->len; - - em_utils_uids_free (uids); - - 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 = itip_address_is_user (strip); - - 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 = is_comp_data_valid (event) ? 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 deleted file mode 100644 index d8ed509e99..0000000000 --- a/plugins/groupwise-features/gw-ui.h +++ /dev/null @@ -1,38 +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 - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef GW_UI_HEADER -#define GW_UI_HEADER - -#include -#include - -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 deleted file mode 100644 index 6d290d0993..0000000000 --- a/plugins/groupwise-features/install-shared.c +++ /dev/null @@ -1,274 +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 - * - * - * Authors: - * Vivek Jain - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -struct AcceptData { - CamelMimeMessage *msg; - EMFolderTreeModel *model; -}; - -void org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target); - -static void -install_folder_response (EMFolderSelector *emfs, gint response, gpointer *data) -{ - struct AcceptData *accept_data = (struct AcceptData *)data; - EMFolderTreeModel *model; - const gchar *uri, *path; - gint parts = 0; - gchar **names; - gchar *folder_name; - gchar *parent_name; - gchar *container_id; - const gchar *item_id; - CamelService *service = NULL; - CamelFolder *folder; - EAccount *account; - CamelProvider *provider; - EGwConnection *cnc; - - if (response == GTK_RESPONSE_CANCEL) { - gtk_widget_destroy (GTK_WIDGET (emfs)); - } else { - CamelSession *session; - CamelURL *url; - 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); - path = em_folder_selector_get_selected_path (emfs); - names = g_strsplit (path, "/", -1); - if (names == NULL) { - folder_name = (gchar *)path; - parent_name = NULL; - } else { - while (names[parts]) - parts++; - folder_name = names[parts -1]; - if (parts >= 2) - parent_name = names[parts -2]; - else - parent_name = NULL; - } - - url = camel_url_new (uri, NULL); - if (url != NULL) { - service = camel_session_get_service_by_url ( - session, url, CAMEL_PROVIDER_STORE); - camel_url_free (url); - } - - if (!CAMEL_IS_STORE (service)) { - g_strfreev (names); - return; - } - - cnc = get_cnc (CAMEL_STORE (service)); - if (E_IS_GW_CONNECTION (cnc)) { - container_id = get_container_id (cnc, parent_name); - - if (e_gw_connection_accept_shared_folder (cnc, folder_name, container_id, (gchar *)item_id, NULL) == E_GW_CONNECTION_STATUS_OK) { - const gchar *uid; - - /* FIXME Not passing a GCancellable or GError here. */ - folder = camel_store_get_folder_sync ( - CAMEL_STORE (service), - "Mailbox", 0, NULL, NULL); - /*changes = camel_folder_change_info_new (); - camel_folder_change_info_remove_uid (changes, (gchar *) item_id); - camel_folder_summary_remove_uid (folder->summary, item_id);*/ - /* camel_folder_delete_message (folder, item_id); */ - camel_folder_set_message_flags ( - folder, item_id, - CAMEL_MESSAGE_DELETED, - CAMEL_MESSAGE_DELETED); - camel_folder_summary_touch (folder->summary); - /* camel_object_trigger_event (CAMEL_OBJECT (folder), "folder_changed", changes); */ - uid = camel_service_get_uid (service); - account = e_get_account_by_uid (uid); - uri = account->source->url; - em_folder_tree_model_remove_store ( - model, CAMEL_STORE (service)); - provider = camel_provider_get (uri, NULL); - if (provider == NULL) { - g_strfreev (names); - return; - } - - /* make sure the new store belongs in the tree */ - if (!(provider->flags & CAMEL_PROVIDER_IS_STORAGE)) { - g_strfreev (names); - return; - } - - em_folder_tree_model_add_store ( - model, CAMEL_STORE (service), - account->name); - } - } - - g_strfreev (names); - gtk_widget_destroy ((GtkWidget *)emfs); - } - -} - -static void -accept_free (gpointer data) -{ - struct AcceptData *accept_data = data; - - g_object_unref (accept_data->msg); - g_free (accept_data); -} - -static void -apply_clicked (GtkAssistant *assistant, CamelMimeMessage *msg) -{ - EShell *shell; - EShellBackend *shell_backend; - EMailSession *session; - EMFolderTree *folder_tree; - GtkWidget *dialog; - struct AcceptData *accept_data; - gchar *uri; - gpointer parent; - - shell = e_shell_get_default (); - shell_backend = e_shell_get_backend_by_name (shell, "mail"); - session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend)); - - parent = gtk_widget_get_toplevel (GTK_WIDGET (assistant)); - parent = gtk_widget_is_toplevel (parent) ? parent : NULL; - - accept_data = g_new0 (struct AcceptData, 1); - folder_tree = (EMFolderTree *) em_folder_tree_new (session); - - 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; - g_object_ref (msg); - 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); - gtk_window_set_title (GTK_WINDOW (dialog), "Install Shared Folder"); - gtk_window_set_modal (GTK_WINDOW (dialog), TRUE); - gtk_widget_show (dialog); -} - -void -org_gnome_popup_wizard (EPlugin *ep, EMEventTargetMessage *target) -{ - CamelInternetAddress *from_addr = NULL; - const gchar *name; - const gchar *email; - CamelMimeMessage *msg = (CamelMimeMessage *) target->message; - CamelStream *stream; - CamelDataWrapper *dw; - GByteArray *byte_array; - gchar *start_message; - - if (!msg) - return; - - if (((gchar *)camel_medium_get_header (CAMEL_MEDIUM(msg),"X-notification")) == NULL - || (from_addr = camel_mime_message_get_from ((CamelMimeMessage *)target->message)) == NULL - || !camel_internet_address_get (from_addr, 0, &name, &email) - || (dw = camel_medium_get_content (CAMEL_MEDIUM (msg))) == NULL) { - return; - } else { - if (CAMEL_IS_MULTIPART (dw)) { - dw = camel_medium_get_content ((CamelMedium *)camel_multipart_get_part ((CamelMultipart *)dw, 0)); - if (dw == NULL) - return; - } - - byte_array = g_byte_array_new (); - stream = camel_stream_mem_new_with_byte_array (byte_array); - camel_data_wrapper_write_to_stream_sync (dw, stream, NULL, NULL); - camel_stream_write (stream, "", 1, NULL, NULL); - - 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 'Apply' to install the shared folder\n\n"), - name, name, byte_array->data); - - 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); - - g_object_ref (msg); - g_object_set_data_full((GObject *)page, "msg", msg, g_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"); - - g_object_unref (stream); - } -} - diff --git a/plugins/groupwise-features/junk-mail-settings.c b/plugins/groupwise-features/junk-mail-settings.c deleted file mode 100644 index a633f0bcc3..0000000000 --- a/plugins/groupwise-features/junk-mail-settings.c +++ /dev/null @@ -1,119 +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 - * - * - * Authors: - * Vivek Jain - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include "config.h" -#endif - -#include -#include -#include -#include - -#include -#include - -#include - -#include "gw-ui.h" -#include "share-folder.h" -#include "junk-settings.h" - -static void -abort_changes (JunkSettings *js) -{ - g_object_run_dispose ((GObject *)js); -} - -static void -junk_dialog_response (GtkWidget *dialog, gint response, JunkSettings *js) -{ - if (response == GTK_RESPONSE_ACCEPT) { - commit_changes (js); - abort_changes (js); - } - else - abort_changes (js); - - gtk_widget_destroy (dialog); - -} - -void -gw_junk_mail_settings_cb (GtkAction *action, EShellView *shell_view) -{ - GtkWidget *dialog ,*w, *notebook, *box; - GtkWidget *content_area; - JunkSettings *junk_tab; - gint page_count =0; - EGwConnection *cnc; - gchar *msg; - EShellContent *shell_content; - EMailReader *reader; - CamelFolder *folder; - - shell_content = e_shell_view_get_shell_content (shell_view); - - reader = E_MAIL_READER (shell_content); - folder = e_mail_reader_get_folder (reader); - g_return_if_fail (folder != NULL); - - cnc = get_cnc (camel_folder_get_parent_store (folder)); - - dialog = gtk_dialog_new_with_buttons (_("Junk Settings"), - NULL, - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_CANCEL, - GTK_RESPONSE_REJECT, - GTK_STOCK_OK, - GTK_RESPONSE_ACCEPT, - NULL); - content_area = gtk_dialog_get_content_area (GTK_DIALOG (dialog)); - gtk_window_set_default_size ((GtkWindow *) dialog, 292, 260); - gtk_widget_ensure_style (dialog); - gtk_container_set_border_width (GTK_CONTAINER (content_area), 12); - box = gtk_vbox_new (FALSE, 6); - w = gtk_label_new (""); - msg = g_strdup_printf("%s", _("Junk Mail Settings")); - gtk_label_set_markup (GTK_LABEL (w), msg); - gtk_box_pack_start ((GtkBox *) box, w, FALSE, FALSE, 6); - g_free (msg); - - junk_tab = junk_settings_new (cnc); - 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 */ - while (page_count > 0 ) { - notebook = gtk_notebook_new (); - gtk_notebook_append_page ((GtkNotebook *)notebook, box, NULL); - gtk_box_pack_start ( - GTK_BOX (content_area), notebook, TRUE, TRUE, 0); - } - - if (page_count == 0) - gtk_box_pack_start ( - GTK_BOX (content_area), box, TRUE, TRUE, 0); - - g_signal_connect (dialog, "response", G_CALLBACK (junk_dialog_response), junk_tab); - gtk_widget_show_all (dialog); -} diff --git a/plugins/groupwise-features/junk-settings.c b/plugins/groupwise-features/junk-settings.c deleted file mode 100644 index 6b0233d2bc..0000000000 --- a/plugins/groupwise-features/junk-settings.c +++ /dev/null @@ -1,428 +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 - * - * - * Authors: - * Vivek Jain - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -# include -#endif -#include "junk-settings.h" -#include -#include -#include -#include -#include -#define ROOTNODE "vboxSettings" -#define d(x) - -struct _JunkEntry { - EGwJunkEntry *entry; - gint flag; -}; - -typedef struct _JunkEntry JunkEntry; - -static void junk_settings_class_init (JunkSettingsClass *class); -static void junk_settings_init (JunkSettings *js); -static void junk_settings_dispose (GObject *obj); -static void junk_settings_finalise (GObject *obj); -static void free_all (JunkSettings *js); -static void get_junk_list (JunkSettings *js); -static void disable_clicked (GtkRadioButton *button, JunkSettings *js); -static void enable_clicked (GtkRadioButton *button, JunkSettings *js); - -static GtkVBoxClass *parent_class = NULL; - -GType -junk_settings_get_type (void) -{ - static GType type = 0; - - if (!type) { - static const GTypeInfo info = { - sizeof (JunkSettingsClass), - NULL, NULL, - (GClassInitFunc) junk_settings_class_init, - NULL, NULL, - sizeof (JunkSettings), - 0, - (GInstanceInitFunc) junk_settings_init - }; - - type = g_type_register_static (gtk_vbox_get_type (), "JunkSettings", &info, 0); - } - - return type; -} - -static void -junk_settings_class_init (JunkSettingsClass *klass) -{ - GObjectClass *object_class = G_OBJECT_CLASS (klass); - - parent_class = g_type_class_ref (gtk_vbox_get_type ()); - object_class->dispose = junk_settings_dispose; - object_class->finalize = junk_settings_finalise; -} - -static void -junk_settings_finalise (GObject *obj) -{ - JunkSettings *js = (JunkSettings *) obj; - g_object_unref (js->builder); - free_all (js); - - G_OBJECT_CLASS (parent_class)->finalize (obj); -} - -static void -junk_settings_dispose (GObject *object) -{ - JunkSettings *js = (JunkSettings *) object; - free_all (js); - - /* Chain up to parent's dispose() method. */ - G_OBJECT_CLASS (parent_class)->dispose (object); -} - -static void -junk_settings_init (JunkSettings *js) -{ - js->users = 0; - js->flag_for_ok = 0; - js->enabled = FALSE; - js->junk_list = NULL; - js->entry_list = NULL; -} - -static void -free_entry_node (EGwJunkEntry *entry) -{ - if (entry) { - g_free (entry->match); - entry->match = NULL; - } - - return; -} - -static void -free_node (JunkEntry *nentry) -{ - EGwJunkEntry *junk_entry = nentry->entry; - - if (junk_entry) { - g_free (junk_entry->match); - junk_entry->match = NULL; - } - - return; -} - -static JunkEntry * -find_node (GList *list, gchar *match) -{ - JunkEntry *one_entry = NULL; - EGwJunkEntry *ent = NULL; - GList *tmp; - gint i; - - if (list) { - tmp = g_list_first (list); - for (i=0; tmp; i++) - { - one_entry = tmp->data; - ent = one_entry->entry; - if (!g_ascii_strcasecmp (ent->match, match)) { - return one_entry; - /*if found, it returns that user*/ - } - tmp= g_list_next (tmp); - } - } - - return NULL; -} - -static void -free_all (JunkSettings *js) -{ - if (js->junk_list) { - g_list_foreach (js->junk_list,(GFunc) free_node, NULL); - g_list_free (js->junk_list); - js->junk_list = NULL; - } -} - -static void -get_junk_list (JunkSettings *js) -{ - GList *list = NULL; - gchar *entry; - gchar *msg; - gint use_junk, use_block, use_pab, persistence; - - if (E_IS_GW_CONNECTION (js->cnc)) { - if (e_gw_connection_get_junk_settings (js->cnc, &use_junk, &use_block, &use_pab, &persistence) == E_GW_CONNECTION_STATUS_OK) { - if (use_junk) { - js->enabled = TRUE; - gtk_toggle_button_set_active ((GtkToggleButton *) js->enable, TRUE); - enable_clicked (js->enable , js); - gtk_widget_set_sensitive (GTK_WIDGET (js->table), TRUE); - } else { - gtk_toggle_button_set_active ((GtkToggleButton *) js->disable, TRUE); - disable_clicked (js->disable , js); - } - } - /* get list of containers */ - if (e_gw_connection_get_junk_entries (js->cnc, &(list)) == E_GW_CONNECTION_STATUS_OK) { - js->users = g_list_length (list); - if (js->users) { -/* I populate the list and set flags to 0 for the existing users*/ - while (list) { - JunkEntry *junk_entry = g_new0 (JunkEntry , 1); - junk_entry->entry = list->data; - junk_entry->flag = 0; - entry = g_strdup ((junk_entry->entry)->match); - msg = g_strdup_printf ("%s", entry); - gtk_list_store_append (GTK_LIST_STORE (js->model), &(js->iter)); - gtk_list_store_set (GTK_LIST_STORE (js->model), &(js->iter), 0, msg, -1); - js->junk_list = g_list_append (js->junk_list, junk_entry); - - g_free (msg); - g_free (entry); - msg = NULL; - entry = NULL; - list = list->next; - } - } - } - else - g_warning("Could not get the JUNK List"); - } -} - -void -commit_changes (JunkSettings *js) -{ - GList *new_list = NULL; - GList *remove_list = NULL; - GList *node = NULL; - JunkEntry *junk_entry = NULL; - EGwJunkEntry *entry; - gint use_junk, use_pab, use_block, persistence; - - for (node = js->junk_list; node; node = node->next) - { - junk_entry = node->data; - if (junk_entry->flag & 0x1) - new_list = g_list_append (new_list, junk_entry->entry); - else if (junk_entry->flag & 0x4) { - remove_list = g_list_append (remove_list, junk_entry->entry); - } - } - - if (E_IS_GW_CONNECTION (js->cnc)) { - if (js->flag_for_ok == 2 && js->enabled){ /* just turn off the bits*/ - use_junk = use_pab = use_block = persistence = 0; - if (e_gw_connection_modify_junk_settings (js->cnc, use_junk, use_pab, use_block, persistence) == E_GW_CONNECTION_STATUS_OK) { - ; - } - - } - if (js->flag_for_ok == 0 && !js->enabled) { - use_block = use_pab =0; - use_junk = 1; - persistence = 14; /* We are setting the default persistence*/ - if (e_gw_connection_modify_junk_settings (js->cnc, use_junk, use_pab, use_block, persistence) == E_GW_CONNECTION_STATUS_OK) { - ; - } - } - - while (new_list) { - entry = new_list->data; - if (e_gw_connection_create_junk_entry (js->cnc, entry->match, "email", "junk") == E_GW_CONNECTION_STATUS_OK) { - ; - } - new_list = new_list->next; - } - while (remove_list) { - entry = remove_list->data; - if (e_gw_connection_remove_junk_entry (js->cnc, entry->id) == E_GW_CONNECTION_STATUS_OK) { - ; - } - remove_list = remove_list->next; - } - - } - if (new_list) { - g_list_foreach (new_list, (GFunc) free_entry_node, NULL); - g_list_free (new_list); - } - new_list = NULL; - if (remove_list) { - g_list_foreach (remove_list,(GFunc) free_entry_node, NULL); - g_list_free (remove_list); - } - remove_list = NULL; -} - -static void -enable_clicked (GtkRadioButton *button, JunkSettings *js) -{ - js->flag_for_ok = 0; - gtk_widget_set_sensitive (GTK_WIDGET (js->table) ,TRUE); -} - -static void -disable_clicked (GtkRadioButton *button, JunkSettings *js) -{ - js->flag_for_ok = 2; - gtk_widget_set_sensitive (GTK_WIDGET (js->table), FALSE); -} - -static void -add_clicked (GtkButton *button, JunkSettings *js) -{ - const gchar *email = NULL; - const gchar *self_email = NULL; - JunkEntry *new_entry = NULL; - EGwJunkEntry *junk_entry = NULL; - gchar *msg = NULL; - - self_email = g_strdup (e_gw_connection_get_user_email (js->cnc)); - email = gtk_entry_get_text (js->entry); - /* You can't mark junk sender yourself*/ - if (g_strrstr (email, "@") == NULL || (!g_ascii_strcasecmp (email , self_email)) || !g_ascii_strcasecmp (email, "" )) - return; - else { - /*check whether already exists*/ - if (js->junk_list && email) { - new_entry = find_node (js->junk_list, (gchar *)email); - if (new_entry) - return; - - } - junk_entry = g_new0 (EGwJunkEntry, 1); - new_entry = g_new0 (JunkEntry, 1); - junk_entry->match = g_strdup (email); -/*XXX:populate more fields*/ - new_entry->entry = junk_entry; - new_entry->flag = 1; - msg = g_strdup (email); - gtk_list_store_append (GTK_LIST_STORE (js->model), &(js->iter)); - gtk_list_store_set (GTK_LIST_STORE (js->model), &(js->iter), 0, msg, -1); - g_free (msg); - js->junk_list = g_list_append (js->junk_list, new_entry); - js->flag_for_ok = 0; - } - gtk_entry_set_text (GTK_ENTRY(js->entry), ""); -} - -static void -remove_clicked (GtkButton *button, JunkSettings *js) -{ - JunkEntry *entry = NULL; - gchar *email; - - gtk_tree_model_get ((GtkTreeModel *) js->model, &(js->iter), 0, &email, -1); - entry = find_node (js->junk_list, email); - if (entry->flag & 0x1) { - js->junk_list = g_list_remove (js->junk_list, entry); - free_node (entry); - } else { - entry->flag = 0; - entry->flag |= 0x4; - } - g_free (email); - gtk_list_store_remove (GTK_LIST_STORE (js->model), &(js->iter)); -} - -static void -user_selected (GtkTreeSelection *selection, JunkSettings *js) -{ - GtkTreeModel *model; - - gtk_tree_selection_set_mode (selection, GTK_SELECTION_SINGLE); - if (gtk_tree_selection_get_selected (selection, &model, &(js->iter))) { - gtk_widget_set_sensitive (GTK_WIDGET (js->remove), TRUE); - - } -} - -static void -junk_settings_construct (JunkSettings *js) -{ - js->builder = gtk_builder_new (); - e_load_ui_builder_definition (js->builder, "junk-settings.ui"); - - js->vbox = GTK_VBOX (e_builder_get_widget(js->builder, "vboxSettings")); - js->table = GTK_VBOX (e_builder_get_widget (js->builder, "vbox194")); - gtk_widget_set_sensitive (GTK_WIDGET (js->table), FALSE); - - js->enable = GTK_RADIO_BUTTON (e_builder_get_widget (js->builder, "radEnable")); - g_signal_connect ((gpointer) js->enable, "clicked", G_CALLBACK (enable_clicked), js); - - js->disable = GTK_RADIO_BUTTON (e_builder_get_widget (js->builder, "radDisable")); - g_signal_connect ((gpointer) js->disable, "clicked", G_CALLBACK (disable_clicked), js); - - js->add_button = GTK_BUTTON (e_builder_get_widget(js->builder, "Add")); - g_signal_connect((GtkWidget *) js->add_button, "clicked", G_CALLBACK (add_clicked), js); - - js->remove = GTK_BUTTON(e_builder_get_widget(js->builder, "Remove")); - g_signal_connect ((GtkWidget *) js->remove, "clicked", G_CALLBACK (remove_clicked), js); - gtk_widget_set_sensitive (GTK_WIDGET (js->remove), FALSE); - - js->entry = GTK_ENTRY (e_builder_get_widget (js->builder, "entry4")); - /*TODO:connect entry and label*/ - gtk_widget_show ((GtkWidget *) js->entry); - - js->scrolled_window = GTK_WIDGET (e_builder_get_widget (js->builder,"scrolledwindow4")); - - gtk_scrolled_window_set_policy (GTK_SCROLLED_WINDOW (js->scrolled_window), GTK_POLICY_AUTOMATIC, GTK_POLICY_AUTOMATIC); - - js->model = gtk_list_store_new (4, G_TYPE_STRING, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN, G_TYPE_BOOLEAN); - js->entry_list = (GtkTreeView *)gtk_tree_view_new (); - /*gtk_scrolled_window_add_with_viewport (GTK_SCROLLED_WINDOW (js->scrolled_window), (GtkWidget *)js->entry_list);*/ - gtk_container_add (GTK_CONTAINER (js->scrolled_window), (GtkWidget *)js->entry_list); - gtk_tree_view_set_model (GTK_TREE_VIEW (js->entry_list), GTK_TREE_MODEL (js->model)); - gtk_widget_show (GTK_WIDGET (js->entry_list)); - - js->cell = gtk_cell_renderer_text_new (); - js->column = gtk_tree_view_column_new_with_attributes (_("Email"), js->cell, "text", 0, NULL); - gtk_tree_view_append_column (GTK_TREE_VIEW (js->entry_list), - GTK_TREE_VIEW_COLUMN (js->column)); - - g_signal_connect(gtk_tree_view_get_selection(GTK_TREE_VIEW (js->entry_list)), "changed", G_CALLBACK (user_selected), js); -} - -JunkSettings * -junk_settings_new (EGwConnection *ccnc) -{ - JunkSettings *new; - new = (JunkSettings *) g_object_new (junk_settings_get_type (), NULL); - junk_settings_construct (new); - new->cnc = ccnc; - if (new->cnc) - get_junk_list (new); - - return (JunkSettings *) new; -} - diff --git a/plugins/groupwise-features/junk-settings.h b/plugins/groupwise-features/junk-settings.h deleted file mode 100644 index 2e67b8cc8c..0000000000 --- a/plugins/groupwise-features/junk-settings.h +++ /dev/null @@ -1,82 +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 - * - * - * Authors: - * Vivek Jain - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef __JUNK_SETTINGS_H__ -#define __JUNK_SETTINGS_H__ - -#include -#include - -#define _JUNK_SETTINGS_TYPE (junk_settings_get_type ()) -#define JUNK_SETTINGS(o) (G_TYPE_CHECK_INSTANCE_CAST ((o), JUNK_SETTINGS, JunkSettings)) -#define JUNK_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_CAST ((k), JUNK_SETTINGS_TYPE, JunkSettings)) -#define IS_JUNK_SETTINGS(o) (G_TYPE_CHECK_INSTANCE_TYPE ((o), JUNK_SETTINGS_TYPE)) -#define IS_JUNK_SETTINGS_CLASS(k) (G_TYPE_CHECK_CLASS_TYPE ((k), JUNK_SETTINGS_TYPE)) - -G_BEGIN_DECLS - -typedef struct _JunkSettings JunkSettings; -typedef struct _JunkSettingsClass JunkSettingsClass; - -struct _JunkSettings { - GtkVBox parent_object; - - GtkBuilder *builder; - - /* General tab */ - - /* Default Behavior */ - GtkTreeView *entry_list; - GtkButton *add_button; - GtkButton *remove; - GtkEntry *entry; - GtkRadioButton *enable; - GtkRadioButton *disable; - GtkWidget *scrolled_window; - GtkListStore *model; - GtkCellRenderer *cell; - GtkTreeViewColumn *column; - GtkVBox *vbox; - GtkVBox *table; - GtkWidget *window; - - GList *junk_list; - gint users; - gint flag_for_ok; - gboolean enabled; - EGwConnection *cnc; - GtkTreeIter iter; -}; - -struct _JunkSettingsClass { - GtkVBoxClass parent_class; - -}; - -GType junk_settings_get_type (void); -JunkSettings * junk_settings_new (EGwConnection *ccnc); -void commit_changes (JunkSettings *js); - -G_END_DECLS - -#endif /* __JUNK_SETTINGS_H__ */ diff --git a/plugins/groupwise-features/junk-settings.ui b/plugins/groupwise-features/junk-settings.ui deleted file mode 100644 index b998c90920..0000000000 --- a/plugins/groupwise-features/junk-settings.ui +++ /dev/null @@ -1,458 +0,0 @@ - - - - - Junk Mail Settings - GTK_WINDOW_TOPLEVEL - GTK_WIN_POS_NONE - False - True - False - True - False - False - GDK_WINDOW_TYPE_HINT_NORMAL - GDK_GRAVITY_NORTH_WEST - True - - - True - True - True - True - GTK_POS_TOP - False - False - - - 12 - True - False - 12 - - - 0 - True - False - 6 - - - 0 - True - False - 12 - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - True - False - 6 - - - True - True - _Disable - True - GTK_RELIEF_NORMAL - True - False - False - True - - - 0 - False - False - - - - - True - True - _Enable - True - GTK_RELIEF_NORMAL - True - False - False - True - radDisable - - - 0 - False - False - - - - - True - False - 0 - - - True - False - 6 - - - 234 - 209 - True - False - 0 - - - True - False - 0 - - - True - Email: - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - True - True - True - True - 0 - - True - False - - - 2 - True - True - - - - - 0 - True - True - - - - - True - Junk List: - False - GTK_JUSTIFY_LEFT - False - False - 0 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - 6 - False - False - - - - - 282 - 150 - True - True - GTK_POLICY_ALWAYS - GTK_POLICY_ALWAYS - GTK_SHADOW_NONE - GTK_CORNER_TOP_LEFT - - - - - - 6 - True - True - - - - - 0 - True - True - - - - - True - False - 6 - - - True - True - GTK_RELIEF_NORMAL - True - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - True - False - 2 - - - True - gtk-add - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 29 - True - _Add - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - False - False - - - - - True - True - GTK_RELIEF_NORMAL - True - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - True - False - 2 - - - True - gtk-remove - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - True - _Remove - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - - - - 0 - False - False - - - - - 0 - True - True - - - - - 0 - True - True - - - - - - - - 0 - False - False - - - - - 0 - False - False - - - - - 0 - False - False - - - - - 0 - False - False - - - - - False - True - - - - - True - _Junk List - True - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - - - - diff --git a/plugins/groupwise-features/mail-retract.c b/plugins/groupwise-features/mail-retract.c deleted file mode 100644 index 1213311e36..0000000000 --- a/plugins/groupwise-features/mail-retract.c +++ /dev/null @@ -1,119 +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 - * - * - * Authors: - * Sankar P - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifdef HAVE_CONFIG_H -#include -#endif - -#include -#include - -#include - -#include -#include -#include - -#include "gw-ui.h" -#include "share-folder.h" - -static gboolean -get_selected_info (EShellView *shell_view, CamelFolder **folder, gchar **selected_uid) -{ - EShellContent *shell_content; - EMailReader *reader; - GPtrArray *uids; - - shell_content = e_shell_view_get_shell_content (shell_view); - - reader = E_MAIL_READER (shell_content); - uids = e_mail_reader_get_selected_uids (reader); - - if (uids && uids->len == 1) { - *folder = e_mail_reader_get_folder (reader); - *selected_uid = g_strdup (g_ptr_array_index (uids, 0)); - } - - em_utils_uids_free (uids); - - return *selected_uid != NULL; -} - -void -gw_retract_mail_cb (GtkAction *action, EShellView *shell_view) -{ - EGwConnection *cnc; - CamelFolder *folder; - CamelStore *parent_store; - gchar *id = NULL; - GtkWidget *confirm_dialog, *confirm_warning; - GtkWidget *content_area; - gint n; - - g_return_if_fail (get_selected_info (shell_view, &folder, &id)); - g_return_if_fail (folder != NULL); - - parent_store = camel_folder_get_parent_store (folder); - - cnc = get_cnc (parent_store); - - if (cnc && E_IS_GW_CONNECTION (cnc)) { - confirm_dialog = gtk_dialog_new_with_buttons ( - _("Message Retract"), - GTK_WINDOW (e_shell_view_get_shell_window (shell_view)), - GTK_DIALOG_MODAL | GTK_DIALOG_DESTROY_WITH_PARENT, - GTK_STOCK_YES, GTK_RESPONSE_YES, - GTK_STOCK_NO, GTK_RESPONSE_NO, NULL); - - content_area = gtk_dialog_get_content_area ( - GTK_DIALOG (confirm_dialog)); - - confirm_warning = gtk_label_new (_("Retracting a message may remove it from the recipient's mailbox. Are you sure you want to do this?")); - gtk_label_set_line_wrap (GTK_LABEL (confirm_warning), TRUE); - gtk_label_set_selectable (GTK_LABEL (confirm_warning), TRUE); - - gtk_container_add (GTK_CONTAINER (content_area), confirm_warning); - gtk_widget_set_size_request (confirm_dialog, 400, 100); - gtk_widget_show_all (confirm_dialog); - - n =gtk_dialog_run (GTK_DIALOG (confirm_dialog)); - - gtk_widget_destroy (confirm_warning); - gtk_widget_destroy (confirm_dialog); - - if (n == GTK_RESPONSE_YES) { - - if (e_gw_connection_retract_request (cnc, id, NULL, FALSE, FALSE) != E_GW_CONNECTION_STATUS_OK ) - e_alert_run_dialog_for_args (GTK_WINDOW (e_shell_view_get_shell_window (shell_view)), - "org.gnome.evolution.message.retract:retract-failure", - NULL); - else { - GtkWidget *dialog; - dialog = gtk_message_dialog_new (NULL, GTK_DIALOG_MODAL, GTK_MESSAGE_INFO, GTK_BUTTONS_CLOSE, _("Message retracted successfully")); - gtk_dialog_run (GTK_DIALOG (dialog)); - gtk_widget_destroy (dialog); - } - } - } - - g_free (id); -} diff --git a/plugins/groupwise-features/mail-send-options.c b/plugins/groupwise-features/mail-send-options.c deleted file mode 100644 index 7c31b6e585..0000000000 --- a/plugins/groupwise-features/mail-send-options.c +++ /dev/null @@ -1,246 +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 - * - * - * Authors: - * Parthasarathi Susarla - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#include -#include -#include -#include -#include - -#include -#include - -#include "mail-send-options.h" - -#include "mail/em-utils.h" -#include "mail/em-event.h" - -#include "composer/e-msg-composer.h" -#include "composer/e-composer-from-header.h" -#include "libedataserver/e-account.h" - -#include "misc/e-send-options.h" - -static ESendOptionsDialog * dialog = NULL; - -gboolean gw_ui_composer_actions (GtkUIManager *manager, EMsgComposer *composer); -void org_gnome_composer_message_reply (EPlugin *ep, EMEventTargetMessage *t); - -static time_t -add_day_to_time (time_t time, gint days) -{ - struct tm *tm; - - tm = localtime (&time); - tm->tm_mday += days; - tm->tm_isdst = -1; - - return mktime (tm); -} - -static void -feed_input_data (ESendOptionsDialog * dialog, gint state, gpointer data) -{ - EMsgComposer *comp; - gchar value[100]; - gchar *temp = NULL; - - comp = (EMsgComposer *) data; - /* we are bothered only for ok response: other cases are handled generally*/ - if (state == GTK_RESPONSE_OK) { - if (dialog->data->gopts->reply_enabled) { - if (dialog->data->gopts->reply_convenient) - e_msg_composer_add_header (comp, X_REPLY_CONVENIENT ,"1" ); - else { - time_t t; - t = add_day_to_time (time (NULL), dialog->data->gopts->reply_within); - strftime (value, 17, "%Y%m%dT%H%M%SZ", gmtime (&t)); - e_msg_composer_add_header (comp, X_REPLY_WITHIN , value); - } - } - - if (dialog->data->gopts->expiration_enabled) { - if (dialog->data->gopts->expire_after != 0) { - time_t t; - t = add_day_to_time (time (NULL), dialog->data->gopts->expire_after); - strftime (value, 17, "%Y%m%dT%H%M%SZ", gmtime (&t)); - e_msg_composer_add_header (comp, X_EXPIRE_AFTER, value); - } - } - if (dialog->data->gopts->delay_enabled) { - strftime (value, 17, "%Y%m%dT%H%M%SZ", gmtime (&dialog->data->gopts->delay_until)); - e_msg_composer_add_header (comp, X_DELAY_UNTIL, value); - } - - /*Status Tracking Options*/ - if (dialog->data->sopts->tracking_enabled) { - temp = g_strdup_printf ("%d",dialog->data->sopts->track_when); - e_msg_composer_add_header (comp, X_TRACK_WHEN, temp); - g_free (temp); - } - - if (dialog->data->sopts->autodelete) { - e_msg_composer_add_header (comp, X_AUTODELETE, "1"); - } - if (dialog->data->sopts->opened) { - temp = g_strdup_printf ("%d",dialog->data->sopts->opened); - e_msg_composer_add_header (comp, X_RETURN_NOTIFY_OPEN, temp); - g_free (temp); - } - if (dialog->data->sopts->declined) { - temp = g_strdup_printf ("%d",dialog->data->sopts->declined); - e_msg_composer_add_header (comp, X_RETURN_NOTIFY_DELETE, temp); - g_free (temp); - } - - if (dialog->data->gopts->priority) { - temp = g_strdup_printf ("%d",dialog->data->gopts->priority); - e_msg_composer_add_header (comp, X_SEND_OPT_PRIORITY, temp); - g_free (temp); - } - - if (dialog->data->gopts->security) { - temp = g_strdup_printf ("%d",dialog->data->gopts->security); - e_msg_composer_add_header (comp, X_SEND_OPT_SECURITY, temp); - g_free (temp); - } - } -} - -static void -send_options_commit (EMsgComposer *comp, gpointer user_data) -{ - if (!user_data && !E_IS_SENDOPTIONS_DIALOG (user_data)) - return; - - if (dialog) { - g_object_unref (dialog); - dialog = NULL; - } -} - -static gboolean -account_is_groupwise (EAccount *account) -{ - const gchar *url; - - if (!account) - return FALSE; - - url = e_account_get_string (account, E_ACCOUNT_TRANSPORT_URL); - return url && g_str_has_prefix (url, "groupwise://"); -} - -static void -from_changed_cb (EComposerFromHeader *header, EMsgComposer *composer) -{ - GtkActionGroup *group; - GtkAction *action; - EAccount *account; - - g_return_if_fail (header != NULL); - g_return_if_fail (composer != NULL); - - group = gtkhtml_editor_get_action_group (GTKHTML_EDITOR (composer), "composer"); - g_return_if_fail (group != NULL); - - action = gtk_action_group_get_action (group, "gw-send-options"); - g_return_if_fail (action != NULL); - - account = e_composer_from_header_get_active (header); - gtk_action_set_visible (action, account_is_groupwise (account)); -} - -static void -action_send_options_cb (GtkAction *action, EMsgComposer *composer) -{ - g_return_if_fail (action != NULL); - g_return_if_fail (composer != NULL); - - /* display the send options dialog */ - if (!dialog) { - dialog = e_send_options_dialog_new (); - } - - e_send_options_dialog_run (dialog, GTK_WIDGET (composer), E_ITEM_MAIL); - - g_signal_connect (dialog, "sod_response", - G_CALLBACK (feed_input_data), composer); - - g_signal_connect (GTK_WIDGET (composer), "destroy", - G_CALLBACK (send_options_commit), dialog); -} - -gboolean -gw_ui_composer_actions (GtkUIManager *manager, EMsgComposer *composer) -{ - static GtkActionEntry entries[] = { - { "gw-send-options", - NULL, - N_("_Send Options"), - NULL, - N_("Insert Send options"), - G_CALLBACK (action_send_options_cb) } - }; - - GtkhtmlEditor *editor; - EComposerHeaderTable *headers; - EComposerHeader *header; - - editor = GTKHTML_EDITOR (composer); - - /* 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); - - headers = e_msg_composer_get_header_table (composer); - header = e_composer_header_table_get_header (headers, E_COMPOSER_HEADER_FROM); - - from_changed_cb (E_COMPOSER_FROM_HEADER (header), composer); - g_signal_connect ( - header, "changed", - G_CALLBACK (from_changed_cb), composer); - - return TRUE; -} - -void -org_gnome_composer_message_reply (EPlugin *ep, EMEventTargetMessage *t) -{ - EMsgComposer *comp = (struct _EMsgComposer *)t->composer; - EComposerHeaderTable *table; - EAccount *account = NULL; - gchar *temp = NULL; - - table = e_msg_composer_get_header_table (comp); - account = e_composer_header_table_get_account (table); - if (!account) - return; - - temp = strstr (account->transport->url, "groupwise"); - if (!temp) { - return; - } - e_msg_composer_add_header (comp, "X-GW-ORIG-ITEM-ID", t->uid); -} diff --git a/plugins/groupwise-features/mail-send-options.h b/plugins/groupwise-features/mail-send-options.h deleted file mode 100644 index 71cacbff01..0000000000 --- a/plugins/groupwise-features/mail-send-options.h +++ /dev/null @@ -1,43 +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 - * - * - * Authors: - * Parthasarathi Susarla - * - * Copyright (C) 1999-2008 Novell, Inc. (www.novell.com) - * - */ - -#ifndef __GW_SEND_OPTIONS__ -#define __GW_SEND_OPTIONS__ - -/*Headers for send options*/ -#define X_SEND_OPTIONS "X-gw-send-options" -/*General Options*/ -#define X_SEND_OPT_PRIORITY "X-gw-send-opt-priority" -#define X_SEND_OPT_SECURITY "X-gw-send-opt-security" -#define X_REPLY_CONVENIENT "X-reply-convenient" -#define X_REPLY_WITHIN "X-reply-within" -#define X_EXPIRE_AFTER "X-expire-after" -#define X_DELAY_UNTIL "X-delay-until" - -/*Status Tracking Options*/ -#define X_TRACK_WHEN "X-track-when" -#define X_AUTODELETE "X-auto-delete" -#define X_RETURN_NOTIFY_OPEN "X-return-notify-open" -#define X_RETURN_NOTIFY_DELETE "X-return-notify-delete" - -#endif /*__GW_SEND_OPTIONS__*/ diff --git a/plugins/groupwise-features/notification.ui b/plugins/groupwise-features/notification.ui deleted file mode 100644 index a3fc64b568..0000000000 --- a/plugins/groupwise-features/notification.ui +++ /dev/null @@ -1,216 +0,0 @@ - - - - - 12 - True - False - 12 - - - True - The participants will receive the following notification. - - False - False - GTK_JUSTIFY_CENTER - False - False - 0.66 - 0.5 - 0 - 0 - - - 1 - False - False - - - - - 309 - True - False - 12 - - - True - False - 5 - - - True - Subject - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 158 - True - True - True - True - 0 - - True - False - - - 6 - False - False - - - - - True - Message - False - False - GTK_JUSTIFY_CENTER - False - False - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - 0 - True - True - GTK_POLICY_AUTOMATIC - GTK_POLICY_AUTOMATIC - GTK_SHADOW_IN - GTK_CORNER_TOP_LEFT - - - True - True - True - False - True - GTK_JUSTIFY_LEFT - GTK_WRAP_NONE - True - 0 - 0 - 0 - 0 - 0 - 0 - - - - - 0 - True - True - - - - - 0 - True - True - - - - - 0 - True - True - - - - - True - False - 0 - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.52 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - True - GTK_BUTTONBOX_END - 6 - - - True - True - True - gtk-cancel - True - GTK_RELIEF_NORMAL - True - - - - - - True - True - True - gtk-ok - True - GTK_RELIEF_NORMAL - True - - - - - - 0 - True - True - - - - - 0 - False - True - - - - diff --git a/plugins/groupwise-features/org-gnome-compose-send-options.xml b/plugins/groupwise-features/org-gnome-compose-send-options.xml deleted file mode 100644 index 25ff89803e..0000000000 --- a/plugins/groupwise-features/org-gnome-compose-send-options.xml +++ /dev/null @@ -1,17 +0,0 @@ - - - - - - - - - - - - - - - - diff --git a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml b/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml deleted file mode 100644 index 08001f97d8..0000000000 --- a/plugins/groupwise-features/org-gnome-groupwise-features.eplug.xml +++ /dev/null @@ -1,108 +0,0 @@ - - - - - - - - - - - - - <_description>Fine-tune your GroupWise accounts. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/plugins/groupwise-features/org-gnome-mail-retract.error.xml b/plugins/groupwise-features/org-gnome-mail-retract.error.xml deleted file mode 100644 index 64e2ce2f1e..0000000000 --- a/plugins/groupwise-features/org-gnome-mail-retract.error.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - <_primary>Message retract failed - <_secondary>The server did not allow the selected message to be retracted. - - diff --git a/plugins/groupwise-features/org-gnome-process-meeting.error.xml b/plugins/groupwise-features/org-gnome-process-meeting.error.xml deleted file mode 100644 index 45fbc98103..0000000000 --- a/plugins/groupwise-features/org-gnome-process-meeting.error.xml +++ /dev/null @@ -1,44 +0,0 @@ - - - - -<_primary>This is a recurring meeting - -<_secondary>Would you like to accept it? -