Commit 987fb91d authored by Matthew Barnes's avatar Matthew Barnes

Reduce diff noise with account-mgmt branch.

parent da67edd2
......@@ -22,6 +22,7 @@
#include <glib/gi18n-lib.h>
#include <gdk/gdkkeysyms.h>
#include <mail/e-mail-session.h>
#include <mail/e-mail-account-tree-view.h>
#define E_MAIL_ACCOUNT_MANAGER_GET_PRIVATE(obj) \
......
......@@ -1106,7 +1106,7 @@ e_mail_account_store_remove_service (EMailAccountStore *store,
CamelService *service)
{
GtkTreeIter iter;
gboolean proceed;
gboolean proceed = TRUE;
g_return_if_fail (E_IS_MAIL_ACCOUNT_STORE (store));
g_return_if_fail (CAMEL_IS_SERVICE (service));
......@@ -1114,10 +1114,11 @@ e_mail_account_store_remove_service (EMailAccountStore *store,
if (!mail_account_store_get_iter (store, service, &iter))
g_return_if_reached ();
/* Possibly request user confirmation. */
g_signal_emit (
store, signals[REMOVE_REQUESTED], 0,
parent_window, service, &proceed);
/* If no parent window was given, skip the request signal. */
if (GTK_IS_WINDOW (parent_window))
g_signal_emit (
store, signals[REMOVE_REQUESTED], 0,
parent_window, service, &proceed);
if (proceed) {
g_object_ref (service);
......@@ -1138,7 +1139,7 @@ e_mail_account_store_enable_service (EMailAccountStore *store,
CamelService *service)
{
GtkTreeIter iter;
gboolean proceed;
gboolean proceed = TRUE;
g_return_if_fail (E_IS_MAIL_ACCOUNT_STORE (store));
g_return_if_fail (CAMEL_IS_SERVICE (service));
......@@ -1146,10 +1147,11 @@ e_mail_account_store_enable_service (EMailAccountStore *store,
if (!mail_account_store_get_iter (store, service, &iter))
g_return_if_reached ();
/* Possibly request user confirmation. */
g_signal_emit (
store, signals[ENABLE_REQUESTED], 0,
parent_window, service, &proceed);
/* If no parent window was given, skip the request signal. */
if (GTK_IS_WINDOW (parent_window))
g_signal_emit (
store, signals[ENABLE_REQUESTED], 0,
parent_window, service, &proceed);
if (proceed) {
gtk_list_store_set (
......@@ -1166,7 +1168,7 @@ e_mail_account_store_disable_service (EMailAccountStore *store,
CamelService *service)
{
GtkTreeIter iter;
gboolean proceed;
gboolean proceed = TRUE;
g_return_if_fail (E_IS_MAIL_ACCOUNT_STORE (store));
g_return_if_fail (CAMEL_IS_SERVICE (service));
......@@ -1174,10 +1176,11 @@ e_mail_account_store_disable_service (EMailAccountStore *store,
if (!mail_account_store_get_iter (store, service, &iter))
g_return_if_reached ();
/* Possibly request user confirmation. */
g_signal_emit (
store, signals[DISABLE_REQUESTED], 0,
parent_window, service, &proceed);
/* If no parent window was given, skip the request signal. */
if (GTK_IS_WINDOW (parent_window))
g_signal_emit (
store, signals[DISABLE_REQUESTED], 0,
parent_window, service, &proceed);
if (proceed) {
gtk_list_store_set (
......
......@@ -1429,6 +1429,8 @@ mail_session_forward_to (CamelSession *session,
CamelFolder *out_folder;
CamelMessageInfo *info;
CamelMedium *medium;
const gchar *from_address;
const gchar *from_name;
const gchar *header_name;
struct _camel_header_raw *xev;
gchar *subject;
......@@ -1454,6 +1456,9 @@ mail_session_forward_to (CamelSession *session,
return FALSE;
}
from_address = account->id->address;
from_name = account->id->name;
forward = camel_mime_message_new ();
/* make copy of the message, because we are going to modify it */
......@@ -1496,8 +1501,7 @@ mail_session_forward_to (CamelSession *session,
/* from */
addr = camel_internet_address_new ();
camel_internet_address_add (
addr, account->id->name, account->id->address);
camel_internet_address_add (addr, from_name, from_address);
camel_mime_message_set_from (forward, addr);
g_object_unref (addr);
......@@ -1781,10 +1785,14 @@ static void
e_mail_session_init (EMailSession *session)
{
GSettings *settings;
GHashTable *junk_filters;
junk_filters = g_hash_table_new (
(GHashFunc) g_str_hash,
(GEqualFunc) g_str_equal);
session->priv = E_MAIL_SESSION_GET_PRIVATE (session);
session->priv->junk_filters = g_hash_table_new (
(GHashFunc) g_str_hash, (GEqualFunc) g_str_equal);
session->priv->junk_filters = junk_filters;
session->priv->proxy = e_proxy_new ();
session->priv->local_folders =
......
......@@ -28,6 +28,8 @@
#include <mail/em-config.h>
#include <mail/e-mail-backend.h>
#include <libedataserver/e-account.h>
/* Standard GObject macros */
#define EM_TYPE_ACCOUNT_EDITOR \
(em_account_editor_get_type ())
......
......@@ -28,9 +28,9 @@
#include <string.h>
#include <gtk/gtk.h>
#include <glib/gi18n.h>
#include <libedataserver/e-data-server-util.h>
#include <glib/gi18n.h>
#include "mail-mt.h"
#include "mail-ops.h"
......
......@@ -24,7 +24,6 @@
#define EM_CONFIG_H
#include <camel/camel.h>
#include <libedataserver/e-account.h>
#include "e-util/e-config.h"
......
......@@ -154,9 +154,9 @@ folder_tree_model_sort (GtkTreeModel *model,
} else if (g_strcmp0 (store_uid, E_MAIL_SESSION_VFOLDER_UID) == 0) {
/* UNMATCHED is always last. */
if (aname && !strcmp (aname, _("UNMATCHED")))
if (g_strcmp0 (aname, _("UNMATCHED")) == 0)
rv = 1;
else if (bname && !strcmp (bname, _("UNMATCHED")))
else if (g_strcmp0 (bname, _("UNMATCHED")) == 0)
rv = -1;
} else {
......
......@@ -42,7 +42,6 @@
#include "e-util/e-mktemp.h"
#include "e-util/e-alert-dialog.h"
#include "e-util/e-account-utils.h"
#include "em-vfolder-rule.h"
......@@ -552,10 +551,11 @@ em_folder_utils_create_folder (GtkWindow *parent,
EMFolderSelector *selector;
EMFolderTree *folder_tree;
EMFolderTreeModel *model;
EMailAccountStore *account_store;
CamelStore *store = NULL;
gchar *folder_name = NULL;
GtkWidget *dialog;
GList *list, *link;
GQueue queue = G_QUEUE_INIT;
GError *error = NULL;
g_return_if_fail (GTK_IS_WINDOW (parent));
......@@ -567,22 +567,19 @@ em_folder_utils_create_folder (GtkWindow *parent,
model = em_folder_tree_model_new ();
em_folder_tree_model_set_session (model, session);
list = camel_session_list_services (CAMEL_SESSION (session));
account_store = e_mail_session_get_account_store (session);
e_mail_account_store_queue_enabled_services (account_store, &queue);
for (link = list; link != NULL; link = g_list_next (link)) {
while (!g_queue_is_empty (&queue)) {
CamelService *service;
CamelStore *store;
EAccount *account;
CamelStoreFlags flags;
const gchar *uid, *prop = NULL;
service = CAMEL_SERVICE (link->data);
service = g_queue_pop_head (&queue);
g_warn_if_fail (CAMEL_IS_STORE (service));
if (!CAMEL_IS_STORE (service))
continue;
store = CAMEL_STORE (service);
if ((store->flags & CAMEL_STORE_CAN_EDIT_FOLDERS) == 0)
flags = CAMEL_STORE (service)->flags;
if ((flags & CAMEL_STORE_CAN_EDIT_FOLDERS) == 0)
continue;
uid = camel_service_get_uid (service);
......@@ -594,15 +591,9 @@ em_folder_utils_create_folder (GtkWindow *parent,
if (prop && !e_shell_settings_get_boolean (shell_settings, prop))
continue;
account = e_get_account_by_uid (uid);
if (account && !account->enabled)
continue;
em_folder_tree_model_add_store (model, store);
em_folder_tree_model_add_store (model, CAMEL_STORE (service));
}
g_list_free (list);
dialog = em_folder_selector_create_new (
parent, model, 0,
_("Create Folder"),
......
......@@ -1665,13 +1665,17 @@ search_address_in_addressbooks (const gchar *address,
EBookClient *book_client = NULL;
GHook *hook_stop;
gboolean cached_book = FALSE;
const gchar *display_name;
const gchar *uid;
GError *err = NULL;
uid = e_source_peek_uid (source);
display_name = e_source_peek_name (source);
/* failed to load this book last time, skip it now */
if (g_hash_table_lookup (emu_broken_books_hash,
e_source_peek_uid (source)) != NULL) {
if (g_hash_table_lookup (emu_broken_books_hash, uid) != NULL) {
d(printf ("%s: skipping broken book '%s'\n",
G_STRFUNC, e_source_peek_name (source)));
G_STRFUNC, display_name));
continue;
}
......@@ -1679,7 +1683,7 @@ search_address_in_addressbooks (const gchar *address,
hook_stop = mail_cancel_hook_add (emu_addr_cancel_stop, &stop);
book_client = g_hash_table_lookup (emu_books_hash, e_source_peek_uid (source));
book_client = g_hash_table_lookup (emu_books_hash, uid);
if (!book_client) {
book_client = e_book_client_new (source, &err);
......@@ -1690,8 +1694,7 @@ search_address_in_addressbooks (const gchar *address,
} else if (err) {
gchar *source_uid;
source_uid = g_strdup (
e_source_peek_uid (source));
source_uid = g_strdup (uid);
g_hash_table_insert (
emu_broken_books_hash,
......@@ -1700,7 +1703,7 @@ search_address_in_addressbooks (const gchar *address,
g_warning (
"%s: Unable to create addressbook '%s': %s",
G_STRFUNC,
e_source_peek_name (source),
display_name,
err->message);
}
g_clear_error (&err);
......@@ -1714,8 +1717,7 @@ search_address_in_addressbooks (const gchar *address,
} else if (err) {
gchar *source_uid;
source_uid = g_strdup (
e_source_peek_uid (source));
source_uid = g_strdup (uid);
g_hash_table_insert (
emu_broken_books_hash,
......@@ -1724,7 +1726,7 @@ search_address_in_addressbooks (const gchar *address,
g_warning (
"%s: Unable to open addressbook '%s': %s",
G_STRFUNC,
e_source_peek_name (source),
display_name,
err->message);
}
g_clear_error (&err);
......@@ -1760,13 +1762,14 @@ search_address_in_addressbooks (const gchar *address,
(g_error_matches (err, E_CLIENT_ERROR, E_CLIENT_ERROR_CANCELLED) ||
g_error_matches (err, G_IO_ERROR, G_IO_ERROR_CANCELLED)));
if (err && !stop) {
gchar *source_uid = g_strdup (e_source_peek_uid (source));
gchar *source_uid = g_strdup (uid);
g_hash_table_insert (emu_broken_books_hash, source_uid, source_uid);
g_warning (
"%s: Can't get contacts from '%s': %s",
G_STRFUNC, e_source_peek_name (source),
G_STRFUNC,
display_name,
err->message);
}
g_clear_error (&err);
......@@ -1778,16 +1781,14 @@ search_address_in_addressbooks (const gchar *address,
g_object_unref (book_client);
} else if (!stop && book_client && !cached_book) {
g_hash_table_insert (
emu_books_hash, g_strdup (
e_source_peek_uid (source)), book_client);
emu_books_hash, g_strdup (uid), book_client);
}
}
mail_cancel_hook_remove (hook_cancellable);
g_object_unref (cancellable);
g_slist_foreach (addr_sources, (GFunc) g_object_unref, NULL);
g_slist_free (addr_sources);
g_slist_free_full (addr_sources, (GDestroyNotify) g_object_unref);
g_free (query);
......
......@@ -27,6 +27,7 @@
#include <sys/types.h>
#include <camel/camel.h>
#include <libedataserver/e-proxy.h>
#include <libedataserver/e-account.h>
#include <mail/e-mail-reader.h>
#include <mail/e-mail-session.h>
......@@ -85,9 +86,12 @@ void em_utils_clear_get_password_canceled_accounts_flag (void);
/* Unescapes &amp; back to a real & in URIs */
gchar *em_utils_url_unescape_amp (const gchar *url);
GHashTable * em_utils_generate_account_hash (void);
struct _EAccount *em_utils_guess_account (CamelMimeMessage *message, CamelFolder *folder);
struct _EAccount *em_utils_guess_account_with_recipients (CamelMimeMessage *message, CamelFolder *folder);
GHashTable * em_utils_generate_account_hash (void);
EAccount * em_utils_guess_account (CamelMimeMessage *message,
CamelFolder *folder);
EAccount * em_utils_guess_account_with_recipients
(CamelMimeMessage *message,
CamelFolder *folder);
void emu_remove_from_mail_cache (const GSList *addresses);
void emu_remove_from_mail_cache_1 (const gchar *address);
......
......@@ -176,7 +176,7 @@ import_contact (EBookClient *book_client,
static void
import_contacts (void)
{
ESource *primary;
ESource *source;
ESourceList *source_list;
EBookClient *book_client;
gchar *name;
......@@ -203,28 +203,23 @@ import_contacts (void)
if (fp == NULL)
return;
primary = e_source_list_peek_source_any (source_list);
/* FIXME Better error handling */
if ((book_client = e_book_client_new (primary, &error)) == NULL) {
fclose (fp);
g_warning ("Could not create EBook: %s", error->message);
if (error)
g_error_free (error);
return;
}
source = e_source_list_peek_source_any (source_list);
if (!e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error)) {
g_object_unref (source_list);
fclose (fp);
book_client = e_book_client_new (source, &error);
if (book_client != NULL)
e_client_open_sync (E_CLIENT (book_client), TRUE, NULL, &error);
g_object_unref (source_list);
if (error != NULL) {
g_warning (
"%s: Failed to open book client: %s",
G_STRFUNC, error->message);
if (error)
g_error_free (error);
g_error_free (error);
fclose (fp);
return;
}
g_object_unref (source_list);
line = g_string_new("");
g_string_set_size (line, 256);
......
......@@ -30,6 +30,7 @@
#include <gtk/gtk.h>
#include <libedataserver/e-data-server-util.h>
#include <e-util/e-util.h>
#include "e-util/e-account-utils.h"
#include "e-util/e-signature-utils.h"
......
......@@ -225,7 +225,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
fm->destination = e_mail_session_get_local_folder (
E_MAIL_SESSION (session), E_MAIL_LOCAL_FOLDER_LOCAL_INBOX);
if (fm->destination == NULL)
goto fail;
goto exit;
g_object_ref (fm->destination);
url = camel_service_new_camel_url (service);
......@@ -335,7 +335,7 @@ fetch_mail_exec (struct _fetch_mail_msg *m,
fm->source_folder = NULL;
}
fail:
exit:
/* we unref this here as it may have more work to do (syncing
* folders and whatnot) before we are really done */
/* should this be cancellable too? (i.e. above unregister above) */
......@@ -1688,4 +1688,3 @@ mail_disconnect_store (CamelStore *store)
return id;
}
......@@ -416,8 +416,8 @@ format_url (CamelService *service)
static send_info_t
get_receive_type (CamelService *service)
{
CamelProvider *provider;
CamelURL *url;
CamelProvider *provider;
gboolean is_local_delivery;
url = camel_service_new_camel_url (service);
......@@ -1102,7 +1102,7 @@ receive_update_got_store (CamelStore *store,
folder_cache = e_mail_session_get_folder_cache (
E_MAIL_SESSION (info->session));
if (store) {
if (store != NULL) {
mail_folder_cache_note_store (
folder_cache, store, info->cancellable,
receive_update_got_folderinfo, info);
......
......@@ -28,11 +28,8 @@
#include <glib/gi18n.h>
#include <libedataserver/e-account-list.h>
#include "e-util/e-alert-dialog.h"
#include "e-util/e-util-private.h"
#include "e-util/e-account-utils.h"
#include "e-mail-backend.h"
#include "e-mail-session.h"
......
......@@ -82,9 +82,9 @@ action_mail_account_disable_cb (GtkAction *action,
EMailShellView *mail_shell_view)
{
EMailShellSidebar *mail_shell_sidebar;
EShellBackend *shell_backend;
EShellView *shell_view;
EShellWindow *shell_window;
EShellBackend *shell_backend;
EMailBackend *backend;
EMailSession *session;
EMailAccountStore *account_store;
......
......@@ -19,10 +19,11 @@
*
*/
/* XXX EAccountManager handles all the user interface stuff. This subclass
* applies policies using mailer resources that EAccountManager does not
* have access to. The desire is to someday move account management
* completely out of the mailer, perhaps to evolution-data-server. */
/* XXX EMailAccountManager handles all the user interface stuff.
* This subclass applies policies using mailer resources that
* EMailAccountManager does not have access to. The desire is
* to someday move account management completely out of the mailer,
* perhaps to evolution-data-server. */
#ifdef HAVE_CONFIG_H
#include <config.h>
......@@ -58,7 +59,7 @@ enum {
PROP_BACKEND
};
G_DEFINE_TYPE (
G_DEFINE_DYNAMIC_TYPE (
EMAccountPrefs,
em_account_prefs,
E_TYPE_MAIL_ACCOUNT_MANAGER)
......@@ -285,31 +286,47 @@ em_account_prefs_class_init (EMAccountPrefsClass *class)
G_PARAM_CONSTRUCT_ONLY));
}
static void
em_account_prefs_class_finalize (EMAccountPrefsClass *class)
{
}
static void
em_account_prefs_init (EMAccountPrefs *prefs)
{
prefs->priv = EM_ACCOUNT_PREFS_GET_PRIVATE (prefs);
}
void
em_account_prefs_type_register (GTypeModule *type_module)
{
/* XXX G_DEFINE_DYNAMIC_TYPE declares a static type registration
* function, so we have to wrap it with a public function in
* order to register types from a separate compilation unit. */
em_account_prefs_register_type (type_module);
}
GtkWidget *
em_account_prefs_new (EPreferencesWindow *window)
{
EShell *shell;
EShellBackend *shell_backend;
EMailAccountStore *account_store;
EMailBackend *backend;
EMailSession *session;
/* XXX Figure out a better way to get the mail backend. */
shell = e_preferences_window_get_shell (window);
shell_backend = e_shell_get_backend_by_name (shell, "mail");
session = e_mail_backend_get_session (E_MAIL_BACKEND (shell_backend));
backend = E_MAIL_BACKEND (shell_backend);
session = e_mail_backend_get_session (backend);
account_store = e_mail_session_get_account_store (session);
return g_object_new (
EM_TYPE_ACCOUNT_PREFS,
"store", account_store,
"backend", shell_backend, NULL);
"backend", backend, NULL);
}
EMailBackend *
......
......@@ -24,7 +24,6 @@
#include <gtk/gtk.h>
#include <table/e-table.h>
#include <libedataserver/e-account-list.h>
#include <mail/e-mail-backend.h>
#include <mail/e-mail-account-manager.h>
#include <widgets/misc/e-preferences-window.h>
......@@ -64,6 +63,7 @@ struct _EMAccountPrefsClass {
};
GType em_account_prefs_get_type (void);
void em_account_prefs_type_register (GTypeModule *type_module);
GtkWidget * em_account_prefs_new (EPreferencesWindow *window);
EMailBackend * em_account_prefs_get_backend (EMAccountPrefs *prefs);
......
......@@ -37,6 +37,8 @@
#include "e-mail-config-reader.h"
#include "e-mail-config-web-view.h"
#include "em-account-prefs.h"
/* Module Entry Points */
void e_module_load (GTypeModule *type_module);
void e_module_unload (GTypeModule *type_module);
......@@ -60,6 +62,8 @@ e_module_load (GTypeModule *type_module)
e_mail_config_format_html_register_type (type_module);
e_mail_config_reader_register_type (type_module);
e_mail_config_web_view_register_type (type_module);
em_account_prefs_type_register (type_module);
}
G_MODULE_EXPORT void
......
......@@ -399,8 +399,7 @@ mdn_notify_action_cb (GtkAction *action,
static void
mdn_message_loaded_cb (EMailReader *reader,
const gchar *message_uid,
CamelMimeMessage *message,
EMdn *extension)
CamelMimeMessage *message)
{
EAlert *alert;
EAccount *account;
......@@ -477,8 +476,7 @@ exit:
static void
mdn_message_seen_cb (EMailReader *reader,
const gchar *message_uid,
CamelMimeMessage *message,
EMdn *extension)
CamelMimeMessage *message)
{
EAccount *account;
CamelFolder *folder;
......@@ -526,11 +524,11 @@ mdn_constructed (GObject *object)
g_signal_connect (
extensible, "message-loaded",
G_CALLBACK (mdn_message_loaded_cb), extension);
G_CALLBACK (mdn_message_loaded_cb), NULL);
g_signal_connect (
extensible, "message-seen",
G_CALLBACK (mdn_message_seen_cb), extension);
G_CALLBACK (mdn_message_seen_cb), NULL);
/* Chain up to parent's constructed() method. */
G_OBJECT_CLASS (e_mdn_parent_class)->constructed (object);
......
......@@ -1368,6 +1368,7 @@ e_shell_get_backend_by_scheme (EShell *shell,
return g_hash_table_lookup (hash_table, scheme);
}
/**
* e_shell_get_shell_settings:
* @shell: an #EShell
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment